Msi: handle more custom actions

Aric Stewart aric at codeweavers.com
Wed Nov 3 10:24:23 CST 2004


Handle 3 more custom action types

-aric
-------------- next part --------------
Index: dlls/msi/action.c
===================================================================
RCS file: /home/wine/wine/dlls/msi/action.c,v
retrieving revision 1.39
diff -u -u -w -r1.39 action.c
--- dlls/msi/action.c	22 Oct 2004 22:06:31 -0000	1.39
+++ dlls/msi/action.c	3 Nov 2004 16:14:53 -0000
@@ -157,6 +157,12 @@
                                 const LPWSTR target, const INT type);
 static UINT HANDLE_CustomType2(MSIPACKAGE *package, const LPWSTR source, 
                                 const LPWSTR target, const INT type);
+static UINT HANDLE_CustomType18(MSIPACKAGE *package, const LPWSTR source, 
+                                const LPWSTR target, const INT type);
+static UINT HANDLE_CustomType50(MSIPACKAGE *package, const LPWSTR source, 
+                                const LPWSTR target, const INT type);
+static UINT HANDLE_CustomType34(MSIPACKAGE *package, const LPWSTR source, 
+                                const LPWSTR target, const INT type);
 
 static DWORD deformat_string(MSIPACKAGE *package, WCHAR* ptr,WCHAR** data);
 static UINT resolve_folder(MSIPACKAGE *package, LPCWSTR name, LPWSTR path, 
@@ -760,6 +766,9 @@
 
             rc = ACTION_PerformAction(package,buffer);
 
+            if (rc == ERROR_FUNCTION_NOT_CALLED)
+                rc = ERROR_SUCCESS;
+
             if (rc != ERROR_SUCCESS)
             {
                 ERR("Execution halted due to error (%i)\n",rc);
@@ -850,6 +859,9 @@
 
             rc = ACTION_PerformAction(package,buffer);
 
+            if (rc == ERROR_FUNCTION_NOT_CALLED)
+                rc = ERROR_SUCCESS;
+
             if (rc != ERROR_SUCCESS)
             {
                 ERR("Execution halted due to error (%i)\n",rc);
@@ -935,7 +947,7 @@
      else if ((rc = ACTION_CustomAction(package,action)) != ERROR_SUCCESS)
      {
         FIXME("UNHANDLED MSI ACTION %s\n",debugstr_w(action));
-        rc = ERROR_SUCCESS;
+        rc = ERROR_FUNCTION_NOT_CALLED;
      }
 
     ui_actioninfo(package, action, FALSE, rc);
@@ -999,6 +1011,15 @@
         case 2: /* EXE file stored in a Binary table strem */
             rc = HANDLE_CustomType2(package,source,target,type);
             break;
+        case 18: /*EXE file installed with package */
+            rc = HANDLE_CustomType18(package,source,target,type);
+            break;
+        case 50: /*EXE file specified by a property value */
+            rc = HANDLE_CustomType50(package,source,target,type);
+            break;
+        case 34: /*EXE to be run in specified directory */
+            rc = HANDLE_CustomType34(package,source,target,type);
+            break;
         case 35: /* Directory set with formatted text. */
         case 51: /* Property set with formatted text. */
             deformat_string(package,target,&deformated);
@@ -1246,6 +1267,127 @@
     TRACE("executing exe %s \n",debugstr_w(tmp_file));
 
     rc = CreateProcessW(NULL, tmp_file, NULL, NULL, FALSE, 0, NULL,
+                  c_collen, &si, &info);
+
+    if ( !rc )
+    {
+        ERR("Unable to execute command\n");
+        return ERROR_SUCCESS;
+    }
+
+    if (!(type & 0xc0))
+        WaitForSingleObject(info.hProcess,INFINITE);
+
+    return ERROR_SUCCESS;
+}
+
+static UINT HANDLE_CustomType18(MSIPACKAGE *package, const LPWSTR source, 
+                                const LPWSTR target, const INT type)
+{
+    WCHAR filename[MAX_PATH*2];
+    STARTUPINFOW si;
+    PROCESS_INFORMATION info;
+    BOOL rc;
+    WCHAR *deformated;
+    static const WCHAR spc[] = {' ',0};
+    int index;
+
+    memset(&si,0,sizeof(STARTUPINFOW));
+    memset(&info,0,sizeof(PROCESS_INFORMATION));
+
+    index = get_loaded_file(package,source);
+    strcpyW(filename,package->files[index].TargetPath);
+
+    strcatW(filename,spc);
+    deformat_string(package,target,&deformated);
+    strcatW(filename,deformated);
+
+    HeapFree(GetProcessHeap(),0,deformated);
+
+    TRACE("executing exe %s \n",debugstr_w(filename));
+
+    rc = CreateProcessW(NULL, filename, NULL, NULL, FALSE, 0, NULL,
+                  c_collen, &si, &info);
+
+    if ( !rc )
+    {
+        ERR("Unable to execute command\n");
+        return ERROR_SUCCESS;
+    }
+
+    if (!(type & 0xc0))
+        WaitForSingleObject(info.hProcess,INFINITE);
+
+    return ERROR_SUCCESS;
+}
+
+static UINT HANDLE_CustomType50(MSIPACKAGE *package, const LPWSTR source, 
+                                const LPWSTR target, const INT type)
+{
+    WCHAR filename[MAX_PATH*2];
+    STARTUPINFOW si;
+    PROCESS_INFORMATION info;
+    BOOL rc;
+    WCHAR *deformated;
+    static const WCHAR spc[] = {' ',0};
+    DWORD sz;
+
+    memset(&si,0,sizeof(STARTUPINFOW));
+    memset(&info,0,sizeof(PROCESS_INFORMATION));
+
+    sz = MAX_PATH*2;
+    if (MSI_GetPropertyW(package,source,filename,&sz) != ERROR_SUCCESS)
+        return ERROR_FUNCTION_FAILED;
+
+    strcatW(filename,spc);
+    deformat_string(package,target,&deformated);
+    strcatW(filename,deformated);
+
+    HeapFree(GetProcessHeap(),0,deformated);
+
+    TRACE("executing exe %s \n",debugstr_w(filename));
+
+    rc = CreateProcessW(NULL, filename, NULL, NULL, FALSE, 0, NULL,
+                  c_collen, &si, &info);
+
+    if ( !rc )
+    {
+        ERR("Unable to execute command\n");
+        return ERROR_SUCCESS;
+    }
+
+    if (!(type & 0xc0))
+        WaitForSingleObject(info.hProcess,INFINITE);
+
+    return ERROR_SUCCESS;
+}
+
+static UINT HANDLE_CustomType34(MSIPACKAGE *package, const LPWSTR source, 
+                                const LPWSTR target, const INT type)
+{
+    WCHAR filename[MAX_PATH*2];
+    STARTUPINFOW si;
+    PROCESS_INFORMATION info;
+    BOOL rc;
+    WCHAR *deformated;
+
+    memset(&si,0,sizeof(STARTUPINFOW));
+    memset(&info,0,sizeof(PROCESS_INFORMATION));
+
+    rc = resolve_folder(package, source, filename, FALSE, FALSE, NULL);
+    if (rc != ERROR_SUCCESS)
+        return rc;
+
+    SetCurrentDirectoryW(filename);
+
+    deformat_string(package,target,&deformated);
+    strcpyW(filename,deformated);
+
+    HeapFree(GetProcessHeap(),0,deformated);
+
+    TRACE("executing exe %s \n",debugstr_w(filename));
+
+    rc = CreateProcessW(NULL, filename, NULL, NULL, FALSE, 0, NULL,
                   c_collen, &si, &info);
 
     if ( !rc )


More information about the wine-patches mailing list