msi: Make MsiSetFeatureState() RPC-compatible.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2018-04-23 23:18:16 -05:00 committed by Alexandre Julliard
parent 9f428f592d
commit 863680d5ed
4 changed files with 24 additions and 26 deletions

View File

@ -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);

View File

@ -2529,10 +2529,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,

View File

@ -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

View File

@ -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 );