/*
* 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
Status = RtlAcquirePrivilege(&Privilege, 1, 0, &State);
if (!NT_SUCCESS(Status)) return NULL;
- if (Keep)
+ if (!Keep)
{
RtlReleasePrivilege(State);
State = (PVOID)TRUE;