msi: Make MsiGetFeatureState() 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:15 -05:00 committed by Alexandre Julliard
parent 1723536058
commit 9f428f592d
4 changed files with 34 additions and 22 deletions

View File

@ -964,33 +964,22 @@ UINT WINAPI MsiGetFeatureStateW(MSIHANDLE hInstall, LPCWSTR szFeature,
TRACE("%d %s %p %p\n", hInstall, debugstr_w(szFeature), piInstalled, piAction);
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;
/* FIXME: should use SEH */
if (!piInstalled || !piAction)
return RPC_X_NULL_REF_POINTER;
hr = remote_GetFeatureState(remote, feature, piInstalled, piAction);
SysFreeString(feature);
if (FAILED(hr))
{
if (HRESULT_FACILITY(hr) == FACILITY_WIN32)
return HRESULT_CODE(hr);
return ERROR_FUNCTION_FAILED;
}
return ERROR_SUCCESS;
return remote_GetFeatureState(remote, szFeature, piInstalled, piAction);
}
ret = MSI_GetFeatureStateW(package, szFeature, piInstalled, piAction);

View File

@ -2523,11 +2523,10 @@ UINT __cdecl remote_SetMode(MSIHANDLE hinst, MSIRUNMODE mode, BOOL state)
return MsiSetMode(hinst, mode, state);
}
HRESULT __cdecl remote_GetFeatureState(MSIHANDLE hinst, BSTR feature,
UINT __cdecl remote_GetFeatureState(MSIHANDLE hinst, LPCWSTR feature,
INSTALLSTATE *installed, INSTALLSTATE *action)
{
UINT r = MsiGetFeatureStateW(hinst, feature, installed, action);
return HRESULT_FROM_WIN32(r);
return MsiGetFeatureStateW(hinst, feature, installed, action);
}
HRESULT __cdecl remote_SetFeatureState(MSIHANDLE hinst, BSTR feature, INSTALLSTATE state)

View File

@ -650,6 +650,29 @@ static void test_mode(MSIHANDLE hinst)
ok(hinst, !r, "got %u\n", r);
}
static void test_feature_states(MSIHANDLE hinst)
{
INSTALLSTATE state, action;
UINT r;
r = MsiGetFeatureStateA(hinst, NULL, &state, &action);
ok(hinst, r == ERROR_UNKNOWN_FEATURE, "got %u\n", r);
r = MsiGetFeatureStateA(hinst, "fake", &state, &action);
ok(hinst, r == ERROR_UNKNOWN_FEATURE, "got %u\n", r);
r = MsiGetFeatureStateA(hinst, "One", NULL, &action);
ok(hinst, r == RPC_X_NULL_REF_POINTER, "got %u\n", r);
r = MsiGetFeatureStateA(hinst, "One", &state, NULL);
ok(hinst, r == RPC_X_NULL_REF_POINTER, "got %u\n", r);
r = MsiGetFeatureStateA(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
* or have undesired side effects should go here. */
UINT WINAPI main_test(MSIHANDLE hinst)
@ -678,6 +701,7 @@ UINT WINAPI main_test(MSIHANDLE hinst)
test_doaction(hinst);
test_targetpath(hinst);
test_mode(hinst);
test_feature_states(hinst);
return ERROR_SUCCESS;
}

View File

@ -81,7 +81,7 @@ interface IWineMsiRemote
UINT remote_GetSourcePath( [in] MSIHANDLE hinst, [in, string] LPCWSTR folder, [out, string] LPWSTR *value );
BOOL remote_GetMode( [in] MSIHANDLE hinst, [in] MSIRUNMODE mode );
UINT remote_SetMode( [in] MSIHANDLE hinst, [in] MSIRUNMODE mode, [in] BOOL state );
HRESULT remote_GetFeatureState( [in] MSIHANDLE hinst, [in] BSTR feature, [out] INSTALLSTATE *installed, [out] INSTALLSTATE *action );
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 );
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 );