From 27395842498d4d55d99724367295a54475f97489 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Sat, 5 Oct 2013 22:17:34 +0000 Subject: [PATCH] [CSRSRV][CONSRV] - Fix the second parameter WaitType (aka. NotifyAll) of CsrNotifyWait. Indeed, we used before the constants WaitAll == 0 / WaitAny == 1 (see the WAIT_TYPE enum); however, it appeared that Win2k3's CsrNotifyWait wanted a WaitType parameter == 1 when waiting for all the waits in a given wait-list. Therefore we would have to use WaitAll for waiting for any of the wait blocks, and WaitAny for waiting for all the wait blocks... looks illogical. Therefore I use instead a BOOLEAN variable (that I call NotifyAll) which is TRUE when I want to wait for all the wait blocks, and FALSE otherwise (as done e.g. for the WaitForMultipleObjects API). - Fix its usage in CONSRV. Magically fix key presses problems in console, when using Win2k3 csrsrv.dll ... svn path=/trunk/; revision=60551 --- reactos/include/reactos/subsys/csr/csrsrv.h | 2 +- reactos/subsystems/win32/csrsrv/wait.c | 13 ++++++++----- .../win32ss/user/winsrv/consrv/condrv/coninput.c | 2 +- reactos/win32ss/user/winsrv/consrv/condrv/console.c | 2 +- reactos/win32ss/user/winsrv/consrv/console.c | 2 +- reactos/win32ss/user/winsrv/consrv/handle.c | 2 +- 6 files changed, 13 insertions(+), 10 deletions(-) diff --git a/reactos/include/reactos/subsys/csr/csrsrv.h b/reactos/include/reactos/subsys/csr/csrsrv.h index a8bf5d2013d..b904710cb6a 100644 --- a/reactos/include/reactos/subsys/csr/csrsrv.h +++ b/reactos/include/reactos/subsys/csr/csrsrv.h @@ -349,7 +349,7 @@ CsrMoveSatisfiedWait(IN PLIST_ENTRY DestinationList, BOOLEAN NTAPI CsrNotifyWait(IN PLIST_ENTRY WaitList, - IN ULONG WaitType, + IN BOOLEAN NotifyAll, IN PVOID WaitArgument1, IN PVOID WaitArgument2); diff --git a/reactos/subsystems/win32/csrsrv/wait.c b/reactos/subsystems/win32/csrsrv/wait.c index e9e4d2f52ae..8a599dccf8b 100644 --- a/reactos/subsystems/win32/csrsrv/wait.c +++ b/reactos/subsystems/win32/csrsrv/wait.c @@ -372,8 +372,8 @@ CsrMoveSatisfiedWait(IN PLIST_ENTRY DestinationList, * @param WaitList * Pointer to the wait list whose wait blocks will be notified. * - * @param WaitType - * Type of the wait to perform, either WaitAny or WaitAll. + * @param NotifyAll + * Whether or not we must notify all the waits. * * @param WaitArgument[1-2] * User-defined argument to pass on to the wait function. @@ -386,7 +386,7 @@ CsrMoveSatisfiedWait(IN PLIST_ENTRY DestinationList, BOOLEAN NTAPI CsrNotifyWait(IN PLIST_ENTRY WaitList, - IN ULONG WaitType, + IN BOOLEAN NotifyAll, IN PVOID WaitArgument1, IN PVOID WaitArgument2) { @@ -420,8 +420,11 @@ CsrNotifyWait(IN PLIST_ENTRY WaitList, 0, FALSE); - /* We've already done a wait, so leave unless this is a Wait All */ - if (WaitType != WaitAll) break; + /* + * We've already done a wait, so leave unless + * we want to notify all the waits... + */ + if (!NotifyAll) break; } } diff --git a/reactos/win32ss/user/winsrv/consrv/condrv/coninput.c b/reactos/win32ss/user/winsrv/consrv/condrv/coninput.c index 38031304921..d013ea8a313 100644 --- a/reactos/win32ss/user/winsrv/consrv/condrv/coninput.c +++ b/reactos/win32ss/user/winsrv/consrv/condrv/coninput.c @@ -101,7 +101,7 @@ ConioProcessInputEvent(PCONSOLE Console, SetEvent(Console->InputBuffer.ActiveEvent); CsrNotifyWait(&Console->InputBuffer.ReadWaitQueue, - WaitAny, + FALSE, NULL, NULL); if (!IsListEmpty(&Console->InputBuffer.ReadWaitQueue)) diff --git a/reactos/win32ss/user/winsrv/consrv/condrv/console.c b/reactos/win32ss/user/winsrv/consrv/condrv/console.c index 0c4cb6ac9ec..fa4562f2ef5 100644 --- a/reactos/win32ss/user/winsrv/consrv/condrv/console.c +++ b/reactos/win32ss/user/winsrv/consrv/condrv/console.c @@ -282,7 +282,7 @@ ConioUnpause(PCONSOLE Console, UINT Flags) Console->UnpauseEvent = NULL; CsrNotifyWait(&Console->WriteWaitQueue, - WaitAll, + TRUE, NULL, NULL); if (!IsListEmpty(&Console->WriteWaitQueue)) diff --git a/reactos/win32ss/user/winsrv/consrv/console.c b/reactos/win32ss/user/winsrv/consrv/console.c index 0b7e2fa6aa4..1b0e7885e57 100644 --- a/reactos/win32ss/user/winsrv/consrv/console.c +++ b/reactos/win32ss/user/winsrv/consrv/console.c @@ -123,7 +123,7 @@ ConioUnpause(PCONSOLE Console, UINT Flags) Console->UnpauseEvent = NULL; CsrNotifyWait(&Console->WriteWaitQueue, - WaitAll, + TRUE, NULL, NULL); if (!IsListEmpty(&Console->WriteWaitQueue)) diff --git a/reactos/win32ss/user/winsrv/consrv/handle.c b/reactos/win32ss/user/winsrv/consrv/handle.c index 84384db91ed..47900de5a02 100644 --- a/reactos/win32ss/user/winsrv/consrv/handle.c +++ b/reactos/win32ss/user/winsrv/consrv/handle.c @@ -89,7 +89,7 @@ ConSrvCloseHandleEntry(PCONSOLE_IO_HANDLE Entry) * return. */ CsrNotifyWait(&InputBuffer->ReadWaitQueue, - WaitAll, + TRUE, NULL, (PVOID)Entry); if (!IsListEmpty(&InputBuffer->ReadWaitQueue)) -- 2.17.1