Commit c51ea856 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

crypt32/tests: Enable compilation with long types.

parent cdc92a7b
EXTRADEFS = -DWINE_NO_LONG_TYPES
TESTDLL = crypt32.dll
IMPORTS = crypt32 advapi32 user32 shlwapi shell32 bcrypt
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -134,12 +134,12 @@ static void test_query_object(void)
ret = pCryptQueryObject(0, NULL, 0, 0, 0, NULL, NULL, NULL, NULL, NULL,
NULL);
ok(!ret && GetLastError() == E_INVALIDARG,
"expected E_INVALIDARG, got %08x\n", GetLastError());
"expected E_INVALIDARG, got %08lx\n", GetLastError());
SetLastError(0xdeadbeef);
ret = pCryptQueryObject(CERT_QUERY_OBJECT_BLOB, NULL, 0, 0, 0, NULL, NULL,
NULL, NULL, NULL, NULL);
ok(!ret && GetLastError() == E_INVALIDARG,
"expected E_INVALIDARG, got %08x\n", GetLastError());
"expected E_INVALIDARG, got %08lx\n", GetLastError());
/* Test with a simple cert */
blob.pbData = bigCert;
blob.cbData = sizeof(bigCert);
......@@ -147,7 +147,7 @@ static void test_query_object(void)
ret = pCryptQueryObject(CERT_QUERY_OBJECT_BLOB, &blob,
CERT_QUERY_CONTENT_FLAG_ALL, CERT_QUERY_FORMAT_FLAG_ALL, 0, NULL, NULL,
NULL, NULL, NULL, NULL);
ok(ret, "CryptQueryObject failed: %08x\n", GetLastError());
ok(ret, "CryptQueryObject failed: %08lx\n", GetLastError());
/* The same cert, base64-encoded */
blob.pbData = (BYTE *)bigCertBase64;
blob.cbData = sizeof(bigCertBase64);
......@@ -155,19 +155,19 @@ static void test_query_object(void)
ret = pCryptQueryObject(CERT_QUERY_OBJECT_BLOB, &blob,
CERT_QUERY_CONTENT_FLAG_ALL, CERT_QUERY_FORMAT_FLAG_ALL, 0, NULL, NULL,
NULL, NULL, NULL, NULL);
ok(ret, "CryptQueryObject failed: %08x\n", GetLastError());
ok(ret, "CryptQueryObject failed: %08lx\n", GetLastError());
/* The same base64-encoded cert, restricting the format types */
SetLastError(0xdeadbeef);
ret = pCryptQueryObject(CERT_QUERY_OBJECT_BLOB, &blob,
CERT_QUERY_CONTENT_FLAG_ALL, CERT_QUERY_FORMAT_FLAG_BINARY, 0, NULL, NULL,
NULL, NULL, NULL, NULL);
ok(!ret && GetLastError() == CRYPT_E_NO_MATCH,
"expected CRYPT_E_NO_MATCH, got %08x\n", GetLastError());
"expected CRYPT_E_NO_MATCH, got %08lx\n", GetLastError());
SetLastError(0xdeadbeef);
ret = pCryptQueryObject(CERT_QUERY_OBJECT_BLOB, &blob,
CERT_QUERY_CONTENT_FLAG_ALL, CERT_QUERY_FORMAT_FLAG_BASE64_ENCODED, 0,
NULL, NULL, NULL, NULL, NULL, NULL);
ok(ret, "CryptQueryObject failed: %08x\n", GetLastError());
ok(ret, "CryptQueryObject failed: %08lx\n", GetLastError());
/* The same cert, base64-encoded but as a wide character string */
blob.pbData = (BYTE *)bigCertBase64W;
blob.cbData = sizeof(bigCertBase64W);
......@@ -176,7 +176,7 @@ static void test_query_object(void)
CERT_QUERY_CONTENT_FLAG_ALL, CERT_QUERY_FORMAT_FLAG_ALL, 0, NULL, NULL,
NULL, NULL, NULL, NULL);
ok(!ret && GetLastError() == CRYPT_E_NO_MATCH,
"expected CRYPT_E_NO_MATCH, got %08x\n", GetLastError());
"expected CRYPT_E_NO_MATCH, got %08lx\n", GetLastError());
/* For brevity, not tested here, but tested on Windows: same failure
* (CRYPT_E_NO_MATCH) when the wide character base64-encoded cert
* is written to a file and queried.
......@@ -188,14 +188,14 @@ static void test_query_object(void)
ret = pCryptQueryObject(CERT_QUERY_OBJECT_BLOB, &blob,
CERT_QUERY_CONTENT_FLAG_ALL, CERT_QUERY_FORMAT_FLAG_ALL, 0, NULL, NULL,
NULL, NULL, NULL, NULL);
ok(ret, "CryptQueryObject failed: %08x\n", GetLastError());
ok(ret, "CryptQueryObject failed: %08lx\n", GetLastError());
blob.pbData = (BYTE *)signedWithCertWithValidPubKeyContentBase64;
blob.cbData = sizeof(signedWithCertWithValidPubKeyContentBase64);
SetLastError(0xdeadbeef);
ret = pCryptQueryObject(CERT_QUERY_OBJECT_BLOB, &blob,
CERT_QUERY_CONTENT_FLAG_ALL, CERT_QUERY_FORMAT_FLAG_ALL, 0, NULL, NULL,
NULL, NULL, NULL, NULL);
ok(ret, "CryptQueryObject failed: %08x\n", GetLastError());
ok(ret, "CryptQueryObject failed: %08lx\n", GetLastError());
/* A valid signed message, encoded as a wide character base64 string, can
* be queried successfully.
*/
......@@ -205,18 +205,18 @@ static void test_query_object(void)
ret = pCryptQueryObject(CERT_QUERY_OBJECT_BLOB, &blob,
CERT_QUERY_CONTENT_FLAG_ALL, CERT_QUERY_FORMAT_FLAG_ALL, 0, NULL, NULL,
NULL, NULL, NULL, NULL);
ok(ret, "CryptQueryObject failed: %08x\n", GetLastError());
ok(ret, "CryptQueryObject failed: %08lx\n", GetLastError());
SetLastError(0xdeadbeef);
ret = pCryptQueryObject(CERT_QUERY_OBJECT_BLOB, &blob,
CERT_QUERY_CONTENT_FLAG_ALL, CERT_QUERY_FORMAT_FLAG_BINARY, 0, NULL, NULL,
NULL, NULL, NULL, NULL);
ok(!ret && GetLastError() == CRYPT_E_NO_MATCH,
"expected CRYPT_E_NO_MATCH, got %08x\n", GetLastError());
"expected CRYPT_E_NO_MATCH, got %08lx\n", GetLastError());
SetLastError(0xdeadbeef);
ret = pCryptQueryObject(CERT_QUERY_OBJECT_BLOB, &blob,
CERT_QUERY_CONTENT_FLAG_ALL, CERT_QUERY_FORMAT_FLAG_BASE64_ENCODED, 0,
NULL, NULL, NULL, NULL, NULL, NULL);
ok(ret, "CryptQueryObject failed: %08x\n", GetLastError());
ok(ret, "CryptQueryObject failed: %08lx\n", GetLastError());
}
START_TEST(object)
......
......@@ -55,13 +55,13 @@ static void test_cryptprotectdata(void)
protected = pCryptProtectData(NULL,desc,NULL,NULL,NULL,0,&cipher);
ok(!protected, "Encrypting without plain data source.\n");
r = GetLastError();
ok(r == ERROR_INVALID_PARAMETER, "Wrong (%u) GetLastError seen\n",r);
ok(r == ERROR_INVALID_PARAMETER, "Wrong (%lu) GetLastError seen\n",r);
SetLastError(0xDEADBEEF);
protected = pCryptProtectData(&plain,desc,NULL,NULL,NULL,0,NULL);
ok(!protected, "Encrypting without cipher destination.\n");
r = GetLastError();
ok(r == ERROR_INVALID_PARAMETER, "Wrong (%u) GetLastError seen\n",r);
ok(r == ERROR_INVALID_PARAMETER, "Wrong (%lu) GetLastError seen\n",r);
cipher.pbData=NULL;
cipher.cbData=0;
......@@ -77,7 +77,7 @@ static void test_cryptprotectdata(void)
r = GetLastError();
ok(r == ERROR_SUCCESS ||
r == ERROR_IO_PENDING, /* win2k */
"Expected ERROR_SUCCESS or ERROR_IO_PENDING, got %d\n",r);
"Expected ERROR_SUCCESS or ERROR_IO_PENDING, got %ld\n",r);
}
cipher_entropy.pbData=NULL;
......@@ -102,7 +102,7 @@ static void test_cryptprotectdata(void)
{
/* fails in win2k */
ok(GetLastError() == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
"Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
}
}
......@@ -131,13 +131,13 @@ static void test_cryptunprotectdata(void)
okay = pCryptUnprotectData(&cipher,NULL,NULL,NULL,NULL,0,NULL);
ok(!okay,"Decrypting without destination\n");
r = GetLastError();
ok(r == ERROR_INVALID_PARAMETER, "Wrong (%u) GetLastError seen\n",r);
ok(r == ERROR_INVALID_PARAMETER, "Wrong (%lu) GetLastError seen\n",r);
SetLastError(0xDEADBEEF);
okay = pCryptUnprotectData(NULL,NULL,NULL,NULL,NULL,0,&plain);
ok(!okay,"Decrypting without source\n");
r = GetLastError();
ok(r == ERROR_INVALID_PARAMETER, "Wrong (%u) GetLastError seen\n",r);
ok(r == ERROR_INVALID_PARAMETER, "Wrong (%lu) GetLastError seen\n",r);
plain.pbData=NULL;
plain.cbData=0;
......@@ -146,7 +146,7 @@ static void test_cryptunprotectdata(void)
okay = pCryptUnprotectData(&cipher_entropy,NULL,NULL,NULL,NULL,0,&plain);
ok(!okay,"Decrypting without needed entropy\n");
r = GetLastError();
ok(r == ERROR_INVALID_DATA, "Wrong (%u) GetLastError seen\n", r);
ok(r == ERROR_INVALID_DATA, "Wrong (%lu) GetLastError seen\n", r);
plain.pbData=NULL;
plain.cbData=0;
......@@ -175,7 +175,7 @@ static void test_cryptunprotectdata(void)
okay = pCryptUnprotectData(&cipher_entropy,&data_desc,&cipher_entropy,NULL,NULL,0,&plain);
ok(!okay,"Decrypting with wrong entropy\n");
r = GetLastError();
ok(r == ERROR_INVALID_DATA, "Wrong (%u) GetLastError seen\n",r);
ok(r == ERROR_INVALID_DATA, "Wrong (%lu) GetLastError seen\n",r);
/* with entropy */
SetLastError(0xDEADBEEF);
......@@ -234,8 +234,8 @@ static void test_simpleroundtrip(const char *plaintext)
}
res = pCryptUnprotectData(&encrypted, NULL, NULL, NULL, NULL, 0, &output);
ok(res != 0, "can't unprotect; last error %u\n", GetLastError());
ok(output.cbData == strlen(plaintext), "output wrong length %d for input '%s', wanted %d\n", output.cbData, plaintext, lstrlenA(plaintext));
ok(res != 0, "can't unprotect; last error %lu\n", GetLastError());
ok(output.cbData == strlen(plaintext), "output wrong length %ld for input '%s', wanted %d\n", output.cbData, plaintext, lstrlenA(plaintext));
ok(!memcmp(plaintext, (char *)output.pbData, output.cbData), "output wrong contents for input '%s'\n", plaintext);
LocalFree(output.pbData);
LocalFree(encrypted.pbData);
......
......@@ -49,7 +49,7 @@ static void test_AddRemoveProvider(void)
ret = CryptSIPRemoveProvider(NULL);
ok (!ret, "Expected CryptSIPRemoveProvider to fail.\n");
ok (GetLastError() == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %d.\n", GetLastError());
"Expected ERROR_INVALID_PARAMETER, got %ld.\n", GetLastError());
/* nonexistent provider should result in a registry error */
SetLastError(0xdeadbeef);
......@@ -68,7 +68,7 @@ static void test_AddRemoveProvider(void)
*/
if (!ret)
ok (GetLastError() == ERROR_FILE_NOT_FOUND,
"Expected ERROR_FILE_NOT_FOUND, got %d.\n", GetLastError());
"Expected ERROR_FILE_NOT_FOUND, got %ld.\n", GetLastError());
}
/* Everything OK, pwszIsFunctionName and pwszIsFunctionNameFmt2 are left NULL
......@@ -90,7 +90,7 @@ static void test_AddRemoveProvider(void)
skip("Need admin rights\n");
return;
}
ok ( ret, "CryptSIPAddProvider should have succeeded, last error %d\n", GetLastError());
ok ( ret, "CryptSIPAddProvider should have succeeded, last error %ld\n", GetLastError());
/* Dummy provider will be deleted, but the function still fails because
* pwszIsFunctionName and pwszIsFunctionNameFmt2 are not present in the
......@@ -105,7 +105,7 @@ static void test_AddRemoveProvider(void)
*/
if (!ret)
ok (GetLastError() == ERROR_FILE_NOT_FOUND,
"Expected ERROR_FILE_NOT_FOUND, got %d.\n", GetLastError());
"Expected ERROR_FILE_NOT_FOUND, got %ld.\n", GetLastError());
/* Everything OK */
memset(&newprov, 0, sizeof(SIP_ADD_NEWPROVIDER));
......@@ -124,12 +124,12 @@ static void test_AddRemoveProvider(void)
SetLastError(0xdeadbeef);
ret = CryptSIPAddProvider(&newprov);
ok ( ret, "CryptSIPAddProvider should have succeeded, last error %d\n", GetLastError());
ok ( ret, "CryptSIPAddProvider should have succeeded, last error %ld\n", GetLastError());
/* Dummy provider should be deleted */
SetLastError(0xdeadbeef);
ret = CryptSIPRemoveProvider(&actionid);
ok ( ret, "CryptSIPRemoveProvider should have succeeded, last error %d\n", GetLastError());
ok ( ret, "CryptSIPRemoveProvider should have succeeded, last error %ld\n", GetLastError());
}
static const BYTE cabFileData[] = {
......@@ -164,7 +164,7 @@ static void test_SIPRetrieveSubjectGUID(void)
ret = CryptSIPRetrieveSubjectGuid(NULL, NULL, NULL);
ok ( !ret, "Expected CryptSIPRetrieveSubjectGuid to fail\n");
ok (GetLastError() == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %d.\n", GetLastError());
"Expected ERROR_INVALID_PARAMETER, got %ld.\n", GetLastError());
/* Test with a nonexistent file (hopefully) */
SetLastError(0xdeadbeef);
......@@ -174,7 +174,7 @@ static void test_SIPRetrieveSubjectGUID(void)
ok ( !ret, "Expected CryptSIPRetrieveSubjectGuid to fail\n");
ok (GetLastError() == ERROR_FILE_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 %ld.\n",
GetLastError());
ok(IsEqualGUID(&subject, &nullSubject),
"Expected a NULL GUID for c:\\deadbeef.dbf, not %s\n", wine_dbgstr_guid(&subject));
......@@ -184,7 +184,7 @@ static void test_SIPRetrieveSubjectGUID(void)
* Use A-functions where possible as that should be available on all platforms
*/
ret = GetEnvironmentVariableA(windir, regeditPath, MAX_PATH);
ok (ret > 0, "expected GEVA(windir) to succeed, last error %d\n", GetLastError());
ok (ret > 0, "expected GEVA(windir) to succeed, last error %ld\n", GetLastError());
strcat(regeditPath, "\\");
strcat(regeditPath, regeditExe);
MultiByteToWideChar(CP_ACP, 0, regeditPath, strlen(regeditPath)+1, regeditPathW,
......@@ -230,7 +230,7 @@ static void test_SIPRetrieveSubjectGUID(void)
GetLastError() == ERROR_INVALID_PARAMETER /* Vista */ ||
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());
"Expected ERROR_FILE_INVALID, ERROR_INVALID_PARAMETER, ERROR_SUCCESS or TRUST_E_SUBJECT_FORM_UNKNOWN, got 0x%08lx\n", GetLastError());
ok(IsEqualGUID(&subject, &nullSubject),
"Expected a NULL GUID for empty file %s, not %s\n", tempfile, wine_dbgstr_guid(&subject));
......@@ -246,7 +246,7 @@ static void test_SIPRetrieveSubjectGUID(void)
ok ( GetLastError() == ERROR_INVALID_PARAMETER ||
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());
"Expected ERROR_INVALID_PARAMETER, ERROR_SUCCESS or TRUST_E_SUBJECT_FORM_UNKNOWN, got 0x%08lx\n", GetLastError());
ok(IsEqualGUID(&subject, &nullSubject),
"Expected a NULL GUID for empty file %s, not %s\n", tempfile, wine_dbgstr_guid(&subject));
......@@ -261,7 +261,7 @@ static void test_SIPRetrieveSubjectGUID(void)
ok ( !ret, "Expected CryptSIPRetrieveSubjectGuid to fail\n");
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());
"Expected TRUST_E_SUBJECT_FORM_UNKNOWN or ERROR_SUCCESS, got 0x%08lx\n", GetLastError());
ok(IsEqualGUID(&subject, &nullSubject),
"Expected a NULL GUID for empty file %s, not %s\n", tempfile, wine_dbgstr_guid(&subject));
......@@ -271,14 +271,14 @@ static void test_SIPRetrieveSubjectGUID(void)
/* Create a file with just the .cab header 'MSCF' */
SetLastError(0xdeadbeef);
file = CreateFileA(tempfile, GENERIC_WRITE, 0, NULL, CREATE_NEW, 0, NULL);
ok(file != INVALID_HANDLE_VALUE, "failed with %u\n", GetLastError());
ok(file != INVALID_HANDLE_VALUE, "failed with %lu\n", GetLastError());
WriteFile(file, cabFileData, 4, &written, NULL);
CloseHandle(file);
SetLastError(0xdeadbeef);
memset(&subject, 1, sizeof(GUID));
ret = CryptSIPRetrieveSubjectGuid(tempfileW, NULL, &subject);
ok( ret, "CryptSIPRetrieveSubjectGuid failed: %d (0x%08x)\n",
ok( ret, "CryptSIPRetrieveSubjectGuid failed: %ld (0x%08lx)\n",
GetLastError(), GetLastError() );
ok(IsEqualGUID(&subject, &cabGUID),
"Expected GUID %s for cabinet file, not %s\n", wine_dbgstr_guid(&cabGUID), wine_dbgstr_guid(&subject));
......@@ -289,14 +289,14 @@ static void test_SIPRetrieveSubjectGUID(void)
/* Create a .cab file */
SetLastError(0xdeadbeef);
file = CreateFileA(tempfile, GENERIC_WRITE, 0, NULL, CREATE_NEW, 0, NULL);
ok(file != INVALID_HANDLE_VALUE, "failed with %u\n", GetLastError());
ok(file != INVALID_HANDLE_VALUE, "failed with %lu\n", GetLastError());
WriteFile(file, cabFileData, sizeof(cabFileData), &written, NULL);
CloseHandle(file);
SetLastError(0xdeadbeef);
memset(&subject, 1, sizeof(GUID));
ret = CryptSIPRetrieveSubjectGuid(tempfileW, NULL, &subject);
ok( ret, "CryptSIPRetrieveSubjectGuid failed: %d (0x%08x)\n",
ok( ret, "CryptSIPRetrieveSubjectGuid failed: %ld (0x%08lx)\n",
GetLastError(), GetLastError() );
ok(IsEqualGUID(&subject, &cabGUID),
"Expected GUID %s for cabinet file, not %s\n", wine_dbgstr_guid(&cabGUID), wine_dbgstr_guid(&subject));
......@@ -322,14 +322,14 @@ static void test_SIPLoad(void)
ret = CryptSIPLoad(NULL, 0, NULL);
ok ( !ret, "Expected CryptSIPLoad to fail\n");
ok ( GetLastError() == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got 0x%08x\n", GetLastError());
"Expected ERROR_INVALID_PARAMETER, got 0x%08lx\n", GetLastError());
/* Only pSipDispatch NULL */
SetLastError(0xdeadbeef);
ret = CryptSIPLoad(&subject, 0, NULL);
ok ( !ret, "Expected CryptSIPLoad to fail\n");
ok ( GetLastError() == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got 0x%08x\n", GetLastError());
"Expected ERROR_INVALID_PARAMETER, got 0x%08lx\n", GetLastError());
/* No NULLs, but nonexistent pgSubject */
SetLastError(0xdeadbeef);
......@@ -339,7 +339,7 @@ static void test_SIPLoad(void)
ret = CryptSIPLoad(&dummySubject, 0, &sdi);
ok ( !ret, "Expected CryptSIPLoad to fail\n");
ok ( GetLastError() == TRUST_E_SUBJECT_FORM_UNKNOWN,
"Expected TRUST_E_SUBJECT_FORM_UNKNOWN, got 0x%08x\n", GetLastError());
"Expected TRUST_E_SUBJECT_FORM_UNKNOWN, got 0x%08lx\n", GetLastError());
ok( sdi.pfGet == (pCryptSIPGetSignedDataMsg)0xdeadbeef, "Expected no change to the function pointer\n");
hCrypt = GetModuleHandleA("crypt32.dll");
......@@ -430,7 +430,7 @@ static void test_SIPLoad(void)
ret = CryptSIPLoad(&unknown, 1, &sdi);
ok ( !ret, "Expected CryptSIPLoad to fail\n");
ok ( GetLastError() == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got 0x%08x\n", GetLastError());
"Expected ERROR_INVALID_PARAMETER, got 0x%08lx\n", GetLastError());
ok( sdi.pfGet == (pCryptSIPGetSignedDataMsg)0xdeadbeef, "Expected no change to the function pointer\n");
}
......
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