27 #ifndef INCLUDED_WUTIL 28 #define INCLUDED_WUTIL 36 return h != 0 && h != INVALID_HANDLE_VALUE;
44 #define WUTIL_FUNC(varName, ret, params)\ 45 ret (WINAPI* varName) params 55 #define WUTIL_IMPORT(hModule, procName, varName)\ 57 const FARPROC f = GetProcAddress(hModule, #procName);\ 58 memcpy(&varName, &f, sizeof(FARPROC));\ 63 #define WUTIL_IMPORT_KERNEL32(procName, varName)\ 64 WUTIL_IMPORT(GetModuleHandleW(L"kernel32.dll"), procName, varName) 123 : m_lastError(GetLastError())
130 if(m_lastError != 0 && GetLastError() == 0)
131 SetLastError(m_lastError);
205 #endif // #ifndef INCLUDED_WUTIL
const OsPath & wutil_RoamingAppdataPath()
Definition: wutil.cpp:273
bool wutil_IsWow64()
Definition: wutil.cpp:434
some WinAPI functions SetLastError(0) on success, which is bad because it can hide previous errors...
Definition: wutil.h:119
bool wutil_IsValidHandle(H h)
Definition: wutil.h:34
bool wutil_IsLocked(WinLockId id)
Definition: wutil.cpp:91
WinLockId m_id
Definition: wutil.h:107
~WinScopedPreserveLastError()
Definition: wutil.h:128
bool wutil_HasCommandLineArgument(const wchar_t *arg)
Definition: wutil.cpp:236
void wutil_Lock(WinLockId id)
Definition: wutil.cpp:77
const OsPath & wutil_PersonalPath()
Definition: wutil.cpp:278
const OsPath & wutil_LocalAppdataPath()
Definition: wutil.cpp:268
void * wutil_Allocate(size_t size)
Definition: wutil.cpp:54
int wutil_argc()
Definition: wutil.cpp:217
wchar_t ** wutil_argv()
Definition: wutil.cpp:222
unsigned long DWORD
Definition: wgl.h:56
~WinScopedLock()
Definition: wutil.h:101
Status StatusFromWin()
Definition: wutil.cpp:125
i64 Status
Error handling system.
Definition: status.h:171
void * m_wasRedirectionEnabled
Definition: wutil.h:179
DWORD m_lastError
Definition: wutil.h:135
WinScopedPreserveLastError()
Definition: wutil.h:122
WinLockId
Definition: wutil.h:78
WinScopedLock(WinLockId id)
Definition: wutil.h:95
HMODULE wutil_LibModuleHandle()
Definition: wutil.cpp:494
LIB_API Status wutil_SetPrivilege(const wchar_t *privilege, bool enable)
Definition: wutil.cpp:463
HWND wutil_AppWindow()
Definition: wutil.cpp:536
void wutil_Free(void *p)
Definition: wutil.cpp:60
void wutil_Unlock(WinLockId id)
Definition: wutil.cpp:84
const OsPath & wutil_ExecutablePath()
Definition: wutil.cpp:263
const OsPath & wutil_SystemPath()
Definition: wutil.cpp:258