[ros-diffs] [rharabien] 54128: [WIN32K/CSRSS] - Remove outdated comments - Make Raw Input Thread CSRSS thread too Thanks to Smiley and ThFabba for investigating TEB issue

rharabien at svn.reactos.org rharabien at svn.reactos.org
Thu Oct 13 22:38:58 UTC 2011


Author: rharabien
Date: Thu Oct 13 22:38:58 2011
New Revision: 54128

URL: http://svn.reactos.org/svn/reactos?rev=54128&view=rev
Log:
[WIN32K/CSRSS]
- Remove outdated comments
- Make Raw Input Thread CSRSS thread too
Thanks to Smiley and ThFabba for investigating TEB issue

Modified:
    trunk/reactos/subsystems/win32/csrss/win32csr/dllmain.c
    trunk/reactos/subsystems/win32/win32k/ntuser/input.c

Modified: trunk/reactos/subsystems/win32/csrss/win32csr/dllmain.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/csrss/win32csr/dllmain.c?rev=54128&r1=54127&r2=54128&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/csrss/win32csr/dllmain.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/csrss/win32csr/dllmain.c [iso-8859-1] Thu Oct 13 22:38:58 2011
@@ -196,6 +196,7 @@
     HANDLE ServerThread;
     CLIENT_ID ClientId;
     NTSTATUS Status;
+    UINT i;
 
     CsrExports = *Exports;
     Win32CsrApiHeap = CsrssApiHeap;
@@ -214,23 +215,18 @@
     RtlInitializeCriticalSection(&Win32CsrDefineDosDeviceCritSec);
     InitializeListHead(&DosDeviceHistory);
 
-    Status = RtlCreateUserThread(NtCurrentProcess(), NULL, TRUE, 0, 0, 0, (PTHREAD_START_ROUTINE)CreateSystemThreads, (PVOID)0, &ServerThread, &ClientId);
-    if (NT_SUCCESS(Status))
-    {
-        NtResumeThread(ServerThread, NULL);
-        NtClose(ServerThread);
-    }
-    else
-        DPRINT1("Cannot start keyboard thread!\n");
-
-    Status = RtlCreateUserThread(NtCurrentProcess(), NULL, TRUE, 0, 0, 0, (PTHREAD_START_ROUTINE)CreateSystemThreads, (PVOID)1, &ServerThread, &ClientId);
-    if (NT_SUCCESS(Status))
-    {
-        NtResumeThread(ServerThread, NULL);
-        NtClose(ServerThread);
-    }
-    else
-        DPRINT1("Cannot start mouse thread!\n");
+    /* Start Keyboard, Mouse and Raw Input Threads */
+    for (i = 0; i < 2; ++i)
+    {
+        Status = RtlCreateUserThread(NtCurrentProcess(), NULL, TRUE, 0, 0, 0, (PTHREAD_START_ROUTINE)CreateSystemThreads, (PVOID)i, &ServerThread, &ClientId);
+        if (NT_SUCCESS(Status))
+        {
+            NtResumeThread(ServerThread, NULL);
+            NtClose(ServerThread);
+        }
+        else
+            DPRINT1("Cannot start system thread: %u!\n", i);
+    }
 
     return TRUE;
 }

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/input.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/input.c?rev=54128&r1=54127&r2=54128&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/input.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/input.c [iso-8859-1] Thu Oct 13 22:38:58 2011
@@ -24,8 +24,6 @@
 
 static DWORD LastInputTick = 0;
 static HANDLE MouseDeviceHandle;
-static HANDLE RawInputThreadHandle;
-static CLIENT_ID RawInputThreadId;
 static KEVENT InputThreadsStart;
 static BOOLEAN InputThreadsRunning = FALSE;
 
@@ -216,14 +214,6 @@
                             FILE_SYNCHRONOUS_IO_ALERT);
     } while (!NT_SUCCESS(Status));
 
-    /* Need to setup basic win32k for this thread to process WH_MOUSE_LL messages. */
-    /*Status = Win32kInitWin32Thread(PsGetCurrentThread());
-    if (!NT_SUCCESS(Status))
-    {
-        ERR("Win32K: Failed making mouse thread a win32 thread.\n");
-        return; //(Status);
-    }*/
-
     ptiMouse = PsGetCurrentThreadWin32Thread();
     ptiMouse->TIF_flags |= TIF_SYSTEMTHREAD;
     TRACE("Mouse Thread 0x%x \n", ptiMouse);
@@ -330,22 +320,6 @@
 
     UserInitKeyboard(ghKeyboardDevice);
 
-    /* Not sure if converting this thread to a win32 thread is such
-       a great idea. Since we're posting keyboard messages to the focus
-       window message queue, we'll be (indirectly) doing sendmessage
-       stuff from this thread (for WH_KEYBOARD_LL processing), which
-       means we need our own message queue. If keyboard messages were
-       instead queued to the system message queue, the thread removing
-       the message from the system message queue would be responsible
-       for WH_KEYBOARD_LL processing and we wouldn't need this thread
-       to be a win32 thread. */
-    /*Status = Win32kInitWin32Thread(PsGetCurrentThread());
-    if (!NT_SUCCESS(Status))
-    {
-        ERR("Win32K: Failed making keyboard thread a win32 thread.\n");
-        return; //(Status);
-    }*/
-
     ptiKeyboard = PsGetCurrentThreadWin32Thread();
     ptiKeyboard->TIF_flags |= TIF_SYSTEMTHREAD;
     TRACE("Keyboard Thread 0x%x \n", ptiKeyboard);
@@ -447,17 +421,8 @@
         Status = KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, &DueTime);
     } while (!NT_SUCCESS(Status));
 
-
     Objects[0] = &InputThreadsStart;
     Objects[1] = MasterTimer;
-
-    // This thread requires win32k!
-    Status = Win32kInitWin32Thread(PsGetCurrentThread());
-    if (!NT_SUCCESS(Status))
-    {
-        ERR("Win32K: Failed making Raw Input thread a win32 thread.\n");
-        return; //(Status);
-    }
 
     ptiRawInput = PsGetCurrentThreadWin32Thread();
     ptiRawInput->TIF_flags |= TIF_SYSTEMTHREAD;
@@ -501,6 +466,7 @@
     {
         case 0: KeyboardThreadMain(NULL); break;
         case 1: MouseThreadMain(NULL); break;
+        case 2: RawInputThreadMain(NULL); break;
         default: ERR("Wrong type: %x\n", Type);
     }
 
@@ -514,8 +480,6 @@
 NTAPI
 InitInputImpl(VOID)
 {
-    NTSTATUS Status;
-
     KeInitializeEvent(&InputThreadsStart, NotificationEvent, FALSE);
 
     MasterTimer = ExAllocatePoolWithTag(NonPagedPool, sizeof(KTIMER), USERTAG_SYSTEM);
@@ -531,18 +495,6 @@
     if(!UserInitDefaultKeyboardLayout())
     {
         ERR("Failed to initialize default keyboard layout!\n");
-    }
-
-    Status = PsCreateSystemThread(&RawInputThreadHandle,
-                                  THREAD_ALL_ACCESS,
-                                  NULL,
-                                  NULL,
-                                  &RawInputThreadId,
-                                  RawInputThreadMain,
-                                  NULL);
-    if (!NT_SUCCESS(Status))
-    {
-        ERR("Win32K: Failed to create raw thread.\n");
     }
 
     InputThreadsRunning = TRUE;




More information about the Ros-diffs mailing list