Paul Vriens : crypt32/tests: Use GetModuleHandle and skip.
Alexandre Julliard
julliard at wine.codeweavers.com
Wed Aug 15 04:34:11 CDT 2007
Module: wine
Branch: master
Commit: 16d9123377ece03b1b854d9c2b829541193033db
URL: http://source.winehq.org/git/wine.git/?a=commit;h=16d9123377ece03b1b854d9c2b829541193033db
Author: Paul Vriens <paul.vriens.wine at gmail.com>
Date: Tue Aug 14 20:38:51 2007 +0200
crypt32/tests: Use GetModuleHandle and skip.
---
dlls/crypt32/tests/main.c | 11 ++---------
dlls/crypt32/tests/sip.c | 17 ++++++-----------
dlls/crypt32/tests/str.c | 34 ++++++++++++++++++++++++++--------
3 files changed, 34 insertions(+), 28 deletions(-)
diff --git a/dlls/crypt32/tests/main.c b/dlls/crypt32/tests/main.c
index e55d2d3..43c07bf 100644
--- a/dlls/crypt32/tests/main.c
+++ b/dlls/crypt32/tests/main.c
@@ -225,8 +225,6 @@ static void test_cryptTls(void)
DWORD index;
BOOL ret;
- if (!hCrypt) return;
-
pI_CryptAllocTls = (I_CryptAllocTlsFunc)GetProcAddress(hCrypt,
"I_CryptAllocTls");
pI_CryptDetachTls = (I_CryptDetachTlsFunc)GetProcAddress(hCrypt,
@@ -290,8 +288,6 @@ static void test_readTrustedPublisherDWORD(void)
{
I_CryptReadTrustedPublisherDWORDValueFromRegistryFunc pReadDWORD;
- if (!hCrypt) return;
-
pReadDWORD =
(I_CryptReadTrustedPublisherDWORDValueFromRegistryFunc)GetProcAddress(
hCrypt, "I_CryptReadTrustedPublisherDWORDValueFromRegistry");
@@ -335,8 +331,6 @@ static void test_getDefaultCryptProv(void)
I_CryptGetDefaultCryptProvFunc pI_CryptGetDefaultCryptProv;
HCRYPTPROV prov;
- if (!hCrypt) return;
-
pI_CryptGetDefaultCryptProv = (I_CryptGetDefaultCryptProvFunc)
GetProcAddress(hCrypt, "I_CryptGetDefaultCryptProv");
if (!pI_CryptGetDefaultCryptProv) return;
@@ -362,8 +356,6 @@ static void test_CryptInstallOssGlobal(void)
int ret,i;
I_CryptInstallOssGlobal pI_CryptInstallOssGlobal;
- if (!hCrypt) return;
-
pI_CryptInstallOssGlobal= (I_CryptInstallOssGlobal)GetProcAddress(hCrypt,"I_CryptInstallOssGlobal");
/* passing in some random values to I_CryptInstallOssGlobal, it always returns 9 the first time, then 10, 11 etc.*/
for(i=0;i<30;i++)
@@ -375,7 +367,8 @@ static void test_CryptInstallOssGlobal(void)
START_TEST(main)
{
- hCrypt = LoadLibraryA("crypt32.dll");
+ hCrypt = GetModuleHandleA("crypt32.dll");
+
test_findAttribute();
test_findExtension();
test_findRDNAttr();
diff --git a/dlls/crypt32/tests/sip.c b/dlls/crypt32/tests/sip.c
index 5e33655..d47b6fc 100644
--- a/dlls/crypt32/tests/sip.c
+++ b/dlls/crypt32/tests/sip.c
@@ -295,17 +295,12 @@ static void test_SIPLoad(void)
"Expected TRUST_E_SUBJECT_FORM_UNKNOWN, got 0x%08x\n", GetLastError());
ok( sdi.pfGet == (pCryptSIPGetSignedDataMsg)0xdeadbeef, "Expected no change to the function pointer\n");
- hCrypt = LoadLibraryA("crypt32.dll");
- if (hCrypt)
- {
- funcCryptSIPGetSignedDataMsg = (void*)GetProcAddress(hCrypt, "CryptSIPGetSignedDataMsg");
- funcCryptSIPPutSignedDataMsg = (void*)GetProcAddress(hCrypt, "CryptSIPPutSignedDataMsg");
- funcCryptSIPCreateIndirectData = (void*)GetProcAddress(hCrypt, "CryptSIPCreateIndirectData");
- funcCryptSIPVerifyIndirectData = (void*)GetProcAddress(hCrypt, "CryptSIPVerifyIndirectData");
- funcCryptSIPRemoveSignedDataMsg = (void*)GetProcAddress(hCrypt, "CryptSIPRemoveSignedDataMsg");
- }
- /* We're not going to use the functions, so we can free already here */
- FreeLibrary(hCrypt);
+ hCrypt = GetModuleHandleA("crypt32.dll");
+ funcCryptSIPGetSignedDataMsg = (void*)GetProcAddress(hCrypt, "CryptSIPGetSignedDataMsg");
+ funcCryptSIPPutSignedDataMsg = (void*)GetProcAddress(hCrypt, "CryptSIPPutSignedDataMsg");
+ funcCryptSIPCreateIndirectData = (void*)GetProcAddress(hCrypt, "CryptSIPCreateIndirectData");
+ funcCryptSIPVerifyIndirectData = (void*)GetProcAddress(hCrypt, "CryptSIPVerifyIndirectData");
+ funcCryptSIPRemoveSignedDataMsg = (void*)GetProcAddress(hCrypt, "CryptSIPRemoveSignedDataMsg");
/* All OK */
SetLastError(0xdeadbeef);
diff --git a/dlls/crypt32/tests/str.c b/dlls/crypt32/tests/str.c
index c166e0e..e4cdb77 100644
--- a/dlls/crypt32/tests/str.c
+++ b/dlls/crypt32/tests/str.c
@@ -271,7 +271,11 @@ static void test_CertRDNValueToStrW(void)
WCHAR buffer[2000];
CERT_RDN_VALUE_BLOB blob = { 0, NULL };
- if (!pCertRDNValueToStrW) return;
+ if (!pCertRDNValueToStrW)
+ {
+ skip("CertRDNValueToStrW is not available\n");
+ return;
+ }
/* This crashes
ret = pCertRDNValueToStrW(0, NULL, NULL, 0);
@@ -319,7 +323,11 @@ static void test_CertNameToStrA(void)
{
PCCERT_CONTEXT context;
- if (!pCertNameToStrA) return;
+ if (!pCertNameToStrA)
+ {
+ skip("CertNameToStrA is not available\n");
+ return;
+ }
context = CertCreateCertificateContext(X509_ASN_ENCODING, cert,
sizeof(cert));
@@ -392,7 +400,11 @@ static void test_CertNameToStrW(void)
{
PCCERT_CONTEXT context;
- if (!pCertNameToStrW) return;
+ if (!pCertNameToStrW)
+ {
+ skip("CertNameToStrW is not available\n");
+ return;
+ }
context = CertCreateCertificateContext(X509_ASN_ENCODING, cert,
sizeof(cert));
@@ -473,7 +485,11 @@ static void test_CertStrToNameA(void)
DWORD size, i;
BYTE buf[100];
- if (!pCertStrToNameA) return;
+ if (!pCertStrToNameA)
+ {
+ skip("CertStrToNameA is not available\n");
+ return;
+ }
/* Crash
ret = pCertStrToNameA(0, NULL, 0, NULL, NULL, NULL, NULL);
@@ -554,7 +570,11 @@ static void test_CertStrToNameW(void)
LPCWSTR errorPtr;
BYTE buf[100];
- if (!pCertStrToNameW) return;
+ if (!pCertStrToNameW)
+ {
+ skip("CertStrToNameW is not available\n");
+ return;
+ }
/* Crash
ret = pCertStrToNameW(0, NULL, 0, NULL, NULL, NULL, NULL);
@@ -600,7 +620,7 @@ static void test_CertStrToNameW(void)
START_TEST(str)
{
- dll = LoadLibrary("Crypt32.dll");
+ dll = GetModuleHandleA("Crypt32.dll");
pCertNameToStrA = (CertNameToStrAFunc)GetProcAddress(dll,"CertNameToStrA");
pCertNameToStrW = (CertNameToStrWFunc)GetProcAddress(dll,"CertNameToStrW");
@@ -619,6 +639,4 @@ START_TEST(str)
test_CertNameToStrW();
test_CertStrToNameA();
test_CertStrToNameW();
-
- FreeLibrary(dll);
}
More information about the wine-cvs
mailing list