Sync with trunk.
[reactos.git] / dll / win32 / kernel32 / client / utils.c
index f0f102a..fa476de 100644 (file)
@@ -615,6 +615,11 @@ BaseInitializeContext(IN PCONTEXT Context,
 
 /*
  * Checks if the privilege for Real-Time Priority is there
+ * Beware about this function behavior:
+ * - In case Keep is set to FALSE, then the function will only check
+ * whether real time is allowed and won't grant the privilege. In that case
+ * it will return TRUE if allowed, FALSE otherwise. Not a state!
+ * It means you don't have to release privilege when calling with FALSE.
  */
 PVOID
 WINAPI
@@ -627,7 +632,7 @@ BasepIsRealtimeAllowed(IN BOOLEAN Keep)
     Status = RtlAcquirePrivilege(&Privilege, 1, 0, &State);
     if (!NT_SUCCESS(Status)) return NULL;
 
-    if (Keep)
+    if (!Keep)
     {
         RtlReleasePrivilege(State);
         State = (PVOID)TRUE;