[1/3] msi: Add support for the Unicode version of the global UI handler.

Hans Leidekker hans at codeweavers.com
Mon Nov 2 03:03:14 CST 2009


---
 dlls/msi/media.c   |   14 ++++++++------
 dlls/msi/msi.c     |    6 ++++--
 dlls/msi/package.c |   21 +++++++++++----------
 3 files changed, 23 insertions(+), 18 deletions(-)

diff --git a/dlls/msi/media.c b/dlls/msi/media.c
index 06f14e0..fe0192e 100644
--- a/dlls/msi/media.c
+++ b/dlls/msi/media.c
@@ -70,7 +70,6 @@ static BOOL source_matches_volume(MSIMEDIAINFO *mi, LPCWSTR source_root)
 
 static UINT msi_change_media(MSIPACKAGE *package, MSIMEDIAINFO *mi)
 {
-    LPSTR msg;
     LPWSTR error, error_dialog;
     LPWSTR source_dir;
     UINT r = ERROR_SUCCESS;
@@ -78,21 +77,24 @@ static UINT msi_change_media(MSIPACKAGE *package, MSIMEDIAINFO *mi)
     static const WCHAR error_prop[] = {'E','r','r','o','r','D','i','a','l','o','g',0};
 
     if ((msi_get_property_int(package, szUILevel, 0) & INSTALLUILEVEL_MASK) ==
-         INSTALLUILEVEL_NONE && !gUIHandlerA)
+         INSTALLUILEVEL_NONE && !gUIHandlerA && !gUIHandlerW)
         return ERROR_SUCCESS;
 
     error = generate_error_string(package, 1302, 1, mi->disk_prompt);
     error_dialog = msi_dup_property(package, error_prop);
     source_dir = msi_dup_property(package, cszSourceDir);
 
-    while (r == ERROR_SUCCESS &&
-           !source_matches_volume(mi, source_dir))
+    while (r == ERROR_SUCCESS && !source_matches_volume(mi, source_dir))
     {
         r = msi_spawn_error_dialog(package, error_dialog, error);
 
-        if (gUIHandlerA)
+        if (gUIHandlerW)
         {
-            msg = strdupWtoA(error);
+            gUIHandlerW(gUIContext, MB_RETRYCANCEL | INSTALLMESSAGE_ERROR, error);
+        }
+        else if (gUIHandlerA)
+        {
+            char *msg = strdupWtoA(error);
             gUIHandlerA(gUIContext, MB_RETRYCANCEL | INSTALLMESSAGE_ERROR, msg);
             msi_free(msg);
         }
diff --git a/dlls/msi/msi.c b/dlls/msi/msi.c
index 14f8f13..8558a75 100644
--- a/dlls/msi/msi.c
+++ b/dlls/msi/msi.c
@@ -1902,7 +1902,8 @@ INSTALLUI_HANDLERA WINAPI MsiSetExternalUIA(INSTALLUI_HANDLERA puiHandler,
 {
     INSTALLUI_HANDLERA prev = gUIHandlerA;
 
-    TRACE("%p %x %p\n",puiHandler, dwMessageFilter,pvContext);
+    TRACE("%p %08x %p\n", puiHandler, dwMessageFilter, pvContext);
+
     gUIHandlerA = puiHandler;
     gUIFilter = dwMessageFilter;
     gUIContext = pvContext;
@@ -1915,7 +1916,8 @@ INSTALLUI_HANDLERW WINAPI MsiSetExternalUIW(INSTALLUI_HANDLERW puiHandler,
 {
     INSTALLUI_HANDLERW prev = gUIHandlerW;
 
-    TRACE("%p %x %p\n",puiHandler,dwMessageFilter,pvContext);
+    TRACE("%p %08x %p\n", puiHandler, dwMessageFilter, pvContext);
+
     gUIHandlerW = puiHandler;
     gUIFilter = dwMessageFilter;
     gUIContext = pvContext;
diff --git a/dlls/msi/package.c b/dlls/msi/package.c
index 13091d9..08a76f6 100644
--- a/dlls/msi/package.c
+++ b/dlls/msi/package.c
@@ -1203,19 +1203,21 @@ INT MSI_ProcessMessage( MSIPACKAGE *package, INSTALLMESSAGE eMessageType,
         }
     }
 
-    TRACE("(%p %x %x %s)\n", gUIHandlerA, gUIFilter, log_type,
-                             debugstr_w(message));
+    TRACE("%p %p %x %x %s\n", gUIHandlerA, gUIHandlerW,
+          gUIFilter, log_type, debugstr_w(message));
 
     /* convert it to ASCII */
-    len = WideCharToMultiByte( CP_ACP, 0, message, -1,
-                               NULL, 0, NULL, NULL );
+    len = WideCharToMultiByte( CP_ACP, 0, message, -1, NULL, 0, NULL, NULL );
     msg = msi_alloc( len );
-    WideCharToMultiByte( CP_ACP, 0, message, -1,
-                         msg, len, NULL, NULL );
+    WideCharToMultiByte( CP_ACP, 0, message, -1, msg, len, NULL, NULL );
 
-    if (gUIHandlerA && (gUIFilter & log_type))
+    if (gUIHandlerW && (gUIFilter & log_type))
     {
-        rc = gUIHandlerA(gUIContext,eMessageType,msg);
+        rc = gUIHandlerW( gUIContext, eMessageType, message );
+    }
+    else if (gUIHandlerA && (gUIFilter & log_type))
+    {
+        rc = gUIHandlerA( gUIContext, eMessageType, msg );
     }
 
     if ((!rc) && (gszLogFile[0]) && !((eMessageType & 0xff000000) ==
@@ -1234,8 +1236,7 @@ INT MSI_ProcessMessage( MSIPACKAGE *package, INSTALLMESSAGE eMessageType,
         }
     }
     msi_free( msg );
-
-    msi_free( message);
+    msi_free( message );
 
     switch (eMessageType & 0xff000000)
     {
-- 
1.6.3.3





More information about the wine-patches mailing list