static void init_pointers(void) { HMODULE hKernel32 = GetModuleHandleA("kernel32.dll"); #define MAKEFUNC(f) (p##f = (void*)GetProcAddress(hKernel32, #f)) MAKEFUNC(GetDllDirectoryA); MAKEFUNC(GetDllDirectoryW); MAKEFUNC(SetDllDirectoryA); MAKEFUNC(GetModuleHandleExA); MAKEFUNC(GetModuleHandleExW); #undef MAKEFUNC }
static BOOL init_pointers(void) { /* don't free module here, it's to be unloaded on exit */ HMODULE mod = LoadLibraryA("xmllite.dll"); if (!mod) { win_skip("xmllite library not available\n"); return FALSE; } #define MAKEFUNC(f) if (!(p##f = (void*)GetProcAddress(mod, #f))) return FALSE; MAKEFUNC(CreateXmlWriter); MAKEFUNC(CreateXmlWriterOutputWithEncodingName); #undef MAKEFUNC return TRUE; }
static void init_pointers(void) { HMODULE hKernel32 = GetModuleHandleA("kernel32.dll"); #define MAKEFUNC(f) (p##f = (void*)GetProcAddress(hKernel32, #f)) MAKEFUNC(GetDllDirectoryA); MAKEFUNC(GetDllDirectoryW); MAKEFUNC(SetDllDirectoryA); MAKEFUNC(GetModuleHandleExA); MAKEFUNC(GetModuleHandleExW); MAKEFUNC(K32GetModuleInformation); #undef MAKEFUNC /* not all Windows versions export this in kernel32 */ if (!pK32GetModuleInformation) { HMODULE hPsapi = LoadLibraryA("psapi.dll"); if (hPsapi) { pK32GetModuleInformation = (void *)GetProcAddress(hPsapi, "GetModuleInformation"); if (!pK32GetModuleInformation) FreeLibrary(hPsapi); } } }