msi: Make MsiSetComponentState() 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:18 -05:00 committed by Alexandre Julliard
parent 35b1b87dc9
commit 11702a31d2
4 changed files with 26 additions and 23 deletions

View File

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

View File

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

View File

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

View File

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