X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Ffs%2Fstat.cpp;h=d11867d99b6af41a427dba423673acc622390a65;hb=427991f60b200fe4a6517e6fb1fe1980ab14983b;hp=b0267d8771d08586645261b7a775c3a991f16aeb;hpb=2a3d0cc4d8ef930ed5fc56c480df3c05967489a4;p=libs%2Fcore.git diff --git a/source/fs/stat.cpp b/source/fs/stat.cpp index b0267d8..d11867d 100644 --- a/source/fs/stat.cpp +++ b/source/fs/stat.cpp @@ -88,7 +88,7 @@ Stat Stat::stat(const Path &path) { #ifdef WIN32 HANDLE handle; - handle = CreateFile(path.str().c_str(), 0, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0); + handle = CreateFile(path.str().c_str(), 0, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0); if(handle==INVALID_HANDLE_VALUE) throw system_error("CreateFile"); @@ -110,16 +110,18 @@ Stat Stat::stat(const Path &path) result.mtime = Time::TimeStamp(Time::filetime_to_rawtime(info.ftLastWriteTime)); PSECURITY_DESCRIPTOR sec_desc; - PSID owner; - PSID group; + PSID owner = 0; + PSID group = 0; if(!GetSecurityInfo(handle, SE_FILE_OBJECT, OWNER_SECURITY_INFORMATION|GROUP_SECURITY_INFORMATION, &owner, &group, 0, 0, &sec_desc)) { CloseHandle(handle); throw system_error("GetSecurityInfo"); } - result.owner = get_account_name(owner); - result.group = get_account_name(group); + if(owner) + result.owner = get_account_name(owner); + if(group) + result.group = get_account_name(group); LocalFree(sec_desc);