msi: Add support for the Unicode version of the global UI handler.

This commit is contained in:
Hans Leidekker 2009-11-02 10:03:14 +01:00 committed by Alexandre Julliard
parent 1c7c406b86
commit 4b5248c9e0
3 changed files with 23 additions and 18 deletions

View File

@ -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);
}

View File

@ -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;

View File

@ -1203,17 +1203,19 @@ 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 = gUIHandlerW( gUIContext, eMessageType, message );
}
else if (gUIHandlerA && (gUIFilter & log_type))
{
rc = gUIHandlerA( gUIContext, eMessageType, msg );
}
@ -1234,7 +1236,6 @@ INT MSI_ProcessMessage( MSIPACKAGE *package, INSTALLMESSAGE eMessageType,
}
}
msi_free( msg );
msi_free( message );
switch (eMessageType & 0xff000000)