[KERNEL32]

- Rename Keep argument of BasepIsRealtimeAllowed to something more accurate.
- Properly document this function usage given its specific behavior.

It's badly used in trunk atm, fixes will come in next commit

svn path=/trunk/; revision=62542
This commit is contained in:
Pierre Schweitzer 2014-03-22 15:59:41 +00:00
parent 2936e38c77
commit 6ef7adc1de

View file

@ -615,10 +615,15 @@ BaseInitializeContext(IN PCONTEXT Context,
/* /*
* Checks if the privilege for Real-Time Priority is there * Checks if the privilege for Real-Time Priority is there
* Beware about this function behavior:
* - In case CheckOnly is set to TRUE, 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 TRUE.
*/ */
PVOID PVOID
WINAPI WINAPI
BasepIsRealtimeAllowed(IN BOOLEAN Keep) BasepIsRealtimeAllowed(IN BOOLEAN CheckOnly)
{ {
ULONG Privilege = SE_INC_BASE_PRIORITY_PRIVILEGE; ULONG Privilege = SE_INC_BASE_PRIORITY_PRIVILEGE;
PVOID State; PVOID State;
@ -627,7 +632,7 @@ BasepIsRealtimeAllowed(IN BOOLEAN Keep)
Status = RtlAcquirePrivilege(&Privilege, 1, 0, &State); Status = RtlAcquirePrivilege(&Privilege, 1, 0, &State);
if (!NT_SUCCESS(Status)) return NULL; if (!NT_SUCCESS(Status)) return NULL;
if (Keep) if (CheckOnly)
{ {
RtlReleasePrivilege(State); RtlReleasePrivilege(State);
State = (PVOID)TRUE; State = (PVOID)TRUE;