https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5219367eac2c53be7df13c7c536d346ec3c8d731

commit 5219367eac2c53be7df13c7c536d346ec3c8d731
Author:     winesync <[email protected]>
AuthorDate: Sat Mar 12 15:12:01 2022 +0100
Commit:     Mark Jansen <[email protected]>
CommitDate: Sun Mar 20 19:27:40 2022 +0100

    [WINESYNC] msi: Make MsiSetMode() RPC-compatible.
    
    Signed-off-by: Zebediah Figura <[email protected]>
    Signed-off-by: Hans Leidekker <[email protected]>
    Signed-off-by: Alexandre Julliard <[email protected]>
    
    wine commit id 1723536058c73b71894f60ab2c030e78948abe45 by Zebediah Figura 
<[email protected]>
---
 dll/win32/msi/install.c                 | 13 +------------
 dll/win32/msi/package.c                 |  5 ++---
 dll/win32/msi/winemsi.idl               |  2 +-
 modules/rostests/winetests/msi/custom.c |  9 +++++++++
 4 files changed, 13 insertions(+), 16 deletions(-)

diff --git a/dll/win32/msi/install.c b/dll/win32/msi/install.c
index 3ac151d36c8..17a0cd516eb 100644
--- a/dll/win32/msi/install.c
+++ b/dll/win32/msi/install.c
@@ -644,22 +644,11 @@ UINT WINAPI MsiSetMode(MSIHANDLE hInstall, MSIRUNMODE 
iRunMode, BOOL fState)
     if (!package)
     {
         MSIHANDLE remote;
-        HRESULT hr;
 
         if (!(remote = msi_get_remote(hInstall)))
             return FALSE;
 
-        hr = remote_SetMode(remote, iRunMode, fState);
-
-        if (FAILED(hr))
-        {
-            if (HRESULT_FACILITY(hr) == FACILITY_WIN32)
-                return HRESULT_CODE(hr);
-
-            return ERROR_FUNCTION_FAILED;
-        }
-
-        return ERROR_SUCCESS;
+        return remote_SetMode(remote, iRunMode, fState);
     }
 
     switch (iRunMode)
diff --git a/dll/win32/msi/package.c b/dll/win32/msi/package.c
index d77b692a771..25fe859dfd6 100644
--- a/dll/win32/msi/package.c
+++ b/dll/win32/msi/package.c
@@ -2525,10 +2525,9 @@ BOOL __cdecl remote_GetMode(MSIHANDLE hinst, MSIRUNMODE 
mode)
     return MsiGetMode(hinst, mode);
 }
 
-HRESULT __cdecl remote_SetMode(MSIHANDLE hinst, MSIRUNMODE mode, BOOL state)
+UINT __cdecl remote_SetMode(MSIHANDLE hinst, MSIRUNMODE mode, BOOL state)
 {
-    UINT r = MsiSetMode(hinst, mode, state);
-    return HRESULT_FROM_WIN32(r);
+    return MsiSetMode(hinst, mode, state);
 }
 
 HRESULT __cdecl remote_GetFeatureState(MSIHANDLE hinst, BSTR feature,
diff --git a/dll/win32/msi/winemsi.idl b/dll/win32/msi/winemsi.idl
index 7282c771a9c..c4c7e88db83 100644
--- a/dll/win32/msi/winemsi.idl
+++ b/dll/win32/msi/winemsi.idl
@@ -80,7 +80,7 @@ interface IWineMsiRemote
     UINT remote_SetTargetPath( [in] MSIHANDLE hinst, [in, string] LPCWSTR 
folder, [in, string] LPCWSTR value );
     UINT remote_GetSourcePath( [in] MSIHANDLE hinst, [in, string] LPCWSTR 
folder, [out, string] LPWSTR *value );
     BOOL remote_GetMode( [in] MSIHANDLE hinst, [in] MSIRUNMODE mode );
-    HRESULT remote_SetMode( [in] MSIHANDLE hinst, [in] MSIRUNMODE mode, [in] 
BOOL state );
+    UINT remote_SetMode( [in] MSIHANDLE hinst, [in] MSIRUNMODE mode, [in] BOOL 
state );
     HRESULT remote_GetFeatureState( [in] MSIHANDLE hinst, [in] BSTR feature, 
[out] INSTALLSTATE *installed, [out] INSTALLSTATE *action );
     HRESULT remote_SetFeatureState( [in] MSIHANDLE hinst, [in] BSTR feature, 
[in] INSTALLSTATE state );
     HRESULT remote_GetComponentState( [in] MSIHANDLE hinst, [in] BSTR 
component, [out] INSTALLSTATE *installed, [out] INSTALLSTATE *action );
diff --git a/modules/rostests/winetests/msi/custom.c 
b/modules/rostests/winetests/msi/custom.c
index d596f1ec328..5f2ff5db095 100644
--- a/modules/rostests/winetests/msi/custom.c
+++ b/modules/rostests/winetests/msi/custom.c
@@ -642,6 +642,14 @@ static void test_targetpath(MSIHANDLE hinst)
     ok(hinst, sz == srcsz, "got size %u\n", sz);
 }
 
+static void test_mode(MSIHANDLE hinst)
+{
+    UINT r;
+
+    r = MsiSetMode(hinst, MSIRUNMODE_REBOOTATEND, FALSE);
+    ok(hinst, !r, "got %u\n", r);
+}
+
 /* Main test. Anything that doesn't depend on a specific install configuration
  * or have undesired side effects should go here. */
 UINT WINAPI main_test(MSIHANDLE hinst)
@@ -669,6 +677,7 @@ UINT WINAPI main_test(MSIHANDLE hinst)
     test_db(hinst);
     test_doaction(hinst);
     test_targetpath(hinst);
+    test_mode(hinst);
 
     return ERROR_SUCCESS;
 }

Reply via email to