Remove unneeded checks on the GetModuleHandle() return value for cases where we are linked with the dll.

This commit is contained in:
Francois Gouget 2007-03-28 10:00:28 +02:00 committed by Alexandre Julliard
parent ebfeb41e99
commit d9e8a0f63e
23 changed files with 122 additions and 159 deletions

View File

@ -70,39 +70,36 @@ static void init_function_pointers(void)
{
hadvapi32 = GetModuleHandleA("advapi32.dll");
if(hadvapi32)
{
pCryptAcquireContextA = (void*)GetProcAddress(hadvapi32, "CryptAcquireContextA");
pCryptEnumProviderTypesA = (void*)GetProcAddress(hadvapi32, "CryptEnumProviderTypesA");
pCryptEnumProvidersA = (void*)GetProcAddress(hadvapi32, "CryptEnumProvidersA");
pCryptGetDefaultProviderA = (void*)GetProcAddress(hadvapi32, "CryptGetDefaultProviderA");
pCryptReleaseContext = (void*)GetProcAddress(hadvapi32, "CryptReleaseContext");
pCryptSetProviderExA = (void*)GetProcAddress(hadvapi32, "CryptSetProviderExA");
pCryptCreateHash = (void*)GetProcAddress(hadvapi32, "CryptCreateHash");
pCryptDestroyHash = (void*)GetProcAddress(hadvapi32, "CryptDestroyHash");
pCryptGenRandom = (void*)GetProcAddress(hadvapi32, "CryptGenRandom");
pCryptContextAddRef = (void*)GetProcAddress(hadvapi32, "CryptContextAddRef");
pCryptGenKey = (void*)GetProcAddress(hadvapi32, "CryptGenKey");
pCryptDestroyKey = (void*)GetProcAddress(hadvapi32, "CryptDestroyKey");
pCryptDecrypt = (void*)GetProcAddress(hadvapi32, "CryptDecrypt");
pCryptDeriveKey = (void*)GetProcAddress(hadvapi32, "CryptDeriveKey");
pCryptDuplicateHash = (void*)GetProcAddress(hadvapi32, "CryptDuplicateHash");
pCryptDuplicateKey = (void*)GetProcAddress(hadvapi32, "CryptDuplicateKey");
pCryptEncrypt = (void*)GetProcAddress(hadvapi32, "CryptEncrypt");
pCryptExportKey = (void*)GetProcAddress(hadvapi32, "CryptExportKey");
pCryptGetHashParam = (void*)GetProcAddress(hadvapi32, "CryptGetHashParam");
pCryptGetKeyParam = (void*)GetProcAddress(hadvapi32, "CryptGetKeyParam");
pCryptGetProvParam = (void*)GetProcAddress(hadvapi32, "CryptGetProvParam");
pCryptGetUserKey = (void*)GetProcAddress(hadvapi32, "CryptGetUserKey");
pCryptHashData = (void*)GetProcAddress(hadvapi32, "CryptHashData");
pCryptHashSessionKey = (void*)GetProcAddress(hadvapi32, "CryptHashSessionKey");
pCryptImportKey = (void*)GetProcAddress(hadvapi32, "CryptImportKey");
pCryptSignHashW = (void*)GetProcAddress(hadvapi32, "CryptSignHashW");
pCryptSetHashParam = (void*)GetProcAddress(hadvapi32, "CryptSetHashParam");
pCryptSetKeyParam = (void*)GetProcAddress(hadvapi32, "CryptSetKeyParam");
pCryptSetProvParam = (void*)GetProcAddress(hadvapi32, "CryptSetProvParam");
pCryptVerifySignatureW = (void*)GetProcAddress(hadvapi32, "CryptVerifySignatureW");
}
pCryptAcquireContextA = (void*)GetProcAddress(hadvapi32, "CryptAcquireContextA");
pCryptEnumProviderTypesA = (void*)GetProcAddress(hadvapi32, "CryptEnumProviderTypesA");
pCryptEnumProvidersA = (void*)GetProcAddress(hadvapi32, "CryptEnumProvidersA");
pCryptGetDefaultProviderA = (void*)GetProcAddress(hadvapi32, "CryptGetDefaultProviderA");
pCryptReleaseContext = (void*)GetProcAddress(hadvapi32, "CryptReleaseContext");
pCryptSetProviderExA = (void*)GetProcAddress(hadvapi32, "CryptSetProviderExA");
pCryptCreateHash = (void*)GetProcAddress(hadvapi32, "CryptCreateHash");
pCryptDestroyHash = (void*)GetProcAddress(hadvapi32, "CryptDestroyHash");
pCryptGenRandom = (void*)GetProcAddress(hadvapi32, "CryptGenRandom");
pCryptContextAddRef = (void*)GetProcAddress(hadvapi32, "CryptContextAddRef");
pCryptGenKey = (void*)GetProcAddress(hadvapi32, "CryptGenKey");
pCryptDestroyKey = (void*)GetProcAddress(hadvapi32, "CryptDestroyKey");
pCryptDecrypt = (void*)GetProcAddress(hadvapi32, "CryptDecrypt");
pCryptDeriveKey = (void*)GetProcAddress(hadvapi32, "CryptDeriveKey");
pCryptDuplicateHash = (void*)GetProcAddress(hadvapi32, "CryptDuplicateHash");
pCryptDuplicateKey = (void*)GetProcAddress(hadvapi32, "CryptDuplicateKey");
pCryptEncrypt = (void*)GetProcAddress(hadvapi32, "CryptEncrypt");
pCryptExportKey = (void*)GetProcAddress(hadvapi32, "CryptExportKey");
pCryptGetHashParam = (void*)GetProcAddress(hadvapi32, "CryptGetHashParam");
pCryptGetKeyParam = (void*)GetProcAddress(hadvapi32, "CryptGetKeyParam");
pCryptGetProvParam = (void*)GetProcAddress(hadvapi32, "CryptGetProvParam");
pCryptGetUserKey = (void*)GetProcAddress(hadvapi32, "CryptGetUserKey");
pCryptHashData = (void*)GetProcAddress(hadvapi32, "CryptHashData");
pCryptHashSessionKey = (void*)GetProcAddress(hadvapi32, "CryptHashSessionKey");
pCryptImportKey = (void*)GetProcAddress(hadvapi32, "CryptImportKey");
pCryptSignHashW = (void*)GetProcAddress(hadvapi32, "CryptSignHashW");
pCryptSetHashParam = (void*)GetProcAddress(hadvapi32, "CryptSetHashParam");
pCryptSetKeyParam = (void*)GetProcAddress(hadvapi32, "CryptSetKeyParam");
pCryptSetProvParam = (void*)GetProcAddress(hadvapi32, "CryptSetProvParam");
pCryptVerifySignatureW = (void*)GetProcAddress(hadvapi32, "CryptVerifySignatureW");
}
static void init_environment(void)

View File

@ -77,7 +77,7 @@ static void test_md5_ctx(void)
{ 0x43, 0x03, 0xdd, 0x8c, 0x60, 0xd9, 0x3a, 0x22,
0x0b, 0x28, 0xd0, 0xb2, 0x65, 0x93, 0xd0, 0x36 };
if (!(module = GetModuleHandleA( "advapi32.dll" ))) return;
module = GetModuleHandleA("advapi32.dll");
pMD5Init = (fnMD5Init)GetProcAddress( module, "MD5Init" );
pMD5Update = (fnMD5Update)GetProcAddress( module, "MD5Update" );

View File

@ -45,16 +45,14 @@ static BOOL init(void)
{
hadvapi32 = GetModuleHandle("advapi32.dll");
if (hadvapi32) {
pLsaClose = (void*)GetProcAddress(hadvapi32, "LsaClose");
pLsaFreeMemory = (void*)GetProcAddress(hadvapi32, "LsaFreeMemory");
pLsaOpenPolicy = (void*)GetProcAddress(hadvapi32, "LsaOpenPolicy");
pLsaQueryInformationPolicy = (void*)GetProcAddress(hadvapi32, "LsaQueryInformationPolicy");
pConvertSidToStringSidA = (void*)GetProcAddress(hadvapi32, "ConvertSidToStringSidA");
pLsaClose = (void*)GetProcAddress(hadvapi32, "LsaClose");
pLsaFreeMemory = (void*)GetProcAddress(hadvapi32, "LsaFreeMemory");
pLsaOpenPolicy = (void*)GetProcAddress(hadvapi32, "LsaOpenPolicy");
pLsaQueryInformationPolicy = (void*)GetProcAddress(hadvapi32, "LsaQueryInformationPolicy");
pConvertSidToStringSidA = (void*)GetProcAddress(hadvapi32, "ConvertSidToStringSidA");
if (pLsaClose && pLsaFreeMemory && pLsaOpenPolicy && pLsaQueryInformationPolicy && pConvertSidToStringSidA)
return TRUE;
}
if (pLsaClose && pLsaFreeMemory && pLsaOpenPolicy && pLsaQueryInformationPolicy && pConvertSidToStringSidA)
return TRUE;
return FALSE;
}

View File

@ -672,15 +672,18 @@ static void test_AccessCheck(void)
DWORD err;
NtDllModule = GetModuleHandle("ntdll.dll");
if (!NtDllModule)
{
trace("not running on NT, skipping test\n");
skip("not running on NT, skipping test\n");
return;
}
pRtlAdjustPrivilege = (fnRtlAdjustPrivilege)
GetProcAddress(NtDllModule, "RtlAdjustPrivilege");
if (!pRtlAdjustPrivilege) return;
if (!pRtlAdjustPrivilege)
{
skip("missing RtlAdjustPrivilege, skipping test\n");
return;
}
Acl = HeapAlloc(GetProcessHeap(), 0, 256);
res = InitializeAcl(Acl, 256, ACL_REVISION);

View File

@ -450,12 +450,6 @@ START_TEST(dpa)
hcomctl32 = GetModuleHandleA("comctl32.dll");
if(!hcomctl32)
{
ok(0, "error=%d\n", GetLastError());
return;
}
if(InitFunctionPtrs(hcomctl32))
test_dpa();
else

View File

@ -288,8 +288,6 @@ static void test_MRUListA(void)
START_TEST(mru)
{
hComctl32 = GetModuleHandleA("comctl32.dll");
if (!hComctl32)
return;
delete_reg_entries();
if (!create_reg_entries())

View File

@ -81,11 +81,7 @@ static BOOL (WINAPI *pCertIsValidCRLForCertificate)(PCCERT_CONTEXT, PCCRL_CONTEX
static void init_function_pointers(void)
{
HMODULE hdll = GetModuleHandleA("crypt32.dll");
if(hdll)
{
pCertIsValidCRLForCertificate = (void*)GetProcAddress(hdll, "CertIsValidCRLForCertificate");
}
pCertIsValidCRLForCertificate = (void*)GetProcAddress(hdll, "CertIsValidCRLForCertificate");
}
static void testCreateCRL(void)

View File

@ -53,11 +53,7 @@ typedef struct _TVERTEX
static void init_function_pointers(void)
{
HMODULE hmod = GetModuleHandleA("ddraw.dll");
if(hmod)
{
pDirectDrawCreateEx = (void*)GetProcAddress(hmod, "DirectDrawCreateEx");
}
pDirectDrawCreateEx = (void*)GetProcAddress(hmod, "DirectDrawCreateEx");
}

View File

@ -30,11 +30,7 @@ static HRESULT (WINAPI *pDirectDrawCreateEx)(LPGUID,LPVOID*,REFIID,LPUNKNOWN);
static void init_function_pointers(void)
{
HMODULE hmod = GetModuleHandleA("ddraw.dll");
if(hmod)
{
pDirectDrawCreateEx = (void*)GetProcAddress(hmod, "DirectDrawCreateEx");
}
pDirectDrawCreateEx = (void*)GetProcAddress(hmod, "DirectDrawCreateEx");
}
static unsigned long getRefcount(IUnknown *iface)

View File

@ -87,16 +87,12 @@ static IsValidLanguageGroupFn pIsValidLanguageGroup;
static void InitFunctionPointers(void)
{
hKernel32 = GetModuleHandleA("kernel32");
if (hKernel32)
{
pEnumSystemLanguageGroupsA = (void*)GetProcAddress(hKernel32, "EnumSystemLanguageGroupsA");
pEnumLanguageGroupLocalesA = (void*)GetProcAddress(hKernel32, "EnumLanguageGroupLocalesA");
pFoldStringA = (void*)GetProcAddress(hKernel32, "FoldStringA");
pFoldStringW = (void*)GetProcAddress(hKernel32, "FoldStringW");
pIsValidLanguageGroup = (void*)GetProcAddress(hKernel32, "IsValidLanguageGroup");
pEnumUILanguagesA = (void*)GetProcAddress(hKernel32, "EnumUILanguagesA");
}
pEnumSystemLanguageGroupsA = (void*)GetProcAddress(hKernel32, "EnumSystemLanguageGroupsA");
pEnumLanguageGroupLocalesA = (void*)GetProcAddress(hKernel32, "EnumLanguageGroupLocalesA");
pFoldStringA = (void*)GetProcAddress(hKernel32, "FoldStringA");
pFoldStringW = (void*)GetProcAddress(hKernel32, "FoldStringW");
pIsValidLanguageGroup = (void*)GetProcAddress(hKernel32, "IsValidLanguageGroup");
pEnumUILanguagesA = (void*)GetProcAddress(hKernel32, "EnumUILanguagesA");
}
#define eq(received, expected, label, type) \

View File

@ -395,7 +395,7 @@ static void test_XcvDataPort_AddPort(void)
*/
if (0)
{
/* create a Port for a normal, writeable file */
/* create a Port for a normal, writable file */
SetLastError(0xdeadbeef);
res = pXcvDataPort(hXcv, cmd_AddPortW, (PBYTE) tempfileW, (lstrlenW(tempfileW) + 1) * sizeof(WCHAR), NULL, 0, NULL);

View File

@ -431,8 +431,6 @@ static void test_msidecomposedesc(void)
HMODULE hmod;
hmod = GetModuleHandle("msi.dll");
if (!hmod)
return;
pMsiDecomposeDescriptorA = (fnMsiDecomposeDescriptorA)
GetProcAddress(hmod, "MsiDecomposeDescriptorA");
if (!pMsiDecomposeDescriptorA)

View File

@ -316,16 +316,22 @@ static void test_ntncdf_async(void)
START_TEST(change)
{
HMODULE hntdll = GetModuleHandle("ntdll");
if (!hntdll)
{
skip("not running on NT, skipping test\n");
return;
}
pNtNotifyChangeDirectoryFile = (fnNtNotifyChangeDirectoryFile)
GetProcAddress(hntdll, "NtNotifyChangeDirectoryFile");
pNtCancelIoFile = (fnNtCancelIoFile)
GetProcAddress(hntdll, "NtCancelIoFile");
if (!pNtNotifyChangeDirectoryFile)
return;
if (!pNtCancelIoFile)
if (!pNtNotifyChangeDirectoryFile || !pNtCancelIoFile)
{
skip("missing functions, skipping test\n");
return;
}
test_ntncdf();
test_ntncdf_async();

View File

@ -130,14 +130,16 @@ static void nt_mailslot_test(void)
START_TEST(file)
{
HMODULE hntdll = GetModuleHandleA("ntdll.dll");
if (hntdll)
if (!hntdll)
{
pRtlFreeUnicodeString = (void *)GetProcAddress(hntdll, "RtlFreeUnicodeString");
pRtlInitUnicodeString = (void *)GetProcAddress(hntdll, "RtlInitUnicodeString");
pNtCreateMailslotFile = (void *)GetProcAddress(hntdll, "NtCreateMailslotFile");
pNtClose = (void *)GetProcAddress(hntdll, "NtClose");
nt_mailslot_test();
skip("not running on NT, skipping test\n");
return;
}
pRtlFreeUnicodeString = (void *)GetProcAddress(hntdll, "RtlFreeUnicodeString");
pRtlInitUnicodeString = (void *)GetProcAddress(hntdll, "RtlInitUnicodeString");
pNtCreateMailslotFile = (void *)GetProcAddress(hntdll, "NtCreateMailslotFile");
pNtClose = (void *)GetProcAddress(hntdll, "NtClose");
nt_mailslot_test();
}

View File

@ -541,29 +541,32 @@ static void test_symboliclink(void)
START_TEST(om)
{
HMODULE hntdll = GetModuleHandleA("ntdll.dll");
if (hntdll)
if (!hntdll)
{
pRtlCreateUnicodeStringFromAsciiz = (void *)GetProcAddress(hntdll, "RtlCreateUnicodeStringFromAsciiz");
pRtlFreeUnicodeString = (void *)GetProcAddress(hntdll, "RtlFreeUnicodeString");
pNtCreateEvent = (void *)GetProcAddress(hntdll, "NtCreateEvent");
pNtCreateMutant = (void *)GetProcAddress(hntdll, "NtCreateMutant");
pNtOpenMutant = (void *)GetProcAddress(hntdll, "NtOpenMutant");
pNtOpenFile = (void *)GetProcAddress(hntdll, "NtOpenFile");
pNtClose = (void *)GetProcAddress(hntdll, "NtClose");
pRtlInitUnicodeString = (void *)GetProcAddress(hntdll, "RtlInitUnicodeString");
pNtCreateNamedPipeFile = (void *)GetProcAddress(hntdll, "NtCreateNamedPipeFile");
pNtOpenDirectoryObject = (void *)GetProcAddress(hntdll, "NtOpenDirectoryObject");
pNtCreateDirectoryObject= (void *)GetProcAddress(hntdll, "NtCreateDirectoryObject");
pNtOpenSymbolicLinkObject = (void *)GetProcAddress(hntdll, "NtOpenSymbolicLinkObject");
pNtCreateSymbolicLinkObject = (void *)GetProcAddress(hntdll, "NtCreateSymbolicLinkObject");
pNtCreateSemaphore = (void *)GetProcAddress(hntdll, "NtCreateSemaphore");
pNtCreateTimer = (void *)GetProcAddress(hntdll, "NtCreateTimer");
pNtCreateSection = (void *)GetProcAddress(hntdll, "NtCreateSection");
test_case_sensitive();
test_namespace_pipe();
test_name_collisions();
test_directory();
test_symboliclink();
skip("not running on NT, skipping test\n");
return;
}
pRtlCreateUnicodeStringFromAsciiz = (void *)GetProcAddress(hntdll, "RtlCreateUnicodeStringFromAsciiz");
pRtlFreeUnicodeString = (void *)GetProcAddress(hntdll, "RtlFreeUnicodeString");
pNtCreateEvent = (void *)GetProcAddress(hntdll, "NtCreateEvent");
pNtCreateMutant = (void *)GetProcAddress(hntdll, "NtCreateMutant");
pNtOpenMutant = (void *)GetProcAddress(hntdll, "NtOpenMutant");
pNtOpenFile = (void *)GetProcAddress(hntdll, "NtOpenFile");
pNtClose = (void *)GetProcAddress(hntdll, "NtClose");
pRtlInitUnicodeString = (void *)GetProcAddress(hntdll, "RtlInitUnicodeString");
pNtCreateNamedPipeFile = (void *)GetProcAddress(hntdll, "NtCreateNamedPipeFile");
pNtOpenDirectoryObject = (void *)GetProcAddress(hntdll, "NtOpenDirectoryObject");
pNtCreateDirectoryObject= (void *)GetProcAddress(hntdll, "NtCreateDirectoryObject");
pNtOpenSymbolicLinkObject = (void *)GetProcAddress(hntdll, "NtOpenSymbolicLinkObject");
pNtCreateSymbolicLinkObject = (void *)GetProcAddress(hntdll, "NtCreateSymbolicLinkObject");
pNtCreateSemaphore = (void *)GetProcAddress(hntdll, "NtCreateSemaphore");
pNtCreateTimer = (void *)GetProcAddress(hntdll, "NtCreateTimer");
pNtCreateSection = (void *)GetProcAddress(hntdll, "NtCreateSection");
test_case_sensitive();
test_namespace_pipe();
test_name_collisions();
test_directory();
test_symboliclink();
}

View File

@ -31,13 +31,9 @@ static HRESULT (WINAPI *pStgCreatePropSetStg)(IStorage *, DWORD, IPropertySetSto
static void init_function_pointers(void)
{
HMODULE hmod = GetModuleHandleA("ole32.dll");
if(hmod)
{
pFmtIdToPropStgName = (void*)GetProcAddress(hmod, "FmtIdToPropStgName");
pPropStgNameToFmtId = (void*)GetProcAddress(hmod, "PropStgNameToFmtId");
pStgCreatePropSetStg = (void*)GetProcAddress(hmod, "StgCreatePropSetStg");
}
pFmtIdToPropStgName = (void*)GetProcAddress(hmod, "FmtIdToPropStgName");
pPropStgNameToFmtId = (void*)GetProcAddress(hmod, "PropStgNameToFmtId");
pStgCreatePropSetStg = (void*)GetProcAddress(hmod, "StgCreatePropSetStg");
}
/* FIXME: this creates an ANSI storage, try to find conditions under which
* Unicode translation fails

View File

@ -40,9 +40,7 @@ static int (WINAPI *pSHCreateDirectoryExA)(HWND, LPCSTR, LPSECURITY_ATTRIBUTES);
static void InitFunctionPointers(void)
{
hshell32 = GetModuleHandleA("shell32.dll");
if(hshell32)
pSHCreateDirectoryExA = (void*)GetProcAddress(hshell32, "SHCreateDirectoryExA");
pSHCreateDirectoryExA = (void*)GetProcAddress(hshell32, "SHCreateDirectoryExA");
}
/* creates a file with the specified name for tests */

View File

@ -55,20 +55,14 @@ static void init_function_pointers(void)
HRESULT hr;
hmod = GetModuleHandleA("shell32.dll");
if(hmod)
{
pSHBindToParent = (void*)GetProcAddress(hmod, "SHBindToParent");
pSHGetSpecialFolderPathW = (void*)GetProcAddress(hmod, "SHGetSpecialFolderPathW");
pILFindLastID = (void *)GetProcAddress(hmod, (LPCSTR)16);
pILFree = (void*)GetProcAddress(hmod, (LPSTR)155);
pILIsEqual = (void*)GetProcAddress(hmod, (LPSTR)21);
}
pSHBindToParent = (void*)GetProcAddress(hmod, "SHBindToParent");
pSHGetSpecialFolderPathW = (void*)GetProcAddress(hmod, "SHGetSpecialFolderPathW");
pILFindLastID = (void *)GetProcAddress(hmod, (LPCSTR)16);
pILFree = (void*)GetProcAddress(hmod, (LPSTR)155);
pILIsEqual = (void*)GetProcAddress(hmod, (LPSTR)21);
hmod = GetModuleHandleA("shlwapi.dll");
if(hmod)
{
pStrRetToBufW = (void*)GetProcAddress(hmod, "StrRetToBufW");
}
pStrRetToBufW = (void*)GetProcAddress(hmod, "StrRetToBufW");
hr = SHGetMalloc(&ppM);
ok(hr == S_OK, "SHGetMalloc failed %08x\n", hr);

View File

@ -381,11 +381,8 @@ START_TEST(shreg)
if (!hkey) return;
hshlwapi = GetModuleHandleA("shlwapi.dll");
if (hshlwapi)
{
pSHCopyKeyA=(SHCopyKeyA_func)GetProcAddress(hshlwapi,"SHCopyKeyA");
pSHRegGetPathA=(SHRegGetPathA_func)GetProcAddress(hshlwapi,"SHRegGetPathA");
}
pSHCopyKeyA=(SHCopyKeyA_func)GetProcAddress(hshlwapi,"SHCopyKeyA");
pSHRegGetPathA=(SHRegGetPathA_func)GetProcAddress(hshlwapi,"SHRegGetPathA");
test_SHGetValue();
test_SHQUeryValueEx();
test_SHGetRegPath();

View File

@ -829,8 +829,6 @@ START_TEST(string)
GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, decimalDelim, 8);
hShlwapi = GetModuleHandleA("shlwapi");
if (!hShlwapi)
return;
test_StrChrA();
test_StrChrW();

View File

@ -218,9 +218,12 @@ static void do_test( HWND hwnd, int seqnr, const KEV td[] )
int kmctr, i;
module = GetModuleHandleA("user32");
if (!module) return;
ptr_SendInput = (void *)GetProcAddress(module, "SendInput");
if (!ptr_SendInput) return;
if (!ptr_SendInput)
{
skip("skipping SendInput tests\n");
return;
}
buf[0]='\0';
TrackSysKey=0; /* see input.c */

View File

@ -33,15 +33,11 @@ static HMONITOR (WINAPI *pMonitorFromWindow)(HWND,DWORD);
static void init_function_pointers(void)
{
hdll = GetModuleHandleA("user32.dll");
if(hdll)
{
pEnumDisplayDevicesA = (void*)GetProcAddress(hdll, "EnumDisplayDevicesA");
pEnumDisplayMonitors = (void*)GetProcAddress(hdll, "EnumDisplayMonitors");
pGetMonitorInfoA = (void*)GetProcAddress(hdll, "GetMonitorInfoA");
pMonitorFromPoint = (void*)GetProcAddress(hdll, "MonitorFromPoint");
pMonitorFromWindow = (void*)GetProcAddress(hdll, "MonitorFromWindow");
}
pEnumDisplayDevicesA = (void*)GetProcAddress(hdll, "EnumDisplayDevicesA");
pEnumDisplayMonitors = (void*)GetProcAddress(hdll, "EnumDisplayMonitors");
pGetMonitorInfoA = (void*)GetProcAddress(hdll, "GetMonitorInfoA");
pMonitorFromPoint = (void*)GetProcAddress(hdll, "MonitorFromPoint");
pMonitorFromWindow = (void*)GetProcAddress(hdll, "MonitorFromWindow");
}
static BOOL CALLBACK monitor_enum_proc(HMONITOR hmon, HDC hdc, LPRECT lprc,

View File

@ -28,9 +28,7 @@ static UINT (WINAPI *pPrivateExtractIconsA)(LPCTSTR, int, int, int, HICON *, UIN
static void init_function_pointers(void)
{
HMODULE hmod = GetModuleHandleA("user32.dll");
if (hmod) {
pPrivateExtractIconsA = (void*)GetProcAddress(hmod, "PrivateExtractIconsA");
}
pPrivateExtractIconsA = (void*)GetProcAddress(hmod, "PrivateExtractIconsA");
}
static void test_LoadStringA (void)