[PATCH] Use GetModuleHandleA instead of LoadLibraryA
Paul Vriens
Paul.Vriens.Wine at gmail.com
Wed Feb 6 05:04:30 CST 2008
---
dlls/wintrust/tests/crypt.c | 23 ++++++-----------------
1 files changed, 6 insertions(+), 17 deletions(-)
diff --git a/dlls/wintrust/tests/crypt.c b/dlls/wintrust/tests/crypt.c
index 600299a..887d57a 100644
--- a/dlls/wintrust/tests/crypt.c
+++ b/dlls/wintrust/tests/crypt.c
@@ -30,33 +30,25 @@ static char selfname[MAX_PATH];
static CHAR CURR_DIR[MAX_PATH];
-static HMODULE hWintrust = 0;
-
static BOOL (WINAPI * pCryptCATAdminAcquireContext)(HCATADMIN*, const GUID*, DWORD);
static BOOL (WINAPI * pCryptCATAdminReleaseContext)(HCATADMIN, DWORD);
static BOOL (WINAPI * pCryptCATAdminCalcHashFromFileHandle)(HANDLE hFile, DWORD*, BYTE*, DWORD);
+static void InitFunctionPtrs(void)
+{
+ HMODULE hWintrust = GetModuleHandleA("wintrust.dll");
+
#define WINTRUST_GET_PROC(func) \
p ## func = (void*)GetProcAddress(hWintrust, #func); \
if(!p ## 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(CryptCATAdminReleaseContext)
WINTRUST_GET_PROC(CryptCATAdminCalcHashFromFileHandle)
- return TRUE;
+#undef WINTRUST_GET_PROC
}
static void test_context(void)
@@ -290,8 +282,7 @@ START_TEST(crypt)
int myARGC;
char** myARGV;
- if(!InitFunctionPtrs())
- return;
+ InitFunctionPtrs();
myARGC = winetest_get_mainargs(&myARGV);
strcpy(selfname, myARGV[0]);
@@ -300,6 +291,4 @@ START_TEST(crypt)
test_context();
test_calchash();
-
- FreeLibrary(hWintrust);
}
--
1.5.3.8
--------------010906020306020109050101--
More information about the wine-patches
mailing list