- Proper fix for the bug that 25558 attempted to fix. Kernel-mode registry handles...
authorAlex Ionescu <aionescu@gmail.com>
Mon, 22 Jan 2007 08:46:56 +0000 (08:46 +0000)
committerAlex Ionescu <aionescu@gmail.com>
Mon, 22 Jan 2007 08:46:56 +0000 (08:46 +0000)
- Also the system now boots again since this fix is correct.

svn path=/trunk/; revision=25587

reactos/ntoskrnl/cm/ntfunc.c

index 74b9c6b..115eeb5 100644 (file)
@@ -49,7 +49,8 @@ CmpCreateHandle(PVOID ObjectBody,
                 */
 {
     HANDLE_TABLE_ENTRY NewEntry;
-    PEPROCESS Process, CurrentProcess;
+    PEPROCESS CurrentProcess;
+    PVOID HandleTable;
     POBJECT_HEADER ObjectHeader;
     HANDLE Handle;
     KAPC_STATE ApcState;
@@ -90,22 +91,20 @@ CmpCreateHandle(PVOID ObjectBody,
     if ((HandleAttributes & OBJ_KERNEL_HANDLE) &&
         ExGetPreviousMode() == KernelMode)
     {
-        Process = PsInitialSystemProcess;
-        if (Process != CurrentProcess)
+        HandleTable = ObpKernelHandleTable;
+        if (PsGetCurrentProcess() != PsInitialSystemProcess)
         {
-            KeStackAttachProcess(&Process->Pcb,
+            KeStackAttachProcess(&PsInitialSystemProcess->Pcb,
                 &ApcState);
             AttachedToProcess = TRUE;
         }
     }
     else
     {
-        Process = CurrentProcess;
-        /* mask out the OBJ_KERNEL_HANDLE attribute */
-        HandleAttributes &= ~OBJ_KERNEL_HANDLE;
+        HandleTable = PsGetCurrentProcess()->ObjectTable;
     }
 
-    Handle = ExCreateHandle(Process->ObjectTable,
+    Handle = ExCreateHandle(HandleTable,
         &NewEntry);
 
     if (AttachedToProcess)