Пример #1
0
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
}
Пример #2
0
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;
}
Пример #3
0
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);
        }
    }

}