https://git.reactos.org/?p=reactos.git;a=commitdiff;h=1c8fdff2931f9d957feb4…
commit 1c8fdff2931f9d957feb42444fa05a671d2b5cca
Author: winesync <ros-dev(a)reactos.org>
AuthorDate: Sat Mar 12 15:12:03 2022 +0100
Commit: Mark Jansen <mark.jansen(a)reactos.org>
CommitDate: Sun Mar 20 19:27:40 2022 +0100
[WINESYNC] msi: Make MsiSetComponentState() RPC-compatible.
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
Signed-off-by: Hans Leidekker <hans(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
wine commit id 11702a31d2a31bfc5ac13e5d7995b2e71578f25f by Zebediah Figura
<z.figura12(a)gmail.com>
---
dll/win32/msi/install.c | 23 ++++-------------------
dll/win32/msi/package.c | 5 ++---
dll/win32/msi/winemsi.idl | 2 +-
modules/rostests/winetests/msi/custom.c | 19 +++++++++++++++++++
4 files changed, 26 insertions(+), 23 deletions(-)
diff --git a/dll/win32/msi/install.c b/dll/win32/msi/install.c
index b19b6471ee2..63ffbfeaeae 100644
--- a/dll/win32/msi/install.c
+++ b/dll/win32/msi/install.c
@@ -1313,33 +1313,18 @@ UINT WINAPI MsiSetComponentStateW(MSIHANDLE hInstall, LPCWSTR
szComponent,
MSIPACKAGE* package;
UINT ret;
+ if (!szComponent)
+ return ERROR_UNKNOWN_COMPONENT;
+
package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE);
if (!package)
{
MSIHANDLE remote;
- HRESULT hr;
- BSTR component;
if (!(remote = msi_get_remote(hInstall)))
return ERROR_INVALID_HANDLE;
- component = SysAllocString(szComponent);
- if (!component)
- return ERROR_OUTOFMEMORY;
-
- hr = remote_SetComponentState(remote, component, iState);
-
- SysFreeString(component);
-
- if (FAILED(hr))
- {
- if (HRESULT_FACILITY(hr) == FACILITY_WIN32)
- return HRESULT_CODE(hr);
-
- return ERROR_FUNCTION_FAILED;
- }
-
- return ERROR_SUCCESS;
+ return remote_SetComponentState(remote, szComponent, iState);
}
ret = MSI_SetComponentStateW(package, szComponent, iState);
diff --git a/dll/win32/msi/package.c b/dll/win32/msi/package.c
index 1155db34f8e..26d999bcbce 100644
--- a/dll/win32/msi/package.c
+++ b/dll/win32/msi/package.c
@@ -2547,10 +2547,9 @@ UINT __cdecl remote_GetComponentState(MSIHANDLE hinst, LPCWSTR
component,
return MsiGetComponentStateW(hinst, component, installed, action);
}
-HRESULT __cdecl remote_SetComponentState(MSIHANDLE hinst, BSTR component, INSTALLSTATE
state)
+UINT __cdecl remote_SetComponentState(MSIHANDLE hinst, LPCWSTR component, INSTALLSTATE
state)
{
- UINT r = MsiSetComponentStateW(hinst, component, state);
- return HRESULT_FROM_WIN32(r);
+ return MsiSetComponentStateW(hinst, component, state);
}
HRESULT __cdecl remote_GetLanguage(MSIHANDLE hinst, LANGID *language)
diff --git a/dll/win32/msi/winemsi.idl b/dll/win32/msi/winemsi.idl
index 59964871cb3..132f140d870 100644
--- a/dll/win32/msi/winemsi.idl
+++ b/dll/win32/msi/winemsi.idl
@@ -84,7 +84,7 @@ interface IWineMsiRemote
UINT remote_GetFeatureState( [in] MSIHANDLE hinst, [in, string] LPCWSTR feature,
[out] INSTALLSTATE *installed, [out] INSTALLSTATE *action );
UINT remote_SetFeatureState( [in] MSIHANDLE hinst, [in, string] LPCWSTR feature, [in]
INSTALLSTATE state );
UINT remote_GetComponentState( [in] MSIHANDLE hinst, [in, string] LPCWSTR component,
[out] INSTALLSTATE *installed, [out] INSTALLSTATE *action );
- HRESULT remote_SetComponentState( [in] MSIHANDLE hinst, [in] BSTR component, [in]
INSTALLSTATE state );
+ UINT remote_SetComponentState( [in] MSIHANDLE hinst, [in, string] LPCWSTR component,
[in] INSTALLSTATE state );
HRESULT remote_GetLanguage( [in] MSIHANDLE hinst, [out] LANGID *language );
HRESULT remote_SetInstallLevel( [in] MSIHANDLE hinst, [in] int level );
HRESULT remote_FormatRecord( [in] MSIHANDLE hinst, [in] MSIHANDLE record, [out] BSTR
*value );
diff --git a/modules/rostests/winetests/msi/custom.c
b/modules/rostests/winetests/msi/custom.c
index b2c9352e27d..2f9ba5d3231 100644
--- a/modules/rostests/winetests/msi/custom.c
+++ b/modules/rostests/winetests/msi/custom.c
@@ -719,6 +719,25 @@ static void test_feature_states(MSIHANDLE hinst)
ok(hinst, !r, "got %u\n", r);
ok(hinst, state == INSTALLSTATE_UNKNOWN, "got state %d\n", state);
ok(hinst, action == INSTALLSTATE_LOCAL, "got action %d\n", action);
+
+ r = MsiSetComponentStateA(hinst, NULL, INSTALLSTATE_ABSENT);
+ ok(hinst, r == ERROR_UNKNOWN_COMPONENT, "got %u\n", r);
+
+ r = MsiSetComponentStateA(hinst, "One", INSTALLSTATE_SOURCE);
+ ok(hinst, !r, "got %u\n", r);
+
+ r = MsiGetComponentStateA(hinst, "One", &state, &action);
+ ok(hinst, !r, "got %u\n", r);
+ ok(hinst, state == INSTALLSTATE_ABSENT, "got state %d\n", state);
+ ok(hinst, action == INSTALLSTATE_SOURCE, "got action %d\n", action);
+
+ r = MsiSetComponentStateA(hinst, "One", INSTALLSTATE_LOCAL);
+ ok(hinst, !r, "got %u\n", r);
+
+ r = MsiGetComponentStateA(hinst, "One", &state, &action);
+ ok(hinst, !r, "got %u\n", r);
+ ok(hinst, state == INSTALLSTATE_ABSENT, "got state %d\n", state);
+ ok(hinst, action == INSTALLSTATE_LOCAL, "got action %d\n", action);
}
/* Main test. Anything that doesn't depend on a specific install configuration