crypt32/tests: Fix regression on Win7 with unprivileged run.

Signed-off-by: Donat Enikeev <donat@enikeev.net>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Donat Enikeev 2016-11-15 00:18:26 +03:00 committed by Alexandre Julliard
parent 613e23976e
commit 20ea59b148
1 changed files with 16 additions and 8 deletions

View File

@ -415,7 +415,15 @@ static void testRegStoreSavedCerts(void)
cert1 = CertCreateCertificateContext(X509_ASN_ENCODING, bigCert, sizeof(bigCert));
ok (cert1 != NULL, "Create cert context failed at %d, %x\n", i, GetLastError());
ret = CertAddCertificateContextToStore(store, cert1, CERT_STORE_ADD_REPLACE_EXISTING, NULL);
ok (ret, "Adding to the store failed at %d, %x\n", i, GetLastError());
/* Addittional skip per Win7, it allows opening HKLM store, but disallows adding certs */
err = GetLastError();
if (!ret)
{
ok (err == ERROR_ACCESS_DENIED, "Failed to add certificate to store at %d (%08x)\n", i, err);
skip("Insufficient privileges for the test %d\n", i);
continue;
}
ok (ret, "Adding to the store failed at %d, %x\n", i, err);
CertFreeCertificateContext(cert1);
CertCloseStore(store, 0);
@ -1517,7 +1525,7 @@ static void testFileStore(void)
if (!GetTempFileNameW(szDot, szPrefix, 0, filename))
return;
DeleteFileW(filename);
file = CreateFileW(filename, GENERIC_READ | GENERIC_WRITE, 0, NULL,
CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
@ -2430,12 +2438,12 @@ static void testAddSerialized(void)
ok(!ret && GetLastError() == E_INVALIDARG,
"Expected E_INVALIDARG, got %08x\n", GetLastError());
/* With a bad context type */
ret = CertAddSerializedElementToStore(store, buf, sizeof(buf), 0, 0,
ret = CertAddSerializedElementToStore(store, buf, sizeof(buf), 0, 0,
CERT_STORE_CRL_CONTEXT_FLAG, NULL, NULL);
ok(!ret && GetLastError() == E_INVALIDARG,
"Expected E_INVALIDARG, got %08x\n", GetLastError());
ret = CertAddSerializedElementToStore(store, buf,
sizeof(struct CertPropIDHeader) + sizeof(bigCert), 0, 0,
sizeof(struct CertPropIDHeader) + sizeof(bigCert), 0, 0,
CERT_STORE_CRL_CONTEXT_FLAG, NULL, NULL);
ok(!ret && GetLastError() == E_INVALIDARG,
"Expected E_INVALIDARG, got %08x\n", GetLastError());
@ -2446,12 +2454,12 @@ static void testAddSerialized(void)
"Expected E_INVALIDARG, got %08x\n", GetLastError());
/* Bad unknown field, good type */
hdr->unknown1 = 2;
ret = CertAddSerializedElementToStore(store, buf, sizeof(buf), 0, 0,
ret = CertAddSerializedElementToStore(store, buf, sizeof(buf), 0, 0,
CERT_STORE_CERTIFICATE_CONTEXT_FLAG, NULL, NULL);
ok(!ret && GetLastError() == ERROR_FILE_NOT_FOUND,
"Expected ERROR_FILE_NOT_FOUND got %08x\n", GetLastError());
ret = CertAddSerializedElementToStore(store, buf,
sizeof(struct CertPropIDHeader) + sizeof(bigCert), 0, 0,
sizeof(struct CertPropIDHeader) + sizeof(bigCert), 0, 0,
CERT_STORE_CERTIFICATE_CONTEXT_FLAG, NULL, NULL);
ok(!ret && GetLastError() == ERROR_FILE_NOT_FOUND,
"Expected ERROR_FILE_NOT_FOUND got %08x\n", GetLastError());
@ -2463,11 +2471,11 @@ static void testAddSerialized(void)
/* Most everything okay, but bad add disposition */
hdr->unknown1 = 1;
/* This crashes
ret = CertAddSerializedElementToStore(store, buf, sizeof(buf), 0, 0,
ret = CertAddSerializedElementToStore(store, buf, sizeof(buf), 0, 0,
CERT_STORE_CERTIFICATE_CONTEXT_FLAG, NULL, NULL);
* as does this
ret = CertAddSerializedElementToStore(store, buf,
sizeof(struct CertPropIDHeader) + sizeof(bigCert), 0, 0,
sizeof(struct CertPropIDHeader) + sizeof(bigCert), 0, 0,
CERT_STORE_CERTIFICATE_CONTEXT_FLAG, NULL, NULL);
*/
/* Everything okay, but buffer's too big */