[CSRSRV]: hbelusca: wait a sec ;-) Fix CsrCreateWait and CSR_WAIT_BLOCK to match Windows Server 2003 semantics, which don't have a "UserWaitList". Fix our winsrv not to call CsrCreateWait incorrectly (which corrupted the heap/stack when using windows's csrsrv.dll).

svn path=/trunk/; revision=60065
This commit is contained in:
Alex Ionescu 2013-09-12 21:05:58 +00:00
parent fabd7b9297
commit b77b18fac3
5 changed files with 7 additions and 31 deletions

View file

@ -148,7 +148,6 @@ typedef struct _CSR_WAIT_BLOCK
{ {
ULONG Size; // Size of the wait block (variable-sized) ULONG Size; // Size of the wait block (variable-sized)
LIST_ENTRY WaitList; LIST_ENTRY WaitList;
LIST_ENTRY UserWaitList;
PVOID WaitContext; PVOID WaitContext;
PCSR_THREAD WaitThread; PCSR_THREAD WaitThread;
CSR_WAIT_FUNCTION WaitFunction; CSR_WAIT_FUNCTION WaitFunction;
@ -285,8 +284,7 @@ CsrCreateWait(IN PLIST_ENTRY WaitList,
IN CSR_WAIT_FUNCTION WaitFunction, IN CSR_WAIT_FUNCTION WaitFunction,
IN PCSR_THREAD CsrWaitThread, IN PCSR_THREAD CsrWaitThread,
IN OUT PCSR_API_MESSAGE WaitApiMessage, IN OUT PCSR_API_MESSAGE WaitApiMessage,
IN PVOID WaitContext, IN PVOID WaitContext);
IN PLIST_ENTRY UserWaitList OPTIONAL);
NTSTATUS NTSTATUS
NTAPI NTAPI

View file

@ -4,7 +4,7 @@
@ stdcall CsrCreateProcess(ptr ptr ptr ptr long ptr) @ stdcall CsrCreateProcess(ptr ptr ptr ptr long ptr)
@ stdcall CsrCreateRemoteThread(ptr ptr) @ stdcall CsrCreateRemoteThread(ptr ptr)
@ stdcall CsrCreateThread(ptr ptr ptr long) @ stdcall CsrCreateThread(ptr ptr ptr long)
@ stdcall CsrCreateWait(ptr ptr ptr ptr ptr ptr) @ stdcall CsrCreateWait(ptr ptr ptr ptr ptr)
@ stdcall CsrDebugProcess(ptr) @ stdcall CsrDebugProcess(ptr)
@ stdcall CsrDebugProcessStop(ptr) @ stdcall CsrDebugProcessStop(ptr)
@ stdcall CsrDereferenceProcess(ptr) @ stdcall CsrDereferenceProcess(ptr)

View file

@ -76,12 +76,11 @@ CsrInitializeWait(IN CSR_WAIT_FUNCTION WaitFunction,
CsrWaitThread->WaitBlock = WaitBlock; CsrWaitThread->WaitBlock = WaitBlock;
WaitBlock->WaitContext = WaitContext; WaitBlock->WaitContext = WaitContext;
WaitBlock->WaitFunction = WaitFunction; WaitBlock->WaitFunction = WaitFunction;
WaitBlock->UserWaitList.Flink = NULL; WaitBlock->WaitList.Flink = NULL;
WaitBlock->UserWaitList.Blink = NULL; WaitBlock->WaitList.Blink = NULL;
WaitBlock->WaitList = WaitBlock->UserWaitList;
/* Copy the message */ /* Copy the message */
RtlMoveMemory(&WaitBlock->WaitApiMessage, RtlCopyMemory(&WaitBlock->WaitApiMessage,
WaitApiMessage, WaitApiMessage,
WaitApiMessage->Header.u1.s1.TotalLength); WaitApiMessage->Header.u1.s1.TotalLength);
@ -158,12 +157,6 @@ CsrNotifyWaitBlock(IN PCSR_WAIT_BLOCK WaitBlock,
RemoveEntryList(&WaitBlock->WaitList); RemoveEntryList(&WaitBlock->WaitList);
} }
/* Remove it from the User Wait List */
if (WaitBlock->UserWaitList.Flink)
{
RemoveEntryList(&WaitBlock->UserWaitList);
}
/* Dereference the thread */ /* Dereference the thread */
CsrDereferenceThread(WaitBlock->WaitThread); CsrDereferenceThread(WaitBlock->WaitThread);
@ -207,9 +200,6 @@ CsrNotifyWaitBlock(IN PCSR_WAIT_BLOCK WaitBlock,
* @param WaitContext * @param WaitContext
* Pointer to a user-defined parameter associated to this wait. * Pointer to a user-defined parameter associated to this wait.
* *
* @param UserWaitList
* Pointer to a list entry of the user-defined waits to associate.
*
* @return TRUE in case of success, FALSE otherwise. * @return TRUE in case of success, FALSE otherwise.
* *
* @remarks None. * @remarks None.
@ -221,8 +211,7 @@ CsrCreateWait(IN PLIST_ENTRY WaitList,
IN CSR_WAIT_FUNCTION WaitFunction, IN CSR_WAIT_FUNCTION WaitFunction,
IN PCSR_THREAD CsrWaitThread, IN PCSR_THREAD CsrWaitThread,
IN OUT PCSR_API_MESSAGE WaitApiMessage, IN OUT PCSR_API_MESSAGE WaitApiMessage,
IN PVOID WaitContext, IN PVOID WaitContext)
IN PLIST_ENTRY UserWaitList OPTIONAL)
{ {
PCSR_WAIT_BLOCK WaitBlock; PCSR_WAIT_BLOCK WaitBlock;
@ -252,9 +241,6 @@ CsrCreateWait(IN PLIST_ENTRY WaitList,
/* Insert the wait in the queue */ /* Insert the wait in the queue */
InsertTailList(WaitList, &WaitBlock->WaitList); InsertTailList(WaitList, &WaitBlock->WaitList);
/* Insert the User Wait too, if one was given */
if (UserWaitList) InsertTailList(UserWaitList, &WaitBlock->UserWaitList);
/* Return */ /* Return */
CsrReleaseWaitLock(); CsrReleaseWaitLock();
return TRUE; return TRUE;
@ -306,12 +292,6 @@ CsrDereferenceWait(IN PLIST_ENTRY WaitList)
RemoveEntryList(&WaitBlock->WaitList); RemoveEntryList(&WaitBlock->WaitList);
} }
/* Remove it from the User Wait List */
if (WaitBlock->UserWaitList.Flink)
{
RemoveEntryList(&WaitBlock->UserWaitList);
}
/* Dereference the thread waiting on it */ /* Dereference the thread waiting on it */
CsrDereferenceThread(WaitBlock->WaitThread); CsrDereferenceThread(WaitBlock->WaitThread);

View file

@ -60,8 +60,7 @@ WaitBeforeReading(IN PGET_INPUT_INFO InputInfo,
WaitFunction, WaitFunction,
InputInfo->CallingThread, InputInfo->CallingThread,
ApiMessage, ApiMessage,
CapturedInputInfo, CapturedInputInfo))
NULL))
{ {
ConsoleFreeHeap(CapturedInputInfo); ConsoleFreeHeap(CapturedInputInfo);
return STATUS_NO_MEMORY; return STATUS_NO_MEMORY;

View file

@ -380,7 +380,6 @@ DoWriteConsole(IN PCSR_API_MESSAGE ApiMessage,
WriteConsoleThread, WriteConsoleThread,
ClientThread, ClientThread,
ApiMessage, ApiMessage,
NULL,
NULL)) NULL))
{ {
/* Fail */ /* Fail */