[PATCH] crypt32/tests: fix regression on Win7 with unpriviled run
Donat Enikeev
donat at enikeev.net
Mon Nov 14 15:18:26 CST 2016
1. Fixes regression in tests reported by François Gouget https://bugs.winehq.org/show_bug.cgi?id=41719
2. Remove legacy trailing spaces
Signed-off-by: Donat Enikeev <donat at enikeev.net>
---
dlls/crypt32/tests/store.c | 24 ++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)
diff --git a/dlls/crypt32/tests/store.c b/dlls/crypt32/tests/store.c
index 03fc927..132a9da 100644
--- a/dlls/crypt32/tests/store.c
+++ b/dlls/crypt32/tests/store.c
@@ -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 */
--
2.7.4
More information about the wine-patches
mailing list