aboutsummaryrefslogtreecommitdiff
path: root/c/win.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'c/win.cpp')
-rw-r--r--c/win.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/c/win.cpp b/c/win.cpp
index 548c951..a09b19b 100644
--- a/c/win.cpp
+++ b/c/win.cpp
@@ -124,8 +124,8 @@ int GetRelativeCursorPos(const HWND hWnd, POINT* const pt) noexcept
return 1;
}
-Win32Error::Win32Error(const DWORD code) noexcept
- : code(code) {}
+Win32Error::Win32Error(const DWORD code, const HMODULE hModule) noexcept
+ : code(code), hModule(hModule) {}
Win32Error::~Win32Error()
{
@@ -143,7 +143,7 @@ const char* Win32Error::what() const noexcept
|FORMAT_MESSAGE_FROM_SYSTEM
|FORMAT_MESSAGE_FROM_HMODULE
|FORMAT_MESSAGE_IGNORE_INSERTS,
- GetModuleHandle(L"wininet.dll"),
+ hModule,
code,
MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US),
(char*)&m_szMsg,
@@ -159,7 +159,7 @@ const wchar_t* Win32Error::What() const noexcept
|FORMAT_MESSAGE_FROM_SYSTEM
|FORMAT_MESSAGE_FROM_HMODULE
|FORMAT_MESSAGE_IGNORE_INSERTS,
- GetModuleHandle(L"wininet.dll"),
+ hModule,
code,
MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US),
(wchar_t*)&m_wszMsg,
@@ -170,7 +170,7 @@ const wchar_t* Win32Error::What() const noexcept
InternetError::InternetError(DWORD codeSystem)
{
if (codeSystem != ERROR_INTERNET_EXTENDED_ERROR)
- throw Win32Error(codeSystem);
+ throw Win32Error(codeSystem, GetModuleHandle(L"wininet.dll"));
DWORD len, cch;
InternetGetLastResponseInfo(&code, nullptr, &len);