| 192 | ~WindowsRandomAccessFile() override = default; |
| 193 | |
| 194 | Status Read(uint64_t offset, size_t n, Slice* result, |
| 195 | char* scratch) const override { |
| 196 | DWORD bytes_read = 0; |
| 197 | OVERLAPPED overlapped = {0}; |
| 198 | |
| 199 | overlapped.OffsetHigh = static_cast<DWORD>(offset >> 32); |
| 200 | overlapped.Offset = static_cast<DWORD>(offset); |
| 201 | if (!::ReadFile(handle_.get(), scratch, static_cast<DWORD>(n), &bytes_read, |
| 202 | &overlapped)) { |
| 203 | DWORD error_code = ::GetLastError(); |
| 204 | if (error_code != ERROR_HANDLE_EOF) { |
| 205 | *result = Slice(scratch, 0); |
| 206 | return Status::IOError(filename_, GetWindowsErrorMessage(error_code)); |
| 207 | } |
| 208 | } |
| 209 | |
| 210 | *result = Slice(scratch, bytes_read); |
| 211 | return Status::OK(); |
| 212 | } |
| 213 | |
| 214 | std::string GetName() const override { return filename_; } |
| 215 |
nothing calls this directly
no test coverage detected