[WIN32K:NTUSER]
[reactos.git] / reactos / win32ss / user / ntuser / main.c
index a3b32ae..b429b63 100644 (file)
@@ -255,7 +255,7 @@ InitProcessCallback(PEPROCESS Process)
 
 #if DBG
     DbgInitDebugChannels();
-#if KDBG
+#if defined(KDBG)
     KdRosRegisterCliCallback(DbgGdiKdbgCliCallback);
 #endif
 #endif
@@ -379,11 +379,7 @@ AllocW32Thread(IN  PETHREAD Thread,
 
     /* Check that we were not called with an already existing Win32 thread info */
     ptiCurrent = PsGetThreadWin32Thread(Thread);
-    if (ptiCurrent)
-    {
-        ERR_CH(UserThread, "PsGetThreadWin32Thread returned non-NULL thread info!!\n");
-        // return STATUS_SUCCESS;
-    }
+    NT_ASSERT(ptiCurrent == NULL);
 
     /* Allocate a new Win32 thread info */
     ptiCurrent = ExAllocatePoolWithTag(NonPagedPool,
@@ -512,12 +508,12 @@ InitThreadCallback(PETHREAD Thread)
         goto error;
     }
     Status = ObReferenceObjectByHandle(ptiCurrent->hEventQueueClient, 0,
-                                       *ExEventObjectType, KernelMode,
+                                       *ExEventObjectType, UserMode,
                                        (PVOID*)&ptiCurrent->pEventQueueServer, NULL);
     if (!NT_SUCCESS(Status))
     {
         ERR_CH(UserThread, "Failed referencing the event object, Status 0x%08x.\n", Status);
-        ZwClose(ptiCurrent->hEventQueueClient);
+        ObCloseHandle(ptiCurrent->hEventQueueClient, UserMode);
         ptiCurrent->hEventQueueClient = NULL;
         goto error;
     }
@@ -822,7 +818,7 @@ ExitThreadCallback(PETHREAD Thread)
 
     if (ptiCurrent->hEventQueueClient != NULL)
     {
-       ZwClose(ptiCurrent->hEventQueueClient);
+       ObCloseHandle(ptiCurrent->hEventQueueClient, UserMode);
        ObDereferenceObject(ptiCurrent->pEventQueueServer);
     }
     ptiCurrent->hEventQueueClient = NULL;
@@ -888,7 +884,7 @@ DriverUnload(IN PDRIVER_OBJECT DriverObject)
 /*
  * This definition doesn't work
  */
-INIT_FUNCTION
+INIT_SECTION
 NTSTATUS
 APIENTRY
 DriverEntry(
@@ -942,7 +938,7 @@ DriverEntry(
     PsEstablishWin32Callouts(&CalloutData);
 
     /* Register service hook callbacks */
-#if DBG
+#if DBG && defined(KDBG)
     KdSystemDebugControl('CsoR', DbgPreServiceHook, ID_Win32PreServiceHook, 0, 0, 0, 0);
     KdSystemDebugControl('CsoR', DbgPostServiceHook, ID_Win32PostServiceHook, 0, 0, 0, 0);
 #endif