#if DBG
DbgInitDebugChannels();
-#if KDBG
+#if defined(KDBG)
KdRosRegisterCliCallback(DbgGdiKdbgCliCallback);
#endif
#endif
/* 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,
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;
}
if (ptiCurrent->hEventQueueClient != NULL)
{
- ZwClose(ptiCurrent->hEventQueueClient);
+ ObCloseHandle(ptiCurrent->hEventQueueClient, UserMode);
ObDereferenceObject(ptiCurrent->pEventQueueServer);
}
ptiCurrent->hEventQueueClient = NULL;
/*
* This definition doesn't work
*/
-INIT_FUNCTION
+INIT_SECTION
NTSTATUS
APIENTRY
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