https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5d3fe05505781e3d5add6afc1b64aa062fa7c0db

commit 5d3fe05505781e3d5add6afc1b64aa062fa7c0db
Author:     Eric Kohl <[email protected]>
AuthorDate: Tue Dec 31 23:23:23 2019 +0100
Commit:     Eric Kohl <[email protected]>
CommitDate: Tue Dec 31 23:23:23 2019 +0100

    [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;
     }
 

Reply via email to