Commit df31a7c1 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

msi: Store string and record callback data separately.

parent cef67993
......@@ -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);
}
}
......
......@@ -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;
}
......
......@@ -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;
......
......@@ -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;
......
......@@ -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 );
}
......
......@@ -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");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment