[WINESYNC] 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>

wine commit id 11702a31d2a31bfc5ac13e5d7995b2e71578f25f by Zebediah Figura <z.figura12@gmail.com>
This commit is contained in:
winesync 2022-03-12 15:12:03 +01:00 committed by Mark Jansen
parent 709d0f5b57
commit 1c8fdff293
No known key found for this signature in database
GPG key ID: B39240EE84BEAE8B
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

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

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

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