msi: Make MsiEvaluateCondition() 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-24 22:27:40 -05:00 committed by Alexandre Julliard
parent ef7ed29348
commit 0fc1b6f2f3
4 changed files with 13 additions and 22 deletions

View File

@ -851,29 +851,14 @@ MSICONDITION WINAPI MsiEvaluateConditionW( MSIHANDLE hInstall, LPCWSTR szConditi
if( !package ) if( !package )
{ {
MSIHANDLE remote; MSIHANDLE remote;
HRESULT hr;
BSTR condition;
if (!(remote = msi_get_remote(hInstall))) if (!(remote = msi_get_remote(hInstall)))
return MSICONDITION_ERROR; return MSICONDITION_ERROR;
condition = SysAllocString( szCondition ); if (!szCondition)
if (!condition) return MSICONDITION_NONE;
return ERROR_OUTOFMEMORY;
hr = remote_EvaluateCondition(remote, condition); return remote_EvaluateCondition(remote, szCondition);
SysFreeString( condition );
if (FAILED(hr))
{
if (HRESULT_FACILITY(hr) == FACILITY_WIN32)
return HRESULT_CODE(hr);
return ERROR_FUNCTION_FAILED;
}
return ERROR_SUCCESS;
} }
ret = MSI_EvaluateConditionW( package, szCondition ); ret = MSI_EvaluateConditionW( package, szCondition );

View File

@ -2578,10 +2578,9 @@ UINT __cdecl remote_FormatRecord(MSIHANDLE hinst, struct wire_record *remote_rec
return r; return r;
} }
HRESULT __cdecl remote_EvaluateCondition(MSIHANDLE hinst, BSTR condition) MSICONDITION __cdecl remote_EvaluateCondition(MSIHANDLE hinst, LPCWSTR condition)
{ {
UINT r = MsiEvaluateConditionW(hinst, condition); return MsiEvaluateConditionW(hinst, condition);
return HRESULT_FROM_WIN32(r);
} }
HRESULT __cdecl remote_GetFeatureCost(MSIHANDLE hinst, BSTR feature, HRESULT __cdecl remote_GetFeatureCost(MSIHANDLE hinst, BSTR feature,

View File

@ -644,6 +644,7 @@ static void test_targetpath(MSIHANDLE hinst)
static void test_misc(MSIHANDLE hinst) static void test_misc(MSIHANDLE hinst)
{ {
MSICONDITION cond;
LANGID lang; LANGID lang;
UINT r; UINT r;
@ -658,6 +659,12 @@ static void test_misc(MSIHANDLE hinst)
ok(hinst, !r, "got %u\n", r); ok(hinst, !r, "got %u\n", r);
check_prop(hinst, "INSTALLLEVEL", "123"); check_prop(hinst, "INSTALLLEVEL", "123");
MsiSetInstallLevel(hinst, 3); 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) static void test_feature_states(MSIHANDLE hinst)

View File

@ -88,7 +88,7 @@ interface IWineMsiRemote
LANGID remote_GetLanguage( [in] MSIHANDLE hinst ); LANGID remote_GetLanguage( [in] MSIHANDLE hinst );
UINT remote_SetInstallLevel( [in] MSIHANDLE hinst, [in] int level ); UINT remote_SetInstallLevel( [in] MSIHANDLE hinst, [in] int level );
UINT remote_FormatRecord( [in] MSIHANDLE hinst, [in] struct wire_record *record, [out, string] LPWSTR *value); 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_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, 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 ); [out, size_is(*buflen)] BSTR drive, [in, out] DWORD *buflen, [out] INT *cost, [out] INT *temp );