chsvlib
chsv helper source code

◆ CheckFileAccessBySecurityDescriptor()

BOOL Chusov::Win32::Security::CheckFileAccessBySecurityDescriptor ( PSECURITY_DESCRIPTOR  pFileSD,
DWORD  dwAccessMask 
)

Checks if a specified security descriptor of a file allows a specified access.

Parameters
[in]pFileSDis a pointer to a security descriptor of a file, which the access is checked against. The security descriptor must include information about its owner and group, otherwise the function fails. If the security descriptor does not include a DACL the function will return TRUE indicating that a client has the requested access.
dwAccessMaskis a standard access mask specifying a type of the access requested. The value is composed of Windows API constants, and it may file specific access control values, standard access control values, generic access control values or any combination of thereof.
Returns
The function returns TRUE, if the requested access is allowed, or FALSE otherwise.
Exceptions
Chusov::Exceptions::ChsvCodeExceptionA system-level error occurred. If the security descriptor has an invalid format, e.g. it does not include owner and group information, the function throws an exception corresponding to ERROR_INVALID_SECURITY_DESCR Windows error code.