From 5d3fe05505781e3d5add6afc1b64aa062fa7c0db Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Tue, 31 Dec 2019 23:23:23 +0100 Subject: [PATCH] [ADVAPI32] OpenSCManagerA/W: Set the last error even in case of success This fixes a failure in the QueryServiceConfig2 api test. --- dll/win32/advapi32/service/scm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dll/win32/advapi32/service/scm.c b/dll/win32/advapi32/service/scm.c index 0588caef19e..f373f311add 100644 --- a/dll/win32/advapi32/service/scm.c +++ b/dll/win32/advapi32/service/scm.c @@ -1989,10 +1989,10 @@ OpenSCManagerA(LPCSTR lpMachineName, } RpcEndExcept; + SetLastError(dwError); if (dwError != ERROR_SUCCESS) { TRACE("ROpenSCManagerA() failed (Error %lu)\n", dwError); - SetLastError(dwError); return NULL; } @@ -2033,10 +2033,10 @@ OpenSCManagerW(LPCWSTR lpMachineName, } RpcEndExcept; + SetLastError(dwError); if (dwError != ERROR_SUCCESS) { TRACE("ROpenSCManagerW() failed (Error %lu)\n", dwError); - SetLastError(dwError); return NULL; }