https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9f3e4bbbecd13e8644621…
commit 9f3e4bbbecd13e8644621e6be87d3d44262bb5be
Author: winesync <ros-dev(a)reactos.org>
AuthorDate: Sat Mar 12 15:12:06 2022 +0100
Commit: Mark Jansen <mark.jansen(a)reactos.org>
CommitDate: Sun Mar 20 19:27:42 2022 +0100
[WINESYNC] msi: Make MsiGetFeatureCost() RPC-compatible.
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
Signed-off-by: Hans Leidekker <hans(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
wine commit id e500af2b678da519011588ee6973bda19999f34d by Zebediah Figura
<z.figura12(a)gmail.com>
---
dll/win32/msi/install.c | 22 ++++------------------
dll/win32/msi/package.c | 7 +++----
dll/win32/msi/winemsi.idl | 3 ++-
modules/rostests/winetests/msi/custom.c | 20 ++++++++++++++++++++
modules/rostests/winetests/msi/install.c | 1 +
5 files changed, 30 insertions(+), 23 deletions(-)
diff --git a/dll/win32/msi/install.c b/dll/win32/msi/install.c
index 63aed1eeebe..45c55375bfd 100644
--- a/dll/win32/msi/install.c
+++ b/dll/win32/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;
-
- 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)
diff --git a/dll/win32/msi/package.c b/dll/win32/msi/package.c
index d4cbe0766da..12893f3ad1d 100644
--- a/dll/win32/msi/package.c
+++ b/dll/win32/msi/package.c
@@ -2590,11 +2590,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/dll/win32/msi/winemsi.idl b/dll/win32/msi/winemsi.idl
index 6bdd117160f..fa98ac00434 100644
--- a/dll/win32/msi/winemsi.idl
+++ b/dll/win32/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 );
diff --git a/modules/rostests/winetests/msi/custom.c
b/modules/rostests/winetests/msi/custom.c
index 2035a8f7295..ecd172a7161 100644
--- a/modules/rostests/winetests/msi/custom.c
+++ b/modules/rostests/winetests/msi/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/modules/rostests/winetests/msi/install.c
b/modules/rostests/winetests/msi/install.c
index 6a7383b3607..5c83d303fa2 100644
--- a/modules/rostests/winetests/msi/install.c
+++ b/modules/rostests/winetests/msi/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";