Commit 353cd81c authored by Juan Lang's avatar Juan Lang Committed by Alexandre Julliard

crypt32/tests: Win64 printf format warning fixes.

parent d62c50bc
...@@ -4,7 +4,6 @@ SRCDIR = @srcdir@ ...@@ -4,7 +4,6 @@ SRCDIR = @srcdir@
VPATH = @srcdir@ VPATH = @srcdir@
TESTDLL = crypt32.dll TESTDLL = crypt32.dll
IMPORTS = crypt32 advapi32 kernel32 IMPORTS = crypt32 advapi32 kernel32
EXTRADEFS = -DWINE_NO_LONG_AS_INT
CTESTS = \ CTESTS = \
base64.c \ base64.c \
......
...@@ -96,7 +96,7 @@ static void encodeAndCompareBase64_A(const BYTE *toEncode, DWORD toEncodeLen, ...@@ -96,7 +96,7 @@ static void encodeAndCompareBase64_A(const BYTE *toEncode, DWORD toEncodeLen,
BOOL ret; BOOL ret;
ret = pCryptBinaryToStringA(toEncode, toEncodeLen, format, NULL, &strLen); ret = pCryptBinaryToStringA(toEncode, toEncodeLen, format, NULL, &strLen);
ok(ret, "CryptBinaryToStringA failed: %ld\n", GetLastError()); ok(ret, "CryptBinaryToStringA failed: %d\n", GetLastError());
str = HeapAlloc(GetProcessHeap(), 0, strLen); str = HeapAlloc(GetProcessHeap(), 0, strLen);
if (str) if (str)
{ {
...@@ -105,8 +105,8 @@ static void encodeAndCompareBase64_A(const BYTE *toEncode, DWORD toEncodeLen, ...@@ -105,8 +105,8 @@ static void encodeAndCompareBase64_A(const BYTE *toEncode, DWORD toEncodeLen,
ret = pCryptBinaryToStringA(toEncode, toEncodeLen, format, str, ret = pCryptBinaryToStringA(toEncode, toEncodeLen, format, str,
&strLen2); &strLen2);
ok(ret, "CryptBinaryToStringA failed: %ld\n", GetLastError()); ok(ret, "CryptBinaryToStringA failed: %d\n", GetLastError());
ok(strLen2 == strLen - 1, "Expected length %ld, got %ld\n", ok(strLen2 == strLen - 1, "Expected length %d, got %d\n",
strLen - 1, strLen); strLen - 1, strLen);
if (header) if (header)
{ {
...@@ -136,10 +136,10 @@ static void testBinaryToStringA(void) ...@@ -136,10 +136,10 @@ static void testBinaryToStringA(void)
ret = pCryptBinaryToStringA(NULL, 0, 0, NULL, NULL); ret = pCryptBinaryToStringA(NULL, 0, 0, NULL, NULL);
ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError()); "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
ret = pCryptBinaryToStringA(NULL, 0, 0, NULL, &strLen); ret = pCryptBinaryToStringA(NULL, 0, 0, NULL, &strLen);
ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError()); "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++) for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++)
{ {
DWORD strLen = 0; DWORD strLen = 0;
...@@ -148,7 +148,7 @@ static void testBinaryToStringA(void) ...@@ -148,7 +148,7 @@ static void testBinaryToStringA(void)
ret = pCryptBinaryToStringA(tests[i].toEncode, tests[i].toEncodeLen, ret = pCryptBinaryToStringA(tests[i].toEncode, tests[i].toEncodeLen,
CRYPT_STRING_BINARY, NULL, &strLen); CRYPT_STRING_BINARY, NULL, &strLen);
ok(ret, "CryptBinaryToStringA failed: %ld\n", GetLastError()); ok(ret, "CryptBinaryToStringA failed: %d\n", GetLastError());
str = HeapAlloc(GetProcessHeap(), 0, strLen); str = HeapAlloc(GetProcessHeap(), 0, strLen);
if (str) if (str)
{ {
...@@ -156,7 +156,7 @@ static void testBinaryToStringA(void) ...@@ -156,7 +156,7 @@ static void testBinaryToStringA(void)
ret = pCryptBinaryToStringA(tests[i].toEncode, tests[i].toEncodeLen, ret = pCryptBinaryToStringA(tests[i].toEncode, tests[i].toEncodeLen,
CRYPT_STRING_BINARY, str, &strLen2); CRYPT_STRING_BINARY, str, &strLen2);
ok(strLen == strLen2, "Expected length %ld, got %ld\n", strLen, ok(strLen == strLen2, "Expected length %d, got %d\n", strLen,
strLen2); strLen2);
ok(!memcmp(str, tests[i].toEncode, tests[i].toEncodeLen), ok(!memcmp(str, tests[i].toEncode, tests[i].toEncodeLen),
"Unexpected value\n"); "Unexpected value\n");
...@@ -183,7 +183,7 @@ static void testBinaryToStringA(void) ...@@ -183,7 +183,7 @@ static void testBinaryToStringA(void)
ret = pCryptBinaryToStringA(testsNoCR[i].toEncode, ret = pCryptBinaryToStringA(testsNoCR[i].toEncode,
testsNoCR[i].toEncodeLen, CRYPT_STRING_BINARY | CRYPT_STRING_NOCR, testsNoCR[i].toEncodeLen, CRYPT_STRING_BINARY | CRYPT_STRING_NOCR,
NULL, &strLen); NULL, &strLen);
ok(ret, "CryptBinaryToStringA failed: %ld\n", GetLastError()); ok(ret, "CryptBinaryToStringA failed: %d\n", GetLastError());
str = HeapAlloc(GetProcessHeap(), 0, strLen); str = HeapAlloc(GetProcessHeap(), 0, strLen);
if (str) if (str)
{ {
...@@ -192,7 +192,7 @@ static void testBinaryToStringA(void) ...@@ -192,7 +192,7 @@ static void testBinaryToStringA(void)
ret = pCryptBinaryToStringA(testsNoCR[i].toEncode, ret = pCryptBinaryToStringA(testsNoCR[i].toEncode,
testsNoCR[i].toEncodeLen, CRYPT_STRING_BINARY | CRYPT_STRING_NOCR, testsNoCR[i].toEncodeLen, CRYPT_STRING_BINARY | CRYPT_STRING_NOCR,
str, &strLen2); str, &strLen2);
ok(strLen == strLen2, "Expected length %ld, got %ld\n", strLen, ok(strLen == strLen2, "Expected length %d, got %d\n", strLen,
strLen2); strLen2);
ok(!memcmp(str, testsNoCR[i].toEncode, testsNoCR[i].toEncodeLen), ok(!memcmp(str, testsNoCR[i].toEncode, testsNoCR[i].toEncodeLen),
"Unexpected value\n"); "Unexpected value\n");
...@@ -245,7 +245,7 @@ static void decodeAndCompareBase64_A(LPCSTR toDecode, LPCSTR header, ...@@ -245,7 +245,7 @@ static void decodeAndCompareBase64_A(LPCSTR toDecode, LPCSTR header,
strcat(str, trailer); strcat(str, trailer);
ret = pCryptStringToBinaryA(str, 0, useFormat, NULL, &bufLen, NULL, ret = pCryptStringToBinaryA(str, 0, useFormat, NULL, &bufLen, NULL,
NULL); NULL);
ok(ret, "CryptStringToBinaryA failed: %ld\n", GetLastError()); ok(ret, "CryptStringToBinaryA failed: %d\n", GetLastError());
buf = HeapAlloc(GetProcessHeap(), 0, bufLen); buf = HeapAlloc(GetProcessHeap(), 0, bufLen);
if (buf) if (buf)
{ {
...@@ -254,16 +254,16 @@ static void decodeAndCompareBase64_A(LPCSTR toDecode, LPCSTR header, ...@@ -254,16 +254,16 @@ static void decodeAndCompareBase64_A(LPCSTR toDecode, LPCSTR header,
/* check as normal, make sure last two parameters are optional */ /* check as normal, make sure last two parameters are optional */
ret = pCryptStringToBinaryA(str, 0, useFormat, buf, &bufLen, NULL, ret = pCryptStringToBinaryA(str, 0, useFormat, buf, &bufLen, NULL,
NULL); NULL);
ok(ret, "CryptStringToBinaryA failed: %ld\n", GetLastError()); ok(ret, "CryptStringToBinaryA failed: %d\n", GetLastError());
ok(bufLen == expectedLen, ok(bufLen == expectedLen,
"Expected length %ld, got %ld\n", expectedLen, bufLen); "Expected length %d, got %d\n", expectedLen, bufLen);
ok(!memcmp(buf, expected, bufLen), "Unexpected value\n"); ok(!memcmp(buf, expected, bufLen), "Unexpected value\n");
/* check last two params */ /* check last two params */
ret = pCryptStringToBinaryA(str, 0, useFormat, buf, &bufLen, ret = pCryptStringToBinaryA(str, 0, useFormat, buf, &bufLen,
&skipped, &usedFormat); &skipped, &usedFormat);
ok(ret, "CryptStringToBinaryA failed: %ld\n", GetLastError()); ok(ret, "CryptStringToBinaryA failed: %d\n", GetLastError());
ok(skipped == 0, "Expected skipped 0, got %ld\n", skipped); ok(skipped == 0, "Expected skipped 0, got %d\n", skipped);
ok(usedFormat == expectedFormat, "Expected format %ld, got %ld\n", ok(usedFormat == expectedFormat, "Expected format %d, got %d\n",
expectedFormat, usedFormat); expectedFormat, usedFormat);
HeapFree(GetProcessHeap(), 0, buf); HeapFree(GetProcessHeap(), 0, buf);
} }
...@@ -279,10 +279,10 @@ static void decodeAndCompareBase64_A(LPCSTR toDecode, LPCSTR header, ...@@ -279,10 +279,10 @@ static void decodeAndCompareBase64_A(LPCSTR toDecode, LPCSTR header,
NULL); NULL);
/* expect failure with no header, and success with one */ /* expect failure with no header, and success with one */
if (header) if (header)
ok(ret, "CryptStringToBinaryA failed: %ld\n", GetLastError()); ok(ret, "CryptStringToBinaryA failed: %d\n", GetLastError());
else else
ok(!ret && GetLastError() == ERROR_INVALID_DATA, ok(!ret && GetLastError() == ERROR_INVALID_DATA,
"Expected ERROR_INVALID_DATA, got %ld\n", GetLastError()); "Expected ERROR_INVALID_DATA, got %d\n", GetLastError());
if (ret) if (ret)
{ {
buf = HeapAlloc(GetProcessHeap(), 0, bufLen); buf = HeapAlloc(GetProcessHeap(), 0, bufLen);
...@@ -293,7 +293,7 @@ static void decodeAndCompareBase64_A(LPCSTR toDecode, LPCSTR header, ...@@ -293,7 +293,7 @@ static void decodeAndCompareBase64_A(LPCSTR toDecode, LPCSTR header,
ret = pCryptStringToBinaryA(str, 0, useFormat, buf, &bufLen, ret = pCryptStringToBinaryA(str, 0, useFormat, buf, &bufLen,
&skipped, &usedFormat); &skipped, &usedFormat);
ok(skipped == strlen(garbage), ok(skipped == strlen(garbage),
"Expected %d characters skipped, got %ld\n", lstrlenA(garbage), "Expected %d characters skipped, got %d\n", lstrlenA(garbage),
skipped); skipped);
HeapFree(GetProcessHeap(), 0, buf); HeapFree(GetProcessHeap(), 0, buf);
} }
...@@ -324,20 +324,20 @@ static void testStringToBinaryA(void) ...@@ -324,20 +324,20 @@ static void testStringToBinaryA(void)
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,
"Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError()); "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
ret = pCryptStringToBinaryA(NULL, 0, 0, NULL, &bufLen, NULL, NULL); ret = pCryptStringToBinaryA(NULL, 0, 0, NULL, &bufLen, NULL, NULL);
ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError()); "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
/* Bogus format */ /* Bogus format */
ret = pCryptStringToBinaryA(tests[0].base64, 0, 0, NULL, &bufLen, NULL, ret = pCryptStringToBinaryA(tests[0].base64, 0, 0, NULL, &bufLen, NULL,
NULL); NULL);
ok(!ret && GetLastError() == ERROR_INVALID_DATA, ok(!ret && GetLastError() == ERROR_INVALID_DATA,
"Expected ERROR_INVALID_DATA, got %ld\n", GetLastError()); "Expected ERROR_INVALID_DATA, got %d\n", GetLastError());
/* Decoding doesn't expect the NOCR flag to be specified */ /* Decoding doesn't expect the NOCR flag to be specified */
ret = pCryptStringToBinaryA(tests[0].base64, 1, ret = pCryptStringToBinaryA(tests[0].base64, 1,
CRYPT_STRING_BASE64 | CRYPT_STRING_NOCR, NULL, &bufLen, NULL, NULL); CRYPT_STRING_BASE64 | CRYPT_STRING_NOCR, NULL, &bufLen, NULL, NULL);
ok(!ret && GetLastError() == ERROR_INVALID_DATA, ok(!ret && GetLastError() == ERROR_INVALID_DATA,
"Expected ERROR_INVALID_DATA, got %ld\n", GetLastError()); "Expected ERROR_INVALID_DATA, got %d\n", GetLastError());
/* Bad strings */ /* Bad strings */
for (i = 0; i < sizeof(badStrings) / sizeof(badStrings[0]); i++) for (i = 0; i < sizeof(badStrings) / sizeof(badStrings[0]); i++)
{ {
...@@ -345,7 +345,7 @@ static void testStringToBinaryA(void) ...@@ -345,7 +345,7 @@ static void testStringToBinaryA(void)
ret = pCryptStringToBinaryA(badStrings[i].str, 0, badStrings[i].format, ret = pCryptStringToBinaryA(badStrings[i].str, 0, badStrings[i].format,
NULL, &bufLen, NULL, NULL); NULL, &bufLen, NULL, NULL);
ok(!ret && GetLastError() == ERROR_INVALID_DATA, ok(!ret && GetLastError() == ERROR_INVALID_DATA,
"Expected ERROR_INVALID_DATA, got %ld\n", GetLastError()); "Expected ERROR_INVALID_DATA, got %d\n", GetLastError());
} }
/* Good strings */ /* Good strings */
for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++) for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++)
...@@ -356,7 +356,7 @@ static void testStringToBinaryA(void) ...@@ -356,7 +356,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: %ld\n", GetLastError()); todo_wine 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,
...@@ -410,7 +410,7 @@ static void testStringToBinaryA(void) ...@@ -410,7 +410,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: %ld\n", GetLastError()); todo_wine 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,
......
...@@ -65,21 +65,21 @@ static void testCreateCertChainEngine(void) ...@@ -65,21 +65,21 @@ static void testCreateCertChainEngine(void)
*/ */
ret = CertCreateCertificateChainEngine(&config, NULL); ret = CertCreateCertificateChainEngine(&config, NULL);
ok(!ret && GetLastError() == E_INVALIDARG, ok(!ret && GetLastError() == E_INVALIDARG,
"Expected E_INVALIDARG, got %08lx\n", GetLastError()); "Expected E_INVALIDARG, got %08x\n", GetLastError());
ret = CertCreateCertificateChainEngine(&config, &engine); ret = CertCreateCertificateChainEngine(&config, &engine);
ok(!ret && GetLastError() == E_INVALIDARG, ok(!ret && GetLastError() == E_INVALIDARG,
"Expected E_INVALIDARG, got %08lx\n", GetLastError()); "Expected E_INVALIDARG, got %08x\n", GetLastError());
/* Crashes /* Crashes
config.cbSize = sizeof(config); config.cbSize = sizeof(config);
ret = CertCreateCertificateChainEngine(&config, NULL); ret = CertCreateCertificateChainEngine(&config, NULL);
*/ */
config.cbSize = sizeof(config); config.cbSize = sizeof(config);
ret = CertCreateCertificateChainEngine(&config, &engine); ret = CertCreateCertificateChainEngine(&config, &engine);
ok(ret, "CertCreateCertificateChainEngine failed: %08lx\n", GetLastError()); ok(ret, "CertCreateCertificateChainEngine failed: %08x\n", GetLastError());
CertFreeCertificateChainEngine(engine); CertFreeCertificateChainEngine(engine);
config.dwFlags = 0xff000000; config.dwFlags = 0xff000000;
ret = CertCreateCertificateChainEngine(&config, &engine); ret = CertCreateCertificateChainEngine(&config, &engine);
ok(ret, "CertCreateCertificateChainEngine failed: %08lx\n", GetLastError()); ok(ret, "CertCreateCertificateChainEngine failed: %08x\n", GetLastError());
CertFreeCertificateChainEngine(engine); CertFreeCertificateChainEngine(engine);
/* Creating a cert with no root certs at all is allowed.. */ /* Creating a cert with no root certs at all is allowed.. */
...@@ -87,7 +87,7 @@ static void testCreateCertChainEngine(void) ...@@ -87,7 +87,7 @@ static void testCreateCertChainEngine(void)
CERT_STORE_CREATE_NEW_FLAG, NULL); CERT_STORE_CREATE_NEW_FLAG, NULL);
config.hRestrictedRoot = store; config.hRestrictedRoot = store;
ret = CertCreateCertificateChainEngine(&config, &engine); ret = CertCreateCertificateChainEngine(&config, &engine);
ok(ret, "CertCreateCertificateChainEngine failed: %08lx\n", GetLastError()); ok(ret, "CertCreateCertificateChainEngine failed: %08x\n", GetLastError());
CertFreeCertificateChainEngine(engine); CertFreeCertificateChainEngine(engine);
/* but creating one with a restricted root with a cert that isn't a member /* but creating one with a restricted root with a cert that isn't a member
...@@ -97,7 +97,7 @@ static void testCreateCertChainEngine(void) ...@@ -97,7 +97,7 @@ static void testCreateCertChainEngine(void)
sizeof(selfSignedCert), CERT_STORE_ADD_ALWAYS, NULL); sizeof(selfSignedCert), CERT_STORE_ADD_ALWAYS, NULL);
ret = CertCreateCertificateChainEngine(&config, &engine); ret = CertCreateCertificateChainEngine(&config, &engine);
ok(!ret && GetLastError() == CRYPT_E_NOT_FOUND, ok(!ret && GetLastError() == CRYPT_E_NOT_FOUND,
"Expected CRYPT_E_NOT_FOUND, got %08lx\n", GetLastError()); "Expected CRYPT_E_NOT_FOUND, got %08x\n", GetLastError());
CertCloseStore(store, 0); CertCloseStore(store, 0);
} }
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -42,7 +42,7 @@ static void test_findAttribute(void) ...@@ -42,7 +42,7 @@ static void test_findAttribute(void)
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = CertFindAttribute(NULL, 0, NULL); ret = CertFindAttribute(NULL, 0, NULL);
ok(ret == NULL, "Expected failure\n"); ok(ret == NULL, "Expected failure\n");
ok(GetLastError() == 0xdeadbeef, "Last error was set to %08lx\n", ok(GetLastError() == 0xdeadbeef, "Last error was set to %08x\n",
GetLastError()); GetLastError());
/* crashes /* crashes
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
...@@ -52,24 +52,24 @@ static void test_findAttribute(void) ...@@ -52,24 +52,24 @@ static void test_findAttribute(void)
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = CertFindAttribute(NULL, 1, &attr); ret = CertFindAttribute(NULL, 1, &attr);
ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %ld (%08lx)\n", GetLastError(), "Expected ERROR_INVALID_PARAMETER, got %d (%08x)\n", GetLastError(),
GetLastError()); GetLastError());
/* returns NULL, last error not set */ /* returns NULL, last error not set */
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = CertFindAttribute("bogus", 1, &attr); ret = CertFindAttribute("bogus", 1, &attr);
ok(ret == NULL, "Expected failure\n"); ok(ret == NULL, "Expected failure\n");
ok(GetLastError() == 0xdeadbeef, "Last error was set to %08lx\n", ok(GetLastError() == 0xdeadbeef, "Last error was set to %08x\n",
GetLastError()); GetLastError());
/* returns NULL, last error not set */ /* returns NULL, last error not set */
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = CertFindAttribute("1.2.4", 1, &attr); ret = CertFindAttribute("1.2.4", 1, &attr);
ok(ret == NULL, "Expected failure\n"); ok(ret == NULL, "Expected failure\n");
ok(GetLastError() == 0xdeadbeef, "Last error was set to %08lx\n", ok(GetLastError() == 0xdeadbeef, "Last error was set to %08x\n",
GetLastError()); GetLastError());
/* succeeds, last error not set */ /* succeeds, last error not set */
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = CertFindAttribute("1.2.3", 1, &attr); ret = CertFindAttribute("1.2.3", 1, &attr);
ok(ret != NULL, "CertFindAttribute failed: %08lx\n", GetLastError()); ok(ret != NULL, "CertFindAttribute failed: %08x\n", GetLastError());
} }
static void test_findExtension(void) static void test_findExtension(void)
...@@ -83,7 +83,7 @@ static void test_findExtension(void) ...@@ -83,7 +83,7 @@ static void test_findExtension(void)
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = CertFindExtension(NULL, 0, NULL); ret = CertFindExtension(NULL, 0, NULL);
ok(ret == NULL, "Expected failure\n"); ok(ret == NULL, "Expected failure\n");
ok(GetLastError() == 0xdeadbeef, "Last error was set to %08lx\n", ok(GetLastError() == 0xdeadbeef, "Last error was set to %08x\n",
GetLastError()); GetLastError());
/* crashes /* crashes
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
...@@ -93,24 +93,24 @@ static void test_findExtension(void) ...@@ -93,24 +93,24 @@ static void test_findExtension(void)
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = CertFindExtension(NULL, 1, &ext); ret = CertFindExtension(NULL, 1, &ext);
ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %ld (%08lx)\n", GetLastError(), "Expected ERROR_INVALID_PARAMETER, got %d (%08x)\n", GetLastError(),
GetLastError()); GetLastError());
/* returns NULL, last error not set */ /* returns NULL, last error not set */
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = CertFindExtension("bogus", 1, &ext); ret = CertFindExtension("bogus", 1, &ext);
ok(ret == NULL, "Expected failure\n"); ok(ret == NULL, "Expected failure\n");
ok(GetLastError() == 0xdeadbeef, "Last error was set to %08lx\n", ok(GetLastError() == 0xdeadbeef, "Last error was set to %08x\n",
GetLastError()); GetLastError());
/* returns NULL, last error not set */ /* returns NULL, last error not set */
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = CertFindExtension("1.2.4", 1, &ext); ret = CertFindExtension("1.2.4", 1, &ext);
ok(ret == NULL, "Expected failure\n"); ok(ret == NULL, "Expected failure\n");
ok(GetLastError() == 0xdeadbeef, "Last error was set to %08lx\n", ok(GetLastError() == 0xdeadbeef, "Last error was set to %08x\n",
GetLastError()); GetLastError());
/* succeeds, last error not set */ /* succeeds, last error not set */
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = CertFindExtension("1.2.3", 1, &ext); ret = CertFindExtension("1.2.3", 1, &ext);
ok(ret != NULL, "CertFindExtension failed: %08lx\n", GetLastError()); ok(ret != NULL, "CertFindExtension failed: %08x\n", GetLastError());
} }
static void test_findRDNAttr(void) static void test_findRDNAttr(void)
...@@ -134,24 +134,24 @@ static void test_findRDNAttr(void) ...@@ -134,24 +134,24 @@ static void test_findRDNAttr(void)
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = CertFindRDNAttr(NULL, &nameInfo); ret = CertFindRDNAttr(NULL, &nameInfo);
ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %ld (%08lx)\n", GetLastError(), "Expected ERROR_INVALID_PARAMETER, got %d (%08x)\n", GetLastError(),
GetLastError()); GetLastError());
/* returns NULL, last error not set */ /* returns NULL, last error not set */
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = CertFindRDNAttr("bogus", &nameInfo); ret = CertFindRDNAttr("bogus", &nameInfo);
ok(ret == NULL, "Expected failure\n"); ok(ret == NULL, "Expected failure\n");
ok(GetLastError() == 0xdeadbeef, "Last error was set to %08lx\n", ok(GetLastError() == 0xdeadbeef, "Last error was set to %08x\n",
GetLastError()); GetLastError());
/* returns NULL, last error not set */ /* returns NULL, last error not set */
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = CertFindRDNAttr("1.2.4", &nameInfo); ret = CertFindRDNAttr("1.2.4", &nameInfo);
ok(ret == NULL, "Expected failure\n"); ok(ret == NULL, "Expected failure\n");
ok(GetLastError() == 0xdeadbeef, "Last error was set to %08lx\n", ok(GetLastError() == 0xdeadbeef, "Last error was set to %08x\n",
GetLastError()); GetLastError());
/* succeeds, last error not set */ /* succeeds, last error not set */
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = CertFindRDNAttr("1.2.3", &nameInfo); ret = CertFindRDNAttr("1.2.3", &nameInfo);
ok(ret != NULL, "CertFindRDNAttr failed: %08lx\n", GetLastError()); ok(ret != NULL, "CertFindRDNAttr failed: %08x\n", GetLastError());
} }
static void test_verifyTimeValidity(void) static void test_verifyTimeValidity(void)
...@@ -169,16 +169,16 @@ static void test_verifyTimeValidity(void) ...@@ -169,16 +169,16 @@ static void test_verifyTimeValidity(void)
*/ */
/* Check with 0 NotBefore and NotAfter */ /* Check with 0 NotBefore and NotAfter */
ret = CertVerifyTimeValidity(&fileTime, &info); ret = CertVerifyTimeValidity(&fileTime, &info);
ok(ret == 1, "Expected 1, got %ld\n", ret); ok(ret == 1, "Expected 1, got %d\n", ret);
memcpy(&info.NotAfter, &fileTime, sizeof(info.NotAfter)); memcpy(&info.NotAfter, &fileTime, sizeof(info.NotAfter));
/* Check with NotAfter equal to comparison time */ /* Check with NotAfter equal to comparison time */
ret = CertVerifyTimeValidity(&fileTime, &info); ret = CertVerifyTimeValidity(&fileTime, &info);
ok(ret == 0, "Expected 0, got %ld\n", ret); ok(ret == 0, "Expected 0, got %d\n", ret);
/* Check with NotBefore after comparison time */ /* Check with NotBefore after comparison time */
memcpy(&info.NotBefore, &fileTime, sizeof(info.NotBefore)); memcpy(&info.NotBefore, &fileTime, sizeof(info.NotBefore));
info.NotBefore.dwLowDateTime += 5000; info.NotBefore.dwLowDateTime += 5000;
ret = CertVerifyTimeValidity(&fileTime, &info); ret = CertVerifyTimeValidity(&fileTime, &info);
ok(ret == -1, "Expected -1, got %ld\n", ret); ok(ret == -1, "Expected -1, got %d\n", ret);
} }
static void test_cryptAllocate(void) static void test_cryptAllocate(void)
...@@ -186,13 +186,13 @@ static void test_cryptAllocate(void) ...@@ -186,13 +186,13 @@ static void test_cryptAllocate(void)
LPVOID buf; LPVOID buf;
buf = CryptMemAlloc(0); buf = CryptMemAlloc(0);
ok(buf != NULL, "CryptMemAlloc failed: %08lx\n", GetLastError()); ok(buf != NULL, "CryptMemAlloc failed: %08x\n", GetLastError());
CryptMemFree(buf); CryptMemFree(buf);
buf = CryptMemRealloc(NULL, 0); buf = CryptMemRealloc(NULL, 0);
ok(!buf, "Expected NULL\n"); ok(!buf, "Expected NULL\n");
buf = CryptMemAlloc(0); buf = CryptMemAlloc(0);
buf = CryptMemRealloc(buf, 1); buf = CryptMemRealloc(buf, 1);
ok(buf != NULL, "CryptMemRealloc failed: %08lx\n", GetLastError()); ok(buf != NULL, "CryptMemRealloc failed: %08x\n", GetLastError());
CryptMemFree(buf); CryptMemFree(buf);
} }
...@@ -228,7 +228,7 @@ static void test_cryptTls(void) ...@@ -228,7 +228,7 @@ static void test_cryptTls(void)
/* One normal pass */ /* One normal pass */
index = pI_CryptAllocTls(); index = pI_CryptAllocTls();
ok(index, "I_CryptAllocTls failed: %08lx\n", GetLastError()); ok(index, "I_CryptAllocTls failed: %08x\n", GetLastError());
if (index) if (index)
{ {
LPVOID ptr; LPVOID ptr;
...@@ -236,24 +236,24 @@ static void test_cryptTls(void) ...@@ -236,24 +236,24 @@ static void test_cryptTls(void)
ptr = pI_CryptGetTls(index); ptr = pI_CryptGetTls(index);
ok(!ptr, "Expected NULL\n"); ok(!ptr, "Expected NULL\n");
ret = pI_CryptSetTls(index, (LPVOID)0xdeadbeef); ret = pI_CryptSetTls(index, (LPVOID)0xdeadbeef);
ok(ret, "I_CryptSetTls failed: %08lx\n", GetLastError()); ok(ret, "I_CryptSetTls failed: %08x\n", GetLastError());
ptr = pI_CryptGetTls(index); ptr = pI_CryptGetTls(index);
ok(ptr == (LPVOID)0xdeadbeef, "Expected 0xdeadbeef, got %p\n", ptr); ok(ptr == (LPVOID)0xdeadbeef, "Expected 0xdeadbeef, got %p\n", ptr);
/* This crashes /* This crashes
ret = pI_CryptFreeTls(index, 1); ret = pI_CryptFreeTls(index, 1);
*/ */
ret = pI_CryptFreeTls(index, 0); ret = pI_CryptFreeTls(index, 0);
ok(ret, "I_CryptFreeTls failed: %08lx\n", GetLastError()); ok(ret, "I_CryptFreeTls failed: %08x\n", GetLastError());
ret = pI_CryptFreeTls(index, 0); ret = pI_CryptFreeTls(index, 0);
/* Not sure if this fails because TlsFree should fail, so leave as /* Not sure if this fails because TlsFree should fail, so leave as
* todo for now. * todo for now.
*/ */
todo_wine ok(!ret && GetLastError() == E_INVALIDARG, todo_wine ok(!ret && GetLastError() == E_INVALIDARG,
"Expected E_INVALIDARG, got %08lx\n", GetLastError()); "Expected E_INVALIDARG, got %08x\n", GetLastError());
} }
/* Similar pass, check I_CryptDetachTls */ /* Similar pass, check I_CryptDetachTls */
index = pI_CryptAllocTls(); index = pI_CryptAllocTls();
ok(index, "I_CryptAllocTls failed: %08lx\n", GetLastError()); ok(index, "I_CryptAllocTls failed: %08x\n", GetLastError());
if (index) if (index)
{ {
LPVOID ptr; LPVOID ptr;
...@@ -261,7 +261,7 @@ static void test_cryptTls(void) ...@@ -261,7 +261,7 @@ static void test_cryptTls(void)
ptr = pI_CryptGetTls(index); ptr = pI_CryptGetTls(index);
ok(!ptr, "Expected NULL\n"); ok(!ptr, "Expected NULL\n");
ret = pI_CryptSetTls(index, (LPVOID)0xdeadbeef); ret = pI_CryptSetTls(index, (LPVOID)0xdeadbeef);
ok(ret, "I_CryptSetTls failed: %08lx\n", GetLastError()); ok(ret, "I_CryptSetTls failed: %08x\n", GetLastError());
ptr = pI_CryptGetTls(index); ptr = pI_CryptGetTls(index);
ok(ptr == (LPVOID)0xdeadbeef, "Expected 0xdeadbeef, got %p\n", ptr); ok(ptr == (LPVOID)0xdeadbeef, "Expected 0xdeadbeef, got %p\n", ptr);
ptr = pI_CryptDetachTls(index); ptr = pI_CryptDetachTls(index);
...@@ -312,7 +312,7 @@ static void test_readTrustedPublisherDWORD(void) ...@@ -312,7 +312,7 @@ static void test_readTrustedPublisherDWORD(void)
ret = pReadDWORD(authenticodeFlags, &returnedFlags); ret = pReadDWORD(authenticodeFlags, &returnedFlags);
ok(ret == exists, "Unexpected return value\n"); ok(ret == exists, "Unexpected return value\n");
ok(readFlags == returnedFlags, ok(readFlags == returnedFlags,
"Expected flags %08lx, got %08lx\n", readFlags, returnedFlags); "Expected flags %08x, got %08x\n", readFlags, returnedFlags);
} }
} }
...@@ -331,15 +331,15 @@ static void test_getDefaultCryptProv(void) ...@@ -331,15 +331,15 @@ static void test_getDefaultCryptProv(void)
prov = pI_CryptGetDefaultCryptProv(0xdeadbeef); prov = pI_CryptGetDefaultCryptProv(0xdeadbeef);
ok(prov == 0 && GetLastError() == E_INVALIDARG, ok(prov == 0 && GetLastError() == E_INVALIDARG,
"Expected E_INVALIDARG, got %08lx\n", GetLastError()); "Expected E_INVALIDARG, got %08x\n", GetLastError());
prov = pI_CryptGetDefaultCryptProv(PROV_RSA_FULL); prov = pI_CryptGetDefaultCryptProv(PROV_RSA_FULL);
ok(prov == 0 && GetLastError() == E_INVALIDARG, ok(prov == 0 && GetLastError() == E_INVALIDARG,
"Expected E_INVALIDARG, got %08lx\n", GetLastError()); "Expected E_INVALIDARG, got %08x\n", GetLastError());
prov = pI_CryptGetDefaultCryptProv(1); prov = pI_CryptGetDefaultCryptProv(1);
ok(prov == 0 && GetLastError() == E_INVALIDARG, ok(prov == 0 && GetLastError() == E_INVALIDARG,
"Expected E_INVALIDARG, got %08lx\n", GetLastError()); "Expected E_INVALIDARG, got %08x\n", GetLastError());
prov = pI_CryptGetDefaultCryptProv(0); prov = pI_CryptGetDefaultCryptProv(0);
ok(prov != 0, "I_CryptGetDefaultCryptProv failed: %08lx\n", GetLastError()); ok(prov != 0, "I_CryptGetDefaultCryptProv failed: %08x\n", GetLastError());
CryptReleaseContext(prov, 0); CryptReleaseContext(prov, 0);
} }
......
...@@ -52,13 +52,13 @@ static void test_cryptprotectdata(void) ...@@ -52,13 +52,13 @@ static void test_cryptprotectdata(void)
protected = CryptProtectData(NULL,desc,NULL,NULL,NULL,0,&cipher); protected = CryptProtectData(NULL,desc,NULL,NULL,NULL,0,&cipher);
ok(!protected, "Encrypting without plain data source.\n"); ok(!protected, "Encrypting without plain data source.\n");
r = GetLastError(); r = GetLastError();
ok(r == ERROR_INVALID_PARAMETER, "Wrong (%lu) GetLastError seen\n",r); ok(r == ERROR_INVALID_PARAMETER, "Wrong (%u) GetLastError seen\n",r);
SetLastError(0xDEADBEEF); SetLastError(0xDEADBEEF);
protected = CryptProtectData(&plain,desc,NULL,NULL,NULL,0,NULL); protected = CryptProtectData(&plain,desc,NULL,NULL,NULL,0,NULL);
ok(!protected, "Encrypting without cipher destination.\n"); ok(!protected, "Encrypting without cipher destination.\n");
r = GetLastError(); r = GetLastError();
ok(r == ERROR_INVALID_PARAMETER, "Wrong (%lu) GetLastError seen\n",r); ok(r == ERROR_INVALID_PARAMETER, "Wrong (%u) GetLastError seen\n",r);
cipher.pbData=NULL; cipher.pbData=NULL;
cipher.cbData=0; cipher.cbData=0;
...@@ -68,7 +68,7 @@ static void test_cryptprotectdata(void) ...@@ -68,7 +68,7 @@ static void test_cryptprotectdata(void)
protected = CryptProtectData(&plain,desc,NULL,NULL,NULL,0,&cipher); protected = CryptProtectData(&plain,desc,NULL,NULL,NULL,0,&cipher);
ok(protected, "Encrypting without entropy.\n"); ok(protected, "Encrypting without entropy.\n");
r = GetLastError(); r = GetLastError();
ok(r == ERROR_SUCCESS, "Wrong (%lu) GetLastError seen\n",r); ok(r == ERROR_SUCCESS, "Wrong (%u) GetLastError seen\n",r);
cipher_entropy.pbData=NULL; cipher_entropy.pbData=NULL;
cipher_entropy.cbData=0; cipher_entropy.cbData=0;
...@@ -78,7 +78,7 @@ static void test_cryptprotectdata(void) ...@@ -78,7 +78,7 @@ static void test_cryptprotectdata(void)
protected = CryptProtectData(&plain,desc,&entropy,NULL,NULL,0,&cipher_entropy); protected = CryptProtectData(&plain,desc,&entropy,NULL,NULL,0,&cipher_entropy);
ok(protected, "Encrypting with entropy.\n"); ok(protected, "Encrypting with entropy.\n");
r = GetLastError(); r = GetLastError();
ok(r == ERROR_SUCCESS, "Wrong (%lu) GetLastError seen\n",r); ok(r == ERROR_SUCCESS, "Wrong (%u) GetLastError seen\n",r);
cipher_no_desc.pbData=NULL; cipher_no_desc.pbData=NULL;
cipher_no_desc.cbData=0; cipher_no_desc.cbData=0;
...@@ -90,7 +90,7 @@ static void test_cryptprotectdata(void) ...@@ -90,7 +90,7 @@ static void test_cryptprotectdata(void)
protected = CryptProtectData(&plain,NULL,&entropy,NULL,NULL,0,&cipher_no_desc); protected = CryptProtectData(&plain,NULL,&entropy,NULL,NULL,0,&cipher_no_desc);
ok(protected, "Encrypting with entropy and no description.\n"); ok(protected, "Encrypting with entropy and no description.\n");
r = GetLastError(); r = GetLastError();
ok(r == ERROR_SUCCESS, "Wrong (%lu) GetLastError seen\n",r); ok(r == ERROR_SUCCESS, "Wrong (%u) GetLastError seen\n",r);
} }
static void test_cryptunprotectdata(void) static void test_cryptunprotectdata(void)
...@@ -114,13 +114,13 @@ static void test_cryptunprotectdata(void) ...@@ -114,13 +114,13 @@ static void test_cryptunprotectdata(void)
okay = CryptUnprotectData(&cipher,NULL,NULL,NULL,NULL,0,NULL); okay = CryptUnprotectData(&cipher,NULL,NULL,NULL,NULL,0,NULL);
ok(!okay,"Decrypting without destination\n"); ok(!okay,"Decrypting without destination\n");
r = GetLastError(); r = GetLastError();
ok(r == ERROR_INVALID_PARAMETER, "Wrong (%lu) GetLastError seen\n",r); ok(r == ERROR_INVALID_PARAMETER, "Wrong (%u) GetLastError seen\n",r);
SetLastError(0xDEADBEEF); SetLastError(0xDEADBEEF);
okay = CryptUnprotectData(NULL,NULL,NULL,NULL,NULL,0,&plain); okay = CryptUnprotectData(NULL,NULL,NULL,NULL,NULL,0,&plain);
ok(!okay,"Decrypting without source\n"); ok(!okay,"Decrypting without source\n");
r = GetLastError(); r = GetLastError();
ok(r == ERROR_INVALID_PARAMETER, "Wrong (%lu) GetLastError seen\n",r); ok(r == ERROR_INVALID_PARAMETER, "Wrong (%u) GetLastError seen\n",r);
plain.pbData=NULL; plain.pbData=NULL;
plain.cbData=0; plain.cbData=0;
...@@ -129,7 +129,7 @@ static void test_cryptunprotectdata(void) ...@@ -129,7 +129,7 @@ static void test_cryptunprotectdata(void)
okay = CryptUnprotectData(&cipher_entropy,NULL,NULL,NULL,NULL,0,&plain); okay = CryptUnprotectData(&cipher_entropy,NULL,NULL,NULL,NULL,0,&plain);
ok(!okay,"Decrypting without needed entropy\n"); ok(!okay,"Decrypting without needed entropy\n");
r = GetLastError(); r = GetLastError();
ok(r == ERROR_INVALID_DATA, "Wrong (%lu) GetLastError seen\n", r); ok(r == ERROR_INVALID_DATA, "Wrong (%u) GetLastError seen\n", r);
plain.pbData=NULL; plain.pbData=NULL;
plain.cbData=0; plain.cbData=0;
...@@ -140,7 +140,7 @@ static void test_cryptunprotectdata(void) ...@@ -140,7 +140,7 @@ static void test_cryptunprotectdata(void)
okay = CryptUnprotectData(&cipher,&data_desc,NULL,NULL,NULL,0,&plain); okay = CryptUnprotectData(&cipher,&data_desc,NULL,NULL,NULL,0,&plain);
ok(okay,"Decrypting without entropy\n"); ok(okay,"Decrypting without entropy\n");
r = GetLastError(); r = GetLastError();
ok(r == ERROR_SUCCESS, "Wrong (%lu) GetLastError seen\n",r); ok(r == ERROR_SUCCESS, "Wrong (%u) GetLastError seen\n",r);
ok(plain.pbData!=NULL,"Plain DATA_BLOB missing data\n"); ok(plain.pbData!=NULL,"Plain DATA_BLOB missing data\n");
ok(plain.cbData==strlen(secret)+1,"Plain DATA_BLOB wrong length\n"); ok(plain.cbData==strlen(secret)+1,"Plain DATA_BLOB wrong length\n");
...@@ -160,14 +160,14 @@ static void test_cryptunprotectdata(void) ...@@ -160,14 +160,14 @@ static void test_cryptunprotectdata(void)
okay = CryptUnprotectData(&cipher_entropy,&data_desc,&cipher_entropy,NULL,NULL,0,&plain); okay = CryptUnprotectData(&cipher_entropy,&data_desc,&cipher_entropy,NULL,NULL,0,&plain);
ok(!okay,"Decrypting with wrong entropy\n"); ok(!okay,"Decrypting with wrong entropy\n");
r = GetLastError(); r = GetLastError();
ok(r == ERROR_INVALID_DATA, "Wrong (%lu) GetLastError seen\n",r); ok(r == ERROR_INVALID_DATA, "Wrong (%u) GetLastError seen\n",r);
/* with entropy */ /* with entropy */
SetLastError(0xDEADBEEF); SetLastError(0xDEADBEEF);
okay = CryptUnprotectData(&cipher_entropy,&data_desc,&entropy,NULL,NULL,0,&plain); okay = CryptUnprotectData(&cipher_entropy,&data_desc,&entropy,NULL,NULL,0,&plain);
ok(okay,"Decrypting with entropy\n"); ok(okay,"Decrypting with entropy\n");
r = GetLastError(); r = GetLastError();
ok(r == ERROR_SUCCESS, "Wrong (%lu) GetLastError seen\n",r); ok(r == ERROR_SUCCESS, "Wrong (%u) GetLastError seen\n",r);
ok(plain.pbData!=NULL,"Plain DATA_BLOB missing data\n"); ok(plain.pbData!=NULL,"Plain DATA_BLOB missing data\n");
ok(plain.cbData==strlen(secret)+1,"Plain DATA_BLOB wrong length\n"); ok(plain.cbData==strlen(secret)+1,"Plain DATA_BLOB wrong length\n");
...@@ -187,7 +187,7 @@ static void test_cryptunprotectdata(void) ...@@ -187,7 +187,7 @@ static void test_cryptunprotectdata(void)
okay = CryptUnprotectData(&cipher_no_desc,&data_desc,&entropy,NULL,NULL,0,&plain); okay = CryptUnprotectData(&cipher_no_desc,&data_desc,&entropy,NULL,NULL,0,&plain);
ok(okay,"Decrypting with entropy and no description\n"); ok(okay,"Decrypting with entropy and no description\n");
r = GetLastError(); r = GetLastError();
ok(r == ERROR_SUCCESS, "Wrong (%lu) GetLastError seen\n",r); ok(r == ERROR_SUCCESS, "Wrong (%u) GetLastError seen\n",r);
ok(plain.pbData!=NULL,"Plain DATA_BLOB missing data\n"); ok(plain.pbData!=NULL,"Plain DATA_BLOB missing data\n");
ok(plain.cbData==strlen(secret2)+1,"Plain DATA_BLOB wrong length\n"); ok(plain.cbData==strlen(secret2)+1,"Plain DATA_BLOB wrong length\n");
......
...@@ -231,7 +231,7 @@ static void test_CertRDNValueToStrA(void) ...@@ -231,7 +231,7 @@ static void test_CertRDNValueToStrA(void)
{ {
ret = pCertRDNValueToStrA(attrs[i].dwValueType, &attrs[i].Value, ret = pCertRDNValueToStrA(attrs[i].dwValueType, &attrs[i].Value,
buffer, sizeof(buffer)); buffer, sizeof(buffer));
ok(ret == strlen(attrs[i].str) + 1, "Expected length %d, got %ld\n", ok(ret == strlen(attrs[i].str) + 1, "Expected length %d, got %d\n",
lstrlenA(attrs[i].str) + 1, ret); lstrlenA(attrs[i].str) + 1, ret);
ok(!strcmp(buffer, attrs[i].str), "Expected %s, got %s\n", attrs[i].str, ok(!strcmp(buffer, attrs[i].str), "Expected %s, got %s\n", attrs[i].str,
buffer); buffer);
...@@ -289,7 +289,7 @@ static void test_CertRDNValueToStrW(void) ...@@ -289,7 +289,7 @@ static void test_CertRDNValueToStrW(void)
{ {
ret = pCertRDNValueToStrW(attrs[i].dwValueType, &attrs[i].Value, ret = pCertRDNValueToStrW(attrs[i].dwValueType, &attrs[i].Value,
buffer, sizeof(buffer) / sizeof(buffer[0])); buffer, sizeof(buffer) / sizeof(buffer[0]));
ok(ret == lstrlenW(attrs[i].str) + 1, "Expected length %d, got %ld\n", ok(ret == lstrlenW(attrs[i].str) + 1, "Expected length %d, got %d\n",
lstrlenW(attrs[i].str) + 1, ret); lstrlenW(attrs[i].str) + 1, ret);
ok(!lstrcmpW(buffer, attrs[i].str), "Unexpected value\n"); ok(!lstrcmpW(buffer, attrs[i].str), "Unexpected value\n");
#ifdef DUMP_STRINGS #ifdef DUMP_STRINGS
...@@ -306,11 +306,11 @@ static void test_NameToStrConversionA(PCERT_NAME_BLOB pName, DWORD dwStrType, ...@@ -306,11 +306,11 @@ static void test_NameToStrConversionA(PCERT_NAME_BLOB pName, DWORD dwStrType,
DWORD i; DWORD i;
i = pCertNameToStrA(X509_ASN_ENCODING, pName, dwStrType, NULL, 0); i = pCertNameToStrA(X509_ASN_ENCODING, pName, dwStrType, NULL, 0);
ok(i == strlen(expected) + 1, "Expected %d chars, got %ld\n", ok(i == strlen(expected) + 1, "Expected %d chars, got %d\n",
lstrlenA(expected) + 1, i); lstrlenA(expected) + 1, i);
i = pCertNameToStrA(X509_ASN_ENCODING,pName, dwStrType, buffer, i = pCertNameToStrA(X509_ASN_ENCODING,pName, dwStrType, buffer,
sizeof(buffer)); sizeof(buffer));
ok(i == strlen(expected) + 1, "Expected %d chars, got %ld\n", ok(i == strlen(expected) + 1, "Expected %d chars, got %d\n",
lstrlenA(expected) + 1, i); lstrlenA(expected) + 1, i);
ok(!strcmp(buffer, expected), "Expected %s, got %s\n", expected, buffer); ok(!strcmp(buffer, expected), "Expected %s, got %s\n", expected, buffer);
} }
...@@ -323,7 +323,7 @@ static void test_CertNameToStrA(void) ...@@ -323,7 +323,7 @@ static void test_CertNameToStrA(void)
context = CertCreateCertificateContext(X509_ASN_ENCODING, cert, context = CertCreateCertificateContext(X509_ASN_ENCODING, cert,
sizeof(cert)); sizeof(cert));
ok(context != NULL, "CertCreateCertificateContext failed: %08lx\n", ok(context != NULL, "CertCreateCertificateContext failed: %08x\n",
GetLastError()); GetLastError());
if (context) if (context)
{ {
...@@ -336,13 +336,13 @@ static void test_CertNameToStrA(void) ...@@ -336,13 +336,13 @@ static void test_CertNameToStrA(void)
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = pCertNameToStrA(0, &context->pCertInfo->Issuer, 0, NULL, 0); ret = pCertNameToStrA(0, &context->pCertInfo->Issuer, 0, NULL, 0);
ok(ret == 1 && GetLastError() == ERROR_FILE_NOT_FOUND, ok(ret == 1 && GetLastError() == ERROR_FILE_NOT_FOUND,
"Expected retval 1 and ERROR_FILE_NOT_FOUND, got %ld - %08lx\n", "Expected retval 1 and ERROR_FILE_NOT_FOUND, got %d - %08x\n",
ret, GetLastError()); ret, GetLastError());
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = pCertNameToStrA(X509_ASN_ENCODING, &context->pCertInfo->Issuer, ret = pCertNameToStrA(X509_ASN_ENCODING, &context->pCertInfo->Issuer,
0, NULL, 0); 0, NULL, 0);
ok(ret && GetLastError() == ERROR_SUCCESS, ok(ret && GetLastError() == ERROR_SUCCESS,
"Expected positive return and ERROR_SUCCESS, got %ld - %08lx\n", "Expected positive return and ERROR_SUCCESS, got %d - %08x\n",
ret, GetLastError()); ret, GetLastError());
test_NameToStrConversionA(&context->pCertInfo->Issuer, test_NameToStrConversionA(&context->pCertInfo->Issuer,
...@@ -375,11 +375,11 @@ static void test_NameToStrConversionW(PCERT_NAME_BLOB pName, DWORD dwStrType, ...@@ -375,11 +375,11 @@ static void test_NameToStrConversionW(PCERT_NAME_BLOB pName, DWORD dwStrType,
DWORD i; DWORD i;
i = pCertNameToStrW(X509_ASN_ENCODING,pName, dwStrType, NULL, 0); i = pCertNameToStrW(X509_ASN_ENCODING,pName, dwStrType, NULL, 0);
ok(i == lstrlenW(expected) + 1, "Expected %d chars, got %ld\n", ok(i == lstrlenW(expected) + 1, "Expected %d chars, got %d\n",
lstrlenW(expected) + 1, i); lstrlenW(expected) + 1, i);
i = pCertNameToStrW(X509_ASN_ENCODING,pName, dwStrType, buffer, i = pCertNameToStrW(X509_ASN_ENCODING,pName, dwStrType, buffer,
sizeof(buffer) / sizeof(buffer[0])); sizeof(buffer) / sizeof(buffer[0]));
ok(i == lstrlenW(expected) + 1, "Expected %d chars, got %ld\n", ok(i == lstrlenW(expected) + 1, "Expected %d chars, got %d\n",
lstrlenW(expected) + 1, i); lstrlenW(expected) + 1, i);
ok(!lstrcmpW(buffer, expected), "Unexpected value\n"); ok(!lstrcmpW(buffer, expected), "Unexpected value\n");
#ifdef DUMP_STRINGS #ifdef DUMP_STRINGS
...@@ -396,7 +396,7 @@ static void test_CertNameToStrW(void) ...@@ -396,7 +396,7 @@ static void test_CertNameToStrW(void)
context = CertCreateCertificateContext(X509_ASN_ENCODING, cert, context = CertCreateCertificateContext(X509_ASN_ENCODING, cert,
sizeof(cert)); sizeof(cert));
ok(context != NULL, "CertCreateCertificateContext failed: %08lx\n", ok(context != NULL, "CertCreateCertificateContext failed: %08x\n",
GetLastError()); GetLastError());
if (context) if (context)
{ {
...@@ -409,13 +409,13 @@ static void test_CertNameToStrW(void) ...@@ -409,13 +409,13 @@ static void test_CertNameToStrW(void)
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = pCertNameToStrW(0, &context->pCertInfo->Issuer, 0, NULL, 0); ret = pCertNameToStrW(0, &context->pCertInfo->Issuer, 0, NULL, 0);
ok(ret == 1 && GetLastError() == ERROR_FILE_NOT_FOUND, ok(ret == 1 && GetLastError() == ERROR_FILE_NOT_FOUND,
"Expected retval 1 and ERROR_FILE_NOT_FOUND, got %ld - %08lx\n", "Expected retval 1 and ERROR_FILE_NOT_FOUND, got %d - %08x\n",
ret, GetLastError()); ret, GetLastError());
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = pCertNameToStrW(X509_ASN_ENCODING, &context->pCertInfo->Issuer, ret = pCertNameToStrW(X509_ASN_ENCODING, &context->pCertInfo->Issuer,
0, NULL, 0); 0, NULL, 0);
ok(ret && GetLastError() == ERROR_SUCCESS, ok(ret && GetLastError() == ERROR_SUCCESS,
"Expected positive return and ERROR_SUCCESS, got %ld - %08lx\n", "Expected positive return and ERROR_SUCCESS, got %d - %08x\n",
ret, GetLastError()); ret, GetLastError());
test_NameToStrConversionW(&context->pCertInfo->Issuer, test_NameToStrConversionW(&context->pCertInfo->Issuer,
...@@ -482,33 +482,33 @@ static void test_CertStrToNameA(void) ...@@ -482,33 +482,33 @@ static void test_CertStrToNameA(void)
ok(!ret, "Expected failure\n"); ok(!ret, "Expected failure\n");
ret = pCertStrToNameA(0, "bogus", 0, NULL, NULL, &size, NULL); ret = pCertStrToNameA(0, "bogus", 0, NULL, NULL, &size, NULL);
ok(!ret && GetLastError() == CRYPT_E_INVALID_X500_STRING, ok(!ret && GetLastError() == CRYPT_E_INVALID_X500_STRING,
"Expected CRYPT_E_INVALID_X500_STRING, got %08lx\n", GetLastError()); "Expected CRYPT_E_INVALID_X500_STRING, got %08x\n", GetLastError());
ret = pCertStrToNameA(0, "foo=1", 0, NULL, NULL, &size, NULL); ret = pCertStrToNameA(0, "foo=1", 0, NULL, NULL, &size, NULL);
ok(!ret && GetLastError() == CRYPT_E_INVALID_X500_STRING, ok(!ret && GetLastError() == CRYPT_E_INVALID_X500_STRING,
"Expected CRYPT_E_INVALID_X500_STRING, got %08lx\n", GetLastError()); "Expected CRYPT_E_INVALID_X500_STRING, got %08x\n", GetLastError());
ret = pCertStrToNameA(0, "CN=1", 0, NULL, NULL, &size, NULL); ret = pCertStrToNameA(0, "CN=1", 0, NULL, NULL, &size, NULL);
ok(!ret && GetLastError() == ERROR_FILE_NOT_FOUND, ok(!ret && GetLastError() == ERROR_FILE_NOT_FOUND,
"Expected ERROR_FILE_NOT_FOUND, got %08lx\n", GetLastError()); "Expected ERROR_FILE_NOT_FOUND, got %08x\n", GetLastError());
ret = pCertStrToNameA(X509_ASN_ENCODING, "CN=1", 0, NULL, NULL, &size, NULL); ret = pCertStrToNameA(X509_ASN_ENCODING, "CN=1", 0, NULL, NULL, &size, NULL);
ok(ret, "CertStrToNameA failed: %08lx\n", GetLastError()); ok(ret, "CertStrToNameA failed: %08x\n", GetLastError());
size = sizeof(buf); size = sizeof(buf);
ret = pCertStrToNameA(X509_ASN_ENCODING, "CN=\"\"1\"\"", 0, NULL, buf, &size, ret = pCertStrToNameA(X509_ASN_ENCODING, "CN=\"\"1\"\"", 0, NULL, buf, &size,
NULL); NULL);
ok(!ret && GetLastError() == CRYPT_E_INVALID_X500_STRING, ok(!ret && GetLastError() == CRYPT_E_INVALID_X500_STRING,
"Expected CRYPT_E_INVALID_X500_STRING, got %08lx\n", GetLastError()); "Expected CRYPT_E_INVALID_X500_STRING, got %08x\n", GetLastError());
ret = pCertStrToNameA(X509_ASN_ENCODING, "CN=1+2", 0, NULL, buf, ret = pCertStrToNameA(X509_ASN_ENCODING, "CN=1+2", 0, NULL, buf,
&size, NULL); &size, NULL);
todo_wine ok(!ret && GetLastError() == CRYPT_E_INVALID_X500_STRING, todo_wine ok(!ret && GetLastError() == CRYPT_E_INVALID_X500_STRING,
"Expected CRYPT_E_INVALID_X500_STRING, got %08lx\n", GetLastError()); "Expected CRYPT_E_INVALID_X500_STRING, got %08x\n", GetLastError());
for (i = 0; i < sizeof(namesA) / sizeof(namesA[0]); i++) for (i = 0; i < sizeof(namesA) / sizeof(namesA[0]); i++)
{ {
size = sizeof(buf); size = sizeof(buf);
ret = pCertStrToNameA(X509_ASN_ENCODING, namesA[i].x500, 0, NULL, buf, ret = pCertStrToNameA(X509_ASN_ENCODING, namesA[i].x500, 0, NULL, buf,
&size, NULL); &size, NULL);
ok(ret, "CertStrToNameA failed on string %s: %08lx\n", namesA[i].x500, ok(ret, "CertStrToNameA failed on string %s: %08x\n", namesA[i].x500,
GetLastError()); GetLastError());
ok(size == namesA[i].encodedSize, ok(size == namesA[i].encodedSize,
"Expected size %ld, got %ld\n", namesA[i].encodedSize, size); "Expected size %d, got %d\n", namesA[i].encodedSize, size);
if (ret) if (ret)
ok(!memcmp(buf, namesA[i].encoded, namesA[i].encodedSize), ok(!memcmp(buf, namesA[i].encoded, namesA[i].encodedSize),
"Unexpected value for string %s\n", namesA[i].x500); "Unexpected value for string %s\n", namesA[i].x500);
...@@ -563,38 +563,38 @@ static void test_CertStrToNameW(void) ...@@ -563,38 +563,38 @@ static void test_CertStrToNameW(void)
ok(!ret, "Expected failure\n"); ok(!ret, "Expected failure\n");
ret = pCertStrToNameW(0, bogusW, 0, NULL, NULL, &size, NULL); ret = pCertStrToNameW(0, bogusW, 0, NULL, NULL, &size, NULL);
ok(!ret && GetLastError() == CRYPT_E_INVALID_X500_STRING, ok(!ret && GetLastError() == CRYPT_E_INVALID_X500_STRING,
"Expected CRYPT_E_INVALID_X500_STRING, got %08lx\n", GetLastError()); "Expected CRYPT_E_INVALID_X500_STRING, got %08x\n", GetLastError());
ret = pCertStrToNameW(0, fooW, 0, NULL, NULL, &size, NULL); ret = pCertStrToNameW(0, fooW, 0, NULL, NULL, &size, NULL);
ok(!ret && GetLastError() == CRYPT_E_INVALID_X500_STRING, ok(!ret && GetLastError() == CRYPT_E_INVALID_X500_STRING,
"Expected CRYPT_E_INVALID_X500_STRING, got %08lx\n", GetLastError()); "Expected CRYPT_E_INVALID_X500_STRING, got %08x\n", GetLastError());
ret = pCertStrToNameW(0, simpleCN_W, 0, NULL, NULL, &size, NULL); ret = pCertStrToNameW(0, simpleCN_W, 0, NULL, NULL, &size, NULL);
ok(!ret && GetLastError() == ERROR_FILE_NOT_FOUND, ok(!ret && GetLastError() == ERROR_FILE_NOT_FOUND,
"Expected ERROR_FILE_NOT_FOUND, got %08lx\n", GetLastError()); "Expected ERROR_FILE_NOT_FOUND, got %08x\n", GetLastError());
ret = pCertStrToNameW(X509_ASN_ENCODING, simpleCN_W, 0, NULL, NULL, &size, ret = pCertStrToNameW(X509_ASN_ENCODING, simpleCN_W, 0, NULL, NULL, &size,
NULL); NULL);
ok(ret, "CertStrToNameW failed: %08lx\n", GetLastError()); ok(ret, "CertStrToNameW failed: %08x\n", GetLastError());
size = sizeof(buf); size = sizeof(buf);
ret = pCertStrToNameW(X509_ASN_ENCODING, badlyQuotedCN_W, 0, NULL, buf, ret = pCertStrToNameW(X509_ASN_ENCODING, badlyQuotedCN_W, 0, NULL, buf,
&size, NULL); &size, NULL);
ok(!ret && GetLastError() == CRYPT_E_INVALID_X500_STRING, ok(!ret && GetLastError() == CRYPT_E_INVALID_X500_STRING,
"Expected CRYPT_E_INVALID_X500_STRING, got %08lx\n", GetLastError()); "Expected CRYPT_E_INVALID_X500_STRING, got %08x\n", GetLastError());
ret = pCertStrToNameW(X509_ASN_ENCODING, badlyQuotedCN_W, 0, NULL, buf, ret = pCertStrToNameW(X509_ASN_ENCODING, badlyQuotedCN_W, 0, NULL, buf,
&size, &errorPtr); &size, &errorPtr);
ok(!ret && GetLastError() == CRYPT_E_INVALID_X500_STRING, ok(!ret && GetLastError() == CRYPT_E_INVALID_X500_STRING,
"Expected CRYPT_E_INVALID_X500_STRING, got %08lx\n", GetLastError()); "Expected CRYPT_E_INVALID_X500_STRING, got %08x\n", GetLastError());
ok(errorPtr && *errorPtr == '1', "Expected first error character was 1\n"); ok(errorPtr && *errorPtr == '1', "Expected first error character was 1\n");
for (i = 0; i < sizeof(namesW) / sizeof(namesW[0]); i++) for (i = 0; i < sizeof(namesW) / sizeof(namesW[0]); i++)
{ {
size = sizeof(buf); size = sizeof(buf);
ret = pCertStrToNameW(X509_ASN_ENCODING, namesW[i].x500, 0, NULL, buf, ret = pCertStrToNameW(X509_ASN_ENCODING, namesW[i].x500, 0, NULL, buf,
&size, NULL); &size, NULL);
ok(ret, "Index %ld: CertStrToNameW failed: %08lx\n", i, GetLastError()); ok(ret, "Index %d: CertStrToNameW failed: %08x\n", i, GetLastError());
ok(size == namesW[i].encodedSize, ok(size == namesW[i].encodedSize,
"Index %ld: expected size %ld, got %ld\n", i, namesW[i].encodedSize, "Index %d: expected size %d, got %d\n", i, namesW[i].encodedSize,
size); size);
if (ret) if (ret)
ok(!memcmp(buf, namesW[i].encoded, size), ok(!memcmp(buf, namesW[i].encoded, size),
"Index %ld: unexpected value\n", i); "Index %d: unexpected value\n", i);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment