diff --git a/dlls/msi/cond.y b/dlls/msi/cond.y index 8a3373f090d..ce061990e93 100644 --- a/dlls/msi/cond.y +++ b/dlls/msi/cond.y @@ -851,29 +851,14 @@ MSICONDITION WINAPI MsiEvaluateConditionW( MSIHANDLE hInstall, LPCWSTR szConditi if( !package ) { MSIHANDLE remote; - HRESULT hr; - BSTR condition; if (!(remote = msi_get_remote(hInstall))) return MSICONDITION_ERROR; - condition = SysAllocString( szCondition ); - if (!condition) - return ERROR_OUTOFMEMORY; + if (!szCondition) + return MSICONDITION_NONE; - hr = remote_EvaluateCondition(remote, condition); - - SysFreeString( condition ); - - if (FAILED(hr)) - { - if (HRESULT_FACILITY(hr) == FACILITY_WIN32) - return HRESULT_CODE(hr); - - return ERROR_FUNCTION_FAILED; - } - - return ERROR_SUCCESS; + return remote_EvaluateCondition(remote, szCondition); } ret = MSI_EvaluateConditionW( package, szCondition ); diff --git a/dlls/msi/package.c b/dlls/msi/package.c index 4a46df10aba..c93a0c85cfd 100644 --- a/dlls/msi/package.c +++ b/dlls/msi/package.c @@ -2578,10 +2578,9 @@ UINT __cdecl remote_FormatRecord(MSIHANDLE hinst, struct wire_record *remote_rec return r; } -HRESULT __cdecl remote_EvaluateCondition(MSIHANDLE hinst, BSTR condition) +MSICONDITION __cdecl remote_EvaluateCondition(MSIHANDLE hinst, LPCWSTR condition) { - UINT r = MsiEvaluateConditionW(hinst, condition); - return HRESULT_FROM_WIN32(r); + return MsiEvaluateConditionW(hinst, condition); } HRESULT __cdecl remote_GetFeatureCost(MSIHANDLE hinst, BSTR feature, diff --git a/dlls/msi/tests/custom.c b/dlls/msi/tests/custom.c index 76a70adac40..2035a8f7295 100644 --- a/dlls/msi/tests/custom.c +++ b/dlls/msi/tests/custom.c @@ -644,6 +644,7 @@ static void test_targetpath(MSIHANDLE hinst) static void test_misc(MSIHANDLE hinst) { + MSICONDITION cond; LANGID lang; UINT r; @@ -658,6 +659,12 @@ static void test_misc(MSIHANDLE hinst) ok(hinst, !r, "got %u\n", r); check_prop(hinst, "INSTALLLEVEL", "123"); MsiSetInstallLevel(hinst, 3); + + cond = MsiEvaluateConditionA(hinst, NULL); + ok(hinst, cond == MSICONDITION_NONE, "got %u\n", cond); + MsiSetPropertyA(hinst, "condprop", "1"); + cond = MsiEvaluateConditionA(hinst, "condprop = 1"); + ok(hinst, cond == MSICONDITION_TRUE, "got %u\n", cond); } static void test_feature_states(MSIHANDLE hinst) diff --git a/dlls/msi/winemsi.idl b/dlls/msi/winemsi.idl index 7d7054a7076..6bdd117160f 100644 --- a/dlls/msi/winemsi.idl +++ b/dlls/msi/winemsi.idl @@ -88,7 +88,7 @@ interface IWineMsiRemote LANGID remote_GetLanguage( [in] MSIHANDLE hinst ); UINT remote_SetInstallLevel( [in] MSIHANDLE hinst, [in] int level ); UINT remote_FormatRecord( [in] MSIHANDLE hinst, [in] struct wire_record *record, [out, string] LPWSTR *value); - HRESULT remote_EvaluateCondition( [in] MSIHANDLE hinst, [in] BSTR condition ); + MSICONDITION remote_EvaluateCondition( [in] MSIHANDLE hinst, [in, string] LPCWSTR condition ); HRESULT remote_GetFeatureCost( [in] MSIHANDLE hinst, [in] BSTR feature, [in] INT cost_tree, [in] INSTALLSTATE state, [out] INT *cost ); HRESULT remote_EnumComponentCosts( [in] MSIHANDLE hinst, [in] BSTR component, [in] DWORD index, [in] INSTALLSTATE state, [out, size_is(*buflen)] BSTR drive, [in, out] DWORD *buflen, [out] INT *cost, [out] INT *temp );