[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)
LIST_ENTRY WaitList;
LIST_ENTRY UserWaitList;
PVOID WaitContext;
PCSR_THREAD WaitThread;
CSR_WAIT_FUNCTION WaitFunction;
@ -285,8 +284,7 @@ CsrCreateWait(IN PLIST_ENTRY WaitList,
IN CSR_WAIT_FUNCTION WaitFunction,
IN PCSR_THREAD CsrWaitThread,
IN OUT PCSR_API_MESSAGE WaitApiMessage,
IN PVOID WaitContext,
IN PLIST_ENTRY UserWaitList OPTIONAL);
IN PVOID WaitContext);
NTSTATUS
NTAPI

View file

@ -4,7 +4,7 @@
@ stdcall CsrCreateProcess(ptr ptr ptr ptr long ptr)
@ stdcall CsrCreateRemoteThread(ptr ptr)
@ 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 CsrDebugProcessStop(ptr)
@ stdcall CsrDereferenceProcess(ptr)

View file

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

View file

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

View file

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