Rémi Bernon : dssenh/tests: Add CryptAcquireContextA last error check.

Alexandre Julliard julliard at winehq.org
Fri Feb 25 07:30:21 CST 2022


Module: wine
Branch: oldstable
Commit: 239bb6cc55c6bdfd15e2aaa7294caee0405b3ace
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=239bb6cc55c6bdfd15e2aaa7294caee0405b3ace

Author: Rémi Bernon <rbernon at codeweavers.com>
Date:   Tue May 25 17:37:10 2021 +0200

dssenh/tests: Add CryptAcquireContextA last error check.

When container key doesn't exist yet.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=30244
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
(cherry picked from commit c5bdc2408fc0278bf893039a5010bcf8e22b9652)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>

---

 dlls/dssenh/tests/dssenh.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/dlls/dssenh/tests/dssenh.c b/dlls/dssenh/tests/dssenh.c
index 4d33fc86cd8..b72b1e3a614 100644
--- a/dlls/dssenh/tests/dssenh.c
+++ b/dlls/dssenh/tests/dssenh.c
@@ -71,6 +71,19 @@ static void test_acquire_context(void)
 
     /* test base DSS provider (PROV_DSS) */
 
+    SetLastError(0xdeadbeef);
+    result = CryptAcquireContextA(&hProv, NULL, NULL, PROV_DSS, 0);
+    if (!result)
+    {
+        todo_wine ok(GetLastError() == NTE_BAD_KEYSET, "Expected NTE_BAD_KEYSET, got %08x\n", GetLastError());
+        SetLastError(0xdeadbeef);
+        result = CryptAcquireContextA(&hProv, NULL, NULL, PROV_DSS, CRYPT_NEWKEYSET);
+    }
+    ok(result, "CryptAcquireContextA succeeded\n");
+
+    result = CryptReleaseContext(hProv, 0);
+    ok(result, "CryptReleaseContext failed.\n");
+
     result = CryptAcquireContextA(
         &hProv, NULL, MS_DEF_DSS_PROV_A, PROV_DSS, CRYPT_VERIFYCONTEXT);
     if(!result)




More information about the wine-cvs mailing list