[CRYPT32_WINETEST] Sync with Wine Staging 2.9. CORE-13362
authorAmine Khaldi <amine.khaldi@reactos.org>
Sat, 3 Jun 2017 18:37:38 +0000 (18:37 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Sat, 3 Jun 2017 18:37:38 +0000 (18:37 +0000)
svn path=/trunk/; revision=74790

rostests/winetests/crypt32/cert.c
rostests/winetests/crypt32/crl.c
rostests/winetests/crypt32/store.c

index 5b506a9..28cc421 100644 (file)
@@ -29,7 +29,6 @@
 
 #include <wine/test.h>
 
-static BOOL (WINAPI *pCertAddStoreToCollection)(HCERTSTORE,HCERTSTORE,DWORD,DWORD);
 static PCCERT_CONTEXT (WINAPI *pCertCreateSelfSignCertificate)(HCRYPTPROV_OR_NCRYPT_KEY_HANDLE,PCERT_NAME_BLOB,DWORD,PCRYPT_KEY_PROV_INFO,PCRYPT_ALGORITHM_IDENTIFIER,PSYSTEMTIME,PSYSTEMTIME,PCERT_EXTENSIONS);
 static BOOL (WINAPI *pCertGetValidUsages)(DWORD,PCCERT_CONTEXT*,int*,LPSTR*,DWORD*);
 static BOOL (WINAPI *pCryptAcquireCertificatePrivateKey)(PCCERT_CONTEXT,DWORD,void*,HCRYPTPROV_OR_NCRYPT_KEY_HANDLE*,DWORD*,BOOL*);
@@ -50,7 +49,6 @@ static void init_function_pointers(void)
     if(!p ## func) \
       trace("GetProcAddress(%s) failed\n", #func);
 
-    GET_PROC(hCrypt32, CertAddStoreToCollection)
     GET_PROC(hCrypt32, CertCreateSelfSignCertificate)
     GET_PROC(hCrypt32, CertGetValidUsages)
     GET_PROC(hCrypt32, CryptAcquireCertificatePrivateKey)
@@ -279,10 +277,10 @@ static void testAddCert(void)
     collection = CertOpenStore(CERT_STORE_PROV_COLLECTION, 0, 0,
      CERT_STORE_CREATE_NEW_FLAG, NULL);
     ok(collection != NULL, "CertOpenStore failed: %08x\n", GetLastError());
-    if (collection && pCertAddStoreToCollection)
+    if (collection)
     {
         /* Add store to the collection, but disable updates */
-        pCertAddStoreToCollection(collection, store, 0, 0);
+        CertAddStoreToCollection(collection, store, 0, 0);
 
         context = CertCreateCertificateContext(X509_ASN_ENCODING, bigCert2,
          sizeof(bigCert2));
index f0a784e..4a15498 100644 (file)
@@ -148,6 +148,7 @@ static void testAddCRL(void)
     BOOL ret;
     DWORD GLE;
 
+    ok(store != NULL, "CertOpenStore failed: %08x\n", GetLastError());
     if (!store) return;
 
     /* Bad CRL encoding type */
@@ -425,21 +426,24 @@ static const BYTE rootSignedCRL[] = {
 
 static void testFindCRL(void)
 {
-    HCERTSTORE store = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0,
-     CERT_STORE_CREATE_NEW_FLAG, NULL);
+    HCERTSTORE store;
     PCCRL_CONTEXT context;
     PCCERT_CONTEXT cert, endCert, rootCert;
     CRL_FIND_ISSUED_FOR_PARA issuedForPara = { NULL, NULL };
     DWORD count, revoked_count;
     BOOL ret;
 
-    if (!store) return;
     if (!pCertFindCRLInStore || !pCertFindCertificateInCRL)
     {
         win_skip("CertFindCRLInStore or CertFindCertificateInCRL not available\n");
         return;
     }
 
+    store = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0,
+                          CERT_STORE_CREATE_NEW_FLAG, NULL);
+    ok(store != NULL, "CertOpenStore failed: %08x\n", GetLastError());
+    if (!store) return;
+
     ret = CertAddEncodedCRLToStore(store, X509_ASN_ENCODING, signedCRL,
      sizeof(signedCRL), CERT_STORE_ADD_ALWAYS, NULL);
     ok(ret, "CertAddEncodedCRLToStore failed: %08x\n", GetLastError());
@@ -783,6 +787,7 @@ static void testGetCRLFromStore(void)
     DWORD flags;
     BOOL ret;
 
+    ok(store != NULL, "CertOpenStore failed: %08x\n", GetLastError());
     if (!store) return;
 
     /* Crash
index 4e33139..1ccf28d 100644 (file)
@@ -116,8 +116,6 @@ static const BYTE signedCTLWithCTLInnerContent[] = {
 0x8e,0xe7,0x5f,0x76,0x2b,0xd1,0x6a,0x82,0xb3,0x30,0x25,0x61,0xf6,0x25,0x23,
 0x57,0x6c,0x0b,0x47,0xb8 };
 
-
-static BOOL (WINAPI *pCertAddStoreToCollection)(HCERTSTORE,HCERTSTORE,DWORD,DWORD);
 static BOOL (WINAPI *pCertControlStore)(HCERTSTORE,DWORD,DWORD,void const*);
 static PCCRL_CONTEXT (WINAPI *pCertEnumCRLsInStore)(HCERTSTORE,PCCRL_CONTEXT);
 static BOOL (WINAPI *pCertEnumSystemStore)(DWORD,void*,void*,PFN_CERT_ENUM_SYSTEM_STORE);
@@ -502,11 +500,6 @@ static void testStoresInCollection(void)
                        WineTestRW2_W[]= { 'W','i','n','e','T','e','s','t','_','R','W','2',0 };
     BOOL ret;
 
-    if (!pCertAddStoreToCollection)
-    {
-        win_skip("CertAddStoreToCollection() is not available\n");
-        return;
-    }
     collection = CertOpenStore(CERT_STORE_PROV_COLLECTION, 0, 0,
         CERT_STORE_CREATE_NEW_FLAG, NULL);
     ok(collection != NULL, "Failed to init collection store, last error %x\n", GetLastError());
@@ -645,12 +638,6 @@ static void testCollectionStore(void)
     WCHAR filename[MAX_PATH];
     HANDLE file;
 
-    if (!pCertAddStoreToCollection)
-    {
-        win_skip("CertAddStoreToCollection() is not available\n");
-        return;
-    }
-
     collection = CertOpenStore(CERT_STORE_PROV_COLLECTION, 0, 0,
      CERT_STORE_CREATE_NEW_FLAG, NULL);
 
@@ -667,7 +654,7 @@ static void testCollectionStore(void)
      bigCert, sizeof(bigCert), CERT_STORE_ADD_ALWAYS, NULL);
     ok(ret, "CertAddEncodedCertificateToStore failed: %08x\n", GetLastError());
     /* Add the memory store to the collection, without allowing adding */
-    ret = pCertAddStoreToCollection(collection, store1, 0, 0);
+    ret = CertAddStoreToCollection(collection, store1, 0, 0);
     ok(ret, "CertAddStoreToCollection failed: %08x\n", GetLastError());
     /* Verify the cert is in the collection */
     context = CertEnumCertificatesInStore(collection, NULL);
@@ -687,7 +674,7 @@ static void testCollectionStore(void)
     store2 = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0,
      CERT_STORE_CREATE_NEW_FLAG, NULL);
     /* Try adding a store to a non-collection store */
-    ret = pCertAddStoreToCollection(store1, store2,
+    ret = CertAddStoreToCollection(store1, store2,
      CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG, 0);
     ok(!ret && GetLastError() == E_INVALIDARG,
      "Expected E_INVALIDARG, got %08x\n", GetLastError());
@@ -697,7 +684,7 @@ static void testCollectionStore(void)
      CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG, 0);
      */
     /* This "succeeds"... */
-    ret = pCertAddStoreToCollection(collection, 0,
+    ret = CertAddStoreToCollection(collection, 0,
      CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG, 0);
     ok(ret, "CertAddStoreToCollection failed: %08x\n", GetLastError());
     /* while this crashes.
@@ -706,7 +693,7 @@ static void testCollectionStore(void)
      */
 
     /* Add it to the collection, this time allowing adding */
-    ret = pCertAddStoreToCollection(collection, store2,
+    ret = CertAddStoreToCollection(collection, store2,
      CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG, 0);
     ok(ret, "CertAddStoreToCollection failed: %08x\n", GetLastError());
     /* Check that adding to the collection is allowed */
@@ -774,7 +761,7 @@ static void testCollectionStore(void)
     /* Adding a collection to a collection is legal */
     collection2 = CertOpenStore(CERT_STORE_PROV_COLLECTION, 0, 0,
      CERT_STORE_CREATE_NEW_FLAG, NULL);
-    ret = pCertAddStoreToCollection(collection2, collection,
+    ret = CertAddStoreToCollection(collection2, collection,
      CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG, 0);
     ok(ret, "CertAddStoreToCollection failed: %08x\n", GetLastError());
     /* check the contents of collection2 */
@@ -834,11 +821,9 @@ static void testCollectionStore(void)
      CERT_STORE_CREATE_NEW_FLAG, NULL);
     ok(collection != 0, "CertOpenStore failed: %08x\n", GetLastError());
 
-    ret = pCertAddStoreToCollection(collection, store1,
-     CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG, 0);
+    ret = CertAddStoreToCollection(collection, store1, CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG, 0);
     ok(ret, "CertAddStoreToCollection failed: %08x\n", GetLastError());
-    ret = pCertAddStoreToCollection(collection, store2,
-     CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG, 0);
+    ret = CertAddStoreToCollection(collection, store2, CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG, 0);
     ok(ret, "CertAddStoreToCollection failed: %08x\n", GetLastError());
 
     /* Check that the collection has two copies of the same cert */
@@ -947,8 +932,7 @@ static void testCollectionStore(void)
     ok(ret, "CertAddEncodedCertificateToStore failed: %08x\n", GetLastError());
     CertDeleteCertificateFromStore(context);
 
-    pCertAddStoreToCollection(collection, store1,
-     CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG, 0);
+    CertAddStoreToCollection(collection, store1, CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG, 0);
 
     ret = CertAddEncodedCertificateToStore(collection, X509_ASN_ENCODING,
      bigCert, sizeof(bigCert), CERT_STORE_ADD_ALWAYS, &context);
@@ -975,7 +959,7 @@ static void testCollectionStore(void)
      */
     store1 = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0,
      CERT_STORE_CREATE_NEW_FLAG, NULL);
-    pCertAddStoreToCollection(collection, store1, 0, 0);
+    CertAddStoreToCollection(collection, store1, 0, 0);
     SetLastError(0xdeadbeef);
     ret = pCertControlStore(collection, 0, CERT_STORE_CTRL_COMMIT, NULL);
     ok(!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED,
@@ -999,8 +983,7 @@ static void testCollectionStore(void)
      CERT_FILE_STORE_COMMIT_ENABLE_FLAG, file);
     ok(store1 != NULL, "CertOpenStore failed: %08x\n", GetLastError());
     CloseHandle(file);
-    pCertAddStoreToCollection(collection, store1,
-     CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG, 0);
+    CertAddStoreToCollection(collection, store1, CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG, 0);
     CertCloseStore(store1, 0);
 
     ret = CertAddEncodedCertificateToStore(collection, X509_ASN_ENCODING,
@@ -1363,12 +1346,8 @@ static void testSystemRegStore(void)
      CERT_STORE_CREATE_NEW_FLAG, NULL);
     if (memStore)
     {
-        if (pCertAddStoreToCollection)
-        {
-            BOOL ret = pCertAddStoreToCollection(store, memStore, 0, 0);
-            ok(!ret && GetLastError() == E_INVALIDARG,
-               "Expected E_INVALIDARG, got %08x\n", GetLastError());
-        }
+        BOOL ret = CertAddStoreToCollection(store, memStore, 0, 0);
+        ok(!ret && GetLastError() == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", GetLastError());
         CertCloseStore(memStore, 0);
     }
     CertCloseStore(store, 0);
@@ -1457,12 +1436,9 @@ static void testSystemStore(void)
         /* Check that it's a collection store */
         if (memStore)
         {
-            if (pCertAddStoreToCollection)
-            {
-                BOOL ret = pCertAddStoreToCollection(store, memStore, 0, 0);
-                /* FIXME: this'll fail on NT4, but what error will it give? */
-                ok(ret, "CertAddStoreToCollection failed: %08x\n", GetLastError());
-            }
+            BOOL ret = CertAddStoreToCollection(store, memStore, 0, 0);
+            /* FIXME: this'll fail on NT4, but what error will it give? */
+            ok(ret, "CertAddStoreToCollection failed: %08x\n", GetLastError());
             CertCloseStore(memStore, 0);
         }
         CertCloseStore(store, 0);
@@ -3168,7 +3144,6 @@ START_TEST(store)
     HMODULE hdll;
 
     hdll = GetModuleHandleA("Crypt32.dll");
-    pCertAddStoreToCollection = (void*)GetProcAddress(hdll, "CertAddStoreToCollection");
     pCertControlStore = (void*)GetProcAddress(hdll, "CertControlStore");
     pCertEnumCRLsInStore = (void*)GetProcAddress(hdll, "CertEnumCRLsInStore");
     pCertEnumSystemStore = (void*)GetProcAddress(hdll, "CertEnumSystemStore");