added a macro IsKernelPointer() to test whether a pointer value points to the kernel...
[reactos.git] / reactos / ntoskrnl / ob / wait.c
index 96f45bd..538cc42 100644 (file)
@@ -149,7 +149,7 @@ NtWaitForMultipleObjects(IN ULONG ObjectCount,
         DefaultObject = ObjectHeader->Type->DefaultObject;
 
         /* Check if it's the internal offset */
-        if ((LONG_PTR)DefaultObject >= 0)
+        if (!IsKernelPointer(DefaultObject))
         {
             /* Increase reference count */
             InterlockedIncrement(&ObjectHeader->PointerCount);
@@ -295,7 +295,7 @@ NtWaitForSingleObject(IN HANDLE ObjectHandle,
         WaitableObject = BODY_TO_HEADER(Object)->Type->DefaultObject;
 
         /* Is it an offset for internal objects? */
-        if ((LONG_PTR)WaitableObject >= 0)
+        if (!IsKernelPointer(WaitableObject))
         {
             /* Turn it into a pointer */
             WaitableObject = (PVOID)((ULONG_PTR)Object +
@@ -389,7 +389,7 @@ NtSignalAndWaitForSingleObject(IN HANDLE ObjectHandleToSignal,
     WaitableObject = BODY_TO_HEADER(WaitObj)->Type->DefaultObject;
 
     /* Handle internal offset */
-    if ((LONG_PTR)WaitableObject >= 0)
+    if (!IsKernelPointer(WaitableObject))
     {
         /* Get real pointer */
         WaitableObject = (PVOID)((ULONG_PTR)WaitObj +