chsvlib
chsv helper source code

◆ GetFileSecurityDescriptor() [1/2]

AutoSecurityDescriptor Chusov::Win32::Security::GetFileSecurityDescriptor ( HANDLE  hFile,
DWORD  dwSecurityInformation 
)

Returns a self-relative security descriptor of a file specified by a handle.

Parameters
[in]hFileis a handle to a Windows file object.
dwSecurityInformationis a bit mask specifying security information to be held by the returned security descriptor. The constants, such as OWNER_SECURITY_INFORMATION, GROUP_SECURITY_INFORMATION or DACL_SECURITY_INFORMATION, are defined as a part of Windows API. See SECURITY_INFORMATION for the full list of available constants and corresponding information that can be retrieved by a call.
Returns
The function returns a smart AutoSecurityDescriptor pointer to the retrieved SECURITY_DESCRIPTOR data, in self-relative format. The returned descriptor contains the file security information according to the value of the dwSecurityInformation constants.
Exceptions
std::bad_allocThe function was unable to allocate a required amount of memory to complete the request.
Chusov::Exceptions::ChsvCodeExceptionA system-level error occurred.
See also
GetFileSecurityDescriptor; retrieves a security descriptor of a file specified by its name.