Commit 533b15d6 authored by Paul Vriens's avatar Paul Vriens Committed by Alexandre Julliard

wintrust/tests: Use GetModuleHandleA instead of LoadLibraryA.

parent dc267e75
...@@ -30,33 +30,25 @@ static char selfname[MAX_PATH]; ...@@ -30,33 +30,25 @@ static char selfname[MAX_PATH];
static CHAR CURR_DIR[MAX_PATH]; static CHAR CURR_DIR[MAX_PATH];
static HMODULE hWintrust = 0;
static BOOL (WINAPI * pCryptCATAdminAcquireContext)(HCATADMIN*, const GUID*, DWORD); static BOOL (WINAPI * pCryptCATAdminAcquireContext)(HCATADMIN*, const GUID*, DWORD);
static BOOL (WINAPI * pCryptCATAdminReleaseContext)(HCATADMIN, DWORD); static BOOL (WINAPI * pCryptCATAdminReleaseContext)(HCATADMIN, DWORD);
static BOOL (WINAPI * pCryptCATAdminCalcHashFromFileHandle)(HANDLE hFile, DWORD*, BYTE*, DWORD); static BOOL (WINAPI * pCryptCATAdminCalcHashFromFileHandle)(HANDLE hFile, DWORD*, BYTE*, DWORD);
static void InitFunctionPtrs(void)
{
HMODULE hWintrust = GetModuleHandleA("wintrust.dll");
#define WINTRUST_GET_PROC(func) \ #define WINTRUST_GET_PROC(func) \
p ## func = (void*)GetProcAddress(hWintrust, #func); \ p ## func = (void*)GetProcAddress(hWintrust, #func); \
if(!p ## func) { \ if(!p ## func) { \
trace("GetProcAddress(%s) failed\n", #func); \ trace("GetProcAddress(%s) failed\n", #func); \
} }
static BOOL InitFunctionPtrs(void)
{
hWintrust = LoadLibraryA("wintrust.dll");
if(!hWintrust)
{
skip("Could not load wintrust.dll\n");
return FALSE;
}
WINTRUST_GET_PROC(CryptCATAdminAcquireContext) WINTRUST_GET_PROC(CryptCATAdminAcquireContext)
WINTRUST_GET_PROC(CryptCATAdminReleaseContext) WINTRUST_GET_PROC(CryptCATAdminReleaseContext)
WINTRUST_GET_PROC(CryptCATAdminCalcHashFromFileHandle) WINTRUST_GET_PROC(CryptCATAdminCalcHashFromFileHandle)
return TRUE; #undef WINTRUST_GET_PROC
} }
static void test_context(void) static void test_context(void)
...@@ -290,8 +282,7 @@ START_TEST(crypt) ...@@ -290,8 +282,7 @@ START_TEST(crypt)
int myARGC; int myARGC;
char** myARGV; char** myARGV;
if(!InitFunctionPtrs()) InitFunctionPtrs();
return;
myARGC = winetest_get_mainargs(&myARGV); myARGC = winetest_get_mainargs(&myARGV);
strcpy(selfname, myARGV[0]); strcpy(selfname, myARGV[0]);
...@@ -300,6 +291,4 @@ START_TEST(crypt) ...@@ -300,6 +291,4 @@ START_TEST(crypt)
test_context(); test_context();
test_calchash(); test_calchash();
FreeLibrary(hWintrust);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment