chsvlib
chsv helper source code

◆ GetFileSecurityDescriptor() [2/2]

AutoSecurityDescriptor Chusov::Win32::Security::GetFileSecurityDescriptor ( LPCWSTR  lpszFileName,
DWORD  dwSecurityInformation 
)

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

Parameters
[in]lpszFileNameis a pointer to a wide string specifying an existent file name.
dwSecurityInformationis a bitmask 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 SECURITY_DESCRIPTOR data, is 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.