| 211 | } |
| 212 | |
| 213 | void GetVolumeSerialUsingFileHandle(const std::wstring& path, uint32_t& volumeSerial32, std::error_code& ec) |
| 214 | { |
| 215 | using namespace Orc; |
| 216 | |
| 217 | auto hVolume = CreateFileApi( |
| 218 | path.c_str(), |
| 219 | GENERIC_READ, |
| 220 | FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, |
| 221 | NULL, |
| 222 | OPEN_EXISTING, |
| 223 | FILE_FLAG_BACKUP_SEMANTICS, |
| 224 | NULL); |
| 225 | |
| 226 | if (!hVolume) |
| 227 | { |
| 228 | Log::Debug(L"Failed CreateFileW '{}' [{}]", path, hVolume.error()); |
| 229 | return; |
| 230 | } |
| 231 | |
| 232 | BY_HANDLE_FILE_INFORMATION info; |
| 233 | if (!GetFileInformationByHandle(hVolume->value(), &info)) |
| 234 | { |
| 235 | ec = LastWin32Error(); |
| 236 | Log::Debug(L"Failed GetFileInformationByHandle '{}' [{}]", path, ec); |
| 237 | return; |
| 238 | } |
| 239 | |
| 240 | volumeSerial32 = info.dwVolumeSerialNumber; |
| 241 | } |
| 242 | |
| 243 | void GetVolumeSerial32(std::wstring path, uint32_t& volumeSerial32, std::error_code& ec) |
| 244 | { |
no test coverage detected