The AccessCheck function determines whether a security descriptor grants a specified set of access rights to the client identified by an access token. Typically, server applications use this function to check access to a private object.
BOOL AccessCheck(
PSECURITY_DESCRIPTOR pSecurityDescriptor, // security descriptor
HANDLE ClientToken, // handle to client access token
DWORD DesiredAccess, // requested access rights
PGENERIC_MAPPING GenericMapping, // map generic to specific rights
PPRIVILEGE_SET PrivilegeSet, // receives privileges used
LPDWORD PrivilegeSetLength, // size of privilege-set buffer
LPDWORD GrantedAccess, // retrieves mask of granted rights
LPBOOL AccessStatus // retrieves results of access check
);
If this parameter is MAXIMUM_ALLOWED, the function sets the GrantedAccess access mask to indicate the maximum access rights the security descriptor allows the client.
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
The AccessCheck function compares the specified security descriptor with the specified access token and indicates, in the AccessStatus parameter, whether access is granted or denied. If access is granted, the requested access mask becomes the object's granted access mask.
If the security descriptor's DACL is NULL, the AccessStatus parameter returns TRUE indicating that the client has the requested access.
AccessCheck fails with ERROR_INVALID_SECURITY_DESCR if the security descriptor does not contain owner and group SIDs.
Windows NT: Requires version 3.1 or later.
Windows: Unsupported.
Windows CE: Unsupported.
Header: Declared in winbase.h.
Import Library: Use advapi32.lib.
Client/Server Access Control Overview, Client/Server Access Control Functions, AccessCheckAndAuditAlarm, AreAllAccessesGranted, AreAnyAccessesGranted, GENERIC_MAPPING, MapGenericMask, PrivilegeCheck, PRIVILEGE_SET, SECURITY_DESCRIPTOR