mirror of
https://github.com/reactos/reactos.git
synced 2025-05-10 12:23:25 +00:00
[CRYPT32_WINETEST] Sync with Wine Staging 2.2. CORE-12823
svn path=/trunk/; revision=74102
This commit is contained in:
parent
9b06dff0d9
commit
a1488a0f38
4 changed files with 776 additions and 494 deletions
|
@ -47,6 +47,9 @@ static BOOL (WINAPI *pCryptBinaryToStringA)(const BYTE *pbBinary,
|
|||
static BOOL (WINAPI *pCryptStringToBinaryA)(LPCSTR pszString,
|
||||
DWORD cchString, DWORD dwFlags, BYTE *pbBinary, DWORD *pcbBinary,
|
||||
DWORD *pdwSkip, DWORD *pdwFlags);
|
||||
static BOOL (WINAPI *pCryptStringToBinaryW)(LPCWSTR pszString,
|
||||
DWORD cchString, DWORD dwFlags, BYTE *pbBinary, DWORD *pcbBinary,
|
||||
DWORD *pdwSkip, DWORD *pdwFlags);
|
||||
|
||||
struct BinTests
|
||||
{
|
||||
|
@ -299,6 +302,60 @@ static void decodeAndCompareBase64_A(LPCSTR toDecode, LPCSTR header,
|
|||
}
|
||||
}
|
||||
|
||||
static void decodeBase64WithLenFmtW(LPCSTR strA, int len, DWORD fmt, BOOL retA,
|
||||
const BYTE *bufA, DWORD bufLenA, DWORD fmtUsedA)
|
||||
{
|
||||
BYTE buf[8] = {0};
|
||||
DWORD bufLen = sizeof(buf)-1, fmtUsed = 0xdeadbeef;
|
||||
BOOL ret;
|
||||
WCHAR strW[64];
|
||||
int i;
|
||||
for (i = 0; (strW[i] = strA[i]) != 0; ++i);
|
||||
ret = pCryptStringToBinaryW(strW, len, fmt, buf, &bufLen, NULL, &fmtUsed);
|
||||
ok(ret == retA && bufLen == bufLenA && memcmp(bufA, buf, bufLen) == 0
|
||||
&& fmtUsed == fmtUsedA, "base64 \"%s\" len %d: W and A differ\n", strA, len);
|
||||
}
|
||||
|
||||
static void decodeBase64WithLenFmt(LPCSTR str, int len, DWORD fmt, LPCSTR expected, int le, BOOL isBroken)
|
||||
{
|
||||
BYTE buf[8] = {0};
|
||||
DWORD bufLen = sizeof(buf)-1, fmtUsed = 0xdeadbeef;
|
||||
BOOL ret;
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = pCryptStringToBinaryA(str, len, fmt, buf, &bufLen, NULL, &fmtUsed);
|
||||
buf[bufLen] = 0;
|
||||
if (expected) {
|
||||
BOOL correct = ret && strcmp(expected, (char*)buf) == 0;
|
||||
ok(correct || (isBroken && broken(!ret)),
|
||||
"base64 \"%s\" len %d: expected \"%s\", got \"%s\" (ret %d, le %d)\n",
|
||||
str, len, expected, (char*)buf, ret, GetLastError());
|
||||
if (correct)
|
||||
ok(fmtUsed == fmt, "base64 \"%s\" len %d: expected fmt %d, used %d\n",
|
||||
str, len, fmt, fmtUsed);
|
||||
} else {
|
||||
ok(!ret && GetLastError() == le,
|
||||
"base64 \"%s\" len %d: expected failure, got \"%s\" (ret %d, le %d)\n",
|
||||
str, len, (char*)buf, ret, GetLastError());
|
||||
}
|
||||
if (pCryptStringToBinaryW)
|
||||
decodeBase64WithLenFmtW(str, len, fmt, ret, buf, bufLen, fmtUsed);
|
||||
}
|
||||
|
||||
static void decodeBase64WithLenBroken(LPCSTR str, int len, LPCSTR expected, int le)
|
||||
{
|
||||
decodeBase64WithLenFmt(str, len, CRYPT_STRING_BASE64, expected, le, TRUE);
|
||||
}
|
||||
|
||||
static void decodeBase64WithLen(LPCSTR str, int len, LPCSTR expected, int le)
|
||||
{
|
||||
decodeBase64WithLenFmt(str, len, CRYPT_STRING_BASE64, expected, le, FALSE);
|
||||
}
|
||||
|
||||
static void decodeBase64WithFmt(LPCSTR str, DWORD fmt, LPCSTR expected, int le)
|
||||
{
|
||||
decodeBase64WithLenFmt(str, 0, fmt, expected, le, FALSE);
|
||||
}
|
||||
|
||||
struct BadString
|
||||
{
|
||||
const char *str;
|
||||
|
@ -313,6 +370,7 @@ static void testStringToBinaryA(void)
|
|||
{
|
||||
BOOL ret;
|
||||
DWORD bufLen = 0, i;
|
||||
BYTE buf[8];
|
||||
|
||||
ret = pCryptStringToBinaryA(NULL, 0, 0, NULL, NULL, NULL, NULL);
|
||||
ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER,
|
||||
|
@ -339,6 +397,64 @@ static void testStringToBinaryA(void)
|
|||
ok(!ret && GetLastError() == ERROR_INVALID_DATA,
|
||||
"%d: Expected ERROR_INVALID_DATA, got ret=%d le=%u\n", i, ret, GetLastError());
|
||||
}
|
||||
/* Weird base64 strings (invalid padding, extra white-space etc.) */
|
||||
decodeBase64WithLen("V=", 0, 0, ERROR_INVALID_DATA);
|
||||
decodeBase64WithLen("VV=", 0, 0, ERROR_INVALID_DATA);
|
||||
decodeBase64WithLen("V==", 0, 0, ERROR_INVALID_DATA);
|
||||
decodeBase64WithLen("V=", 2, 0, ERROR_INVALID_DATA);
|
||||
decodeBase64WithLen("VV=", 3, 0, ERROR_INVALID_DATA);
|
||||
decodeBase64WithLen("V==", 3, 0, ERROR_INVALID_DATA);
|
||||
decodeBase64WithLenBroken("V", 0, "T", 0);
|
||||
decodeBase64WithLenBroken("VV", 0, "U", 0);
|
||||
decodeBase64WithLenBroken("VVV", 0, "UU", 0);
|
||||
decodeBase64WithLen("V", 1, "T", 0);
|
||||
decodeBase64WithLen("VV", 2, "U", 0);
|
||||
decodeBase64WithLen("VVV", 3, "UU", 0);
|
||||
decodeBase64WithLen("V===", 0, "T", 0);
|
||||
decodeBase64WithLen("V========", 0, "T", 0);
|
||||
decodeBase64WithLen("V===", 4, "T", 0);
|
||||
decodeBase64WithLen("V\nVVV", 0, "UUU", 0);
|
||||
decodeBase64WithLen("VV\nVV", 0, "UUU", 0);
|
||||
decodeBase64WithLen("VVV\nV", 0, "UUU", 0);
|
||||
decodeBase64WithLen("V\nVVV", 5, "UUU", 0);
|
||||
decodeBase64WithLen("VV\nVV", 5, "UUU", 0);
|
||||
decodeBase64WithLen("VVV\nV", 5, "UUU", 0);
|
||||
decodeBase64WithLen("VV VV", 0, "UUU", 0);
|
||||
decodeBase64WithLen("V===VVVV", 0, "T", 0);
|
||||
decodeBase64WithLen("VV==VVVV", 0, "U", 0);
|
||||
decodeBase64WithLen("VVV=VVVV", 0, "UU", 0);
|
||||
decodeBase64WithLen("VVVV=VVVV", 0, "UUU", 0);
|
||||
decodeBase64WithLen("V===VVVV", 8, "T", 0);
|
||||
decodeBase64WithLen("VV==VVVV", 8, "U", 0);
|
||||
decodeBase64WithLen("VVV=VVVV", 8, "UU", 0);
|
||||
decodeBase64WithLen("VVVV=VVVV", 8, "UUU", 0);
|
||||
|
||||
decodeBase64WithFmt("-----BEGIN-----VVVV-----END-----", CRYPT_STRING_BASE64HEADER, 0, ERROR_INVALID_DATA);
|
||||
decodeBase64WithFmt("-----BEGIN-----VVVV-----END -----", CRYPT_STRING_BASE64HEADER, 0, ERROR_INVALID_DATA);
|
||||
decodeBase64WithFmt("-----BEGIN -----VVVV-----END-----", CRYPT_STRING_BASE64HEADER, 0, ERROR_INVALID_DATA);
|
||||
decodeBase64WithFmt("-----BEGIN -----VVVV-----END -----", CRYPT_STRING_BASE64HEADER, "UUU", 0);
|
||||
|
||||
decodeBase64WithFmt("-----BEGIN -----V-----END -----", CRYPT_STRING_BASE64HEADER, "T", 0);
|
||||
decodeBase64WithFmt("-----BEGIN foo-----V-----END -----", CRYPT_STRING_BASE64HEADER, "T", 0);
|
||||
decodeBase64WithFmt("-----BEGIN foo-----V-----END foo-----", CRYPT_STRING_BASE64HEADER, "T", 0);
|
||||
decodeBase64WithFmt("-----BEGIN -----V-----END foo-----", CRYPT_STRING_BASE64HEADER, "T", 0);
|
||||
decodeBase64WithFmt("-----BEGIN -----V-----END -----", CRYPT_STRING_BASE64X509CRLHEADER, "T", 0);
|
||||
decodeBase64WithFmt("-----BEGIN foo-----V-----END -----", CRYPT_STRING_BASE64X509CRLHEADER, "T", 0);
|
||||
decodeBase64WithFmt("-----BEGIN foo-----V-----END foo-----", CRYPT_STRING_BASE64X509CRLHEADER, "T", 0);
|
||||
decodeBase64WithFmt("-----BEGIN -----V-----END foo-----", CRYPT_STRING_BASE64X509CRLHEADER, "T", 0);
|
||||
decodeBase64WithFmt("-----BEGIN -----V-----END -----", CRYPT_STRING_BASE64REQUESTHEADER, "T", 0);
|
||||
decodeBase64WithFmt("-----BEGIN foo-----V-----END -----", CRYPT_STRING_BASE64REQUESTHEADER, "T", 0);
|
||||
decodeBase64WithFmt("-----BEGIN foo-----V-----END foo-----", CRYPT_STRING_BASE64REQUESTHEADER, "T", 0);
|
||||
decodeBase64WithFmt("-----BEGIN -----V-----END foo-----", CRYPT_STRING_BASE64REQUESTHEADER, "T", 0);
|
||||
|
||||
/* Too small buffer */
|
||||
buf[0] = 0;
|
||||
bufLen = 4;
|
||||
ret = pCryptStringToBinaryA("VVVVVVVV", 8, CRYPT_STRING_BASE64, (BYTE*)buf, &bufLen, NULL, NULL);
|
||||
ok(!ret && bufLen == 4 && buf[0] == 0,
|
||||
"Expected ret 0, bufLen 4, buf[0] '\\0', got ret %d, bufLen %d, buf[0] '%c'\n",
|
||||
ret, bufLen, buf[0]);
|
||||
|
||||
/* Good strings */
|
||||
for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++)
|
||||
{
|
||||
|
@ -348,7 +464,7 @@ static void testStringToBinaryA(void)
|
|||
*/
|
||||
ret = pCryptStringToBinaryA(tests[i].base64, 1, CRYPT_STRING_BASE64,
|
||||
NULL, &bufLen, NULL, NULL);
|
||||
todo_wine ok(ret, "CryptStringToBinaryA failed: %d\n", GetLastError());
|
||||
ok(ret, "CryptStringToBinaryA failed: %d\n", GetLastError());
|
||||
/* Check with the precise format */
|
||||
decodeAndCompareBase64_A(tests[i].base64, NULL, NULL,
|
||||
CRYPT_STRING_BASE64, CRYPT_STRING_BASE64, tests[i].toEncode,
|
||||
|
@ -405,7 +521,7 @@ static void testStringToBinaryA(void)
|
|||
*/
|
||||
ret = pCryptStringToBinaryA(testsNoCR[i].base64, 1, CRYPT_STRING_BASE64,
|
||||
NULL, &bufLen, NULL, NULL);
|
||||
todo_wine ok(ret, "CryptStringToBinaryA failed: %d\n", GetLastError());
|
||||
ok(ret, "CryptStringToBinaryA failed: %d\n", GetLastError());
|
||||
/* Check with the precise format */
|
||||
decodeAndCompareBase64_A(testsNoCR[i].base64, NULL, NULL,
|
||||
CRYPT_STRING_BASE64, CRYPT_STRING_BASE64, testsNoCR[i].toEncode,
|
||||
|
@ -442,6 +558,7 @@ START_TEST(base64)
|
|||
|
||||
pCryptBinaryToStringA = (void *)GetProcAddress(lib, "CryptBinaryToStringA");
|
||||
pCryptStringToBinaryA = (void *)GetProcAddress(lib, "CryptStringToBinaryA");
|
||||
pCryptStringToBinaryW = (void *)GetProcAddress(lib, "CryptStringToBinaryW");
|
||||
|
||||
if (pCryptBinaryToStringA)
|
||||
testBinaryToStringA();
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -176,8 +176,8 @@ static void test_SIPRetrieveSubjectGUID(void)
|
|||
GetLastError() == ERROR_PATH_NOT_FOUND,
|
||||
"Expected ERROR_FILE_NOT_FOUND or ERROR_PATH_NOT_FOUND, got %d.\n",
|
||||
GetLastError());
|
||||
ok ( !memcmp(&subject, &nullSubject, sizeof(GUID)),
|
||||
"Expected a NULL GUID for c:\\deadbeef.dbf, not %s\n", wine_dbgstr_guid(&subject));
|
||||
ok(IsEqualGUID(&subject, &nullSubject),
|
||||
"Expected a NULL GUID for c:\\deadbeef.dbf, not %s\n", wine_dbgstr_guid(&subject));
|
||||
|
||||
/* Now with an executable that should exist
|
||||
*
|
||||
|
@ -195,8 +195,8 @@ static void test_SIPRetrieveSubjectGUID(void)
|
|||
memset(&subject, 1, sizeof(GUID));
|
||||
ret = CryptSIPRetrieveSubjectGuid(regeditPathW, NULL, &subject);
|
||||
ok ( ret, "Expected CryptSIPRetrieveSubjectGuid to succeed\n");
|
||||
ok ( !memcmp(&subject, &unknownGUID, sizeof(GUID)),
|
||||
"Expected (%s), got (%s).\n", wine_dbgstr_guid(&unknownGUID), wine_dbgstr_guid(&subject));
|
||||
ok(IsEqualGUID(&subject, &unknownGUID),
|
||||
"Expected (%s), got (%s).\n", wine_dbgstr_guid(&unknownGUID), wine_dbgstr_guid(&subject));
|
||||
|
||||
/* The same thing but now with a handle instead of a filename */
|
||||
file = CreateFileA(regeditPath, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);
|
||||
|
@ -204,8 +204,8 @@ static void test_SIPRetrieveSubjectGUID(void)
|
|||
memset(&subject, 1, sizeof(GUID));
|
||||
ret = CryptSIPRetrieveSubjectGuid(NULL, file, &subject);
|
||||
ok ( ret, "Expected CryptSIPRetrieveSubjectGuid to succeed\n");
|
||||
ok ( !memcmp(&subject, &unknownGUID, sizeof(GUID)),
|
||||
"Expected (%s), got (%s).\n", wine_dbgstr_guid(&unknownGUID), wine_dbgstr_guid(&subject));
|
||||
ok(IsEqualGUID(&subject, &unknownGUID),
|
||||
"Expected (%s), got (%s).\n", wine_dbgstr_guid(&unknownGUID), wine_dbgstr_guid(&subject));
|
||||
CloseHandle(file);
|
||||
|
||||
/* And both */
|
||||
|
@ -214,8 +214,8 @@ static void test_SIPRetrieveSubjectGUID(void)
|
|||
memset(&subject, 1, sizeof(GUID));
|
||||
ret = CryptSIPRetrieveSubjectGuid(regeditPathW, file, &subject);
|
||||
ok ( ret, "Expected CryptSIPRetrieveSubjectGuid to succeed\n");
|
||||
ok ( !memcmp(&subject, &unknownGUID, sizeof(GUID)),
|
||||
"Expected (%s), got (%s).\n", wine_dbgstr_guid(&unknownGUID), wine_dbgstr_guid(&subject));
|
||||
ok(IsEqualGUID(&subject, &unknownGUID),
|
||||
"Expected (%s), got (%s).\n", wine_dbgstr_guid(&unknownGUID), wine_dbgstr_guid(&subject));
|
||||
CloseHandle(file);
|
||||
|
||||
/* Now with an empty file */
|
||||
|
@ -234,8 +234,8 @@ static void test_SIPRetrieveSubjectGUID(void)
|
|||
GetLastError() == ERROR_SUCCESS /* most Win98 */ ||
|
||||
GetLastError() == TRUST_E_SUBJECT_FORM_UNKNOWN /* some Win98 */,
|
||||
"Expected ERROR_FILE_INVALID, ERROR_INVALID_PARAMETER, ERROR_SUCCESS or TRUST_E_SUBJECT_FORM_UNKNOWN, got 0x%08x\n", GetLastError());
|
||||
ok ( !memcmp(&subject, &nullSubject, sizeof(GUID)),
|
||||
"Expected a NULL GUID for empty file %s, not %s\n", tempfile, wine_dbgstr_guid(&subject));
|
||||
ok(IsEqualGUID(&subject, &nullSubject),
|
||||
"Expected a NULL GUID for empty file %s, not %s\n", tempfile, wine_dbgstr_guid(&subject));
|
||||
|
||||
/* Use a file with a size of 3 (at least < 4) */
|
||||
file = CreateFileA(tempfile, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
|
||||
|
@ -250,8 +250,8 @@ static void test_SIPRetrieveSubjectGUID(void)
|
|||
GetLastError() == ERROR_SUCCESS /* most Win98 */ ||
|
||||
GetLastError() == TRUST_E_SUBJECT_FORM_UNKNOWN /* some Win98 */,
|
||||
"Expected ERROR_INVALID_PARAMETER, ERROR_SUCCESS or TRUST_E_SUBJECT_FORM_UNKNOWN, got 0x%08x\n", GetLastError());
|
||||
ok ( !memcmp(&subject, &nullSubject, sizeof(GUID)),
|
||||
"Expected a NULL GUID for empty file %s, not %s\n", tempfile, wine_dbgstr_guid(&subject));
|
||||
ok(IsEqualGUID(&subject, &nullSubject),
|
||||
"Expected a NULL GUID for empty file %s, not %s\n", tempfile, wine_dbgstr_guid(&subject));
|
||||
|
||||
/* And now >= 4 */
|
||||
file = CreateFileA(tempfile, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
|
||||
|
@ -265,8 +265,8 @@ static void test_SIPRetrieveSubjectGUID(void)
|
|||
ok ( GetLastError() == TRUST_E_SUBJECT_FORM_UNKNOWN ||
|
||||
GetLastError() == ERROR_SUCCESS /* Win98 */,
|
||||
"Expected TRUST_E_SUBJECT_FORM_UNKNOWN or ERROR_SUCCESS, got 0x%08x\n", GetLastError());
|
||||
ok ( !memcmp(&subject, &nullSubject, sizeof(GUID)),
|
||||
"Expected a NULL GUID for empty file %s, not %s\n", tempfile, wine_dbgstr_guid(&subject));
|
||||
ok(IsEqualGUID(&subject, &nullSubject),
|
||||
"Expected a NULL GUID for empty file %s, not %s\n", tempfile, wine_dbgstr_guid(&subject));
|
||||
|
||||
/* Clean up */
|
||||
DeleteFileA(tempfile);
|
||||
|
@ -283,8 +283,8 @@ static void test_SIPRetrieveSubjectGUID(void)
|
|||
ret = CryptSIPRetrieveSubjectGuid(tempfileW, NULL, &subject);
|
||||
ok( ret, "CryptSIPRetrieveSubjectGuid failed: %d (0x%08x)\n",
|
||||
GetLastError(), GetLastError() );
|
||||
ok ( !memcmp(&subject, &cabGUID, sizeof(GUID)),
|
||||
"Expected GUID %s for cabinet file, not %s\n", wine_dbgstr_guid(&cabGUID), wine_dbgstr_guid(&subject));
|
||||
ok(IsEqualGUID(&subject, &cabGUID),
|
||||
"Expected GUID %s for cabinet file, not %s\n", wine_dbgstr_guid(&cabGUID), wine_dbgstr_guid(&subject));
|
||||
|
||||
/* Clean up */
|
||||
DeleteFileA(tempfile);
|
||||
|
@ -301,8 +301,8 @@ static void test_SIPRetrieveSubjectGUID(void)
|
|||
ret = CryptSIPRetrieveSubjectGuid(tempfileW, NULL, &subject);
|
||||
ok( ret, "CryptSIPRetrieveSubjectGuid failed: %d (0x%08x)\n",
|
||||
GetLastError(), GetLastError() );
|
||||
ok ( !memcmp(&subject, &cabGUID, sizeof(GUID)),
|
||||
"Expected GUID %s for cabinet file, not %s\n", wine_dbgstr_guid(&cabGUID), wine_dbgstr_guid(&subject));
|
||||
ok(IsEqualGUID(&subject, &cabGUID),
|
||||
"Expected GUID %s for cabinet file, not %s\n", wine_dbgstr_guid(&cabGUID), wine_dbgstr_guid(&subject));
|
||||
|
||||
/* Clean up */
|
||||
DeleteFileA(tempfile);
|
||||
|
|
|
@ -410,11 +410,19 @@ static void testRegStoreSavedCerts(void)
|
|||
skip("Insufficient privileges for the test %d\n", i);
|
||||
continue;
|
||||
}
|
||||
ok (store!=NULL, "Failed to open the store at %d, %x", i, GetLastError());
|
||||
ok (store!=NULL, "Failed to open the store at %d, %x\n", i, GetLastError());
|
||||
cert1 = CertCreateCertificateContext(X509_ASN_ENCODING, bigCert, sizeof(bigCert));
|
||||
ok (cert1 != NULL, "Create cert context failed at %d, %x\n", i, GetLastError());
|
||||
ret = CertAddCertificateContextToStore(store, cert1, CERT_STORE_ADD_REPLACE_EXISTING, NULL);
|
||||
ok (ret, "Adding to the store failed at %d, %x\n", i, GetLastError());
|
||||
/* Addittional skip per Win7, it allows opening HKLM store, but disallows adding certs */
|
||||
err = GetLastError();
|
||||
if (!ret)
|
||||
{
|
||||
ok (err == ERROR_ACCESS_DENIED, "Failed to add certificate to store at %d (%08x)\n", i, err);
|
||||
skip("Insufficient privileges for the test %d\n", i);
|
||||
continue;
|
||||
}
|
||||
ok (ret, "Adding to the store failed at %d, %x\n", i, err);
|
||||
CertFreeCertificateContext(cert1);
|
||||
CertCloseStore(store, 0);
|
||||
|
||||
|
@ -449,7 +457,7 @@ static void testRegStoreSavedCerts(void)
|
|||
/* deleting cert from store */
|
||||
store = CertOpenStore(CERT_STORE_PROV_SYSTEM_REGISTRY_W,0,0,
|
||||
reg_store_saved_certs[i].cert_store, reg_store_saved_certs[i].store_name);
|
||||
ok (store!=NULL, "Failed to open the store at %d, %x", i, GetLastError());
|
||||
ok (store!=NULL, "Failed to open the store at %d, %x\n", i, GetLastError());
|
||||
|
||||
cert1 = CertCreateCertificateContext(X509_ASN_ENCODING, bigCert, sizeof(bigCert));
|
||||
ok (cert1 != NULL, "Create cert context failed at %d, %x\n", i, GetLastError());
|
||||
|
@ -547,7 +555,7 @@ static void testStoresInCollection(void)
|
|||
ok (ret, "Failed to add rw_store_2 to collection %x\n",GetLastError());
|
||||
|
||||
cert2 = CertCreateCertificateContext(X509_ASN_ENCODING, signedBigCert, sizeof(signedBigCert));
|
||||
ok (cert2 != NULL, "Failed to create cert context %x \n", GetLastError());
|
||||
ok (cert2 != NULL, "Failed to create cert context %x\n", GetLastError());
|
||||
ret = CertAddCertificateContextToStore(collection, cert2, CERT_STORE_ADD_REPLACE_EXISTING, NULL);
|
||||
ok (ret, "Failed to add cert3 to the store %x\n",GetLastError());
|
||||
|
||||
|
@ -1516,7 +1524,7 @@ static void testFileStore(void)
|
|||
|
||||
if (!GetTempFileNameW(szDot, szPrefix, 0, filename))
|
||||
return;
|
||||
|
||||
|
||||
DeleteFileW(filename);
|
||||
file = CreateFileW(filename, GENERIC_READ | GENERIC_WRITE, 0, NULL,
|
||||
CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
|
@ -2222,7 +2230,7 @@ static void testCertRegisterSystemStore(void)
|
|||
}
|
||||
|
||||
ret = CertCloseStore(hstore, 0);
|
||||
ok (ret, "CertCloseStore failed at %08x, last error %x", cur_flag, GetLastError());
|
||||
ok (ret, "CertCloseStore failed at %08x, last error %x\n", cur_flag, GetLastError());
|
||||
|
||||
ret = pCertUnregisterSystemStore(WineTestW, cur_flag );
|
||||
todo_wine_if (reg_system_store_test_data[i].todo)
|
||||
|
@ -2429,12 +2437,12 @@ static void testAddSerialized(void)
|
|||
ok(!ret && GetLastError() == E_INVALIDARG,
|
||||
"Expected E_INVALIDARG, got %08x\n", GetLastError());
|
||||
/* With a bad context type */
|
||||
ret = CertAddSerializedElementToStore(store, buf, sizeof(buf), 0, 0,
|
||||
ret = CertAddSerializedElementToStore(store, buf, sizeof(buf), 0, 0,
|
||||
CERT_STORE_CRL_CONTEXT_FLAG, NULL, NULL);
|
||||
ok(!ret && GetLastError() == E_INVALIDARG,
|
||||
"Expected E_INVALIDARG, got %08x\n", GetLastError());
|
||||
ret = CertAddSerializedElementToStore(store, buf,
|
||||
sizeof(struct CertPropIDHeader) + sizeof(bigCert), 0, 0,
|
||||
sizeof(struct CertPropIDHeader) + sizeof(bigCert), 0, 0,
|
||||
CERT_STORE_CRL_CONTEXT_FLAG, NULL, NULL);
|
||||
ok(!ret && GetLastError() == E_INVALIDARG,
|
||||
"Expected E_INVALIDARG, got %08x\n", GetLastError());
|
||||
|
@ -2445,12 +2453,12 @@ static void testAddSerialized(void)
|
|||
"Expected E_INVALIDARG, got %08x\n", GetLastError());
|
||||
/* Bad unknown field, good type */
|
||||
hdr->unknown1 = 2;
|
||||
ret = CertAddSerializedElementToStore(store, buf, sizeof(buf), 0, 0,
|
||||
ret = CertAddSerializedElementToStore(store, buf, sizeof(buf), 0, 0,
|
||||
CERT_STORE_CERTIFICATE_CONTEXT_FLAG, NULL, NULL);
|
||||
ok(!ret && GetLastError() == ERROR_FILE_NOT_FOUND,
|
||||
"Expected ERROR_FILE_NOT_FOUND got %08x\n", GetLastError());
|
||||
ret = CertAddSerializedElementToStore(store, buf,
|
||||
sizeof(struct CertPropIDHeader) + sizeof(bigCert), 0, 0,
|
||||
sizeof(struct CertPropIDHeader) + sizeof(bigCert), 0, 0,
|
||||
CERT_STORE_CERTIFICATE_CONTEXT_FLAG, NULL, NULL);
|
||||
ok(!ret && GetLastError() == ERROR_FILE_NOT_FOUND,
|
||||
"Expected ERROR_FILE_NOT_FOUND got %08x\n", GetLastError());
|
||||
|
@ -2462,11 +2470,11 @@ static void testAddSerialized(void)
|
|||
/* Most everything okay, but bad add disposition */
|
||||
hdr->unknown1 = 1;
|
||||
/* This crashes
|
||||
ret = CertAddSerializedElementToStore(store, buf, sizeof(buf), 0, 0,
|
||||
ret = CertAddSerializedElementToStore(store, buf, sizeof(buf), 0, 0,
|
||||
CERT_STORE_CERTIFICATE_CONTEXT_FLAG, NULL, NULL);
|
||||
* as does this
|
||||
ret = CertAddSerializedElementToStore(store, buf,
|
||||
sizeof(struct CertPropIDHeader) + sizeof(bigCert), 0, 0,
|
||||
sizeof(struct CertPropIDHeader) + sizeof(bigCert), 0, 0,
|
||||
CERT_STORE_CERTIFICATE_CONTEXT_FLAG, NULL, NULL);
|
||||
*/
|
||||
/* Everything okay, but buffer's too big */
|
||||
|
|
Loading…
Reference in a new issue