diff --git a/src/io_engine_iocp.cpp b/src/io_engine_iocp.cpp index 41778c4..74c700d 100644 --- a/src/io_engine_iocp.cpp +++ b/src/io_engine_iocp.cpp @@ -709,11 +709,9 @@ namespace asyncpp::io::detail { void io_engine_iocp::file_close(file_handle_t fd) { ::CloseHandle(fd); } uint64_t io_engine_iocp::file_size(file_handle_t fd) { - DWORD high; - auto res = GetFileSize(fd, &high); - if (res == INVALID_FILE_SIZE && GetLastError() != NO_ERROR) - throw std::system_error(GetLastError(), std::system_category()); - return (static_cast(high) << 32) + res; + LARGE_INTEGER file_size{}; + if (GetFileSizeEx(fd, &file_size) == FALSE) throw std::system_error(GetLastError(), std::system_category()); + return file_size.QuadPart; } bool io_engine_iocp::enqueue_readv(file_handle_t fd, void* buf, size_t len, uint64_t offset, completion_data* cd) {