Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/msi/install.c | 25 +++++++------------------ dlls/msi/package.c | 5 ++--- dlls/msi/tests/custom.c | 24 ++++++++++++++++++++++++ dlls/msi/winemsi.idl | 2 +- 4 files changed, 34 insertions(+), 22 deletions(-)
diff --git a/dlls/msi/install.c b/dlls/msi/install.c index 17a0cd5..706fdb4 100644 --- a/dlls/msi/install.c +++ b/dlls/msi/install.c @@ -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); diff --git a/dlls/msi/package.c b/dlls/msi/package.c index 6d2610d..ec05d43 100644 --- a/dlls/msi/package.c +++ b/dlls/msi/package.c @@ -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) diff --git a/dlls/msi/tests/custom.c b/dlls/msi/tests/custom.c index 5f2ff5d..ef4e282 100644 --- a/dlls/msi/tests/custom.c +++ b/dlls/msi/tests/custom.c @@ -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; } diff --git a/dlls/msi/winemsi.idl b/dlls/msi/winemsi.idl index c4c7e88..091ef16 100644 --- a/dlls/msi/winemsi.idl +++ b/dlls/msi/winemsi.idl @@ -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 );