[WIN32K]
[reactos.git] / reactos / win32ss / gdi / eng / semaphor.c
index 0207186..fa72ea3 100644 (file)
@@ -42,7 +42,14 @@ EngAcquireSemaphore(
 {
     // www.osr.com/ddk/graphics/gdifncs_14br.htm
     PTHREADINFO W32Thread;
-    ASSERT(hsem);
+
+    /* On Windows a NULL hsem is ignored */
+    if (hsem == NULL)
+    {
+        DPRINT1("EngAcquireSemaphore called with hsem == NULL!\n");
+        return;
+    }
+
     ExEnterCriticalRegionAndAcquireResourceExclusive((PERESOURCE)hsem);
     W32Thread = PsGetThreadWin32Thread(PsGetCurrentThread());
     if (W32Thread) W32Thread->dwEngAcquireCount++;
@@ -61,7 +68,14 @@ EngReleaseSemaphore(
 {
     // www.osr.com/ddk/graphics/gdifncs_5u3r.htm
     PTHREADINFO W32Thread;
-    ASSERT(hsem);
+
+    /* On Windows a NULL hsem is ignored */
+    if (hsem == NULL)
+    {
+        DPRINT1("EngReleaseSemaphore called with hsem == NULL!\n");
+        return;
+    }
+
     W32Thread = PsGetThreadWin32Thread(PsGetCurrentThread());
     if (W32Thread) --W32Thread->dwEngAcquireCount;
     ExReleaseResourceAndLeaveCriticalRegion((PERESOURCE)hsem);