https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5bbed507957d97702dfff…
commit 5bbed507957d97702dfff605bb73e03ddc20d47c
Author: winesync <ros-dev(a)reactos.org>
AuthorDate: Sat Mar 12 15:12:02 2022 +0100
Commit: Mark Jansen <mark.jansen(a)reactos.org>
CommitDate: Sun Mar 20 19:27:40 2022 +0100
[WINESYNC] msi: Make MsiSetFeatureState() 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 863680d5edcdb9fd62910cd7266658d2e3a0e743 by Zebediah Figura
<z.figura12(a)gmail.com>
---
dll/win32/msi/install.c | 26 ++++----------------------
dll/win32/msi/package.c | 5 ++---
dll/win32/msi/winemsi.idl | 2 +-
modules/rostests/winetests/msi/custom.c | 17 +++++++++++++++++
4 files changed, 24 insertions(+), 26 deletions(-)
diff --git a/dll/win32/msi/install.c b/dll/win32/msi/install.c
index 706fdb47955..1ff3ad98804 100644
--- a/dll/win32/msi/install.c
+++ b/dll/win32/msi/install.c
@@ -685,9 +685,6 @@ UINT WINAPI MsiSetFeatureStateA(MSIHANDLE hInstall, LPCSTR szFeature,
szwFeature = strdupAtoW(szFeature);
- if (!szwFeature)
- return ERROR_FUNCTION_FAILED;
-
rc = MsiSetFeatureStateW(hInstall,szwFeature, iState);
msi_free(szwFeature);
@@ -818,33 +815,18 @@ UINT WINAPI MsiSetFeatureStateW(MSIHANDLE hInstall, LPCWSTR
szFeature,
TRACE("%s %i\n",debugstr_w(szFeature), iState);
+ if (!szFeature)
+ return ERROR_UNKNOWN_FEATURE;
+
package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE);
if (!package)
{
MSIHANDLE remote;
- HRESULT hr;
- BSTR feature;
if (!(remote = msi_get_remote(hInstall)))
return ERROR_INVALID_HANDLE;
- feature = SysAllocString(szFeature);
- if (!feature)
- return ERROR_OUTOFMEMORY;
-
- hr = remote_SetFeatureState(remote, feature, iState);
-
- SysFreeString(feature);
-
- if (FAILED(hr))
- {
- if (HRESULT_FACILITY(hr) == FACILITY_WIN32)
- return HRESULT_CODE(hr);
-
- return ERROR_FUNCTION_FAILED;
- }
-
- return ERROR_SUCCESS;
+ return remote_SetFeatureState(remote, szFeature, iState);
}
rc = MSI_SetFeatureStateW(package,szFeature,iState);
diff --git a/dll/win32/msi/package.c b/dll/win32/msi/package.c
index ed7216b85ab..c0ec5a3aa7a 100644
--- a/dll/win32/msi/package.c
+++ b/dll/win32/msi/package.c
@@ -2536,10 +2536,9 @@ UINT __cdecl remote_GetFeatureState(MSIHANDLE hinst, LPCWSTR
feature,
return MsiGetFeatureStateW(hinst, feature, installed, action);
}
-HRESULT __cdecl remote_SetFeatureState(MSIHANDLE hinst, BSTR feature, INSTALLSTATE
state)
+UINT __cdecl remote_SetFeatureState(MSIHANDLE hinst, LPCWSTR feature, INSTALLSTATE
state)
{
- UINT r = MsiSetFeatureStateW(hinst, feature, state);
- return HRESULT_FROM_WIN32(r);
+ return MsiSetFeatureStateW(hinst, feature, state);
}
HRESULT __cdecl remote_GetComponentState(MSIHANDLE hinst, BSTR component,
diff --git a/dll/win32/msi/winemsi.idl b/dll/win32/msi/winemsi.idl
index 091ef16504c..8bdc10dcddc 100644
--- a/dll/win32/msi/winemsi.idl
+++ b/dll/win32/msi/winemsi.idl
@@ -82,7 +82,7 @@ interface IWineMsiRemote
BOOL remote_GetMode( [in] MSIHANDLE hinst, [in] MSIRUNMODE mode );
UINT remote_SetMode( [in] MSIHANDLE hinst, [in] MSIRUNMODE mode, [in] BOOL state );
UINT remote_GetFeatureState( [in] MSIHANDLE hinst, [in, string] LPCWSTR feature,
[out] INSTALLSTATE *installed, [out] INSTALLSTATE *action );
- HRESULT remote_SetFeatureState( [in] MSIHANDLE hinst, [in] BSTR feature, [in]
INSTALLSTATE state );
+ UINT remote_SetFeatureState( [in] MSIHANDLE hinst, [in, string] LPCWSTR feature, [in]
INSTALLSTATE state );
HRESULT remote_GetComponentState( [in] MSIHANDLE hinst, [in] BSTR component, [out]
INSTALLSTATE *installed, [out] INSTALLSTATE *action );
HRESULT remote_SetComponentState( [in] MSIHANDLE hinst, [in] BSTR component, [in]
INSTALLSTATE state );
HRESULT remote_GetLanguage( [in] MSIHANDLE hinst, [out] LANGID *language );
diff --git a/modules/rostests/winetests/msi/custom.c
b/modules/rostests/winetests/msi/custom.c
index ef4e282ea7f..b30953a8553 100644
--- a/modules/rostests/winetests/msi/custom.c
+++ b/modules/rostests/winetests/msi/custom.c
@@ -671,6 +671,23 @@ static void test_feature_states(MSIHANDLE hinst)
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);
+
+ r = MsiSetFeatureStateA(hinst, NULL, INSTALLSTATE_ABSENT);
+ ok(hinst, r == ERROR_UNKNOWN_FEATURE, "got %u\n", r);
+
+ r = MsiSetFeatureStateA(hinst, "One", INSTALLSTATE_ADVERTISED);
+ ok(hinst, !r, "got %u\n", r);
+
+ r = MsiGetFeatureStateA(hinst, "One", &state, &action);
+ ok(hinst, !r, "got %u\n", r);
+ ok(hinst, action == INSTALLSTATE_ADVERTISED, "got action %d\n", action);
+
+ r = MsiSetFeatureStateA(hinst, "One", INSTALLSTATE_LOCAL);
+ ok(hinst, !r, "got %u\n", r);
+
+ r = MsiGetFeatureStateA(hinst, "One", &state, &action);
+ ok(hinst, !r, "got %u\n", r);
+ ok(hinst, action == INSTALLSTATE_LOCAL, "got action %d\n", action);
}
/* Main test. Anything that doesn't depend on a specific install configuration