Commit 863680d5 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

msi: Make MsiSetFeatureState() RPC-compatible.

parent 9f428f59
......@@ -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);
......
......@@ -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,
......
......@@ -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
......
......@@ -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 );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment