setupapi/tests: Use GetModuleHandleA instead of LoadLibraryA.

oldstable
Paul Vriens 2007-07-31 09:30:55 +02:00 committed by Alexandre Julliard
parent b90c6e2792
commit c0cc85f78e
4 changed files with 14 additions and 28 deletions

View File

@ -39,14 +39,11 @@ static HKEY (WINAPI *pSetupDiOpenClassRegKeyExA)(GUID*,REGSAM,DWORD,PCSTR,PV
static void init_function_pointers(void)
{
hSetupAPI = LoadLibraryA("setupapi.dll");
hSetupAPI = GetModuleHandleA("setupapi.dll");
if (hSetupAPI)
{
pSetupDiCreateDeviceInfoListExW = (void *)GetProcAddress(hSetupAPI, "SetupDiCreateDeviceInfoListExW");
pSetupDiDestroyDeviceInfoList = (void *)GetProcAddress(hSetupAPI, "SetupDiDestroyDeviceInfoList");
pSetupDiOpenClassRegKeyExA = (void *)GetProcAddress(hSetupAPI, "SetupDiOpenClassRegKeyExA");
}
pSetupDiCreateDeviceInfoListExW = (void *)GetProcAddress(hSetupAPI, "SetupDiCreateDeviceInfoListExW");
pSetupDiDestroyDeviceInfoList = (void *)GetProcAddress(hSetupAPI, "SetupDiDestroyDeviceInfoList");
pSetupDiOpenClassRegKeyExA = (void *)GetProcAddress(hSetupAPI, "SetupDiOpenClassRegKeyExA");
}
static void test_SetupDiCreateDeviceInfoListEx(void)
@ -129,8 +126,6 @@ static void test_SetupDiOpenClassRegKeyExA(void)
START_TEST(devinst)
{
init_function_pointers();
if (!hSetupAPI)
return;
if (pSetupDiCreateDeviceInfoListExW && pSetupDiDestroyDeviceInfoList)
test_SetupDiCreateDeviceInfoListEx();

View File

@ -36,9 +36,7 @@ static LPCWSTR (WINAPI *pSetupGetField)(PINFCONTEXT,DWORD);
static void init_function_pointers(void)
{
hSetupAPI = LoadLibraryA("setupapi.dll");
if (!hSetupAPI)
return;
hSetupAPI = GetModuleHandleA("setupapi.dll");
pSetupGetField = (void *)GetProcAddress(hSetupAPI, "pSetupGetField");
}

View File

@ -38,18 +38,15 @@ CHAR WIN_DIR[MAX_PATH];
static void init_function_pointers(void)
{
hSetupAPI = LoadLibraryA("setupapi.dll");
hSetupAPI = GetModuleHandleA("setupapi.dll");
if (hSetupAPI)
{
pSetupCloseInfFile = (void *)GetProcAddress(hSetupAPI, "SetupCloseInfFile");
pSetupGetInfInformationA = (void *)GetProcAddress(hSetupAPI, "SetupGetInfInformationA");
pSetupOpenInfFileA = (void *)GetProcAddress(hSetupAPI, "SetupOpenInfFileA");
pSetupQueryInfFileInformationA = (void *)GetProcAddress(hSetupAPI, "SetupQueryInfFileInformationA");
pSetupGetSourceFileLocationA = (void *)GetProcAddress(hSetupAPI, "SetupGetSourceFileLocationA");
pSetupGetSourceInfoA = (void *)GetProcAddress(hSetupAPI, "SetupGetSourceInfoA");
pSetupGetTargetPathA = (void *)GetProcAddress(hSetupAPI, "SetupGetTargetPathA");
}
pSetupCloseInfFile = (void *)GetProcAddress(hSetupAPI, "SetupCloseInfFile");
pSetupGetInfInformationA = (void *)GetProcAddress(hSetupAPI, "SetupGetInfInformationA");
pSetupOpenInfFileA = (void *)GetProcAddress(hSetupAPI, "SetupOpenInfFileA");
pSetupQueryInfFileInformationA = (void *)GetProcAddress(hSetupAPI, "SetupQueryInfFileInformationA");
pSetupGetSourceFileLocationA = (void *)GetProcAddress(hSetupAPI, "SetupGetSourceFileLocationA");
pSetupGetSourceInfoA = (void *)GetProcAddress(hSetupAPI, "SetupGetSourceInfoA");
pSetupGetTargetPathA = (void *)GetProcAddress(hSetupAPI, "SetupGetTargetPathA");
}
static void get_directories(void)

View File

@ -59,9 +59,7 @@ HANDLE table, table2; /* Handles pointing to our tables */
static void load_it_up(void)
{
hdll = LoadLibraryA("setupapi.dll");
if (!hdll)
return;
hdll = GetModuleHandleA("setupapi.dll");
pStringTableInitialize = (void*)GetProcAddress(hdll, "StringTableInitialize");
if (!pStringTableInitialize)
@ -192,6 +190,4 @@ START_TEST(stringtable)
/* assume we can always distroy */
pStringTableDestroy(table);
pStringTableDestroy(table2);
FreeLibrary(hdll);
}