CRYPT32/tests: make it loadable on win98
Saulius Krasuckas
saulius2 at ar.fi.lt
Mon Nov 7 18:38:27 CST 2005
Log message:
Saulius Krasuckas <saulius.krasuckas at ieee.org>
Make Crypt32 tests loadable on Win98.
Index: dlls/crypt32/tests/cert.c
===================================================================
RCS file: /home/wine/wine/dlls/crypt32/tests/cert.c,v
retrieving revision 1.11
diff -p -u -r1.11 cert.c
--- dlls/crypt32/tests/cert.c 31 Oct 2005 10:04:06 -0000 1.11
+++ dlls/crypt32/tests/cert.c 7 Nov 2005 23:40:15 -0000
@@ -18,6 +18,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include <assert.h>
#include <stdio.h>
#include <stdarg.h>
#include <windef.h>
@@ -40,6 +41,26 @@ struct CertPropIDHeader
DWORD cb;
};
+static BOOL (WINAPI * pCryptVerifyCertificateSignatureEx)
+ (HCRYPTPROV, DWORD, DWORD, void *, DWORD, void *, DWORD, void *);
+
+#define CRYPT_GET_PROC(func) \
+ p ## func = (void *)GetProcAddress(hCrypt32, #func); \
+ if(!p ## func) \
+ trace("GetProcAddress(hCrypt32, \"%s\") failed\n", #func); \
+
+static void init_function_pointers(void)
+{
+ HMODULE hCrypt32;
+
+ pCryptVerifyCertificateSignatureEx = NULL;
+
+ hCrypt32 = GetModuleHandleA("crypt32.dll");
+ assert(hCrypt32);
+
+ CRYPT_GET_PROC(CryptVerifyCertificateSignatureEx);
+}
+
static void testCryptHashCert(void)
{
static const BYTE emptyHash[] = { 0xda, 0x39, 0xa3, 0xee, 0x5e, 0x6b, 0x4b,
@@ -1448,21 +1469,21 @@ static void testVerifyCertSig(HCRYPTPROV
DWORD size = 0;
BOOL ret;
- ret = CryptVerifyCertificateSignatureEx(0, 0, 0, NULL, 0, NULL, 0, NULL);
+ ret = pCryptVerifyCertificateSignatureEx(0, 0, 0, NULL, 0, NULL, 0, NULL);
ok(!ret && GetLastError() == HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER),
"Expected HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), got %08lx\n",
GetLastError());
- ret = CryptVerifyCertificateSignatureEx(csp, 0, 0, NULL, 0, NULL, 0, NULL);
+ ret = pCryptVerifyCertificateSignatureEx(csp, 0, 0, NULL, 0, NULL, 0, NULL);
ok(!ret && GetLastError() == HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER),
"Expected HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), got %08lx\n",
GetLastError());
- ret = CryptVerifyCertificateSignatureEx(csp, X509_ASN_ENCODING, 0, NULL, 0,
+ ret = pCryptVerifyCertificateSignatureEx(csp, X509_ASN_ENCODING, 0, NULL, 0,
NULL, 0, NULL);
ok(!ret && GetLastError() == HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER),
"Expected HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), got %08lx\n",
GetLastError());
/* This crashes
- ret = CryptVerifyCertificateSignatureEx(csp, X509_ASN_ENCODING,
+ ret = pCryptVerifyCertificateSignatureEx(csp, X509_ASN_ENCODING,
CRYPT_VERIFY_CERT_SIGN_SUBJECT_BLOB, NULL, 0, NULL, 0, NULL);
*/
info.ToBeSigned.cbData = toBeSigned->cbData;
@@ -1480,25 +1501,25 @@ static void testVerifyCertSig(HCRYPTPROV
CRYPT_DATA_BLOB certBlob = { 0, NULL };
PCERT_PUBLIC_KEY_INFO pubKeyInfo = NULL;
- ret = CryptVerifyCertificateSignatureEx(csp, X509_ASN_ENCODING,
+ ret = pCryptVerifyCertificateSignatureEx(csp, X509_ASN_ENCODING,
CRYPT_VERIFY_CERT_SIGN_SUBJECT_BLOB, &certBlob, 0, NULL, 0, NULL);
ok(!ret && GetLastError() == CRYPT_E_ASN1_EOD,
"Expected CRYPT_E_ASN1_EOD, got %08lx\n", GetLastError());
certBlob.cbData = 1;
certBlob.pbData = (void *)0xdeadbeef;
- ret = CryptVerifyCertificateSignatureEx(csp, X509_ASN_ENCODING,
+ ret = pCryptVerifyCertificateSignatureEx(csp, X509_ASN_ENCODING,
CRYPT_VERIFY_CERT_SIGN_SUBJECT_BLOB, &certBlob, 0, NULL, 0, NULL);
ok(!ret && GetLastError() == STATUS_ACCESS_VIOLATION,
"Expected STATUS_ACCESS_VIOLATION, got %08lx\n", GetLastError());
certBlob.cbData = size;
certBlob.pbData = cert;
- ret = CryptVerifyCertificateSignatureEx(csp, X509_ASN_ENCODING,
+ ret = pCryptVerifyCertificateSignatureEx(csp, X509_ASN_ENCODING,
CRYPT_VERIFY_CERT_SIGN_SUBJECT_BLOB, &certBlob, 0, NULL, 0, NULL);
ok(!ret && GetLastError() ==
HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER),
"Expected HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), got %08lx\n",
GetLastError());
- ret = CryptVerifyCertificateSignatureEx(csp, X509_ASN_ENCODING,
+ ret = pCryptVerifyCertificateSignatureEx(csp, X509_ASN_ENCODING,
CRYPT_VERIFY_CERT_SIGN_SUBJECT_BLOB, &certBlob,
CRYPT_VERIFY_CERT_SIGN_ISSUER_NULL, NULL, 0, NULL);
ok(!ret && GetLastError() ==
@@ -1506,7 +1527,7 @@ static void testVerifyCertSig(HCRYPTPROV
"Expected HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), got %08lx\n",
GetLastError());
/* This crashes
- ret = CryptVerifyCertificateSignatureEx(csp, X509_ASN_ENCODING,
+ ret = pCryptVerifyCertificateSignatureEx(csp, X509_ASN_ENCODING,
CRYPT_VERIFY_CERT_SIGN_SUBJECT_BLOB, &certBlob,
CRYPT_VERIFY_CERT_SIGN_ISSUER_PUBKEY, NULL, 0, NULL);
*/
@@ -1520,7 +1541,7 @@ static void testVerifyCertSig(HCRYPTPROV
ok(ret, "CryptExportKey failed: %08lx\n", GetLastError());
if (ret)
{
- ret = CryptVerifyCertificateSignatureEx(csp, X509_ASN_ENCODING,
+ ret = pCryptVerifyCertificateSignatureEx(csp, X509_ASN_ENCODING,
CRYPT_VERIFY_CERT_SIGN_SUBJECT_BLOB, &certBlob,
CRYPT_VERIFY_CERT_SIGN_ISSUER_PUBKEY, pubKeyInfo, 0, NULL);
ok(ret, "CryptVerifyCertificateSignatureEx failed: %08lx\n",
@@ -1559,6 +1580,8 @@ static void testCertSigs(void)
START_TEST(cert)
{
+ init_function_pointers();
+
testCryptHashCert();
/* various combinations of CertOpenStore */
More information about the wine-patches
mailing list