MSI: handle a number as a parameter for custom action 19

Mike McCormack mike at codeweavers.com
Tue Feb 8 08:58:37 CST 2005


ChangeLog:
* handle a number as a parameter for custom action 19
-------------- next part --------------
--- dlls/msi/custom.c.1	2005-02-08 23:56:12.000000000 +0900
+++ dlls/msi/custom.c	2005-02-08 23:56:22.000000000 +0900
@@ -67,6 +67,8 @@
                                LPCWSTR target, const INT type, LPCWSTR action);
 static UINT HANDLE_CustomType18(MSIPACKAGE *package, LPCWSTR source,
                                 LPCWSTR target, const INT type, LPCWSTR action);
+static UINT HANDLE_CustomType19(MSIPACKAGE *package, LPCWSTR source,
+                                LPCWSTR target, const INT type, LPCWSTR action);
 static UINT HANDLE_CustomType50(MSIPACKAGE *package, LPCWSTR source,
                                 LPCWSTR target, const INT type, LPCWSTR action);
 static UINT HANDLE_CustomType34(MSIPACKAGE *package, LPCWSTR source,
@@ -193,9 +195,7 @@
             rc = HANDLE_CustomType18(package,source,target,type,action);
             break;
         case 19: /* Error that halts install */
-            deformat_string(package,target,&deformated);
-            MessageBoxW(NULL,deformated,NULL,MB_OK);
-            rc = ERROR_FUNCTION_FAILED;
+            rc = HANDLE_CustomType19(package,source,target,type,action);
             break;
         case 50: /*EXE file specified by a property value */
             rc = HANDLE_CustomType50(package,source,target,type,action);
@@ -624,6 +624,49 @@
     return prc;
 }
 
+static UINT HANDLE_CustomType19(MSIPACKAGE *package, LPCWSTR source,
+                                LPCWSTR target, const INT type, LPCWSTR action)
+{
+    static const WCHAR query[] = {
+      'S','E','L','E','C','T',' ','`','M','e','s','s','a','g','e','`',' ',
+      'F','R','O','M',' ','`','E','r','r','o','r','`',' ',
+      'W','H','E','R','E',' ','`','E','r','r','o','r','`',' ','=',' ','%','s',0
+    };
+    MSIQUERY *view = NULL;
+    MSIRECORD *row = 0;
+    UINT r;
+    LPWSTR deformated = NULL;
+
+    deformat_string( package, target, &deformated );
+
+    /* first try treat the error as a number */
+    r = MSI_OpenQuery( package->db, &view, query, deformated );
+    if( r == ERROR_SUCCESS )
+    {
+        r = MSI_ViewExecute( view, 0 );
+        if( r == ERROR_SUCCESS )
+        {
+            r = MSI_ViewFetch( view, &row );
+            if( r == ERROR_SUCCESS )
+            {
+                LPCWSTR error = MSI_RecordGetString( row, 1 );
+                MessageBoxW( NULL, error, NULL, MB_OK );
+                msiobj_release( &row->hdr );
+            }
+        }
+        MSI_ViewClose( view );
+        msiobj_release( &view->hdr );
+    }
+
+    if (r != ERROR_SUCCESS )
+    {
+        MessageBoxW( NULL, deformated, NULL, MB_OK );
+        HeapFree( GetProcessHeap(), 0, deformated );
+    }
+
+    return ERROR_FUNCTION_FAILED;
+}
+
 static UINT HANDLE_CustomType50(MSIPACKAGE *package, LPCWSTR source,
                                 LPCWSTR target, const INT type, LPCWSTR action)
 {


More information about the wine-patches mailing list