Big merge: thanks alex and greatlord. Not a complete merge but most
[reactos.git] / reactos / ntoskrnl / ke / gmutex.c
index 19d11cf..44466ec 100644 (file)
@@ -50,7 +50,7 @@ KiAcquireGuardedMutexContented(IN OUT PKGUARDED_MUTEX GuardedMutex)
                    ((OldValue & GM_LOCK_WAITER_WOKEN) != 0));
 
             /* Unlock it by removing the Lock Bit */
-            NewValue = InterlockedCompareExchange(&GuardedMutex->Count,
+            NewValue = InterlockedCompareExchange((PLONG)&GuardedMutex->Count,
                                                   OldValue ^ BitsToRemove,
                                                   OldValue);
             if (NewValue == OldValue) break;
@@ -61,7 +61,7 @@ KiAcquireGuardedMutexContented(IN OUT PKGUARDED_MUTEX GuardedMutex)
         else
         {
             /* The Guarded Mutex isn't locked, so simply set the bits */
-            NewValue = InterlockedCompareExchange(&GuardedMutex->Count,
+            NewValue = InterlockedCompareExchange((PLONG)&GuardedMutex->Count,
                                                   OldValue + BitsToAdd,
                                                   OldValue);
             if (NewValue != OldValue)
@@ -109,7 +109,7 @@ KiReleaseGuardedMutex(IN OUT PKGUARDED_MUTEX GuardedMutex)
     GuardedMutex->Owner = NULL;
 
     /* Add the Lock Bit */
-    OldValue = InterlockedExchangeAdd(&GuardedMutex->Count, 1);
+    OldValue = InterlockedExchangeAdd((PLONG)&GuardedMutex->Count, 1);
     ASSERT((OldValue & GM_LOCK_BIT) == 0);
 
     /* Check if it was already locked, but not woken */
@@ -119,7 +119,7 @@ KiReleaseGuardedMutex(IN OUT PKGUARDED_MUTEX GuardedMutex)
         OldValue |= GM_LOCK_BIT;
 
         /* Remove the Woken bit */
-        if (InterlockedCompareExchange(&GuardedMutex->Count,
+        if (InterlockedCompareExchange((PLONG)&GuardedMutex->Count,
                                        OldValue - GM_LOCK_WAITER_WOKEN,
                                        OldValue) == OldValue)
         {