27 #ifndef INCLUDED_WUTIL 28 #define INCLUDED_WUTIL 31 # pragma warning(disable:4091) // hides previous local declaration 40 return h != 0 && h != INVALID_HANDLE_VALUE;
48 #define WUTIL_FUNC(varName, ret, params)\ 49 ret (WINAPI* varName) params 59 #define WUTIL_IMPORT(hModule, procName, varName)\ 61 const FARPROC f = GetProcAddress(hModule, #procName);\ 62 memcpy(&varName, &f, sizeof(FARPROC));\ 67 #define WUTIL_IMPORT_KERNEL32(procName, varName)\ 68 WUTIL_IMPORT(GetModuleHandleW(L"kernel32.dll"), procName, varName) 72 #define WUTIL_IMPORT_NTDLL(procName, varName)\ 73 WUTIL_IMPORT(GetModuleHandleW(L"ntdll.dll"), procName, varName) 131 : m_lastError(GetLastError())
138 if(m_lastError != 0 && GetLastError() == 0)
139 SetLastError(m_lastError);
208 #endif // #ifndef INCLUDED_WUTIL
const OsPath & wutil_RoamingAppdataPath()
Definition: wutil.cpp:189
bool wutil_IsWow64()
Definition: wutil.cpp:319
some WinAPI functions SetLastError(0) on success, which is bad because it can hide previous errors...
Definition: wutil.h:127
bool wutil_IsValidHandle(H h)
Definition: wutil.h:38
bool wutil_IsLocked(WinLockId id)
Definition: wutil.cpp:93
WinLockId m_id
Definition: wutil.h:115
~WinScopedPreserveLastError()
Definition: wutil.h:136
void wutil_Lock(WinLockId id)
Definition: wutil.cpp:79
const OsPath & wutil_PersonalPath()
Definition: wutil.cpp:194
const OsPath & wutil_LocalAppdataPath()
Definition: wutil.cpp:184
Status wutil_SetPrivilege(const wchar_t *privilege, bool enable)
Definition: wutil.cpp:348
void wutil_EnableHiDPIOnWindows()
Definition: wutil.cpp:428
void * wutil_Allocate(size_t size)
Definition: wutil.cpp:56
~WinScopedLock()
Definition: wutil.h:109
Status StatusFromWin()
Definition: wutil.cpp:127
i64 Status
Error handling system.
Definition: status.h:169
void wutil_SetAppWindow(void *hwnd)
Definition: wutil.cpp:402
void * m_wasRedirectionEnabled
Definition: wutil.h:178
DWORD m_lastError
Definition: wutil.h:143
WinScopedPreserveLastError()
Definition: wutil.h:130
WinLockId
Definition: wutil.h:86
WinScopedLock(WinLockId id)
Definition: wutil.h:103
HMODULE wutil_LibModuleHandle()
Definition: wutil.cpp:375
HWND wutil_AppWindow()
Definition: wutil.cpp:407
void wutil_Free(void *p)
Definition: wutil.cpp:62
void wutil_Unlock(WinLockId id)
Definition: wutil.cpp:86
const OsPath & wutil_ExecutablePath()
Definition: wutil.cpp:179
const OsPath & wutil_SystemPath()
Definition: wutil.cpp:174