sync crypt32_winetest with wine 1.1.13

svn path=/trunk/; revision=38943
This commit is contained in:
Christoph von Wittich 2009-01-19 16:47:57 +00:00
parent d58aa939f6
commit ab1f060739
3 changed files with 307 additions and 312 deletions

View file

@ -551,7 +551,7 @@ static void testCertProperties(void)
ok(ret, "CertSetCertificateContextProperty failed: %08x\n", GetLastError());
/* Now that that's set, the key prov handle property is also gettable.
*/
size = sizeof(DWORD);
size = sizeof(keyContext.hCryptProv);
ret = CertGetCertificateContextProperty(context,
CERT_KEY_PROV_HANDLE_PROP_ID, &keyContext.hCryptProv, &size);
ok(ret, "Expected to get the CERT_KEY_PROV_HANDLE_PROP_ID, got %08x\n",
@ -1678,7 +1678,7 @@ static void testVerifyCertSig(HCRYPTPROV csp, const CRYPT_DATA_BLOB *toBeSigned,
info.Signature.pbData = (BYTE *)sig;
info.Signature.cUnusedBits = 0;
ret = pCryptEncodeObjectEx(X509_ASN_ENCODING, X509_CERT, &info,
CRYPT_ENCODE_ALLOC_FLAG, NULL, (BYTE *)&cert, &size);
CRYPT_ENCODE_ALLOC_FLAG, NULL, &cert, &size);
ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
if (cert)
{

File diff suppressed because it is too large Load diff

View file

@ -26,6 +26,9 @@
#include "wine/test.h"
static BOOL (WINAPI * pCryptQueryObject)(DWORD, const void *, DWORD, DWORD,
DWORD, DWORD *, DWORD *, DWORD *, HCERTSTORE *, HCRYPTMSG *, const void **);
static BYTE bigCert[] = {
0x30,0x7a,0x02,0x01,0x01,0x30,0x02,0x06,0x00,0x30,0x15,0x31,
0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,
@ -128,12 +131,12 @@ static void test_query_object(void)
/* Test the usual invalid arguments */
SetLastError(0xdeadbeef);
ret = CryptQueryObject(0, NULL, 0, 0, 0, NULL, NULL, NULL, NULL, NULL,
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());
SetLastError(0xdeadbeef);
ret = CryptQueryObject(CERT_QUERY_OBJECT_BLOB, NULL, 0, 0, 0, NULL, NULL,
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());
@ -141,7 +144,7 @@ static void test_query_object(void)
blob.pbData = bigCert;
blob.cbData = sizeof(bigCert);
SetLastError(0xdeadbeef);
ret = CryptQueryObject(CERT_QUERY_OBJECT_BLOB, &blob,
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());
@ -149,19 +152,19 @@ static void test_query_object(void)
blob.pbData = (BYTE *)bigCertBase64;
blob.cbData = sizeof(bigCertBase64);
SetLastError(0xdeadbeef);
ret = CryptQueryObject(CERT_QUERY_OBJECT_BLOB, &blob,
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());
/* The same base64-encoded cert, restricting the format types */
SetLastError(0xdeadbeef);
ret = CryptQueryObject(CERT_QUERY_OBJECT_BLOB, &blob,
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());
SetLastError(0xdeadbeef);
ret = CryptQueryObject(CERT_QUERY_OBJECT_BLOB, &blob,
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());
@ -169,7 +172,7 @@ static void test_query_object(void)
blob.pbData = (BYTE *)bigCertBase64W;
blob.cbData = sizeof(bigCertBase64W);
SetLastError(0xdeadbeef);
ret = CryptQueryObject(CERT_QUERY_OBJECT_BLOB, &blob,
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 && GetLastError() == CRYPT_E_NO_MATCH,
@ -182,14 +185,14 @@ static void test_query_object(void)
blob.pbData = signedWithCertWithValidPubKeyContent;
blob.cbData = sizeof(signedWithCertWithValidPubKeyContent);
SetLastError(0xdeadbeef);
ret = CryptQueryObject(CERT_QUERY_OBJECT_BLOB, &blob,
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());
blob.pbData = (BYTE *)signedWithCertWithValidPubKeyContentBase64;
blob.cbData = sizeof(signedWithCertWithValidPubKeyContentBase64);
SetLastError(0xdeadbeef);
ret = CryptQueryObject(CERT_QUERY_OBJECT_BLOB, &blob,
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());
@ -199,18 +202,18 @@ static void test_query_object(void)
blob.pbData = (BYTE *)signedWithCertWithValidPubKeyContentBase64W;
blob.cbData = sizeof(signedWithCertWithValidPubKeyContentBase64W);
SetLastError(0xdeadbeef);
ret = CryptQueryObject(CERT_QUERY_OBJECT_BLOB, &blob,
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());
SetLastError(0xdeadbeef);
ret = CryptQueryObject(CERT_QUERY_OBJECT_BLOB, &blob,
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());
SetLastError(0xdeadbeef);
ret = CryptQueryObject(CERT_QUERY_OBJECT_BLOB, &blob,
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());
@ -218,5 +221,15 @@ static void test_query_object(void)
START_TEST(object)
{
HMODULE mod = GetModuleHandleA("crypt32.dll");
pCryptQueryObject = (void *)GetProcAddress(mod, "CryptQueryObject");
if (!pCryptQueryObject)
{
win_skip("CryptQueryObject is not available\n");
return;
}
test_query_object();
}