aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/utils
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2021-05-15 23:36:29 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2021-05-15 23:36:29 +0300
commit46ef2fbd49b2e48206a0554ae9a7d84f5961d817 (patch)
treed25e78e4c7e8a36c960a1157e06be77d39a0afcf /src/utils
parentrename the project (diff)
downloadwinapi-debug-46ef2fbd49b2e48206a0554ae9a7d84f5961d817.tar.gz
winapi-debug-46ef2fbd49b2e48206a0554ae9a7d84f5961d817.zip
use error reporting from winapi-common
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/file.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/utils/file.cpp b/src/utils/file.cpp
index af1de6e..fdc695f 100644
--- a/src/utils/file.cpp
+++ b/src/utils/file.cpp
@@ -5,6 +5,7 @@
#include <pdb/all.hpp>
+#include <winapi/error.hpp>
#include <winapi/utf8.hpp>
#include <windows.h>
@@ -27,12 +28,12 @@ std::size_t get_size(const std::string& path) {
NULL)};
if (handle.get() == INVALID_HANDLE_VALUE)
- throw error::windows(GetLastError(), "CreateFileW");
+ throw winapi::error::windows(GetLastError(), "CreateFileW");
LARGE_INTEGER size;
if (!GetFileSizeEx(handle.get(), &size))
- throw error::windows(GetLastError(), "GetFileSizeEx");
+ throw winapi::error::windows(GetLastError(), "GetFileSizeEx");
if (size.QuadPart < 0 || size.QuadPart > SIZE_MAX)
throw std::runtime_error{"invalid file size"};
@@ -49,12 +50,12 @@ ID query_id(const std::string& path) {
NULL)};
if (handle.get() == INVALID_HANDLE_VALUE)
- throw error::windows(GetLastError(), "CreateFileW");
+ throw winapi::error::windows(GetLastError(), "CreateFileW");
FILE_ID_INFO id;
if (!GetFileInformationByHandleEx(handle.get(), FileIdInfo, &id, sizeof(id)))
- throw error::windows(GetLastError(), "GetFileInformationByHandleEx");
+ throw winapi::error::windows(GetLastError(), "GetFileInformationByHandleEx");
return {id};
}