Module: wine Branch: oldstable Commit: e83cd0e70fa015cfdb3f5cc71b6a1539ec1bc7b2 URL: https://source.winehq.org/git/wine.git/?a=commit;h=e83cd0e70fa015cfdb3f5cc71...
Author: Rémi Bernon rbernon@codeweavers.com Date: Tue May 25 17:37:11 2021 +0200
dssenh: Return NTE_BAD_KEYSET when key cannot be opened.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=30244 Signed-off-by: Rémi Bernon rbernon@codeweavers.com Signed-off-by: Hans Leidekker hans@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org (cherry picked from commit cf770571bf538f2794f56220f649b232688d1736) Signed-off-by: Michael Stefaniuc mstefani@winehq.org
---
dlls/dssenh/main.c | 3 ++- dlls/dssenh/tests/dssenh.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/dlls/dssenh/main.c b/dlls/dssenh/main.c index 82822e4daec..6286b4604fb 100644 --- a/dlls/dssenh/main.c +++ b/dlls/dssenh/main.c @@ -286,7 +286,8 @@ BOOL WINAPI CPAcquireContext( HCRYPTPROV *ret_prov, LPSTR container, DWORD flags { case 0: case 0 | CRYPT_MACHINE_KEYSET: - ret = read_key_container( name, flags ); + if (!(ret = read_key_container( name, flags ))) + SetLastError( NTE_BAD_KEYSET ); break;
case CRYPT_NEWKEYSET: diff --git a/dlls/dssenh/tests/dssenh.c b/dlls/dssenh/tests/dssenh.c index b72b1e3a614..f0fe4a02f97 100644 --- a/dlls/dssenh/tests/dssenh.c +++ b/dlls/dssenh/tests/dssenh.c @@ -75,7 +75,7 @@ static void test_acquire_context(void) 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()); + ok(GetLastError() == NTE_BAD_KEYSET, "Expected NTE_BAD_KEYSET, got %08x\n", GetLastError()); SetLastError(0xdeadbeef); result = CryptAcquireContextA(&hProv, NULL, NULL, PROV_DSS, CRYPT_NEWKEYSET); }