From b77b18fac3b4b9d4a93596ca57c7a56a55f7bb52 Mon Sep 17 00:00:00 2001 From: Alex Ionescu Date: Thu, 12 Sep 2013 21:05:58 +0000 Subject: [PATCH] [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 --- reactos/include/reactos/subsys/csr/csrsrv.h | 4 +-- reactos/subsystems/win32/csrsrv/csrsrv.spec | 2 +- reactos/subsystems/win32/csrsrv/wait.c | 28 +++---------------- reactos/win32ss/user/winsrv/consrv/coninput.c | 3 +- .../win32ss/user/winsrv/consrv/conoutput.c | 1 - 5 files changed, 7 insertions(+), 31 deletions(-) diff --git a/reactos/include/reactos/subsys/csr/csrsrv.h b/reactos/include/reactos/subsys/csr/csrsrv.h index 5a0b53f4f0a..055a7429434 100644 --- a/reactos/include/reactos/subsys/csr/csrsrv.h +++ b/reactos/include/reactos/subsys/csr/csrsrv.h @@ -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 diff --git a/reactos/subsystems/win32/csrsrv/csrsrv.spec b/reactos/subsystems/win32/csrsrv/csrsrv.spec index b84f92e8878..2f968e6ebad 100644 --- a/reactos/subsystems/win32/csrsrv/csrsrv.spec +++ b/reactos/subsystems/win32/csrsrv/csrsrv.spec @@ -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) diff --git a/reactos/subsystems/win32/csrsrv/wait.c b/reactos/subsystems/win32/csrsrv/wait.c index 73518703fb7..40f9d575ae8 100644 --- a/reactos/subsystems/win32/csrsrv/wait.c +++ b/reactos/subsystems/win32/csrsrv/wait.c @@ -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); diff --git a/reactos/win32ss/user/winsrv/consrv/coninput.c b/reactos/win32ss/user/winsrv/consrv/coninput.c index 7143a322c5f..7adb68424de 100644 --- a/reactos/win32ss/user/winsrv/consrv/coninput.c +++ b/reactos/win32ss/user/winsrv/consrv/coninput.c @@ -60,8 +60,7 @@ WaitBeforeReading(IN PGET_INPUT_INFO InputInfo, WaitFunction, InputInfo->CallingThread, ApiMessage, - CapturedInputInfo, - NULL)) + CapturedInputInfo)) { ConsoleFreeHeap(CapturedInputInfo); return STATUS_NO_MEMORY; diff --git a/reactos/win32ss/user/winsrv/consrv/conoutput.c b/reactos/win32ss/user/winsrv/consrv/conoutput.c index af3325a1a48..6a0f10cc7e9 100644 --- a/reactos/win32ss/user/winsrv/consrv/conoutput.c +++ b/reactos/win32ss/user/winsrv/consrv/conoutput.c @@ -380,7 +380,6 @@ DoWriteConsole(IN PCSR_API_MESSAGE ApiMessage, WriteConsoleThread, ClientThread, ApiMessage, - NULL, NULL)) { /* Fail */