Author: cwittich
Date: Sat Jan 31 08:31:11 2009
New Revision: 39237
URL:
http://svn.reactos.org/svn/reactos?rev=39237&view=rev
Log:
sync crypt32_winetest with wine 1.1.14
Modified:
trunk/rostests/winetests/crypt32/cert.c
trunk/rostests/winetests/crypt32/encode.c
trunk/rostests/winetests/crypt32/msg.c
trunk/rostests/winetests/crypt32/protectdata.c
trunk/rostests/winetests/crypt32/store.c
trunk/rostests/winetests/crypt32/str.c
Modified: trunk/rostests/winetests/crypt32/cert.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/crypt32/cert.c?…
==============================================================================
--- trunk/rostests/winetests/crypt32/cert.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/crypt32/cert.c [iso-8859-1] Sat Jan 31 08:31:11 2009
@@ -662,6 +662,10 @@
CertFreeCertificateContext(context);
}
CertCloseStore(store, 0);
+
+ SetLastError(0xdeadbeef);
+ context = CertDuplicateCertificateContext(NULL);
+ ok(context == NULL, "Expected context to be NULL\n");
}
static BYTE subjectName3[] = { 0x30, 0x15, 0x31, 0x13, 0x30, 0x11, 0x06,
Modified: trunk/rostests/winetests/crypt32/encode.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/crypt32/encode.…
==============================================================================
--- trunk/rostests/winetests/crypt32/encode.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/crypt32/encode.c [iso-8859-1] Sat Jan 31 08:31:11 2009
@@ -808,7 +808,7 @@
attrs[0].pszObjId = "bogus";
attrs[0].dwValueType = CERT_RDN_PRINTABLE_STRING;
attrs[0].Value.cbData = sizeof(commonName);
- attrs[0].Value.pbData = (BYTE *)commonName;
+ attrs[0].Value.pbData = commonName;
rdn.cRDNAttr = 1;
rdn.rgRDNAttr = attrs;
ret = pCryptEncodeObjectEx(dwEncoding, X509_NAME, &info,
@@ -861,7 +861,7 @@
"Expected E_INVALIDARG, got %08x\n", GetLastError());
/* Test a more complex name */
rdn.cRDNAttr = sizeof(rdnAttrs) / sizeof(rdnAttrs[0]);
- rdn.rgRDNAttr = (PCERT_RDN_ATTR)rdnAttrs;
+ rdn.rgRDNAttr = rdnAttrs;
info.cRDN = 1;
info.rgRDN = &rdn;
buf = NULL;
@@ -993,6 +993,13 @@
static void compareNameValues(const CERT_NAME_VALUE *expected,
const CERT_NAME_VALUE *got)
{
+ if (expected->dwValueType == CERT_RDN_UTF8_STRING &&
+ got->dwValueType == CERT_RDN_ENCODED_BLOB)
+ {
+ win_skip("Can't handle CERT_RDN_UTF8_STRING\n");
+ return;
+ }
+
ok(got->dwValueType == expected->dwValueType,
"Expected string type %d, got %d\n", expected->dwValueType,
got->dwValueType);
@@ -1149,7 +1156,7 @@
if (ret)
{
rdn.cRDNAttr = sizeof(decodedRdnAttrs) / sizeof(decodedRdnAttrs[0]);
- rdn.rgRDNAttr = (PCERT_RDN_ATTR)decodedRdnAttrs;
+ rdn.rgRDNAttr = decodedRdnAttrs;
compareNames(&info, (CERT_NAME_INFO *)buf);
LocalFree(buf);
}
@@ -1977,10 +1984,10 @@
if (buf)
{
ok(bufSize == bits[i].encoded[1] + 2,
- "Got unexpected size %d, expected %d\n", bufSize,
+ "%d: Got unexpected size %d, expected %d\n", i, bufSize,
bits[i].encoded[1] + 2);
ok(!memcmp(buf, bits[i].encoded, bits[i].encoded[1] + 2),
- "Unexpected value\n");
+ "%d: Unexpected value\n", i);
LocalFree(buf);
}
}
@@ -2962,7 +2969,7 @@
ext.pszObjId = oid_subject_key_identifier;
ext.fCritical = FALSE;
ext.Value.cbData = sizeof(octetCommonNameValue);
- ext.Value.pbData = (BYTE *)octetCommonNameValue;
+ ext.Value.pbData = octetCommonNameValue;
info.cExtension = 1;
info.rgExtension = &ext;
ret = pCryptEncodeObjectEx(dwEncoding, X509_CERT_TO_BE_SIGNED, &info,
Modified: trunk/rostests/winetests/crypt32/msg.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/crypt32/msg.c?r…
==============================================================================
--- trunk/rostests/winetests/crypt32/msg.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/crypt32/msg.c [iso-8859-1] Sat Jan 31 08:31:11 2009
@@ -182,7 +182,7 @@
ret = CryptMsgGetParam(msg, CMSG_TYPE_PARAM, 0, NULL, &size);
ok(ret, "CryptMsgGetParam failed: %x\n", GetLastError());
size = sizeof(value);
- ret = CryptMsgGetParam(msg, CMSG_TYPE_PARAM, 0, (LPBYTE)&value, &size);
+ ret = CryptMsgGetParam(msg, CMSG_TYPE_PARAM, 0, &value, &size);
ok(ret, "CryptMsgGetParam failed: %x\n", GetLastError());
/* For this (empty) message, the type isn't set */
ok(value == 0, "Expected type 0, got %d\n", value);
@@ -193,7 +193,7 @@
ok(msg != NULL, "CryptMsgOpenToDecode failed: %x\n", GetLastError());
/* For explicitly typed messages, the type is known. */
size = sizeof(value);
- ret = CryptMsgGetParam(msg, CMSG_TYPE_PARAM, 0, (LPBYTE)&value, &size);
+ ret = CryptMsgGetParam(msg, CMSG_TYPE_PARAM, 0, &value, &size);
ok(ret, "CryptMsgGetParam failed: %x\n", GetLastError());
ok(value == CMSG_DATA, "Expected CMSG_DATA, got %d\n", value);
for (i = CMSG_CONTENT_PARAM; i <= CMSG_CMS_SIGNER_INFO_PARAM; i++)
@@ -208,7 +208,7 @@
NULL);
ok(msg != NULL, "CryptMsgOpenToDecode failed: %x\n", GetLastError());
size = sizeof(value);
- ret = CryptMsgGetParam(msg, CMSG_TYPE_PARAM, 0, (LPBYTE)&value, &size);
+ ret = CryptMsgGetParam(msg, CMSG_TYPE_PARAM, 0, &value, &size);
ok(ret, "CryptMsgGetParam failed: %x\n", GetLastError());
ok(value == CMSG_ENVELOPED, "Expected CMSG_ENVELOPED, got %d\n", value);
for (i = CMSG_CONTENT_PARAM; i <= CMSG_CMS_SIGNER_INFO_PARAM; i++)
@@ -223,7 +223,7 @@
NULL);
ok(msg != NULL, "CryptMsgOpenToDecode failed: %x\n", GetLastError());
size = sizeof(value);
- ret = CryptMsgGetParam(msg, CMSG_TYPE_PARAM, 0, (LPBYTE)&value, &size);
+ ret = CryptMsgGetParam(msg, CMSG_TYPE_PARAM, 0, &value, &size);
ok(ret, "CryptMsgGetParam failed: %x\n", GetLastError());
ok(value == CMSG_HASHED, "Expected CMSG_HASHED, got %d\n", value);
for (i = CMSG_CONTENT_PARAM; i <= CMSG_CMS_SIGNER_INFO_PARAM; i++)
@@ -238,7 +238,7 @@
NULL);
ok(msg != NULL, "CryptMsgOpenToDecode failed: %x\n", GetLastError());
size = sizeof(value);
- ret = CryptMsgGetParam(msg, CMSG_TYPE_PARAM, 0, (LPBYTE)&value, &size);
+ ret = CryptMsgGetParam(msg, CMSG_TYPE_PARAM, 0, &value, &size);
ok(ret, "CryptMsgGetParam failed: %x\n", GetLastError());
ok(value == CMSG_SIGNED, "Expected CMSG_SIGNED, got %d\n", value);
for (i = CMSG_CONTENT_PARAM; i <= CMSG_CMS_SIGNER_INFO_PARAM; i++)
@@ -254,7 +254,7 @@
NULL);
ok(msg != NULL, "CryptMsgOpenToDecode failed: %x\n", GetLastError());
size = sizeof(value);
- ret = CryptMsgGetParam(msg, CMSG_TYPE_PARAM, 0, (LPBYTE)&value, &size);
+ ret = CryptMsgGetParam(msg, CMSG_TYPE_PARAM, 0, &value, &size);
ok(ret, "CryptMsgGetParam failed: %x\n", GetLastError());
ok(value == CMSG_ENCRYPTED, "Expected CMSG_ENCRYPTED, got %d\n", value);
CryptMsgClose(msg);
@@ -262,7 +262,7 @@
msg = CryptMsgOpenToDecode(PKCS_7_ASN_ENCODING, 0, 1000, 0, NULL, NULL);
ok(msg != NULL, "CryptMsgOpenToDecode failed: %x\n", GetLastError());
size = sizeof(value);
- ret = CryptMsgGetParam(msg, CMSG_TYPE_PARAM, 0, (LPBYTE)&value, &size);
+ ret = CryptMsgGetParam(msg, CMSG_TYPE_PARAM, 0, &value, &size);
ok(ret, "CryptMsgGetParam failed: %x\n", GetLastError());
ok(value == 1000, "Expected 1000, got %d\n", value);
CryptMsgClose(msg);
@@ -830,7 +830,7 @@
ret = CryptMsgGetParam(msg, CMSG_VERSION_PARAM, 0, NULL, &size);
ok(ret, "CryptMsgGetParam failed: %08x\n", GetLastError());
size = sizeof(value);
- ret = CryptMsgGetParam(msg, CMSG_VERSION_PARAM, 0, (LPBYTE)&value, &size);
+ ret = CryptMsgGetParam(msg, CMSG_VERSION_PARAM, 0, &value, &size);
ok(ret, "CryptMsgGetParam failed: %08x\n", GetLastError());
ok(value == 0, "Expected version 0, got %d\n", value);
/* As usual, the type isn't available. */
@@ -1116,11 +1116,10 @@
signer.SignerId.dwIdChoice = CERT_ID_ISSUER_SERIAL_NUMBER;
U(signer.SignerId).IssuerSerialNumber.Issuer.cbData =
sizeof(encodedCommonName);
- U(signer.SignerId).IssuerSerialNumber.Issuer.pbData =
- (BYTE *)encodedCommonName;
+ U(signer.SignerId).IssuerSerialNumber.Issuer.pbData = encodedCommonName;
U(signer.SignerId).IssuerSerialNumber.SerialNumber.cbData =
sizeof(serialNum);
- U(signer.SignerId).IssuerSerialNumber.SerialNumber.pbData = (BYTE *)serialNum;
+ U(signer.SignerId).IssuerSerialNumber.SerialNumber.pbData = serialNum;
msg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING, 0, CMSG_SIGNED, &signInfo,
NULL, NULL);
ok(msg != NULL, "CryptMsgOpenToEncode failed: %x\n", GetLastError());
@@ -1211,7 +1210,7 @@
ok(!ret && (GetLastError() == NTE_BAD_KEYSET ||
GetLastError() == NTE_NO_KEY),
"Expected NTE_BAD_KEYSET or NTE_NO_KEY, got %x\n", GetLastError());
- ret = CryptImportKey(signer.hCryptProv, (LPBYTE)privKey, sizeof(privKey),
+ ret = CryptImportKey(signer.hCryptProv, privKey, sizeof(privKey),
0, 0, &key);
ok(ret, "CryptImportKey failed: %08x\n", GetLastError());
/* The final update should be able to succeed now that a key exists, but
@@ -1630,7 +1629,7 @@
return;
}
- ret = CryptImportKey(signer.hCryptProv, (LPBYTE)privKey, sizeof(privKey),
+ ret = CryptImportKey(signer.hCryptProv, privKey, sizeof(privKey),
0, 0, &key);
ok(ret, "CryptImportKey failed: %08x\n", GetLastError());
@@ -1664,7 +1663,7 @@
certInfo.Issuer.cbData = 0;
signer.SignerId.dwIdChoice = CERT_ID_KEY_IDENTIFIER;
U(signer.SignerId).KeyId.cbData = sizeof(serialNum);
- U(signer.SignerId).KeyId.pbData = (BYTE *)serialNum;
+ U(signer.SignerId).KeyId.pbData = serialNum;
msg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING, 0, CMSG_SIGNED, &signInfo,
NULL, NULL);
ok(msg != NULL, "CryptMsgOpenToEncode failed: %x\n", GetLastError());
@@ -1814,7 +1813,7 @@
ret = CryptMsgGetParam(msg, CMSG_VERSION_PARAM, 0, NULL, &size);
ok(ret, "CryptMsgGetParam failed: %08x\n", GetLastError());
size = sizeof(value);
- ret = CryptMsgGetParam(msg, CMSG_VERSION_PARAM, 0, (LPBYTE)&value, &size);
+ ret = CryptMsgGetParam(msg, CMSG_VERSION_PARAM, 0, &value, &size);
ok(ret, "CryptMsgGetParam failed: %08x\n", GetLastError());
ok(value == CMSG_SIGNED_DATA_V1, "Expected version 1, got %d\n", value);
/* But for this message, with no signers, the hash and signer aren't
@@ -1892,11 +1891,10 @@
signer.SignerId.dwIdChoice = CERT_ID_ISSUER_SERIAL_NUMBER;
U(signer.SignerId).IssuerSerialNumber.Issuer.cbData =
sizeof(encodedCommonName);
- U(signer.SignerId).IssuerSerialNumber.Issuer.pbData =
- (BYTE *)encodedCommonName;
+ U(signer.SignerId).IssuerSerialNumber.Issuer.pbData = encodedCommonName;
U(signer.SignerId).IssuerSerialNumber.SerialNumber.cbData =
sizeof(serialNum);
- U(signer.SignerId).IssuerSerialNumber.SerialNumber.pbData = (BYTE *)serialNum;
+ U(signer.SignerId).IssuerSerialNumber.SerialNumber.pbData = serialNum;
ret = pCryptAcquireContextA(&signer.hCryptProv, cspNameA, NULL,
PROV_RSA_FULL, CRYPT_NEWKEYSET);
if (!ret && GetLastError() == NTE_EXISTS)
@@ -1910,7 +1908,7 @@
* are used and no additional CMS fields are used.
*/
size = sizeof(value);
- ret = CryptMsgGetParam(msg, CMSG_VERSION_PARAM, 0, (LPBYTE)&value, &size);
+ ret = CryptMsgGetParam(msg, CMSG_VERSION_PARAM, 0, &value, &size);
ok(ret, "CryptMsgGetParam failed: %08x\n", GetLastError());
ok(value == CMSG_SIGNED_DATA_V1, "expected version 1, got %d\n", value);
/* Apparently the encoded signer can be retrieved.. */
@@ -1936,7 +1934,7 @@
*/
signer.SignerId.dwIdChoice = CERT_ID_KEY_IDENTIFIER;
U(signer.SignerId).KeyId.cbData = sizeof(serialNum);
- U(signer.SignerId).KeyId.pbData = (BYTE *)serialNum;
+ U(signer.SignerId).KeyId.pbData = serialNum;
ret = pCryptAcquireContextA(&signer.hCryptProv, cspNameA, NULL,
PROV_RSA_FULL, CRYPT_NEWKEYSET);
if (!ret && GetLastError() == NTE_EXISTS)
@@ -1947,7 +1945,7 @@
CMSG_CRYPT_RELEASE_CONTEXT_FLAG, CMSG_SIGNED, &signInfo, NULL, NULL);
ok(msg != NULL, "CryptMsgOpenToEncode failed: %x\n", GetLastError());
size = sizeof(value);
- ret = CryptMsgGetParam(msg, CMSG_VERSION_PARAM, 0, (LPBYTE)&value, &size);
+ ret = CryptMsgGetParam(msg, CMSG_VERSION_PARAM, 0, &value, &size);
ok(value == CMSG_SIGNED_DATA_V3, "expected version 3, got %d\n", value);
/* Even for a CMS message, the signer can be retrieved.. */
ret = CryptMsgGetParam(msg, CMSG_ENCODED_SIGNER, 0, NULL, &size);
@@ -2528,7 +2526,7 @@
signer.dwVersion = CMSG_SIGNED_DATA_V3;
signer.SignerId.dwIdChoice = CERT_ID_KEY_IDENTIFIER;
U(signer.SignerId).KeyId.cbData = sizeof(serialNum);
- U(signer.SignerId).KeyId.pbData = (BYTE *)serialNum;
+ U(signer.SignerId).KeyId.pbData = serialNum;
signer.HashAlgorithm.pszObjId = oid_rsa_md5;
CryptMsgGetParam(msg, CMSG_CMS_SIGNER_INFO_PARAM, 0, buf, &size);
compare_cms_signer_info((CMSG_CMS_SIGNER_INFO *)buf, &signer);
Modified: trunk/rostests/winetests/crypt32/protectdata.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/crypt32/protect…
==============================================================================
--- trunk/rostests/winetests/crypt32/protectdata.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/crypt32/protectdata.c [iso-8859-1] Sat Jan 31 08:31:11 2009
@@ -69,11 +69,16 @@
/* without entropy */
SetLastError(0xDEADBEEF);
protected = pCryptProtectData(&plain,desc,NULL,NULL,NULL,0,&cipher);
- ok(protected, "Encrypting without entropy.\n");
- r = GetLastError();
- ok(r == ERROR_SUCCESS ||
- r == ERROR_IO_PENDING, /* win2k */
- "Expected ERROR_SUCCESS or ERROR_IO_PENDING, got %d\n",r);
+ ok(protected ||
+ broken(!protected), /* Win9x/NT4 */
+ "Encrypting without entropy.\n");
+ if (protected)
+ {
+ r = GetLastError();
+ ok(r == ERROR_SUCCESS ||
+ r == ERROR_IO_PENDING, /* win2k */
+ "Expected ERROR_SUCCESS or ERROR_IO_PENDING, got %d\n",r);
+ }
cipher_entropy.pbData=NULL;
cipher_entropy.cbData=0;
@@ -81,7 +86,9 @@
/* with entropy */
SetLastError(0xDEADBEEF);
protected =
pCryptProtectData(&plain,desc,&entropy,NULL,NULL,0,&cipher_entropy);
- ok(protected, "Encrypting with entropy.\n");
+ ok(protected ||
+ broken(!protected), /* Win9x/NT4 */
+ "Encrypting with entropy.\n");
cipher_no_desc.pbData=NULL;
cipher_no_desc.cbData=0;
Modified: trunk/rostests/winetests/crypt32/store.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/crypt32/store.c…
==============================================================================
--- trunk/rostests/winetests/crypt32/store.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/crypt32/store.c [iso-8859-1] Sat Jan 31 08:31:11 2009
@@ -1701,7 +1701,7 @@
static BOOL CALLBACK enumSystemStoreCB(const void *systemStore, DWORD dwFlags,
PCERT_SYSTEM_STORE_INFO pStoreInfo, void *pvReserved, void *pvArg)
{
- struct EnumSystemStoreInfo *info = (struct EnumSystemStoreInfo *)pvArg;
+ struct EnumSystemStoreInfo *info = pvArg;
info->storeCount++;
return info->goOn;
Modified: trunk/rostests/winetests/crypt32/str.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/crypt32/str.c?r…
==============================================================================
--- trunk/rostests/winetests/crypt32/str.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/crypt32/str.c [iso-8859-1] Sat Jan 31 08:31:11 2009
@@ -204,19 +204,19 @@
{
CertRDNAttrEncoding attrs[] = {
{ "2.5.4.6", CERT_RDN_PRINTABLE_STRING,
- { sizeof(bin1), (PBYTE)bin1 }, "US" },
+ { sizeof(bin1), bin1 }, "US" },
{ "2.5.4.8", CERT_RDN_PRINTABLE_STRING,
- { sizeof(bin2), (PBYTE)bin2 }, "Minnesota" },
+ { sizeof(bin2), bin2 }, "Minnesota" },
{ "2.5.4.7", CERT_RDN_PRINTABLE_STRING,
- { sizeof(bin3), (PBYTE)bin3 }, "Minneapolis" },
+ { sizeof(bin3), bin3 }, "Minneapolis" },
{ "2.5.4.10", CERT_RDN_PRINTABLE_STRING,
- { sizeof(bin4), (PBYTE)bin4 }, "CodeWeavers" },
+ { sizeof(bin4), bin4 }, "CodeWeavers" },
{ "2.5.4.11", CERT_RDN_PRINTABLE_STRING,
- { sizeof(bin5), (PBYTE)bin5 }, "Wine Development" },
+ { sizeof(bin5), bin5 }, "Wine Development" },
{ "2.5.4.3", CERT_RDN_PRINTABLE_STRING,
- { sizeof(bin6), (PBYTE)bin6 }, "localhost" },
+ { sizeof(bin6), bin6 }, "localhost" },
{ "1.2.840.113549.1.9.1", CERT_RDN_IA5_STRING,
- { sizeof(bin7), (PBYTE)bin7 }, "aric(a)codeweavers.com" },
+ { sizeof(bin7), bin7 }, "aric(a)codeweavers.com" },
};
DWORD i, ret;
char buffer[2000];
@@ -261,19 +261,19 @@
'a','v','e','r','s','.','c','o','m',0
};
CertRDNAttrEncodingW attrs[] = {
{ "2.5.4.6", CERT_RDN_PRINTABLE_STRING,
- { sizeof(bin1), (PBYTE)bin1 }, usW },
+ { sizeof(bin1), bin1 }, usW },
{ "2.5.4.8", CERT_RDN_PRINTABLE_STRING,
- { sizeof(bin2), (PBYTE)bin2 }, minnesotaW },
+ { sizeof(bin2), bin2 }, minnesotaW },
{ "2.5.4.7", CERT_RDN_PRINTABLE_STRING,
- { sizeof(bin3), (PBYTE)bin3 }, minneapolisW },
+ { sizeof(bin3), bin3 }, minneapolisW },
{ "2.5.4.10", CERT_RDN_PRINTABLE_STRING,
- { sizeof(bin4), (PBYTE)bin4 }, codeweaversW },
+ { sizeof(bin4), bin4 }, codeweaversW },
{ "2.5.4.11", CERT_RDN_PRINTABLE_STRING,
- { sizeof(bin5), (PBYTE)bin5 }, wineDevW },
+ { sizeof(bin5), bin5 }, wineDevW },
{ "2.5.4.3", CERT_RDN_PRINTABLE_STRING,
- { sizeof(bin6), (PBYTE)bin6 }, localhostW },
+ { sizeof(bin6), bin6 }, localhostW },
{ "1.2.840.113549.1.9.1", CERT_RDN_IA5_STRING,
- { sizeof(bin7), (PBYTE)bin7 }, aricW },
+ { sizeof(bin7), bin7 }, aricW },
};
DWORD i, ret;
WCHAR buffer[2000];