Commit e500af2b authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

msi: Make MsiGetFeatureCost() RPC-compatible.

parent 1b6adcb7
......@@ -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;
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;
}
/* FIXME: should use SEH */
if (!piCost)
return RPC_X_NULL_REF_POINTER;
return ERROR_SUCCESS;
return remote_GetFeatureCost(remote, szFeature, iCostTree, iState, piCost);
}
if (!piCost)
......
......@@ -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,
......
......@@ -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;
}
......
......@@ -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";
......
......@@ -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 );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment