mirror of
https://github.com/reactos/reactos.git
synced 2025-05-13 14:20:31 +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,
|
static BOOL (WINAPI *pCryptStringToBinaryA)(LPCSTR pszString,
|
||||||
DWORD cchString, DWORD dwFlags, BYTE *pbBinary, DWORD *pcbBinary,
|
DWORD cchString, DWORD dwFlags, BYTE *pbBinary, DWORD *pcbBinary,
|
||||||
DWORD *pdwSkip, DWORD *pdwFlags);
|
DWORD *pdwSkip, DWORD *pdwFlags);
|
||||||
|
static BOOL (WINAPI *pCryptStringToBinaryW)(LPCWSTR pszString,
|
||||||
|
DWORD cchString, DWORD dwFlags, BYTE *pbBinary, DWORD *pcbBinary,
|
||||||
|
DWORD *pdwSkip, DWORD *pdwFlags);
|
||||||
|
|
||||||
struct BinTests
|
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
|
struct BadString
|
||||||
{
|
{
|
||||||
const char *str;
|
const char *str;
|
||||||
|
@ -313,6 +370,7 @@ static void testStringToBinaryA(void)
|
||||||
{
|
{
|
||||||
BOOL ret;
|
BOOL ret;
|
||||||
DWORD bufLen = 0, i;
|
DWORD bufLen = 0, i;
|
||||||
|
BYTE buf[8];
|
||||||
|
|
||||||
ret = pCryptStringToBinaryA(NULL, 0, 0, NULL, NULL, NULL, NULL);
|
ret = pCryptStringToBinaryA(NULL, 0, 0, NULL, NULL, NULL, NULL);
|
||||||
ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER,
|
ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER,
|
||||||
|
@ -339,6 +397,64 @@ static void testStringToBinaryA(void)
|
||||||
ok(!ret && GetLastError() == ERROR_INVALID_DATA,
|
ok(!ret && GetLastError() == ERROR_INVALID_DATA,
|
||||||
"%d: Expected ERROR_INVALID_DATA, got ret=%d le=%u\n", i, ret, GetLastError());
|
"%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 */
|
/* Good strings */
|
||||||
for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++)
|
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,
|
ret = pCryptStringToBinaryA(tests[i].base64, 1, CRYPT_STRING_BASE64,
|
||||||
NULL, &bufLen, NULL, NULL);
|
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 */
|
/* Check with the precise format */
|
||||||
decodeAndCompareBase64_A(tests[i].base64, NULL, NULL,
|
decodeAndCompareBase64_A(tests[i].base64, NULL, NULL,
|
||||||
CRYPT_STRING_BASE64, CRYPT_STRING_BASE64, tests[i].toEncode,
|
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,
|
ret = pCryptStringToBinaryA(testsNoCR[i].base64, 1, CRYPT_STRING_BASE64,
|
||||||
NULL, &bufLen, NULL, NULL);
|
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 */
|
/* Check with the precise format */
|
||||||
decodeAndCompareBase64_A(testsNoCR[i].base64, NULL, NULL,
|
decodeAndCompareBase64_A(testsNoCR[i].base64, NULL, NULL,
|
||||||
CRYPT_STRING_BASE64, CRYPT_STRING_BASE64, testsNoCR[i].toEncode,
|
CRYPT_STRING_BASE64, CRYPT_STRING_BASE64, testsNoCR[i].toEncode,
|
||||||
|
@ -442,6 +558,7 @@ START_TEST(base64)
|
||||||
|
|
||||||
pCryptBinaryToStringA = (void *)GetProcAddress(lib, "CryptBinaryToStringA");
|
pCryptBinaryToStringA = (void *)GetProcAddress(lib, "CryptBinaryToStringA");
|
||||||
pCryptStringToBinaryA = (void *)GetProcAddress(lib, "CryptStringToBinaryA");
|
pCryptStringToBinaryA = (void *)GetProcAddress(lib, "CryptStringToBinaryA");
|
||||||
|
pCryptStringToBinaryW = (void *)GetProcAddress(lib, "CryptStringToBinaryW");
|
||||||
|
|
||||||
if (pCryptBinaryToStringA)
|
if (pCryptBinaryToStringA)
|
||||||
testBinaryToStringA();
|
testBinaryToStringA();
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -176,7 +176,7 @@ static void test_SIPRetrieveSubjectGUID(void)
|
||||||
GetLastError() == ERROR_PATH_NOT_FOUND,
|
GetLastError() == ERROR_PATH_NOT_FOUND,
|
||||||
"Expected ERROR_FILE_NOT_FOUND or ERROR_PATH_NOT_FOUND, got %d.\n",
|
"Expected ERROR_FILE_NOT_FOUND or ERROR_PATH_NOT_FOUND, got %d.\n",
|
||||||
GetLastError());
|
GetLastError());
|
||||||
ok ( !memcmp(&subject, &nullSubject, sizeof(GUID)),
|
ok(IsEqualGUID(&subject, &nullSubject),
|
||||||
"Expected a NULL GUID for c:\\deadbeef.dbf, not %s\n", wine_dbgstr_guid(&subject));
|
"Expected a NULL GUID for c:\\deadbeef.dbf, not %s\n", wine_dbgstr_guid(&subject));
|
||||||
|
|
||||||
/* Now with an executable that should exist
|
/* Now with an executable that should exist
|
||||||
|
@ -195,7 +195,7 @@ static void test_SIPRetrieveSubjectGUID(void)
|
||||||
memset(&subject, 1, sizeof(GUID));
|
memset(&subject, 1, sizeof(GUID));
|
||||||
ret = CryptSIPRetrieveSubjectGuid(regeditPathW, NULL, &subject);
|
ret = CryptSIPRetrieveSubjectGuid(regeditPathW, NULL, &subject);
|
||||||
ok ( ret, "Expected CryptSIPRetrieveSubjectGuid to succeed\n");
|
ok ( ret, "Expected CryptSIPRetrieveSubjectGuid to succeed\n");
|
||||||
ok ( !memcmp(&subject, &unknownGUID, sizeof(GUID)),
|
ok(IsEqualGUID(&subject, &unknownGUID),
|
||||||
"Expected (%s), got (%s).\n", wine_dbgstr_guid(&unknownGUID), wine_dbgstr_guid(&subject));
|
"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 */
|
/* The same thing but now with a handle instead of a filename */
|
||||||
|
@ -204,7 +204,7 @@ static void test_SIPRetrieveSubjectGUID(void)
|
||||||
memset(&subject, 1, sizeof(GUID));
|
memset(&subject, 1, sizeof(GUID));
|
||||||
ret = CryptSIPRetrieveSubjectGuid(NULL, file, &subject);
|
ret = CryptSIPRetrieveSubjectGuid(NULL, file, &subject);
|
||||||
ok ( ret, "Expected CryptSIPRetrieveSubjectGuid to succeed\n");
|
ok ( ret, "Expected CryptSIPRetrieveSubjectGuid to succeed\n");
|
||||||
ok ( !memcmp(&subject, &unknownGUID, sizeof(GUID)),
|
ok(IsEqualGUID(&subject, &unknownGUID),
|
||||||
"Expected (%s), got (%s).\n", wine_dbgstr_guid(&unknownGUID), wine_dbgstr_guid(&subject));
|
"Expected (%s), got (%s).\n", wine_dbgstr_guid(&unknownGUID), wine_dbgstr_guid(&subject));
|
||||||
CloseHandle(file);
|
CloseHandle(file);
|
||||||
|
|
||||||
|
@ -214,7 +214,7 @@ static void test_SIPRetrieveSubjectGUID(void)
|
||||||
memset(&subject, 1, sizeof(GUID));
|
memset(&subject, 1, sizeof(GUID));
|
||||||
ret = CryptSIPRetrieveSubjectGuid(regeditPathW, file, &subject);
|
ret = CryptSIPRetrieveSubjectGuid(regeditPathW, file, &subject);
|
||||||
ok ( ret, "Expected CryptSIPRetrieveSubjectGuid to succeed\n");
|
ok ( ret, "Expected CryptSIPRetrieveSubjectGuid to succeed\n");
|
||||||
ok ( !memcmp(&subject, &unknownGUID, sizeof(GUID)),
|
ok(IsEqualGUID(&subject, &unknownGUID),
|
||||||
"Expected (%s), got (%s).\n", wine_dbgstr_guid(&unknownGUID), wine_dbgstr_guid(&subject));
|
"Expected (%s), got (%s).\n", wine_dbgstr_guid(&unknownGUID), wine_dbgstr_guid(&subject));
|
||||||
CloseHandle(file);
|
CloseHandle(file);
|
||||||
|
|
||||||
|
@ -234,7 +234,7 @@ static void test_SIPRetrieveSubjectGUID(void)
|
||||||
GetLastError() == ERROR_SUCCESS /* most Win98 */ ||
|
GetLastError() == ERROR_SUCCESS /* most Win98 */ ||
|
||||||
GetLastError() == TRUST_E_SUBJECT_FORM_UNKNOWN /* some 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());
|
"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)),
|
ok(IsEqualGUID(&subject, &nullSubject),
|
||||||
"Expected a NULL GUID for empty file %s, not %s\n", tempfile, wine_dbgstr_guid(&subject));
|
"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) */
|
/* Use a file with a size of 3 (at least < 4) */
|
||||||
|
@ -250,7 +250,7 @@ static void test_SIPRetrieveSubjectGUID(void)
|
||||||
GetLastError() == ERROR_SUCCESS /* most Win98 */ ||
|
GetLastError() == ERROR_SUCCESS /* most Win98 */ ||
|
||||||
GetLastError() == TRUST_E_SUBJECT_FORM_UNKNOWN /* some 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());
|
"Expected ERROR_INVALID_PARAMETER, ERROR_SUCCESS or TRUST_E_SUBJECT_FORM_UNKNOWN, got 0x%08x\n", GetLastError());
|
||||||
ok ( !memcmp(&subject, &nullSubject, sizeof(GUID)),
|
ok(IsEqualGUID(&subject, &nullSubject),
|
||||||
"Expected a NULL GUID for empty file %s, not %s\n", tempfile, wine_dbgstr_guid(&subject));
|
"Expected a NULL GUID for empty file %s, not %s\n", tempfile, wine_dbgstr_guid(&subject));
|
||||||
|
|
||||||
/* And now >= 4 */
|
/* And now >= 4 */
|
||||||
|
@ -265,7 +265,7 @@ static void test_SIPRetrieveSubjectGUID(void)
|
||||||
ok ( GetLastError() == TRUST_E_SUBJECT_FORM_UNKNOWN ||
|
ok ( GetLastError() == TRUST_E_SUBJECT_FORM_UNKNOWN ||
|
||||||
GetLastError() == ERROR_SUCCESS /* Win98 */,
|
GetLastError() == ERROR_SUCCESS /* Win98 */,
|
||||||
"Expected TRUST_E_SUBJECT_FORM_UNKNOWN or ERROR_SUCCESS, got 0x%08x\n", GetLastError());
|
"Expected TRUST_E_SUBJECT_FORM_UNKNOWN or ERROR_SUCCESS, got 0x%08x\n", GetLastError());
|
||||||
ok ( !memcmp(&subject, &nullSubject, sizeof(GUID)),
|
ok(IsEqualGUID(&subject, &nullSubject),
|
||||||
"Expected a NULL GUID for empty file %s, not %s\n", tempfile, wine_dbgstr_guid(&subject));
|
"Expected a NULL GUID for empty file %s, not %s\n", tempfile, wine_dbgstr_guid(&subject));
|
||||||
|
|
||||||
/* Clean up */
|
/* Clean up */
|
||||||
|
@ -283,7 +283,7 @@ static void test_SIPRetrieveSubjectGUID(void)
|
||||||
ret = CryptSIPRetrieveSubjectGuid(tempfileW, NULL, &subject);
|
ret = CryptSIPRetrieveSubjectGuid(tempfileW, NULL, &subject);
|
||||||
ok( ret, "CryptSIPRetrieveSubjectGuid failed: %d (0x%08x)\n",
|
ok( ret, "CryptSIPRetrieveSubjectGuid failed: %d (0x%08x)\n",
|
||||||
GetLastError(), GetLastError() );
|
GetLastError(), GetLastError() );
|
||||||
ok ( !memcmp(&subject, &cabGUID, sizeof(GUID)),
|
ok(IsEqualGUID(&subject, &cabGUID),
|
||||||
"Expected GUID %s for cabinet file, not %s\n", wine_dbgstr_guid(&cabGUID), wine_dbgstr_guid(&subject));
|
"Expected GUID %s for cabinet file, not %s\n", wine_dbgstr_guid(&cabGUID), wine_dbgstr_guid(&subject));
|
||||||
|
|
||||||
/* Clean up */
|
/* Clean up */
|
||||||
|
@ -301,7 +301,7 @@ static void test_SIPRetrieveSubjectGUID(void)
|
||||||
ret = CryptSIPRetrieveSubjectGuid(tempfileW, NULL, &subject);
|
ret = CryptSIPRetrieveSubjectGuid(tempfileW, NULL, &subject);
|
||||||
ok( ret, "CryptSIPRetrieveSubjectGuid failed: %d (0x%08x)\n",
|
ok( ret, "CryptSIPRetrieveSubjectGuid failed: %d (0x%08x)\n",
|
||||||
GetLastError(), GetLastError() );
|
GetLastError(), GetLastError() );
|
||||||
ok ( !memcmp(&subject, &cabGUID, sizeof(GUID)),
|
ok(IsEqualGUID(&subject, &cabGUID),
|
||||||
"Expected GUID %s for cabinet file, not %s\n", wine_dbgstr_guid(&cabGUID), wine_dbgstr_guid(&subject));
|
"Expected GUID %s for cabinet file, not %s\n", wine_dbgstr_guid(&cabGUID), wine_dbgstr_guid(&subject));
|
||||||
|
|
||||||
/* Clean up */
|
/* Clean up */
|
||||||
|
|
|
@ -410,11 +410,19 @@ static void testRegStoreSavedCerts(void)
|
||||||
skip("Insufficient privileges for the test %d\n", i);
|
skip("Insufficient privileges for the test %d\n", i);
|
||||||
continue;
|
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));
|
cert1 = CertCreateCertificateContext(X509_ASN_ENCODING, bigCert, sizeof(bigCert));
|
||||||
ok (cert1 != NULL, "Create cert context failed at %d, %x\n", i, GetLastError());
|
ok (cert1 != NULL, "Create cert context failed at %d, %x\n", i, GetLastError());
|
||||||
ret = CertAddCertificateContextToStore(store, cert1, CERT_STORE_ADD_REPLACE_EXISTING, NULL);
|
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);
|
CertFreeCertificateContext(cert1);
|
||||||
CertCloseStore(store, 0);
|
CertCloseStore(store, 0);
|
||||||
|
|
||||||
|
@ -449,7 +457,7 @@ static void testRegStoreSavedCerts(void)
|
||||||
/* deleting cert from store */
|
/* deleting cert from store */
|
||||||
store = CertOpenStore(CERT_STORE_PROV_SYSTEM_REGISTRY_W,0,0,
|
store = CertOpenStore(CERT_STORE_PROV_SYSTEM_REGISTRY_W,0,0,
|
||||||
reg_store_saved_certs[i].cert_store, reg_store_saved_certs[i].store_name);
|
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));
|
cert1 = CertCreateCertificateContext(X509_ASN_ENCODING, bigCert, sizeof(bigCert));
|
||||||
ok (cert1 != NULL, "Create cert context failed at %d, %x\n", i, GetLastError());
|
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());
|
ok (ret, "Failed to add rw_store_2 to collection %x\n",GetLastError());
|
||||||
|
|
||||||
cert2 = CertCreateCertificateContext(X509_ASN_ENCODING, signedBigCert, sizeof(signedBigCert));
|
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);
|
ret = CertAddCertificateContextToStore(collection, cert2, CERT_STORE_ADD_REPLACE_EXISTING, NULL);
|
||||||
ok (ret, "Failed to add cert3 to the store %x\n",GetLastError());
|
ok (ret, "Failed to add cert3 to the store %x\n",GetLastError());
|
||||||
|
|
||||||
|
@ -2222,7 +2230,7 @@ static void testCertRegisterSystemStore(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = CertCloseStore(hstore, 0);
|
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 );
|
ret = pCertUnregisterSystemStore(WineTestW, cur_flag );
|
||||||
todo_wine_if (reg_system_store_test_data[i].todo)
|
todo_wine_if (reg_system_store_test_data[i].todo)
|
||||||
|
|
Loading…
Reference in a new issue