From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/crypt32/tests/base64.c | 59 ++++++++++++----------- dlls/crypt32/tests/cert.c | 92 ++++++++++++++++++------------------ dlls/crypt32/tests/encode.c | 41 ++++++++-------- dlls/crypt32/tests/message.c | 16 +++---- dlls/crypt32/tests/msg.c | 4 +- dlls/crypt32/tests/oid.c | 4 +- dlls/crypt32/tests/store.c | 32 ++++++------- 7 files changed, 123 insertions(+), 125 deletions(-)
diff --git a/dlls/crypt32/tests/base64.c b/dlls/crypt32/tests/base64.c index a1517b294ad..0839543f0f0 100644 --- a/dlls/crypt32/tests/base64.c +++ b/dlls/crypt32/tests/base64.c @@ -23,7 +23,6 @@ #include <windows.h> #include <wincrypt.h>
-#include "wine/heap.h" #include "wine/test.h"
#define CERT_HEADER "-----BEGIN CERTIFICATE-----\r\n" @@ -93,7 +92,7 @@ static WCHAR *strdupAtoW(const char *str)
if (!str) return ret; len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0); - ret = heap_alloc(len * sizeof(WCHAR)); + ret = malloc(len * sizeof(WCHAR)); if (ret) MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len); return ret; @@ -128,7 +127,7 @@ static void encodeAndCompareBase64_A(const BYTE *toEncode, DWORD toEncodeLen, ok(ret, "CryptBinaryToStringA failed: %ld\n", GetLastError()); ok(strLen == strLen2, "Unexpected required length %lu, expected %lu.\n", strLen2, strLen);
- str = heap_alloc(strLen); + str = malloc(strLen);
/* Partially filled output buffer. */ strLen2 = strLen - 1; @@ -157,7 +156,7 @@ static void encodeAndCompareBase64_A(const BYTE *toEncode, DWORD toEncodeLen, if (trailer) ok(!strncmp(trailer, ptr, strlen(trailer)), "Expected trailer %s, got %s\n", trailer, ptr);
- heap_free(str); + free(str); }
static void encode_compare_base64_W(const BYTE *toEncode, DWORD toEncodeLen, DWORD format, @@ -196,7 +195,7 @@ static void encode_compare_base64_W(const BYTE *toEncode, DWORD toEncodeLen, DWO ok(ret, "CryptBinaryToStringW failed: %ld\n", GetLastError()); ok(strLen == strLen2, "Unexpected required length.\n");
- strW = heap_alloc(strLen * sizeof(WCHAR)); + strW = malloc(strLen * sizeof(WCHAR));
headerW = strdupAtoW(header); trailerW = strdupAtoW(trailer); @@ -231,9 +230,9 @@ static void encode_compare_base64_W(const BYTE *toEncode, DWORD toEncodeLen, DWO ok(!memcmp(trailerW, ptr, lstrlenW(trailerW)), "Expected trailer %s, got %s.\n", wine_dbgstr_w(trailerW), wine_dbgstr_w(ptr));
- heap_free(strW); - heap_free(headerW); - heap_free(trailerW); + free(strW); + free(headerW); + free(trailerW); }
static DWORD binary_to_hex_len(DWORD binary_len, DWORD flags) @@ -299,12 +298,12 @@ static void test_CryptBinaryToString(void) ok(strLen == tests[i].toEncodeLen, "Unexpected required length %lu.\n", strLen);
strLen2 = strLen; - str = heap_alloc(strLen); + str = malloc(strLen); ret = CryptBinaryToStringA(tests[i].toEncode, tests[i].toEncodeLen, CRYPT_STRING_BINARY, str, &strLen2); ok(ret, "CryptBinaryToStringA failed: %ld\n", GetLastError()); ok(strLen == strLen2, "Expected length %lu, got %lu\n", strLen, strLen2); ok(!memcmp(str, tests[i].toEncode, tests[i].toEncodeLen), "Unexpected value\n"); - heap_free(str); + free(str);
strLen = 0; ret = CryptBinaryToStringW(tests[i].toEncode, tests[i].toEncodeLen, CRYPT_STRING_BINARY, NULL, &strLen); @@ -312,12 +311,12 @@ static void test_CryptBinaryToString(void) ok(strLen == tests[i].toEncodeLen, "Unexpected required length %lu.\n", strLen);
strLen2 = strLen; - strW = heap_alloc(strLen); + strW = malloc(strLen); ret = CryptBinaryToStringW(tests[i].toEncode, tests[i].toEncodeLen, CRYPT_STRING_BINARY, strW, &strLen2); ok(ret, "CryptBinaryToStringW failed: %ld\n", GetLastError()); ok(strLen == strLen2, "Expected length %lu, got %lu\n", strLen, strLen2); ok(!memcmp(strW, tests[i].toEncode, tests[i].toEncodeLen), "Unexpected value\n"); - heap_free(strW); + free(strW);
encodeAndCompareBase64_A(tests[i].toEncode, tests[i].toEncodeLen, CRYPT_STRING_BASE64, tests[i].base64, NULL, NULL); @@ -338,7 +337,7 @@ static void test_CryptBinaryToString(void) encode_compare_base64_W(tests[i].toEncode, tests[i].toEncodeLen, CRYPT_STRING_BASE64X509CRLHEADER, encodedW, X509_HEADER, X509_TRAILER);
- heap_free(encodedW); + free(encodedW); }
for (i = 0; i < ARRAY_SIZE(testsNoCR); i++) @@ -352,13 +351,13 @@ static void test_CryptBinaryToString(void) ok(ret, "CryptBinaryToStringA failed: %ld\n", GetLastError());
strLen2 = strLen; - str = heap_alloc(strLen); + str = malloc(strLen); ret = CryptBinaryToStringA(testsNoCR[i].toEncode, testsNoCR[i].toEncodeLen, CRYPT_STRING_BINARY | CRYPT_STRING_NOCR, str, &strLen2); ok(ret, "CryptBinaryToStringA failed: %ld\n", GetLastError()); ok(strLen == strLen2, "Expected length %ld, got %ld\n", strLen, strLen2); ok(!memcmp(str, testsNoCR[i].toEncode, testsNoCR[i].toEncodeLen), "Unexpected value\n"); - heap_free(str); + free(str);
encodeAndCompareBase64_A(testsNoCR[i].toEncode, testsNoCR[i].toEncodeLen, CRYPT_STRING_BASE64 | CRYPT_STRING_NOCR, testsNoCR[i].base64, NULL, NULL); @@ -383,7 +382,7 @@ static void test_CryptBinaryToString(void) CRYPT_STRING_BASE64X509CRLHEADER | CRYPT_STRING_NOCR, encodedW, X509_HEADER_NOCR, X509_TRAILER_NOCR);
- heap_free(encodedW); + free(encodedW); }
/* Systems that don't support HEXRAW format convert to BASE64 instead - 3 bytes in -> 4 chars + crlf + 1 null out. */ @@ -420,9 +419,9 @@ static void test_CryptBinaryToString(void) strLen2 += sizeof(input) * 2 + 1; ok(strLen == strLen2, "Expected length %ld, got %ld\n", strLen2, strLen);
- hex = heap_alloc(strLen * sizeof(WCHAR)); + hex = malloc(strLen * sizeof(WCHAR)); memset(hex, 0xcc, strLen * sizeof(WCHAR)); - ptr = cmp = heap_alloc(strLen * sizeof(WCHAR)); + ptr = cmp = malloc(strLen * sizeof(WCHAR)); for (j = 0; j < ARRAY_SIZE(input); j++) { *ptr++ = hexdig[(input[j] >> 4) & 0xf]; @@ -465,8 +464,8 @@ static void test_CryptBinaryToString(void) ok(strLen == strLen2, "Expected length %ld, got %ld\n", strLen, strLen2); ok(!memcmp(hex, cmp, strLen * sizeof(WCHAR)), "Unexpected value\n");
- heap_free(hex); - heap_free(cmp); + free(hex); + free(cmp); }
for (k = 0; k < ARRAY_SIZE(sizes); k++) @@ -483,10 +482,10 @@ static void test_CryptBinaryToString(void) strLen2 = binary_to_hex_len(sizes[k], CRYPT_STRING_HEX | flags[i]); ok(strLen == strLen2, "%lu: Expected length %ld, got %ld\n", i, strLen2, strLen);
- hex = heap_alloc(strLen * sizeof(WCHAR) + 256); + hex = malloc(strLen * sizeof(WCHAR) + 256); memset(hex, 0xcc, strLen * sizeof(WCHAR));
- ptr = cmp = heap_alloc(strLen * sizeof(WCHAR) + 256); + ptr = cmp = malloc(strLen * sizeof(WCHAR) + 256); for (j = 0; j < sizes[k]; j++) { *ptr++ = hexdig[(input[j] >> 4) & 0xf]; @@ -552,8 +551,8 @@ static void test_CryptBinaryToString(void) ok(strLen == strLen2, "%lu: Expected length %ld, got %ld\n", i, strLen, strLen2); ok(!memcmp(hex, cmp, strLen * sizeof(WCHAR)), "%lu: got %s\n", i, wine_dbgstr_wn(hex, strLen));
- heap_free(hex); - heap_free(cmp); + free(hex); + free(cmp); } }
@@ -569,7 +568,7 @@ static void decodeAndCompareBase64_A(LPCSTR toDecode, LPCSTR header, len += strlen(header); if (trailer) len += strlen(trailer); - str = HeapAlloc(GetProcessHeap(), 0, len); + str = malloc(len); if (str) { LPBYTE buf; @@ -586,7 +585,7 @@ static void decodeAndCompareBase64_A(LPCSTR toDecode, LPCSTR header, ret = CryptStringToBinaryA(str, 0, useFormat, NULL, &bufLen, NULL, NULL); ok(ret, "CryptStringToBinaryA failed: %ld\n", GetLastError()); - buf = HeapAlloc(GetProcessHeap(), 0, bufLen); + buf = malloc(bufLen); if (buf) { DWORD skipped, usedFormat; @@ -605,7 +604,7 @@ static void decodeAndCompareBase64_A(LPCSTR toDecode, LPCSTR header, ok(skipped == 0, "Expected skipped 0, got %ld\n", skipped); ok(usedFormat == expectedFormat, "Expected format %ld, got %ld\n", expectedFormat, usedFormat); - HeapFree(GetProcessHeap(), 0, buf); + free(buf); }
/* Check again, but with garbage up front */ @@ -625,7 +624,7 @@ static void decodeAndCompareBase64_A(LPCSTR toDecode, LPCSTR header, "Expected !ret and last error ERROR_INVALID_DATA, got ret=%d, error=%ld\n", ret, GetLastError()); if (ret) { - buf = HeapAlloc(GetProcessHeap(), 0, bufLen); + buf = malloc(bufLen); if (buf) { DWORD skipped, usedFormat; @@ -636,10 +635,10 @@ static void decodeAndCompareBase64_A(LPCSTR toDecode, LPCSTR header, ok(skipped == strlen(garbage), "Expected %d characters of "%s" skipped when trying format %08lx, got %ld (used format is %08lx)\n", lstrlenA(garbage), str, useFormat, skipped, usedFormat); - HeapFree(GetProcessHeap(), 0, buf); + free(buf); } } - HeapFree(GetProcessHeap(), 0, str); + free(str); } }
diff --git a/dlls/crypt32/tests/cert.c b/dlls/crypt32/tests/cert.c index ea25826f4ed..882bb4a0723 100644 --- a/dlls/crypt32/tests/cert.c +++ b/dlls/crypt32/tests/cert.c @@ -554,7 +554,7 @@ static void testCertProperties(void) ok(ret, "CertGetCertificateContextProperty failed: %08lx\n", GetLastError()); if (ret) { - LPBYTE buf = HeapAlloc(GetProcessHeap(), 0, size); + LPBYTE buf = malloc(size);
if (buf) { @@ -563,7 +563,7 @@ static void testCertProperties(void) ok(ret, "CertGetCertificateContextProperty failed: %08lx\n", GetLastError()); ok(!memcmp(buf, subjectKeyId, size), "Unexpected subject key id\n"); - HeapFree(GetProcessHeap(), 0, buf); + free(buf); } } CertFreeCertificateContext(context); @@ -1640,7 +1640,7 @@ static void testGetIssuerCert(void) size = 0; ok(CertStrToNameW(X509_ASN_ENCODING, L"CN=dummy, T=Test", CERT_X500_NAME_STR, NULL, NULL, &size, NULL), "CertStrToName should have worked\n"); - certencoded = HeapAlloc(GetProcessHeap(), 0, size); + certencoded = malloc(size); ok(CertStrToNameW(X509_ASN_ENCODING, L"CN=dummy, T=Test", CERT_X500_NAME_STR, NULL, certencoded, &size, NULL), "CertStrToName should have worked\n"); certsubject.pbData = certencoded; @@ -1663,7 +1663,7 @@ static void testGetIssuerCert(void) CertFreeCertificateContext(cert2); CertFreeCertificateContext(cert3); CertCloseStore(store, 0); - HeapFree(GetProcessHeap(), 0, certencoded); + free(certencoded);
/* Test root storage self-signed certificate */ store = CertOpenStore(CERT_STORE_PROV_SYSTEM, 0, 0, CERT_SYSTEM_STORE_CURRENT_USER, L"ROOT"); @@ -1913,7 +1913,7 @@ static void testVerifyCertSig(HCRYPTPROV csp, const CRYPT_DATA_BLOB *toBeSigned, } CryptExportPublicKeyInfoEx(csp, AT_SIGNATURE, X509_ASN_ENCODING, (LPSTR)sigOID, 0, NULL, NULL, &pubKeySize); - pubKeyInfo = HeapAlloc(GetProcessHeap(), 0, pubKeySize); + pubKeyInfo = malloc(pubKeySize); if (pubKeyInfo) { ret = CryptExportPublicKeyInfoEx(csp, AT_SIGNATURE, @@ -1927,7 +1927,7 @@ static void testVerifyCertSig(HCRYPTPROV csp, const CRYPT_DATA_BLOB *toBeSigned, ok(ret, "CryptVerifyCertificateSignature failed: %08lx\n", GetLastError()); } - HeapFree(GetProcessHeap(), 0, pubKeyInfo); + free(pubKeyInfo); } LocalFree(cert); } @@ -2000,7 +2000,7 @@ static void testVerifyCertSigEx(HCRYPTPROV csp, const CRYPT_DATA_BLOB *toBeSigne */ CryptExportPublicKeyInfoEx(csp, AT_SIGNATURE, X509_ASN_ENCODING, (LPSTR)sigOID, 0, NULL, NULL, &size); - pubKeyInfo = HeapAlloc(GetProcessHeap(), 0, size); + pubKeyInfo = malloc(size); if (pubKeyInfo) { ret = CryptExportPublicKeyInfoEx(csp, AT_SIGNATURE, @@ -2014,7 +2014,7 @@ static void testVerifyCertSigEx(HCRYPTPROV csp, const CRYPT_DATA_BLOB *toBeSigne ok(ret, "CryptVerifyCertificateSignatureEx failed: %08lx\n", GetLastError()); } - HeapFree(GetProcessHeap(), 0, pubKeyInfo); + free(pubKeyInfo); } LocalFree(cert); } @@ -2114,7 +2114,7 @@ static void testSignAndEncodeCert(void) /* oid_rsa_md5 not present in some win2k */ if (ret) { - LPBYTE buf = HeapAlloc(GetProcessHeap(), 0, size); + LPBYTE buf = malloc(size);
if (buf) { @@ -2135,7 +2135,7 @@ static void testSignAndEncodeCert(void) else if (size == sizeof(md5SignedEmptyCertNoNull)) ok(!memcmp(buf, md5SignedEmptyCertNoNull, size), "Unexpected value\n"); - HeapFree(GetProcessHeap(), 0, buf); + free(buf); } } } @@ -2188,7 +2188,7 @@ static void testCreateSelfSignCert(void) ok(ret && size, "Expected non-zero key provider info\n"); if (size) { - PCRYPT_KEY_PROV_INFO pInfo = HeapAlloc(GetProcessHeap(), 0, size); + PCRYPT_KEY_PROV_INFO pInfo = malloc(size);
if (pInfo) { @@ -2206,7 +2206,7 @@ static void testCreateSelfSignCert(void) ok(pInfo->dwKeySpec == AT_SIGNATURE, "Expected AT_SIGNATURE, got %ld\n", pInfo->dwKeySpec); } - HeapFree(GetProcessHeap(), 0, pInfo); + free(pInfo); } }
@@ -2262,7 +2262,7 @@ static void testCreateSelfSignCert(void) ok(ret && size, "Expected non-zero key provider info\n"); if (size) { - PCRYPT_KEY_PROV_INFO pInfo = HeapAlloc(GetProcessHeap(), 0, size); + PCRYPT_KEY_PROV_INFO pInfo = malloc(size);
if (pInfo) { @@ -2280,7 +2280,7 @@ static void testCreateSelfSignCert(void) ok(pInfo->dwKeySpec == AT_SIGNATURE, "Expected AT_SIGNATURE, got %ld\n", pInfo->dwKeySpec); } - HeapFree(GetProcessHeap(), 0, pInfo); + free(pInfo); } }
@@ -2309,7 +2309,7 @@ static void testCreateSelfSignCert(void) ok(ret && size, "Expected non-zero key provider info\n"); if (size) { - PCRYPT_KEY_PROV_INFO pInfo = HeapAlloc(GetProcessHeap(), 0, size); + PCRYPT_KEY_PROV_INFO pInfo = malloc(size);
if (pInfo) { @@ -2327,7 +2327,7 @@ static void testCreateSelfSignCert(void) ok(pInfo->dwKeySpec == AT_KEYEXCHANGE, "Expected AT_KEYEXCHANGE, got %ld\n", pInfo->dwKeySpec); } - HeapFree(GetProcessHeap(), 0, pInfo); + free(pInfo); } }
@@ -2386,7 +2386,7 @@ static void testCreateSelfSignCert(void) ok(ret && size, "Expected non-zero key provider info\n"); if (size) { - PCRYPT_KEY_PROV_INFO pInfo = HeapAlloc(GetProcessHeap(), 0, size); + PCRYPT_KEY_PROV_INFO pInfo = malloc(size);
if (pInfo) { @@ -2404,7 +2404,7 @@ static void testCreateSelfSignCert(void) ok(pInfo->dwKeySpec == AT_KEYEXCHANGE, "Expected AT_KEYEXCHANGE, got %ld\n", pInfo->dwKeySpec); } - HeapFree(GetProcessHeap(), 0, pInfo); + free(pInfo); } }
@@ -2627,7 +2627,7 @@ static void testKeyUsage(void) ret = CertGetEnhancedKeyUsage(context, CERT_FIND_EXT_ONLY_ENHKEY_USAGE_FLAG, NULL, &bufSize); ok(ret, "CertGetEnhancedKeyUsage failed: %08lx\n", GetLastError()); - buf = HeapAlloc(GetProcessHeap(), 0, bufSize); + buf = malloc(bufSize); if (buf) { PCERT_ENHKEY_USAGE pUsage = (PCERT_ENHKEY_USAGE)buf; @@ -2644,11 +2644,11 @@ static void testKeyUsage(void) ok(!strcmp(pUsage->rgpszUsageIdentifier[i], keyUsages[i]), "Expected %s, got %s\n", keyUsages[i], pUsage->rgpszUsageIdentifier[i]); - HeapFree(GetProcessHeap(), 0, buf); + free(buf); } ret = CertGetEnhancedKeyUsage(context, 0, NULL, &bufSize); ok(ret, "CertGetEnhancedKeyUsage failed: %08lx\n", GetLastError()); - buf = HeapAlloc(GetProcessHeap(), 0, bufSize); + buf = malloc(bufSize); if (buf) { PCERT_ENHKEY_USAGE pUsage = (PCERT_ENHKEY_USAGE)buf; @@ -2668,7 +2668,7 @@ static void testKeyUsage(void) ok(!strcmp(pUsage->rgpszUsageIdentifier[i], keyUsages[i]), "Expected %s, got %s\n", keyUsages[i], pUsage->rgpszUsageIdentifier[i]); - HeapFree(GetProcessHeap(), 0, buf); + free(buf); } /* Shouldn't find it as an extended property */ ret = CertGetEnhancedKeyUsage(context, @@ -2681,7 +2681,7 @@ static void testKeyUsage(void) GetLastError()); ret = CertGetEnhancedKeyUsage(context, 0, NULL, &bufSize); ok(ret, "CertGetEnhancedKeyUsage failed: %08lx\n", GetLastError()); - buf = HeapAlloc(GetProcessHeap(), 0, bufSize); + buf = malloc(bufSize); if (buf) { PCERT_ENHKEY_USAGE pUsage = (PCERT_ENHKEY_USAGE)buf; @@ -2696,13 +2696,13 @@ static void testKeyUsage(void) ok(!strcmp(pUsage->rgpszUsageIdentifier[0], szOID_RSA_RSA), "Expected %s, got %s\n", szOID_RSA_RSA, pUsage->rgpszUsageIdentifier[0]); - HeapFree(GetProcessHeap(), 0, buf); + free(buf); } /* But querying the cert directly returns its usage */ ret = CertGetEnhancedKeyUsage(context, CERT_FIND_EXT_ONLY_ENHKEY_USAGE_FLAG, NULL, &bufSize); ok(ret, "CertGetEnhancedKeyUsage failed: %08lx\n", GetLastError()); - buf = HeapAlloc(GetProcessHeap(), 0, bufSize); + buf = malloc(bufSize); if (buf) { PCERT_ENHKEY_USAGE pUsage = (PCERT_ENHKEY_USAGE)buf; @@ -2718,7 +2718,7 @@ static void testKeyUsage(void) ok(!strcmp(pUsage->rgpszUsageIdentifier[i], keyUsages[i]), "Expected %s, got %s\n", keyUsages[i], pUsage->rgpszUsageIdentifier[i]); - HeapFree(GetProcessHeap(), 0, buf); + free(buf); } /* And removing the only usage identifier in the extended property * results in the cert's key usage being found. @@ -2727,7 +2727,7 @@ static void testKeyUsage(void) ok(ret, "CertRemoveEnhancedKeyUsage failed: %08lx\n", GetLastError()); ret = CertGetEnhancedKeyUsage(context, 0, NULL, &bufSize); ok(ret, "CertGetEnhancedKeyUsage failed: %08lx\n", GetLastError()); - buf = HeapAlloc(GetProcessHeap(), 0, bufSize); + buf = malloc(bufSize); if (buf) { PCERT_ENHKEY_USAGE pUsage = (PCERT_ENHKEY_USAGE)buf; @@ -2743,7 +2743,7 @@ static void testKeyUsage(void) ok(!strcmp(pUsage->rgpszUsageIdentifier[i], keyUsages[i]), "Expected %s, got %s\n", keyUsages[i], pUsage->rgpszUsageIdentifier[i]); - HeapFree(GetProcessHeap(), 0, buf); + free(buf); }
CertFreeCertificateContext(context); @@ -2810,7 +2810,7 @@ static void testGetValidUsages(void) ok(ret, "CertGetValidUsages failed: %08lx\n", GetLastError()); ok(numOIDs == 3, "Expected 3, got %d\n", numOIDs); ok(size, "Expected non-zero size\n"); - oids = HeapAlloc(GetProcessHeap(), 0, size); + oids = malloc(size); if (oids) { int i; @@ -2825,7 +2825,7 @@ static void testGetValidUsages(void) for (i = 0; i < numOIDs; i++) ok(!lstrcmpA(oids[i], expectedOIDs[i]), "unexpected OID %s\n", oids[i]); - HeapFree(GetProcessHeap(), 0, oids); + free(oids); } numOIDs = 0xdeadbeef; /* Oddly enough, this crashes when the number of contexts is not 1: @@ -2837,7 +2837,7 @@ static void testGetValidUsages(void) ok(ret, "CertGetValidUsages failed: %08lx\n", GetLastError()); ok(numOIDs == 3, "Expected 3, got %d\n", numOIDs); ok(size, "Expected non-zero size\n"); - oids = HeapAlloc(GetProcessHeap(), 0, size); + oids = malloc(size); if (oids) { int i; @@ -2847,7 +2847,7 @@ static void testGetValidUsages(void) for (i = 0; i < numOIDs; i++) ok(!lstrcmpA(oids[i], expectedOIDs[i]), "unexpected OID %s\n", oids[i]); - HeapFree(GetProcessHeap(), 0, oids); + free(oids); } numOIDs = 0xdeadbeef; size = 0; @@ -2855,7 +2855,7 @@ static void testGetValidUsages(void) ok(ret, "CertGetValidUsages failed: %08lx\n", GetLastError()); ok(numOIDs == 2, "Expected 2, got %d\n", numOIDs); ok(size, "Expected non-zero size\n"); - oids = HeapAlloc(GetProcessHeap(), 0, size); + oids = malloc(size); if (oids) { int i; @@ -2865,7 +2865,7 @@ static void testGetValidUsages(void) for (i = 0; i < numOIDs; i++) ok(!lstrcmpA(oids[i], expectedOIDs2[i]), "unexpected OID %s\n", oids[i]); - HeapFree(GetProcessHeap(), 0, oids); + free(oids); } numOIDs = 0xdeadbeef; size = 0; @@ -2873,7 +2873,7 @@ static void testGetValidUsages(void) ok(ret, "CertGetValidUsages failed: %08lx\n", GetLastError()); ok(numOIDs == 2, "Expected 2, got %d\n", numOIDs); ok(size, "Expected non-zero size\n"); - oids = HeapAlloc(GetProcessHeap(), 0, size); + oids = malloc(size); if (oids) { int i; @@ -2883,7 +2883,7 @@ static void testGetValidUsages(void) for (i = 0; i < numOIDs; i++) ok(!lstrcmpA(oids[i], expectedOIDs2[i]), "unexpected OID %s\n", oids[i]); - HeapFree(GetProcessHeap(), 0, oids); + free(oids); } CertFreeCertificateContext(contexts[0]); CertFreeCertificateContext(contexts[1]); @@ -4377,7 +4377,7 @@ static void testAcquireCertPrivateKey(void) ok(ret, "CryptExportKey failed: %08lx\n", GetLastError()); if (ret) { - LPBYTE buf = HeapAlloc(GetProcessHeap(), 0, size), encodedKey; + LPBYTE buf = malloc(size), encodedKey;
ret = CryptExportKey(key, 0, PUBLICKEYBLOB, 0, buf, &size); ok(ret, "CryptExportKey failed: %08lx\n", GetLastError()); @@ -4395,7 +4395,7 @@ static void testAcquireCertPrivateKey(void) "Unexpected value\n"); LocalFree(encodedKey); } - HeapFree(GetProcessHeap(), 0, buf); + free(buf); } CryptDestroyKey(key); } @@ -4404,7 +4404,7 @@ static void testAcquireCertPrivateKey(void) ok(ret, "CryptExportPublicKeyInfoEx failed: %08lx\n", GetLastError()); if (ret) { - PCERT_PUBLIC_KEY_INFO info = HeapAlloc(GetProcessHeap(), 0, size); + PCERT_PUBLIC_KEY_INFO info = malloc(size);
ret = CryptExportPublicKeyInfoEx(csp, AT_SIGNATURE, X509_ASN_ENCODING, NULL, 0, NULL, info, &size); @@ -4416,7 +4416,7 @@ static void testAcquireCertPrivateKey(void) ok(!memcmp(info->PublicKey.pbData, asnEncodedPublicKey, info->PublicKey.cbData), "Unexpected value\n"); } - HeapFree(GetProcessHeap(), 0, info); + free(info); }
CryptReleaseContext(csp, 0); @@ -4541,7 +4541,7 @@ static void testKeyProvInfo(void)
ret = CertGetCertificateContextProperty(cert, CERT_KEY_PROV_INFO_PROP_ID, NULL, &size); ok(ret, "CertGetCertificateContextProperty error %#lx\n", GetLastError()); - info = HeapAlloc(GetProcessHeap(), 0, size); + info = malloc(size); ret = CertGetCertificateContextProperty(cert, CERT_KEY_PROV_INFO_PROP_ID, info, &size); ok(ret, "CertGetCertificateContextProperty error %#lx\n", GetLastError()); ok(!lstrcmpW(info->pwszContainerName, containerW), "got %s\n", wine_dbgstr_w(info->pwszContainerName)); @@ -4559,7 +4559,7 @@ static void testKeyProvInfo(void) ok(info->rgProvParam[1].cbData == param[1].cbData, "got %#lx\n", info->rgProvParam[1].cbData); ok(!memcmp(info->rgProvParam[1].pbData, param[1].pbData, param[1].cbData), "param2 mismatch\n"); ok(info->rgProvParam[1].dwFlags == param[1].dwFlags, "got %#lx\n", info->rgProvParam[1].dwFlags); - HeapFree(GetProcessHeap(), 0, info); + free(info);
ret = CertAddCertificateContextToStore(store, cert, CERT_STORE_ADD_NEW, NULL); ok(ret, "CertAddCertificateContextToStore error %#lx\n", GetLastError()); @@ -4578,7 +4578,7 @@ static void testKeyProvInfo(void)
ret = CertGetCertificateContextProperty(cert, CERT_KEY_PROV_INFO_PROP_ID, NULL, &size); ok(ret, "CertGetCertificateContextProperty error %#lx\n", GetLastError()); - info = HeapAlloc(GetProcessHeap(), 0, size); + info = malloc(size); ret = CertGetCertificateContextProperty(cert, CERT_KEY_PROV_INFO_PROP_ID, info, &size); ok(ret, "CertGetCertificateContextProperty error %#lx\n", GetLastError()); ok(!lstrcmpW(info->pwszContainerName, containerW), "got %s\n", wine_dbgstr_w(info->pwszContainerName)); @@ -4596,7 +4596,7 @@ static void testKeyProvInfo(void) ok(info->rgProvParam[1].cbData == param[1].cbData, "got %#lx\n", info->rgProvParam[1].cbData); ok(!memcmp(info->rgProvParam[1].pbData, param[1].pbData, param[1].cbData), "param2 mismatch\n"); ok(info->rgProvParam[1].dwFlags == param[1].dwFlags, "got %#lx\n", info->rgProvParam[1].dwFlags); - HeapFree(GetProcessHeap(), 0, info); + free(info);
ret = CertDeleteCertificateFromStore(cert); ok(ret, "CertDeleteCertificateFromStore error %#lx\n", GetLastError()); @@ -4675,7 +4675,7 @@ static void test_VerifySignature(void) ok(!status, "got %#lx\n", status); ok(hash_len == sizeof(hash_value), "got %lu\n", hash_len);
- sig_value = HeapAlloc(GetProcessHeap(), 0, info->Signature.cbData); + sig_value = malloc(info->Signature.cbData); for (i = 0; i < info->Signature.cbData; i++) sig_value[i] = info->Signature.pbData[info->Signature.cbData - i - 1];
@@ -4683,7 +4683,7 @@ static void test_VerifySignature(void) status = BCryptVerifySignature(bkey, &pad, hash_value, sizeof(hash_value), sig_value, info->Signature.cbData, BCRYPT_PAD_PKCS1); ok(!status, "got %#lx\n", status);
- HeapFree(GetProcessHeap(), 0, sig_value); + free(sig_value); BCryptDestroyHash(bhash); BCryptCloseAlgorithmProvider(alg, 0); BCryptDestroyKey(bkey); diff --git a/dlls/crypt32/tests/encode.c b/dlls/crypt32/tests/encode.c index c611bb63936..3c37f41d504 100644 --- a/dlls/crypt32/tests/encode.c +++ b/dlls/crypt32/tests/encode.c @@ -2592,7 +2592,7 @@ static void test_decodeRsaPublicKey_Bcrypt(DWORD dwEncoding) ok(!memcmp(pubexp, pubexp_expected, sizeof(pubexp_expected)), "Wrong exponent\n"); todo_wine ok(pubexp[3] == 0xff, "Got %02x\n", pubexp[3]);
- leModulus = HeapAlloc(GetProcessHeap(), 0, hdr->cbModulus); + leModulus = malloc(hdr->cbModulus); /* * CNG_RSA_PUBLIC_KEY_BLOB stores the modulus in big-endian format, * so we need to convert it to little-endian @@ -2603,7 +2603,7 @@ static void test_decodeRsaPublicKey_Bcrypt(DWORD dwEncoding) rsaPubKeys[i].modulus, rsaPubKeys[i].decodedModulusLen), "Unexpected modulus\n"); LocalFree(buf); - HeapFree(GetProcessHeap(), 0, leModulus); + free(leModulus); } } } @@ -2799,13 +2799,13 @@ static void test_decodeExtensions(DWORD dwEncoding) ret = CryptDecodeObjectEx(dwEncoding, X509_EXTENSIONS, exts[i].encoded, exts[i].encoded[1] + 2, 0, NULL, NULL, &bufSize); ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError()); - buf = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, bufSize); + buf = calloc(1, bufSize); if (buf) { ret = CryptDecodeObjectEx(dwEncoding, X509_EXTENSIONS, exts[i].encoded, exts[i].encoded[1] + 2, 0, NULL, buf, &bufSize); ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError()); - HeapFree(GetProcessHeap(), 0, buf); + free(buf); } } } @@ -3770,14 +3770,14 @@ static void test_decodeCRLDistPoints(DWORD dwEncoding) distPointWithUrlAndIssuer, distPointWithUrlAndIssuer[1] + 2, 0, NULL, NULL, &size); ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError()); - buf = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size); + buf = calloc(1, size); if (buf) { ret = CryptDecodeObjectEx(dwEncoding, X509_CRL_DIST_POINTS, distPointWithUrlAndIssuer, distPointWithUrlAndIssuer[1] + 2, 0, NULL, buf, &size); ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError()); - HeapFree(GetProcessHeap(), 0, buf); + free(buf); } }
@@ -4906,13 +4906,13 @@ static void test_decodeEnhancedKeyUsage(DWORD dwEncoding) ret = CryptDecodeObjectEx(dwEncoding, X509_ENHANCED_KEY_USAGE, encodedUsage, sizeof(encodedUsage), 0, NULL, NULL, &size); ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError()); - buf = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size); + buf = calloc(1, size); if (buf) { ret = CryptDecodeObjectEx(dwEncoding, X509_ENHANCED_KEY_USAGE, encodedUsage, sizeof(encodedUsage), 0, NULL, buf, &size); ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError()); - HeapFree(GetProcessHeap(), 0, buf); + free(buf); } }
@@ -5391,14 +5391,14 @@ static void test_decodeAuthorityInfoAccess(DWORD dwEncoding) authorityInfoAccessWithUrlAndIPAddr, sizeof(authorityInfoAccessWithUrlAndIPAddr), 0, NULL, NULL, &size); ok(ret, "CryptDecodeObjectEx failed: %lx\n", GetLastError()); - buf = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size); + buf = calloc(1, size); if (buf) { ret = CryptDecodeObjectEx(dwEncoding, X509_AUTHORITY_INFO_ACCESS, authorityInfoAccessWithUrlAndIPAddr, sizeof(authorityInfoAccessWithUrlAndIPAddr), 0, NULL, buf, &size); ok(ret, "CryptDecodeObjectEx failed: %lx\n", GetLastError()); - HeapFree(GetProcessHeap(), 0, buf); + free(buf); } }
@@ -6354,13 +6354,13 @@ static void test_decodePKCSAttributes(DWORD dwEncoding) ret = CryptDecodeObjectEx(dwEncoding, PKCS_ATTRIBUTES, doublePKCSAttributes, sizeof(doublePKCSAttributes), 0, NULL, NULL, &size); ok(ret, "CryptDecodeObjectEx failed: %lx\n", GetLastError()); - buf = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size); + buf = calloc(1, size); if (buf) { ret = CryptDecodeObjectEx(dwEncoding, PKCS_ATTRIBUTES, doublePKCSAttributes, sizeof(doublePKCSAttributes), 0, NULL, buf, &size); ok(ret, "CryptDecodeObjectEx failed: %lx\n", GetLastError()); - HeapFree(GetProcessHeap(), 0, buf); + free(buf); } }
@@ -6522,14 +6522,14 @@ static void test_decodePKCSSMimeCapabilities(DWORD dwEncoding) ret = CryptDecodeObjectEx(dwEncoding, PKCS_SMIME_CAPABILITIES, twoCapabilities, sizeof(twoCapabilities), 0, NULL, NULL, &size); ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError()); - ptr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size); + ptr = calloc(1, size); if (ptr) { SetLastError(0xdeadbeef); ret = CryptDecodeObjectEx(dwEncoding, PKCS_SMIME_CAPABILITIES, twoCapabilities, sizeof(twoCapabilities), 0, NULL, ptr, &size); ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError()); - HeapFree(GetProcessHeap(), 0, ptr); + free(ptr); } }
@@ -7645,13 +7645,13 @@ static void test_decodeCertPolicies(DWORD dwEncoding) ret = CryptDecodeObjectEx(dwEncoding, X509_CERT_POLICIES, twoPolicies, sizeof(twoPolicies), 0, NULL, NULL, &size); ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError()); - info = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size); + info = calloc(1, size); if (info) { ret = CryptDecodeObjectEx(dwEncoding, X509_CERT_POLICIES, twoPolicies, sizeof(twoPolicies), 0, NULL, info, &size); ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError()); - HeapFree(GetProcessHeap(), 0, info); + free(info); } }
@@ -7788,14 +7788,14 @@ static void test_decodeCertPolicyMappings(DWORD dwEncoding) policyMappingWithTwoMappings, sizeof(policyMappingWithTwoMappings), 0, NULL, NULL, &size); ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError()); - info = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size); + info = calloc(1, size); if (info) { ret = CryptDecodeObjectEx(dwEncoding, mappingOids[i], policyMappingWithTwoMappings, sizeof(policyMappingWithTwoMappings), 0, NULL, info, &size); ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError()); - HeapFree(GetProcessHeap(), 0, info); + free(info); } } } @@ -8225,7 +8225,6 @@ static void test_decodeRsaPrivateKey(DWORD dwEncoding) } }
-/* Free *pInfo with HeapFree */ static void testExportPublicKey(HCRYPTPROV csp, PCERT_PUBLIC_KEY_INFO *pInfo) { BOOL ret; @@ -8262,7 +8261,7 @@ static void testExportPublicKey(HCRYPTPROV csp, PCERT_PUBLIC_KEY_INFO *pInfo) ret = CryptExportPublicKeyInfoEx(csp, AT_SIGNATURE, X509_ASN_ENCODING, NULL, 0, NULL, NULL, &size); ok(ret, "CryptExportPublicKeyInfoEx failed: %08lx\n", GetLastError()); - *pInfo = HeapAlloc(GetProcessHeap(), 0, size); + *pInfo = malloc(size); if (*pInfo) { ret = CryptExportPublicKeyInfoEx(csp, AT_SIGNATURE, @@ -8411,7 +8410,7 @@ static void testPortPublicKeyInfo(void) testExportPublicKey(csp, &info); testImportPublicKey(csp, info);
- HeapFree(GetProcessHeap(), 0, info); + free(info); CryptReleaseContext(csp, 0); ret = CryptAcquireContextA(&csp, cspName, MS_DEF_PROV_A, PROV_RSA_FULL, CRYPT_DELETEKEYSET); diff --git a/dlls/crypt32/tests/message.c b/dlls/crypt32/tests/message.c index fa4790a2a6b..e6339553e52 100644 --- a/dlls/crypt32/tests/message.c +++ b/dlls/crypt32/tests/message.c @@ -688,14 +688,14 @@ static void test_hash_message(void) /* Actually attempting to get the hashed data fails, perhaps because * detached is FALSE. */ - hashedBlob = HeapAlloc(GetProcessHeap(), 0, hashedBlobSize); + hashedBlob = malloc(hashedBlobSize); SetLastError(0xdeadbeef); ret = CryptHashMessage(¶, FALSE, 2, toHash, hashSize, hashedBlob, &hashedBlobSize, NULL, NULL); ok(!ret && GetLastError() == CRYPT_E_MSG_ERROR, "expected CRYPT_E_MSG_ERROR, got 0x%08lx (%ld)\n", GetLastError(), GetLastError()); - HeapFree(GetProcessHeap(), 0, hashedBlob); + free(hashedBlob); } /* Repeating tests with fDetached = TRUE results in success */ SetLastError(0xdeadbeef); @@ -704,7 +704,7 @@ static void test_hash_message(void) ok(ret, "CryptHashMessage failed: 0x%08lx\n", GetLastError()); if (ret) { - hashedBlob = HeapAlloc(GetProcessHeap(), 0, hashedBlobSize); + hashedBlob = malloc(hashedBlobSize); SetLastError(0xdeadbeef); ret = CryptHashMessage(¶, TRUE, 2, toHash, hashSize, hashedBlob, &hashedBlobSize, NULL, NULL); @@ -713,7 +713,7 @@ static void test_hash_message(void) "unexpected size of detached blob %ld\n", hashedBlobSize); ok(!memcmp(hashedBlob, detachedHashBlob, hashedBlobSize), "unexpected detached blob value\n"); - HeapFree(GetProcessHeap(), 0, hashedBlob); + free(hashedBlob); } /* Hashing a single item with fDetached = FALSE also succeeds */ SetLastError(0xdeadbeef); @@ -722,7 +722,7 @@ static void test_hash_message(void) ok(ret, "CryptHashMessage failed: 0x%08lx\n", GetLastError()); if (ret) { - hashedBlob = HeapAlloc(GetProcessHeap(), 0, hashedBlobSize); + hashedBlob = malloc(hashedBlobSize); ret = CryptHashMessage(¶, FALSE, 1, toHash, hashSize, hashedBlob, &hashedBlobSize, NULL, NULL); ok(ret, "CryptHashMessage failed: 0x%08lx\n", GetLastError()); @@ -730,7 +730,7 @@ static void test_hash_message(void) "unexpected size of detached blob %ld\n", hashedBlobSize); ok(!memcmp(hashedBlob, hashBlob, hashedBlobSize), "unexpected detached blob value\n"); - HeapFree(GetProcessHeap(), 0, hashedBlob); + free(hashedBlob); } /* Check the computed hash value too. You don't need to get the encoded * blob to get it. @@ -743,7 +743,7 @@ static void test_hash_message(void) computedHashSize); if (ret) { - computedHash = HeapAlloc(GetProcessHeap(), 0, computedHashSize); + computedHash = malloc(computedHashSize); SetLastError(0xdeadbeef); ret = CryptHashMessage(¶, TRUE, 2, toHash, hashSize, NULL, &hashedBlobSize, computedHash, &computedHashSize); @@ -752,7 +752,7 @@ static void test_hash_message(void) "unexpected size of hash value %ld\n", computedHashSize); ok(!memcmp(computedHash, hashVal, computedHashSize), "unexpected value\n"); - HeapFree(GetProcessHeap(), 0, computedHash); + free(computedHash); } }
diff --git a/dlls/crypt32/tests/msg.c b/dlls/crypt32/tests/msg.c index f779d70695e..16f7402c613 100644 --- a/dlls/crypt32/tests/msg.c +++ b/dlls/crypt32/tests/msg.c @@ -274,14 +274,14 @@ static void check_param(LPCSTR test, HCRYPTMSG msg, DWORD param, ret = CryptMsgGetParam(msg, param, 0, NULL, &size); ok(ret, "%s: CryptMsgGetParam failed: %08lx\n", test, GetLastError());
- buf = HeapAlloc(GetProcessHeap(), 0, size); + buf = malloc(size); ret = CryptMsgGetParam(msg, param, 0, buf, &size); ok(ret, "%s: CryptMsgGetParam failed: %08lx\n", test, GetLastError()); ok(size == expectedSize, "%s: expected size %ld, got %ld\n", test, expectedSize, size); if (size == expectedSize && size) ok(!memcmp(buf, expected, size), "%s: unexpected data\n", test); - HeapFree(GetProcessHeap(), 0, buf); + free(buf); }
static void test_data_msg_open(void) diff --git a/dlls/crypt32/tests/oid.c b/dlls/crypt32/tests/oid.c index 9520e8c5a4a..715d76b9c31 100644 --- a/dlls/crypt32/tests/oid.c +++ b/dlls/crypt32/tests/oid.c @@ -152,14 +152,14 @@ static void test_oidFunctionSet(void) ok(ret, "CryptGetDefaultOIDDllList failed: %08lx\n", GetLastError()); if (ret) { - buf = HeapAlloc(GetProcessHeap(), 0, size * sizeof(WCHAR)); + buf = malloc(size * sizeof(WCHAR)); if (buf) { ret = CryptGetDefaultOIDDllList(set1, 0, buf, &size); ok(ret, "CryptGetDefaultOIDDllList failed: %08lx\n", GetLastError()); ok(!*buf, "Expected empty DLL list\n"); - HeapFree(GetProcessHeap(), 0, buf); + free(buf); } } } diff --git a/dlls/crypt32/tests/store.c b/dlls/crypt32/tests/store.c index 00c2cae19e0..20d10a110f9 100644 --- a/dlls/crypt32/tests/store.c +++ b/dlls/crypt32/tests/store.c @@ -216,7 +216,7 @@ static void testMemStore(void) ret = CertSerializeCertificateStoreElement(context, 1, NULL, &size); ok(ret, "CertSerializeCertificateStoreElement failed: %08lx\n", GetLastError()); - buf = HeapAlloc(GetProcessHeap(), 0, size); + buf = malloc(size); if (buf) { ret = CertSerializeCertificateStoreElement(context, 0, buf, &size); @@ -224,7 +224,7 @@ static void testMemStore(void) ok(size == sizeof(serializedCert), "Wrong size %ld\n", size); ok(!memcmp(serializedCert, buf, size), "Unexpected serialized cert\n"); - HeapFree(GetProcessHeap(), 0, buf); + free(buf); }
ret = CertFreeCertificateContext(context); @@ -311,7 +311,7 @@ static void compareStore(HCERTSTORE store, LPCSTR name, const BYTE *pb, todo_wine_if (todo) ok(blob.cbData == cb, "%s: expected size %ld, got %ld\n", name, cb, blob.cbData); - blob.pbData = HeapAlloc(GetProcessHeap(), 0, blob.cbData); + blob.pbData = malloc(blob.cbData); if (blob.pbData) { ret = CertSaveStore(store, X509_ASN_ENCODING, CERT_STORE_SAVE_AS_STORE, @@ -319,7 +319,7 @@ static void compareStore(HCERTSTORE store, LPCSTR name, const BYTE *pb, ok(ret, "CertSaveStore failed: %08lx\n", GetLastError()); todo_wine_if (todo) ok(!memcmp(pb, blob.pbData, cb), "%s: unexpected value\n", name); - HeapFree(GetProcessHeap(), 0, blob.pbData); + free(blob.pbData); } }
@@ -1063,7 +1063,7 @@ static void testRegStore(void)
size = 0; RegQueryValueExA(subKey, "Blob", NULL, NULL, NULL, &size); - buf = HeapAlloc(GetProcessHeap(), 0, size); + buf = malloc(size); if (buf) { rc = RegQueryValueExA(subKey, "Blob", NULL, NULL, buf, &size); @@ -1092,7 +1092,7 @@ static void testRegStore(void) hdr->cb), "Unexpected hash in cert property\n"); } } - HeapFree(GetProcessHeap(), 0, buf); + free(buf); } RegCloseKey(subKey); } @@ -2465,7 +2465,7 @@ static void testAddCertificateLink(void) ret = CertSerializeCertificateStoreElement(linked, 0, NULL, &size); ok(ret, "CertSerializeCertificateStoreElement failed: %08lx\n", GetLastError()); - buf = HeapAlloc(GetProcessHeap(), 0, size); + buf = malloc(size); if (buf) { ret = CertSerializeCertificateStoreElement(linked, 0, buf, &size); @@ -2477,7 +2477,7 @@ static void testAddCertificateLink(void) ok(size == sizeof(serializedCert), "Wrong size %ld\n", size); ok(!memcmp(serializedCert, buf, size), "Unexpected serialized cert\n"); - HeapFree(GetProcessHeap(), 0, buf); + free(buf); } /* Set a friendly name on the source certificate... */ blob.pbData = (LPBYTE)L"WineTest"; @@ -2491,7 +2491,7 @@ static void testAddCertificateLink(void) CERT_FRIENDLY_NAME_PROP_ID, NULL, &size); ok(ret, "CertGetCertificateContextProperty failed: %08lx\n", GetLastError()); - buf = HeapAlloc(GetProcessHeap(), 0, size); + buf = malloc(size); if (buf) { ret = CertGetCertificateContextProperty(linked, @@ -2500,7 +2500,7 @@ static void testAddCertificateLink(void) GetLastError()); ok(!lstrcmpW((LPCWSTR)buf, L"WineTest"), "unexpected friendly name\n"); - HeapFree(GetProcessHeap(), 0, buf); + free(buf); } CertFreeCertificateContext(linked); } @@ -2541,7 +2541,7 @@ static void testAddCertificateLink(void) ret = CertSerializeCertificateStoreElement(linked, 0, NULL, &size); ok(ret, "CertSerializeCertificateStoreElement failed: %08lx\n", GetLastError()); - buf = HeapAlloc(GetProcessHeap(), 0, size); + buf = malloc(size); if (buf) { ret = CertSerializeCertificateStoreElement(linked, 0, buf, &size); @@ -2552,7 +2552,7 @@ static void testAddCertificateLink(void) ok(size == sizeof(serializedCert), "Wrong size %ld\n", size); ok(!memcmp(serializedCert, buf, size), "Unexpected serialized cert\n"); - HeapFree(GetProcessHeap(), 0, buf); + free(buf); } /* Set a friendly name on the source certificate... */ blob.pbData = (LPBYTE)L"WineTest"; @@ -2566,7 +2566,7 @@ static void testAddCertificateLink(void) CERT_FRIENDLY_NAME_PROP_ID, NULL, &size); ok(ret, "CertGetCertificateContextProperty failed: %08lx\n", GetLastError()); - buf = HeapAlloc(GetProcessHeap(), 0, size); + buf = malloc(size); if (buf) { ret = CertGetCertificateContextProperty(linked, @@ -2574,7 +2574,7 @@ static void testAddCertificateLink(void) ok(ret, "CertGetCertificateContextProperty failed: %08lx\n", GetLastError()); ok(!lstrcmpW((LPCWSTR)buf, L"WineTest"), "unexpected friendly name\n"); - HeapFree(GetProcessHeap(), 0, buf); + free(buf); } CertFreeCertificateContext(linked); } @@ -2603,7 +2603,7 @@ static void testAddCertificateLink(void) ret = CertSerializeCertificateStoreElement(linked, 0, NULL, &size); ok(ret, "CertSerializeCertificateStoreElement failed: %08lx\n", GetLastError()); - buf = HeapAlloc(GetProcessHeap(), 0, size); + buf = malloc(size); if (buf) { ret = CertSerializeCertificateStoreElement(linked, 0, buf, &size); @@ -2616,7 +2616,7 @@ static void testAddCertificateLink(void) "Wrong size %ld\n", size); ok(!memcmp(serializedCertWithFriendlyName, buf, size), "Unexpected serialized cert\n"); - HeapFree(GetProcessHeap(), 0, buf); + free(buf); } CertFreeCertificateContext(linked); compareStore(store2, "file store -> file store",