Zebediah Figura : msi: Store string and record callback data separately.

Alexandre Julliard julliard at winehq.org
Mon Jun 19 14:49:30 CDT 2017


Module: wine
Branch: master
Commit: df31a7c1ece45ad5492bd96a4ad43611b3dde072
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=df31a7c1ece45ad5492bd96a4ad43611b3dde072

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Sun Jun 18 21:53:28 2017 -0500

msi: Store string and record callback data separately.

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/msi/media.c         |  2 +-
 dlls/msi/msi.c           |  4 ++--
 dlls/msi/msi_main.c      |  2 ++
 dlls/msi/msipriv.h       |  2 ++
 dlls/msi/package.c       | 13 ++++++++-----
 dlls/msi/tests/package.c | 12 ++++++++++--
 6 files changed, 25 insertions(+), 10 deletions(-)

diff --git a/dlls/msi/media.c b/dlls/msi/media.c
index 1357a64..bbfdd6f 100644
--- a/dlls/msi/media.c
+++ b/dlls/msi/media.c
@@ -109,7 +109,7 @@ static UINT msi_change_media(MSIPACKAGE *package, MSIMEDIAINFO *mi)
         {
             MSIHANDLE rec = MsiCreateRecord(1);
             MsiRecordSetStringW(rec, 0, error);
-            gUIHandlerRecord(gUIContext, MB_RETRYCANCEL | INSTALLMESSAGE_ERROR, rec);
+            gUIHandlerRecord(gUIContextRecord, MB_RETRYCANCEL | INSTALLMESSAGE_ERROR, rec);
             MsiCloseHandle(rec);
         }
     }
diff --git a/dlls/msi/msi.c b/dlls/msi/msi.c
index 8a11e83..ce8a7be 100644
--- a/dlls/msi/msi.c
+++ b/dlls/msi/msi.c
@@ -4222,8 +4222,8 @@ UINT WINAPI MsiSetExternalUIRecord( INSTALLUI_HANDLER_RECORD handler,
         *prev = gUIHandlerRecord;
 
     gUIHandlerRecord = handler;
-    gUIFilter        = filter;
-    gUIContext       = context;
+    gUIFilterRecord  = filter;
+    gUIContextRecord = context;
 
     return ERROR_SUCCESS;
 }
diff --git a/dlls/msi/msi_main.c b/dlls/msi/msi_main.c
index 0955856..11cbf41 100644
--- a/dlls/msi/msi_main.c
+++ b/dlls/msi/msi_main.c
@@ -44,7 +44,9 @@ INSTALLUI_HANDLERA       gUIHandlerA      = NULL;
 INSTALLUI_HANDLERW       gUIHandlerW      = NULL;
 INSTALLUI_HANDLER_RECORD gUIHandlerRecord = NULL;
 DWORD                    gUIFilter        = 0;
+DWORD                    gUIFilterRecord  = 0;
 LPVOID                   gUIContext       = NULL;
+LPVOID                   gUIContextRecord = NULL;
 WCHAR                   *gszLogFile       = NULL;
 HINSTANCE msi_hInstance;
 
diff --git a/dlls/msi/msipriv.h b/dlls/msi/msipriv.h
index 2e9e91e..cc42316 100644
--- a/dlls/msi/msipriv.h
+++ b/dlls/msi/msipriv.h
@@ -972,7 +972,9 @@ extern INSTALLUI_HANDLERA gUIHandlerA DECLSPEC_HIDDEN;
 extern INSTALLUI_HANDLERW gUIHandlerW DECLSPEC_HIDDEN;
 extern INSTALLUI_HANDLER_RECORD gUIHandlerRecord DECLSPEC_HIDDEN;
 extern DWORD gUIFilter DECLSPEC_HIDDEN;
+extern DWORD gUIFilterRecord DECLSPEC_HIDDEN;
 extern LPVOID gUIContext DECLSPEC_HIDDEN;
+extern LPVOID gUIContextRecord DECLSPEC_HIDDEN;
 extern WCHAR *gszLogFile DECLSPEC_HIDDEN;
 extern HINSTANCE msi_hInstance DECLSPEC_HIDDEN;
 
diff --git a/dlls/msi/package.c b/dlls/msi/package.c
index 8f86352..eae01e0 100644
--- a/dlls/msi/package.c
+++ b/dlls/msi/package.c
@@ -1811,27 +1811,30 @@ INT MSI_ProcessMessage( MSIPACKAGE *package, INSTALLMESSAGE eMessageType, MSIREC
         p[0] = 0;
     }
 
-    TRACE("%p %p %p %x %x %s\n", gUIHandlerA, gUIHandlerW, gUIHandlerRecord,
-          gUIFilter, log_type, debugstr_w(message));
-
     /* convert it to ASCII */
     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 );
 
-    if (gUIHandlerRecord && (gUIFilter & log_type))
+    if (gUIHandlerRecord && (gUIFilterRecord & log_type))
     {
         MSIHANDLE rec = MsiCreateRecord( 1 );
         MsiRecordSetStringW( rec, 0, message );
-        rc = gUIHandlerRecord( gUIContext, eMessageType, rec );
+        TRACE("Calling UI handler %p(pvContext=%p, iMessageType=%08x, hRecord=%u)\n",
+              gUIHandlerRecord, gUIContextRecord, eMessageType, rec);
+        rc = gUIHandlerRecord( gUIContextRecord, eMessageType, rec );
         MsiCloseHandle( rec );
     }
     if (!rc && gUIHandlerW && (gUIFilter & log_type))
     {
+        TRACE("Calling UI handler %p(pvContext=%p, iMessageType=%08x, szMessage=%s)\n",
+              gUIHandlerW, gUIContext, eMessageType, debugstr_w(message));
         rc = gUIHandlerW( gUIContext, eMessageType, message );
     }
     else if (!rc && gUIHandlerA && (gUIFilter & log_type))
     {
+        TRACE("Calling UI handler %p(pvContext=%p, iMessageType=%08x, szMessage=%s)\n",
+              gUIHandlerA, gUIContext, eMessageType, debugstr_a(msg));
         rc = gUIHandlerA( gUIContext, eMessageType, msg );
     }
 
diff --git a/dlls/msi/tests/package.c b/dlls/msi/tests/package.c
index e18f0f0..a7cec7f 100644
--- a/dlls/msi/tests/package.c
+++ b/dlls/msi/tests/package.c
@@ -9159,11 +9159,19 @@ static void test_externalui(void)
         retval = 1;
         externalui_ran = externalui_record_ran = 0;
         r = MsiProcessMessage(hpkg, INSTALLMESSAGE_USER, hrecord);
-        todo_wine
         ok(r == 1, "expected 1, got %u\n", r);
-        todo_wine
         ok(externalui_ran == 0, "external UI callback should not have run\n");
         ok(externalui_record_ran == 1, "external UI record callback did not run\n");
+
+        /* filter and context should be kept separately */
+        r = pMsiSetExternalUIRecord(externalui_record_callback, INSTALLLOGMODE_ERROR, &retval, &prev_record);
+        ok(r == ERROR_SUCCESS, "MsiSetExternalUIRecord failed %u\n", r);
+
+        externalui_ran = externalui_record_ran = 0;
+        r = MsiProcessMessage(hpkg, INSTALLMESSAGE_USER, hrecord);
+        ok(r == 0, "expected 0, got %u\n", r);
+        ok(externalui_ran == 1, "external UI callback did not run\n");
+        ok(externalui_record_ran == 0, "external UI record callback should not have run\n");
     }
     else
         win_skip("MsiSetExternalUIRecord is not available\n");




More information about the wine-cvs mailing list