-#ifdef WIN32
- HANDLE handle;
- 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");
-
- BY_HANDLE_FILE_INFORMATION info;
- if(!GetFileInformationByHandle(handle, &info))
- {
- CloseHandle(handle);
- throw system_error("GetFileInformationByHandle");
- }
-
- Stat result;
- if(info.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)
- result.type = DIRECTORY;
- else
- result.type = REGULAR;
-
- result.size = FileSize(info.nFileSizeHigh)<<32 | info.nFileSizeLow;
- result.alloc_size = (result.size+511)&~511;
- result.mtime = Time::TimeStamp(Time::filetime_to_rawtime(info.ftLastWriteTime));
-
- PSECURITY_DESCRIPTOR sec_desc;
- PSID owner;
- PSID group;
- 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);
-
- LocalFree(sec_desc);
-
- CloseHandle(handle);
-
- return result;
-#else
- struct stat st;
- int ret = ::stat(path.str().c_str(), &st);
- if(ret==-1)
- throw system_error("stat");
-
- return Private::from_struct_stat(st);
-#endif