Update AdjustTokenPrivileges PInvoke usage

Refactored the AdjustTokenPrivileges call to use null for the previous state and an out variable for the return length, improving compatibility with the PInvoke signature and aligning with recommended usage.
This commit is contained in:
Jack251970 2026-02-05 20:28:37 +08:00
parent 97d7eab1a7
commit d4f472a64e

View file

@ -175,7 +175,7 @@ namespace Flow.Launcher.Plugin.Sys
Privileges = new() { e0 = new LUID_AND_ATTRIBUTES { Luid = luid, Attributes = TOKEN_PRIVILEGES_ATTRIBUTES.SE_PRIVILEGE_ENABLED } }
};
if (!PInvoke.AdjustTokenPrivileges(tokenHandle, false, &privileges, 0, null, null))
if (!PInvoke.AdjustTokenPrivileges(tokenHandle, false, &privileges, null, out var _))
{
return false;
}