diff --git a/dlls/msi/install.c b/dlls/msi/install.c index 63aed1eeebe..45c55375bfd 100644 --- a/dlls/msi/install.c +++ b/dlls/msi/install.c @@ -1068,29 +1068,15 @@ UINT WINAPI MsiGetFeatureCostW(MSIHANDLE hInstall, LPCWSTR szFeature, 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 (!piCost) + return RPC_X_NULL_REF_POINTER; - hr = remote_GetFeatureCost(remote, feature, iCostTree, iState, piCost); - - SysFreeString(feature); - - if (FAILED(hr)) - { - if (HRESULT_FACILITY(hr) == FACILITY_WIN32) - return HRESULT_CODE(hr); - - return ERROR_FUNCTION_FAILED; - } - - return ERROR_SUCCESS; + return remote_GetFeatureCost(remote, szFeature, iCostTree, iState, piCost); } if (!piCost) diff --git a/dlls/msi/package.c b/dlls/msi/package.c index c93a0c85cfd..b6332509d42 100644 --- a/dlls/msi/package.c +++ b/dlls/msi/package.c @@ -2583,11 +2583,10 @@ MSICONDITION __cdecl remote_EvaluateCondition(MSIHANDLE hinst, LPCWSTR condition return MsiEvaluateConditionW(hinst, condition); } -HRESULT __cdecl remote_GetFeatureCost(MSIHANDLE hinst, BSTR feature, - INT cost_tree, INSTALLSTATE state, INT *cost) +UINT __cdecl remote_GetFeatureCost(MSIHANDLE hinst, LPCWSTR feature, + MSICOSTTREE cost_tree, INSTALLSTATE state, INT *cost) { - UINT r = MsiGetFeatureCostW(hinst, feature, cost_tree, state, cost); - return HRESULT_FROM_WIN32(r); + return MsiGetFeatureCostW(hinst, feature, cost_tree, state, cost); } HRESULT __cdecl remote_EnumComponentCosts(MSIHANDLE hinst, BSTR component, diff --git a/dlls/msi/tests/custom.c b/dlls/msi/tests/custom.c index 2035a8f7295..ecd172a7161 100644 --- a/dlls/msi/tests/custom.c +++ b/dlls/msi/tests/custom.c @@ -855,6 +855,25 @@ static void test_format_record(MSIHANDLE hinst) MsiCloseHandle(rec); } +static void test_costs(MSIHANDLE hinst) +{ + INT cost; + UINT r; + + cost = 0xdead; + r = MsiGetFeatureCostA(hinst, NULL, MSICOSTTREE_CHILDREN, INSTALLSTATE_LOCAL, &cost); + ok(hinst, r == ERROR_INVALID_PARAMETER, "got %u\n", r); + todo_wine_ok(hinst, !cost, "got %d\n", cost); + + r = MsiGetFeatureCostA(hinst, "One", MSICOSTTREE_CHILDREN, INSTALLSTATE_LOCAL, NULL); + ok(hinst, r == RPC_X_NULL_REF_POINTER, "got %u\n", r); + + cost = 0xdead; + r = MsiGetFeatureCostA(hinst, "One", MSICOSTTREE_CHILDREN, INSTALLSTATE_LOCAL, &cost); + ok(hinst, !r, "got %u\n", r); + todo_wine_ok(hinst, cost == 8, "got %d\n", cost); +} + /* 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) @@ -885,6 +904,7 @@ UINT WINAPI main_test(MSIHANDLE hinst) test_misc(hinst); test_feature_states(hinst); test_format_record(hinst); + test_costs(hinst); return ERROR_SUCCESS; } diff --git a/dlls/msi/tests/install.c b/dlls/msi/tests/install.c index 6a7383b3607..5c83d303fa2 100644 --- a/dlls/msi/tests/install.c +++ b/dlls/msi/tests/install.c @@ -698,6 +698,7 @@ static const CHAR ca1_install_exec_seq_dat[] = "Action\tCondition\tSequence\n" "CostInitialize\t\t100\n" "FileCost\t\t200\n" "CostFinalize\t\t300\n" + "InstallValidate\t\t400\n" "embednull\t\t600\n" "maintest\tMAIN_TEST\t700\n" "testretval\tTEST_RETVAL\t710\n"; diff --git a/dlls/msi/winemsi.idl b/dlls/msi/winemsi.idl index 6bdd117160f..fa98ac00434 100644 --- a/dlls/msi/winemsi.idl +++ b/dlls/msi/winemsi.idl @@ -29,6 +29,7 @@ typedef int MSIRUNMODE; typedef int INSTALLSTATE; typedef int MSICOLINFO; typedef int MSIMODIFY; +typedef int MSICOSTTREE; #define MSIFIELD_NULL 0 #define MSIFIELD_INT 1 @@ -89,7 +90,7 @@ interface IWineMsiRemote UINT remote_SetInstallLevel( [in] MSIHANDLE hinst, [in] int level ); UINT remote_FormatRecord( [in] MSIHANDLE hinst, [in] struct wire_record *record, [out, string] LPWSTR *value); 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 ); + UINT remote_GetFeatureCost( [in] MSIHANDLE hinst, [in, string] LPCWSTR feature, [in] MSICOSTTREE 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 );