setupapi/tests: Use GetModuleHandleA instead of LoadLibraryA.
This commit is contained in:
parent
b90c6e2792
commit
c0cc85f78e
|
@ -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();
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue