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

commit e58cc02596abbbcbe343a82aad2d4789be3e0182
Author:     winesync <[email protected]>
AuthorDate: Sat Mar 12 23:57:42 2022 +0100
Commit:     Mark Jansen <[email protected]>
CommitDate: Sun Mar 20 19:28:02 2022 +0100

    [WINESYNC] msi: Move parameter checks to a common helper in 
MsiSummaryInfoSetProperty.
    
    Currently MsiSummaryInfoSetProperty tests don't have a chance to execute 
under
    Wine because the tests crash earlier, and the crashes are hidden by a custom
    action exception handler. This patch simplifies the next one.
    
    Signed-off-by: Dmitry Timoshkov <[email protected]>
    Signed-off-by: Hans Leidekker <[email protected]>
    Signed-off-by: Alexandre Julliard <[email protected]>
    
    wine commit id 7929c31ea7b9f47f68cd434393f1212e448a9cf7 by Dmitry Timoshkov 
<[email protected]>
---
 dll/win32/msi/suminfo.c | 44 ++++++++++++++++++++------------------------
 1 file changed, 20 insertions(+), 24 deletions(-)

diff --git a/dll/win32/msi/suminfo.c b/dll/win32/msi/suminfo.c
index 41ea4e44122..ec676e46e00 100644
--- a/dll/win32/msi/suminfo.c
+++ b/dll/win32/msi/suminfo.c
@@ -892,26 +892,32 @@ static UINT set_prop( MSISUMMARYINFO *si, UINT 
uiProperty, UINT type,
     return ERROR_SUCCESS;
 }
 
-UINT WINAPI MsiSummaryInfoSetPropertyW( MSIHANDLE handle, UINT uiProperty, 
UINT uiDataType,
-                                        INT iValue, FILETIME *pftValue, 
LPCWSTR szValue )
+static UINT msi_set_prop( MSISUMMARYINFO *si, UINT uiProperty, UINT uiDataType,
+                          INT iValue, FILETIME *pftValue, awcstring *str )
 {
-    awcstring str;
-    MSISUMMARYINFO *si;
-    UINT type, ret;
-
-    TRACE("%u, %u, %u, %d, %p, %s\n", handle, uiProperty, uiDataType, iValue, 
pftValue,
-          debugstr_w(szValue) );
-
-    type = get_type( uiProperty );
+    UINT type = get_type( uiProperty );
     if( type == VT_EMPTY || type != uiDataType )
         return ERROR_DATATYPE_MISMATCH;
 
-    if( uiDataType == VT_LPSTR && !szValue )
+    if( uiDataType == VT_LPSTR && !str->str.a )
         return ERROR_INVALID_PARAMETER;
 
     if( uiDataType == VT_FILETIME && !pftValue )
         return ERROR_INVALID_PARAMETER;
 
+    return set_prop( si, uiProperty, type, iValue, pftValue, str );
+}
+
+UINT WINAPI MsiSummaryInfoSetPropertyW( MSIHANDLE handle, UINT uiProperty, 
UINT uiDataType,
+                                        INT iValue, FILETIME *pftValue, 
LPCWSTR szValue )
+{
+    awcstring str;
+    MSISUMMARYINFO *si;
+    UINT ret;
+
+    TRACE("%u, %u, %u, %d, %p, %s\n", handle, uiProperty, uiDataType, iValue, 
pftValue,
+          debugstr_w(szValue) );
+
     if (!(si = msihandle2msiinfo( handle, MSIHANDLETYPE_SUMMARYINFO )))
     {
         MSIHANDLE remote;
@@ -928,7 +934,7 @@ UINT WINAPI MsiSummaryInfoSetPropertyW( MSIHANDLE handle, 
UINT uiProperty, UINT
     str.unicode = TRUE;
     str.str.w = szValue;
 
-    ret = set_prop( si, uiProperty, type, iValue, pftValue, &str );
+    ret = msi_set_prop( si, uiProperty, uiDataType, iValue, pftValue, &str );
     msiobj_release( &si->hdr );
     return ret;
 }
@@ -938,21 +944,11 @@ UINT WINAPI MsiSummaryInfoSetPropertyA( MSIHANDLE handle, 
UINT uiProperty, UINT
 {
     awcstring str;
     MSISUMMARYINFO *si;
-    UINT type, ret;
+    UINT ret;
 
     TRACE("%u, %u, %u, %d, %p, %s\n", handle, uiProperty, uiDataType, iValue, 
pftValue,
           debugstr_a(szValue) );
 
-    type = get_type( uiProperty );
-    if( type == VT_EMPTY || type != uiDataType )
-        return ERROR_DATATYPE_MISMATCH;
-
-    if( uiDataType == VT_LPSTR && !szValue )
-        return ERROR_INVALID_PARAMETER;
-
-    if( uiDataType == VT_FILETIME && !pftValue )
-        return ERROR_INVALID_PARAMETER;
-
     if (!(si = msihandle2msiinfo( handle, MSIHANDLETYPE_SUMMARYINFO )))
     {
         MSIHANDLE remote;
@@ -969,7 +965,7 @@ UINT WINAPI MsiSummaryInfoSetPropertyA( MSIHANDLE handle, 
UINT uiProperty, UINT
     str.unicode = FALSE;
     str.str.a = szValue;
 
-    ret = set_prop( si, uiProperty, uiDataType, iValue, pftValue, &str );
+    ret = msi_set_prop( si, uiProperty, uiDataType, iValue, pftValue, &str );
     msiobj_release( &si->hdr );
     return ret;
 }

Reply via email to