From: Daniel Lehman dlehman@esri.com
Signed-off-by: Daniel Lehman dlehman25@gmail.com --- dlls/wintrust/tests/softpub.c | 10 ++++++++++ dlls/wintrust/wintrust_main.c | 1 + 2 files changed, 11 insertions(+)
diff --git a/dlls/wintrust/tests/softpub.c b/dlls/wintrust/tests/softpub.c index 5a150e684d..25d458faad 100644 --- a/dlls/wintrust/tests/softpub.c +++ b/dlls/wintrust/tests/softpub.c @@ -845,7 +845,9 @@ static void test_wintrust(void) file.pcwszFilePath = pathW; /* Test with an empty file */ file.hFile = create_temp_file(pathW); + SetLastError(0xdeadbeef); r = WinVerifyTrust(INVALID_HANDLE_VALUE, &generic_action_v2, &wtd); + ok(r == GetLastError(), "expected %08x, got %08x\n", GetLastError(), r); ok(r == TRUST_E_SUBJECT_FORM_UNKNOWN, "expected TRUST_E_SUBJECT_FORM_UNKNOWN, got %08x\n", r); CloseHandle(file.hFile); @@ -853,18 +855,26 @@ static void test_wintrust(void) file.hFile = NULL; /* Test with a known file path, which we expect not have a signature */ getNotepadPath(pathW, MAX_PATH); + SetLastError(0xdeadbeef); r = WinVerifyTrust(INVALID_HANDLE_VALUE, &generic_action_v2, &wtd); + ok(r == GetLastError(), "expected %08x, got %08x\n", GetLastError(), r); ok(r == TRUST_E_NOSIGNATURE || r == CRYPT_E_FILE_ERROR, "expected TRUST_E_NOSIGNATURE or CRYPT_E_FILE_ERROR, got %08x\n", r); wtd.dwStateAction = WTD_STATEACTION_CLOSE; + SetLastError(0xdeadbeef); r = WinVerifyTrust(INVALID_HANDLE_VALUE, &generic_action_v2, &wtd); + ok(GetLastError() == 0xdeadbeef, "expected 0xdeadbeef, got %08x\n", GetLastError()); ok(r == S_OK, "WinVerifyTrust failed: %08x\n", r); wtd.dwStateAction = WTD_STATEACTION_VERIFY; + SetLastError(0xdeadbeef); hr = WinVerifyTrustEx(INVALID_HANDLE_VALUE, &generic_action_v2, &wtd); + ok(hr == GetLastError(), "expected %08x, got %08x\n", GetLastError(), hr); ok(hr == TRUST_E_NOSIGNATURE || hr == CRYPT_E_FILE_ERROR, "expected TRUST_E_NOSIGNATURE or CRYPT_E_FILE_ERROR, got %08x\n", hr); wtd.dwStateAction = WTD_STATEACTION_CLOSE; + SetLastError(0xdeadbeef); r = WinVerifyTrust(INVALID_HANDLE_VALUE, &generic_action_v2, &wtd); + ok(GetLastError() == 0xdeadbeef, "expected 0xdeadbeef, got %08x\n", GetLastError()); ok(r == S_OK, "WinVerifyTrust failed: %08x\n", r); }
diff --git a/dlls/wintrust/wintrust_main.c b/dlls/wintrust/wintrust_main.c index a0b8a137ed..768522ea4a 100644 --- a/dlls/wintrust/wintrust_main.c +++ b/dlls/wintrust/wintrust_main.c @@ -732,6 +732,7 @@ LONG WINAPI WinVerifyTrust( HWND hwnd, GUID *ActionID, LPVOID ActionData ) } }
+ if (err) SetLastError(err); TRACE("returning %08x\n", err); return err; }