[PATCH 1/5] msi: Make MsiDoAction() RPC-compatible.

Zebediah Figura z.figura12 at gmail.com
Sat Apr 21 19:33:43 CDT 2018


Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 dlls/msi/install.c         | 20 +-------------------
 dlls/msi/package.c         |  5 ++---
 dlls/msi/tests/custom.c    | 21 +++++++++++++++++++++
 dlls/msi/tests/custom.spec |  1 +
 dlls/msi/tests/install.c   |  2 ++
 dlls/msi/winemsi.idl       |  2 +-
 6 files changed, 28 insertions(+), 23 deletions(-)

diff --git a/dlls/msi/install.c b/dlls/msi/install.c
index 814addc..f488674 100644
--- a/dlls/msi/install.c
+++ b/dlls/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/dlls/msi/package.c b/dlls/msi/package.c
index d18736b..0681189 100644
--- a/dlls/msi/package.c
+++ b/dlls/msi/package.c
@@ -2464,10 +2464,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/dlls/msi/tests/custom.c b/dlls/msi/tests/custom.c
index e782311..5bdb8d2 100644
--- a/dlls/msi/tests/custom.c
+++ b/dlls/msi/tests/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/dlls/msi/tests/custom.spec b/dlls/msi/tests/custom.spec
index bb400ff..51bb60e 100644
--- a/dlls/msi/tests/custom.spec
+++ b/dlls/msi/tests/custom.spec
@@ -2,3 +2,4 @@
 @ stdcall test_retval(long)
 @ stdcall da_immediate(long)
 @ stdcall da_deferred(long)
+@ stdcall nested(long)
diff --git a/dlls/msi/tests/install.c b/dlls/msi/tests/install.c
index 41a77cd..b63e5da 100644
--- a/dlls/msi/tests/install.c
+++ b/dlls/msi/tests/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";
 
diff --git a/dlls/msi/winemsi.idl b/dlls/msi/winemsi.idl
index 7613fd3..57790d1 100644
--- a/dlls/msi/winemsi.idl
+++ b/dlls/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 );
-- 
2.7.4




More information about the wine-devel mailing list