{
#ifdef WIN32
HANDLE handle;
- handle = CreateFile(path.str().c_str(), 0, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0);
+ handle = CreateFile(path.str().c_str(), READ_CONTROL, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL|FILE_FLAG_BACKUP_SEMANTICS, 0);
if(handle==INVALID_HANDLE_VALUE)
{
DWORD err = GetLastError();
PSECURITY_DESCRIPTOR sec_desc;
PSID owner = 0;
PSID group = 0;
- if(!GetSecurityInfo(handle, SE_FILE_OBJECT, OWNER_SECURITY_INFORMATION|GROUP_SECURITY_INFORMATION, &owner, &group, 0, 0, &sec_desc))
+ const SECURITY_INFORMATION sec_info = OWNER_SECURITY_INFORMATION|GROUP_SECURITY_INFORMATION;
+ DWORD err = GetSecurityInfo(handle, SE_FILE_OBJECT, sec_info, &owner, &group, 0, 0, &sec_desc);
+ if(err)
{
CloseHandle(handle);
- throw system_error("GetSecurityInfo");
+ throw system_error("GetSecurityInfo", err);
}
if(owner)