AdvApi32PrivilegeCheck Method
Determines whether a specified set of privileges are enabled in an access token.
This function is typically called by a server application to check the privileges of a client's access token.
Namespace: DevCase.Win32.NativeMethodsAssembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[DllImportAttribute("AdvApi32.dll", SetLastError = true)]
public static bool PrivilegeCheck(
IntPtr token,
out PrivilegeSet refPrivileges,
ref bool refResult
)
<DllImportAttribute("AdvApi32.dll", SetLastError := true>]
Public Shared Function PrivilegeCheck (
token As IntPtr,
<OutAttribute> ByRef refPrivileges As PrivilegeSet,
ByRef refResult As Boolean
) As Boolean
Dim token As IntPtr
Dim refPrivileges As PrivilegeSet
Dim refResult As Boolean
Dim returnValue As Boolean
returnValue = AdvApi32.PrivilegeCheck(token,
refPrivileges, refResult)
public:
[DllImportAttribute(L"AdvApi32.dll", SetLastError = true)]
static bool PrivilegeCheck(
IntPtr token,
[InAttribute] [OutAttribute] PrivilegeSet% refPrivileges,
bool% refResult
)
[<DllImportAttribute("AdvApi32.dll", SetLastError = true)>]
static member PrivilegeCheck :
token : IntPtr *
refPrivileges : PrivilegeSet byref *
refResult : bool byref -> bool
No code example is currently available or this language may not be supported.
- token IntPtr
-
A handle to an access token representing a client process.
This handle must have been obtained by opening the token of a thread impersonating the client.
The token must be open for Query access.
- refPrivileges PrivilegeSet
-
A pointer to a PrivilegeSet structure.
The Privileges member of this structure is an array of
LuIdAndAttributes structures.
Before calling PrivilegeCheck,
use the Privileges array to indicate the set of privileges to check.
Set the Control member to PRIVILEGE_SET_ALL_NECESSARY if
all of the privileges must be enabled;
or set it to 0 if it is sufficient that any one of the privileges be enabled.
When PrivilegeCheck returns,
the Attributes member of each LuIdAndAttributes structure
is set to PrivilegeUsedForAccess if the corresponding privilege is enabled.
- refResult Boolean
-
A pointer to a value the function sets to indicate whether any or all of the specified privileges are enabled
in the access token.
If the Control member of the PrivilegeSet structure
specifies PRIVILEGE_SET_ALL_NECESSARY, this value is only if
all the privileges are enabled;
otherwise, this value is if any of the privileges are enabled.
Boolean
If the function succeeds, the return value is
.
If the function fails, the return value is
.
To get extended error information, call
GetLastWin32Error.