Commit 11702a31 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

msi: Make MsiSetComponentState() RPC-compatible.

parent 35b1b87d
......@@ -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);
......
......@@ -2540,10 +2540,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)
......
......@@ -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
......
......@@ -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 );
......
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