https://git.reactos.org/?p=reactos.git;a=commitdiff;h=03faa10759eb1562ecf13d47c366b0f7aa9618d3

commit 03faa10759eb1562ecf13d47c366b0f7aa9618d3
Author:     winesync <[email protected]>
AuthorDate: Sat Mar 12 15:12:05 2022 +0100
Commit:     Mark Jansen <[email protected]>
CommitDate: Sun Mar 20 19:27:41 2022 +0100

    [WINESYNC] msi: Make MsiEvaluateCondition() RPC-compatible.
    
    Signed-off-by: Zebediah Figura <[email protected]>
    Signed-off-by: Hans Leidekker <[email protected]>
    Signed-off-by: Alexandre Julliard <[email protected]>
    
    wine commit id 0fc1b6f2f31952f9dab4a22805fe0f098548cb25 by Zebediah Figura 
<[email protected]>
---
 dll/win32/msi/cond.y                    | 21 +++------------------
 dll/win32/msi/package.c                 |  5 ++---
 dll/win32/msi/winemsi.idl               |  2 +-
 modules/rostests/winetests/msi/custom.c |  7 +++++++
 4 files changed, 13 insertions(+), 22 deletions(-)

diff --git a/dll/win32/msi/cond.y b/dll/win32/msi/cond.y
index 6156750c04b..a8c97340db9 100644
--- a/dll/win32/msi/cond.y
+++ b/dll/win32/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/dll/win32/msi/package.c b/dll/win32/msi/package.c
index 03335fb9d66..d4cbe0766da 100644
--- a/dll/win32/msi/package.c
+++ b/dll/win32/msi/package.c
@@ -2585,10 +2585,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/dll/win32/msi/winemsi.idl b/dll/win32/msi/winemsi.idl
index 7d7054a7076..6bdd117160f 100644
--- a/dll/win32/msi/winemsi.idl
+++ b/dll/win32/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 );
diff --git a/modules/rostests/winetests/msi/custom.c 
b/modules/rostests/winetests/msi/custom.c
index 76a70adac40..2035a8f7295 100644
--- a/modules/rostests/winetests/msi/custom.c
+++ b/modules/rostests/winetests/msi/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)

Reply via email to