6 #ifndef _INC_cWinOSWrap_H
7 #define _INC_cWinOSWrap_H
12 #include "../WinAPI/WinTypes.h"
31 class GRAYLIB_LINK cWinOSWrap :
public cSingleton < cWinOSWrap >
39 friend class cSingleton < cWinOSWrap >;
45 typedef BOOL(WINAPI* FUNC_ChangeWindowMessageFilter_t)(UINT message, DWORD dwFlag);
46 typedef BOOL(WINAPI* FUNC_EnumProcessModulesEx)(HANDLE hProcess, OUT HMODULE *lphModule, DWORD cb, OUT LPDWORD lpcbNeeded, DWORD dwFilterFlag);
47 typedef LONG(WINAPI* FUNC_RegDeleteKeyExW)(HKEY hKey, LPCWSTR lpSubKey, REGSAM samDesired, DWORD Reserved);
48 typedef LONG(WINAPI* FUNC_RegDeleteKeyExA)(HKEY hKey, LPCSTR lpSubKey, REGSAM samDesired, DWORD Reserved);
52 cOSModuleFunc<FUNC_ChangeWindowMessageFilter_t> m_funcChangeWindowMessageFilter;
53 cOSModuleFunc<FUNC_EnumProcessModulesEx> m_funcEnumProcessModulesEx;
54 cOSModuleFunc<FUNC_RegDeleteKeyExA> m_funcRegDeleteKeyExA;
58 cOSModule m_mod[WINOSD_QTY + 1];
62 : cSingleton<cWinOSWrap>(this, typeid(cWinOSWrap))
73 if (mod.isValidModule())
78 HRESULT hRes = mod.LoadModule(szPath);
81 ASSERT(mod.isValidModule());
87 HRESULT hRes = BindModule(m_mod[WINOSD_Kernel32],
_FN(
"kernel32.dll"));
88 if (
FAILED(hRes) || hRes == S_OK)
96 HRESULT hRes = BindModule(m_mod[WINOSD_User32],
_FN(
"user32.dll"));
97 if (
FAILED(hRes) || hRes == S_OK)
102 m_funcChangeWindowMessageFilter.put_FuncGeneric(m_mod[WINOSD_User32].GetSymbolAddress(
"ChangeWindowMessageFilter"));
108 HRESULT hRes = BindModule(m_mod[WINOSD_PSAPI],
_FN(
"psapi.dll"));
109 if (
FAILED(hRes) || hRes == S_OK)
114 m_funcEnumProcessModulesEx.put_FuncGeneric(m_mod[WINOSD_PSAPI].GetSymbolAddress(
"EnumProcessModulesEx"));
119 HRESULT hRes = BindModule(m_mod[WINOSD_ADVAPI32],
_FN(
"Advapi32.dll"));
120 if (
FAILED(hRes) || hRes == S_OK)
124 m_funcRegDeleteKeyExA.put_FuncGeneric(m_mod[WINOSD_ADVAPI32].GetSymbolAddress(
"RegDeleteKeyExA"));
#define _FN(x)
like _T(x) macro for static text file names.
Definition: FileName.h:23
#define GRAYLIB_LINK
Definition: GrayLibBase.h:35
#define FAILED(x)
Definition: HResult.h:30
#define STRMAX(x)
Get Max size of static string space. minus the '\0' terminator character.
Definition: StrConst.h:33
#define _MAX_PATH
Definition: SysTypes.h:423
INT32 HRESULT
_WIN32 style error codes. INT32
Definition: SysTypes.h:465
#define ASSERT(exp)
Definition: cDebugAssert.h:87
#define CHEAPOBJECT_IMPL
Definition: cHeapObject.h:32
static StrLen_t __stdcall CombineFilePathA(FILECHAR_t *pszOut, StrLen_t iLenMax, StrLen_t iLen, const FILECHAR_t *pszName, FILECHAR_t chSep=k_DirSep)
Definition: cFilePath.cpp:552
static StrLen_t __stdcall GetSystemDir(FILECHAR_t *pszDir, StrLen_t iLenMax)
Definition: cSystemInfo.cpp:183
int StrLen_t
the length of a string in chars (bytes for UTF8, wchar_t for UNICODE). or offset in characters....
Definition: StrConst.h:32
char FILECHAR_t
a UTF8 char in a file name. like TCHAR
Definition: FileName.h:22