From 676376d1d3b87a8843e15baf6c7f7b958c2bdf83 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sat, 21 Apr 2018 19:33:44 -0500 Subject: [PATCH] msi: Make MsiSequence() RPC-compatible. Signed-off-by: Zebediah Figura Signed-off-by: Hans Leidekker Signed-off-by: Alexandre Julliard --- dlls/msi/install.c | 23 ++++------------------- dlls/msi/package.c | 5 ++--- dlls/msi/tests/custom.c | 7 +++++++ dlls/msi/tests/install.c | 7 +++++++ dlls/msi/winemsi.idl | 2 +- 5 files changed, 21 insertions(+), 23 deletions(-) diff --git a/dlls/msi/install.c b/dlls/msi/install.c index f48867483df..2a5ff403692 100644 --- a/dlls/msi/install.c +++ b/dlls/msi/install.c @@ -117,33 +117,18 @@ UINT WINAPI MsiSequenceW( MSIHANDLE hInstall, LPCWSTR szTable, INT iSequenceMode TRACE("%s, %d\n", debugstr_w(szTable), iSequenceMode); + if (!szTable) + return ERROR_INVALID_PARAMETER; + package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE ); if (!package) { MSIHANDLE remote; - HRESULT hr; - BSTR table; if (!(remote = msi_get_remote(hInstall))) return ERROR_INVALID_HANDLE; - table = SysAllocString( szTable ); - if (!table) - return ERROR_OUTOFMEMORY; - - hr = remote_Sequence(remote, table, iSequenceMode); - - SysFreeString( table ); - - if (FAILED(hr)) - { - if (HRESULT_FACILITY(hr) == FACILITY_WIN32) - return HRESULT_CODE(hr); - - return ERROR_FUNCTION_FAILED; - } - - return ERROR_SUCCESS; + return remote_Sequence(remote, szTable, iSequenceMode); } ret = MSI_Sequence( package, szTable ); msiobj_release( &package->hdr ); diff --git a/dlls/msi/package.c b/dlls/msi/package.c index 06811897f0f..161ba81987b 100644 --- a/dlls/msi/package.c +++ b/dlls/msi/package.c @@ -2469,10 +2469,9 @@ UINT __cdecl remote_DoAction(MSIHANDLE hinst, LPCWSTR action) return MsiDoActionW(hinst, action); } -HRESULT __cdecl remote_Sequence(MSIHANDLE hinst, BSTR table, int sequence) +UINT __cdecl remote_Sequence(MSIHANDLE hinst, LPCWSTR table, int sequence) { - UINT r = MsiSequenceW(hinst, table, sequence); - return HRESULT_FROM_WIN32(r); + return MsiSequenceW(hinst, table, sequence); } HRESULT __cdecl remote_GetTargetPath(MSIHANDLE hinst, BSTR folder, BSTR value, DWORD *size) diff --git a/dlls/msi/tests/custom.c b/dlls/msi/tests/custom.c index 5bdb8d2cc55..bfd1e857bfb 100644 --- a/dlls/msi/tests/custom.c +++ b/dlls/msi/tests/custom.c @@ -437,6 +437,13 @@ static void test_doaction(MSIHANDLE hinst) r = MsiDoActionA(hinst, "nested1"); ok(hinst, !r, "got %u\n", r); check_prop(hinst, "nested", "2"); + + r = MsiSequenceA(hinst, NULL, 0); + ok(hinst, r == ERROR_INVALID_PARAMETER, "got %u\n", r); + + r = MsiSequenceA(hinst, "TestSequence", 0); + ok(hinst, !r, "got %u\n", r); + check_prop(hinst, "nested", "1"); } UINT WINAPI nested(MSIHANDLE hinst) diff --git a/dlls/msi/tests/install.c b/dlls/msi/tests/install.c index b63e5da9686..c5d9243275d 100644 --- a/dlls/msi/tests/install.c +++ b/dlls/msi/tests/install.c @@ -708,6 +708,12 @@ static const CHAR ca1_custom_action_dat[] = "Action\tType\tSource\tTarget\n" "maintest\t1\tcustom.dll\tmain_test\n" "testretval\t1\tcustom.dll\ttest_retval\n"; +static const CHAR ca1_test_seq_dat[] = "Action\tCondition\tSequence\n" + "s72\tS255\tI2\n" + "TestSequence\tAction\n" + "nested1\t\t1\n" + "nested51\t\t2\n"; + static const CHAR ca51_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n" "s72\tS38\ts72\ti2\tS255\tS72\n" "Component\tComponent\n" @@ -1706,6 +1712,7 @@ static const msi_table ca1_tables[] = ADD_TABLE(property), ADD_TABLE(ca1_install_exec_seq), ADD_TABLE(ca1_custom_action), + ADD_TABLE(ca1_test_seq), }; static const msi_table ca51_tables[] = diff --git a/dlls/msi/winemsi.idl b/dlls/msi/winemsi.idl index 57790d12d4e..d103e9aa068 100644 --- a/dlls/msi/winemsi.idl +++ b/dlls/msi/winemsi.idl @@ -75,7 +75,7 @@ interface IWineMsiRemote 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 ); UINT remote_DoAction( [in] MSIHANDLE hinst, [in, string] LPCWSTR action ); - HRESULT remote_Sequence( [in] MSIHANDLE hinst, [in] BSTR table, [in] int sequence ); + UINT remote_Sequence( [in] MSIHANDLE hinst, [in, string] LPCWSTR 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 ); HRESULT remote_GetSourcePath( [in] MSIHANDLE hinst, [in] BSTR folder, [out, size_is(*size)] BSTR value, [in, out] DWORD *size );