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

commit c65c209a0cdcf3db5fad03a2eb726f3c1777e2cb
Author:     winesync <[email protected]>
AuthorDate: Sat Mar 12 15:11:57 2022 +0100
Commit:     Mark Jansen <[email protected]>
CommitDate: Sun Mar 20 19:27:38 2022 +0100

    [WINESYNC] msi: Make MsiDoAction() 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 c49abc8ce006441163c4a0b25d42ad1e9650d9da by Zebediah Figura 
<[email protected]>
---
 dll/win32/msi/install.c                    | 20 +-------------------
 dll/win32/msi/package.c                    |  5 ++---
 dll/win32/msi/winemsi.idl                  |  2 +-
 modules/rostests/winetests/msi/custom.c    | 21 +++++++++++++++++++++
 modules/rostests/winetests/msi/custom.spec |  1 +
 modules/rostests/winetests/msi/install.c   |  2 ++
 6 files changed, 28 insertions(+), 23 deletions(-)

diff --git a/dll/win32/msi/install.c b/dll/win32/msi/install.c
index 814addc402f..f48867483df 100644
--- a/dll/win32/msi/install.c
+++ b/dll/win32/msi/install.c
@@ -75,29 +75,11 @@ UINT WINAPI MsiDoActionW( MSIHANDLE hInstall, LPCWSTR 
szAction )
     if (!package)
     {
         MSIHANDLE remote;
-        HRESULT hr;
-        BSTR action;
 
         if (!(remote = msi_get_remote(hInstall)))
             return ERROR_INVALID_HANDLE;
 
-        action = SysAllocString( szAction );
-        if (!action)
-            return ERROR_OUTOFMEMORY;
-
-        hr = remote_DoAction(remote, action);
-
-        SysFreeString( action );
-
-        if (FAILED(hr))
-        {
-            if (HRESULT_FACILITY(hr) == FACILITY_WIN32)
-                return HRESULT_CODE(hr);
-
-            return ERROR_FUNCTION_FAILED;
-        }
-
-        return ERROR_SUCCESS;
+        return remote_DoAction(remote, szAction);
     }
  
     ret = ACTION_PerformAction( package, szAction, SCRIPT_NONE );
diff --git a/dll/win32/msi/package.c b/dll/win32/msi/package.c
index b4379fe81a3..948e70ee266 100644
--- a/dll/win32/msi/package.c
+++ b/dll/win32/msi/package.c
@@ -2471,10 +2471,9 @@ int __cdecl remote_ProcessMessage(MSIHANDLE hinst, 
INSTALLMESSAGE message, struc
     return ret;
 }
 
-HRESULT __cdecl remote_DoAction(MSIHANDLE hinst, BSTR action)
+UINT __cdecl remote_DoAction(MSIHANDLE hinst, LPCWSTR action)
 {
-    UINT r = MsiDoActionW(hinst, action);
-    return HRESULT_FROM_WIN32(r);
+    return MsiDoActionW(hinst, action);
 }
 
 HRESULT __cdecl remote_Sequence(MSIHANDLE hinst, BSTR table, int sequence)
diff --git a/dll/win32/msi/winemsi.idl b/dll/win32/msi/winemsi.idl
index 7613fd3e3ad..57790d12d4e 100644
--- a/dll/win32/msi/winemsi.idl
+++ b/dll/win32/msi/winemsi.idl
@@ -74,7 +74,7 @@ interface IWineMsiRemote
     UINT remote_GetProperty( [in] MSIHANDLE hinst, [in, string] LPCWSTR 
property, [out, string] LPWSTR *value, [out] DWORD *size );
     UINT remote_SetProperty( [in] MSIHANDLE hinst, [in, string, unique] 
LPCWSTR property, [in, string, unique] LPCWSTR value );
     int remote_ProcessMessage( [in] MSIHANDLE hinst, [in] INSTALLMESSAGE 
message, [in] struct wire_record *record );
-    HRESULT remote_DoAction( [in] MSIHANDLE hinst, [in] BSTR action );
+    UINT remote_DoAction( [in] MSIHANDLE hinst, [in, string] LPCWSTR action );
     HRESULT remote_Sequence( [in] MSIHANDLE hinst, [in] BSTR table, [in] int 
sequence );
     HRESULT remote_GetTargetPath( [in] MSIHANDLE hinst, [in] BSTR folder, 
[out, size_is(*size)] BSTR value, [in, out] DWORD *size );
     HRESULT remote_SetTargetPath( [in] MSIHANDLE hinst, [in] BSTR folder, [in] 
BSTR value );
diff --git a/modules/rostests/winetests/msi/custom.c 
b/modules/rostests/winetests/msi/custom.c
index e782311446f..5bdb8d2cc55 100644
--- a/modules/rostests/winetests/msi/custom.c
+++ b/modules/rostests/winetests/msi/custom.c
@@ -426,6 +426,26 @@ static void test_db(MSIHANDLE hinst)
     ok(hinst, !r, "got %u\n", r);
 }
 
+static void test_doaction(MSIHANDLE hinst)
+{
+    UINT r;
+
+    r = MsiDoActionA(hinst, "nested51");
+    ok(hinst, !r, "got %u\n", r);
+    check_prop(hinst, "nested", "1");
+
+    r = MsiDoActionA(hinst, "nested1");
+    ok(hinst, !r, "got %u\n", r);
+    check_prop(hinst, "nested", "2");
+}
+
+UINT WINAPI nested(MSIHANDLE hinst)
+{
+    MsiSetPropertyA(hinst, "nested", "2");
+
+    return ERROR_SUCCESS;
+}
+
 /* 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)
@@ -451,6 +471,7 @@ UINT WINAPI main_test(MSIHANDLE hinst)
 
     test_props(hinst);
     test_db(hinst);
+    test_doaction(hinst);
 
     return ERROR_SUCCESS;
 }
diff --git a/modules/rostests/winetests/msi/custom.spec 
b/modules/rostests/winetests/msi/custom.spec
index bb400fffe9d..51bb60ec1a4 100644
--- a/modules/rostests/winetests/msi/custom.spec
+++ b/modules/rostests/winetests/msi/custom.spec
@@ -2,3 +2,4 @@
 @ stdcall test_retval(long)
 @ stdcall da_immediate(long)
 @ stdcall da_deferred(long)
+@ stdcall nested(long)
diff --git a/modules/rostests/winetests/msi/install.c 
b/modules/rostests/winetests/msi/install.c
index 41a77cdb4ed..b63e5da9686 100644
--- a/modules/rostests/winetests/msi/install.c
+++ b/modules/rostests/winetests/msi/install.c
@@ -703,6 +703,8 @@ static const CHAR ca1_custom_action_dat[] = 
"Action\tType\tSource\tTarget\n"
                                              "s72\ti2\tS64\tS0\n"
                                              "CustomAction\tAction\n"
                                              
"embednull\t51\tembednullprop\ta[~]b\n"
+                                             "nested51\t51\tnested\t1\n"
+                                             "nested1\t1\tcustom.dll\tnested\n"
                                              
"maintest\t1\tcustom.dll\tmain_test\n"
                                              
"testretval\t1\tcustom.dll\ttest_retval\n";
 

Reply via email to