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.

Definition

Namespace: DevCase.Win32.NativeMethods
Assembly: 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
)

Parameters

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.

Return Value

Boolean
If the function succeeds, the return value is .

If the function fails, the return value is .

To get extended error information, call GetLastWin32Error.

Remarks

See Also