Author: tfaber
Date: Fri Oct 16 15:30:35 2015
New Revision: 69556
URL:
http://svn.reactos.org/svn/reactos?rev=69556&view=rev
Log:
[WIN32K:NTUSER]
- Terminate the RawInputThread on shutdown
CORE-10217 #resolve
Modified:
trunk/reactos/win32ss/user/ntuser/input.c
trunk/reactos/win32ss/user/winsrv/usersrv/init.c
Modified: trunk/reactos/win32ss/user/ntuser/input.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/input.…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/input.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/input.c [iso-8859-1] Fri Oct 16 15:30:35 2015
@@ -132,10 +132,12 @@
PFILE_OBJECT pKbdDevice = NULL, pMouDevice = NULL;
LARGE_INTEGER ByteOffset;
//LARGE_INTEGER WaitTimeout;
- PVOID WaitObjects[3], pSignaledObject = NULL;
- ULONG cWaitObjects = 0, cMaxWaitObjects = 1;
+ PVOID WaitObjects[4], pSignaledObject = NULL;
+ KWAIT_BLOCK WaitBlockArray[RTL_NUMBER_OF(WaitObjects)];
+ ULONG cWaitObjects = 0, cMaxWaitObjects = 2;
MOUSE_INPUT_DATA MouseInput;
KEYBOARD_INPUT_DATA KeyInput;
+ PVOID ShutdownEvent;
ByteOffset.QuadPart = (LONGLONG)0;
//WaitTimeout.QuadPart = (LONGLONG)(-10000000);
@@ -156,6 +158,7 @@
NT_ASSERT(ghMouseDevice == NULL);
NT_ASSERT(ghKeyboardDevice == NULL);
+ PoRequestShutdownEvent(&ShutdownEvent);
for (;;)
{
if (!ghMouseDevice)
@@ -189,6 +192,7 @@
/* Reset WaitHandles array */
cWaitObjects = 0;
+ WaitObjects[cWaitObjects++] = ShutdownEvent;
WaitObjects[cWaitObjects++] = MasterTimer;
if (ghMouseDevice)
@@ -241,7 +245,7 @@
KernelMode,
TRUE,
NULL,//&WaitTimeout,
- NULL);
+ WaitBlockArray);
if ((Status >= STATUS_WAIT_0) &&
(Status < (STATUS_WAIT_0 + (LONG)cWaitObjects)))
@@ -264,6 +268,10 @@
{
ProcessTimers();
}
+ else if (pSignaledObject == ShutdownEvent)
+ {
+ break;
+ }
else ASSERT(FALSE);
}
}
@@ -302,6 +310,23 @@
else if (KbdStatus != STATUS_PENDING)
ERR("Failed to read from keyboard: %x.\n", KbdStatus);
}
+
+ if (ghMouseDevice)
+ {
+ (void)ZwCancelIoFile(ghMouseDevice, &MouIosb);
+ ObCloseHandle(ghMouseDevice, KernelMode);
+ ObDereferenceObject(pMouDevice);
+ ghMouseDevice = NULL;
+ }
+
+ if (ghKeyboardDevice)
+ {
+ (void)ZwCancelIoFile(ghKeyboardDevice, &KbdIosb);
+ ObCloseHandle(ghKeyboardDevice, KernelMode);
+ ObDereferenceObject(pKbdDevice);
+ ghKeyboardDevice = NULL;
+ }
+
ERR("Raw Input Thread Exit!\n");
}
Modified: trunk/reactos/win32ss/user/winsrv/usersrv/init.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/winsrv/usersr…
==============================================================================
--- trunk/reactos/win32ss/user/winsrv/usersrv/init.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/winsrv/usersrv/init.c [iso-8859-1] Fri Oct 16 15:30:35
2015
@@ -102,7 +102,7 @@
CreateSystemThreads(PVOID pParam)
{
NtUserCallOneParam((DWORD)pParam, ONEPARAM_ROUTINE_CREATESYSTEMTHREADS);
- DPRINT1("This thread should not terminate!\n");
+ RtlExitUserThread(0);
return 0;
}