msi: Strip leading text style label from control text before lookup in binary table.
This commit is contained in:
parent
1b8ba25371
commit
7b6858546c
|
@ -801,11 +801,31 @@ static UINT msi_dialog_text_control( msi_dialog *dialog, MSIRECORD *rec )
|
|||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
/* strip any leading text style label from text field */
|
||||
static WCHAR *msi_get_binary_name( MSIPACKAGE *package, MSIRECORD *rec )
|
||||
{
|
||||
WCHAR *p, *text;
|
||||
|
||||
text = msi_get_deformatted_field( package, rec, 10 );
|
||||
if (!text)
|
||||
return NULL;
|
||||
|
||||
p = text;
|
||||
while (*p && *p != '{') p++;
|
||||
if (!*p++) return text;
|
||||
|
||||
while (*p && *p != '}') p++;
|
||||
if (!*p++) return text;
|
||||
|
||||
p = strdupW( p );
|
||||
msi_free( text );
|
||||
return p;
|
||||
}
|
||||
|
||||
static UINT msi_dialog_button_control( msi_dialog *dialog, MSIRECORD *rec )
|
||||
{
|
||||
msi_control *control;
|
||||
UINT attributes, style;
|
||||
LPWSTR text;
|
||||
|
||||
TRACE("%p %p\n", dialog, rec);
|
||||
|
||||
|
@ -820,12 +840,19 @@ static UINT msi_dialog_button_control( msi_dialog *dialog, MSIRECORD *rec )
|
|||
|
||||
control->handler = msi_dialog_button_handler;
|
||||
|
||||
if (attributes & msidbControlAttributesIcon)
|
||||
{
|
||||
/* set the icon */
|
||||
text = msi_get_deformatted_field( dialog->package, rec, 10 );
|
||||
control->hIcon = msi_load_icon( dialog->package->db, text, attributes );
|
||||
if( attributes & msidbControlAttributesIcon )
|
||||
LPWSTR name = msi_get_binary_name( dialog->package, rec );
|
||||
control->hIcon = msi_load_icon( dialog->package->db, name, attributes );
|
||||
if (control->hIcon)
|
||||
{
|
||||
SendMessageW( control->hwnd, BM_SETIMAGE, IMAGE_ICON, (LPARAM) control->hIcon );
|
||||
msi_free( text );
|
||||
}
|
||||
else
|
||||
ERR("Failed to load icon %s\n", debugstr_w(name));
|
||||
msi_free( name );
|
||||
}
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
@ -1142,7 +1169,7 @@ static UINT msi_dialog_bitmap_control( msi_dialog *dialog, MSIRECORD *rec )
|
|||
{
|
||||
UINT cx, cy, flags, style, attributes;
|
||||
msi_control *control;
|
||||
LPWSTR text;
|
||||
LPWSTR name;
|
||||
|
||||
flags = LR_LOADFROMFILE;
|
||||
style = SS_BITMAP | SS_LEFT | WS_GROUP;
|
||||
|
@ -1160,15 +1187,15 @@ static UINT msi_dialog_bitmap_control( msi_dialog *dialog, MSIRECORD *rec )
|
|||
cx = msi_dialog_scale_unit( dialog, cx );
|
||||
cy = msi_dialog_scale_unit( dialog, cy );
|
||||
|
||||
text = msi_get_deformatted_field( dialog->package, rec, 10 );
|
||||
control->hBitmap = msi_load_picture( dialog->package->db, text, cx, cy, flags );
|
||||
name = msi_get_binary_name( dialog->package, rec );
|
||||
control->hBitmap = msi_load_picture( dialog->package->db, name, cx, cy, flags );
|
||||
if( control->hBitmap )
|
||||
SendMessageW( control->hwnd, STM_SETIMAGE,
|
||||
IMAGE_BITMAP, (LPARAM) control->hBitmap );
|
||||
else
|
||||
ERR("Failed to load bitmap %s\n", debugstr_w(text));
|
||||
ERR("Failed to load bitmap %s\n", debugstr_w(name));
|
||||
|
||||
msi_free( text );
|
||||
msi_free( name );
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
@ -1177,7 +1204,7 @@ static UINT msi_dialog_icon_control( msi_dialog *dialog, MSIRECORD *rec )
|
|||
{
|
||||
msi_control *control;
|
||||
DWORD attributes;
|
||||
LPWSTR text;
|
||||
LPWSTR name;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
|
@ -1185,13 +1212,13 @@ static UINT msi_dialog_icon_control( msi_dialog *dialog, MSIRECORD *rec )
|
|||
SS_ICON | SS_CENTERIMAGE | WS_GROUP );
|
||||
|
||||
attributes = MSI_RecordGetInteger( rec, 8 );
|
||||
text = msi_get_deformatted_field( dialog->package, rec, 10 );
|
||||
control->hIcon = msi_load_icon( dialog->package->db, text, attributes );
|
||||
name = msi_get_binary_name( dialog->package, rec );
|
||||
control->hIcon = msi_load_icon( dialog->package->db, name, attributes );
|
||||
if( control->hIcon )
|
||||
SendMessageW( control->hwnd, STM_SETICON, (WPARAM) control->hIcon, 0 );
|
||||
else
|
||||
ERR("Failed to load bitmap %s\n", debugstr_w(text));
|
||||
msi_free( text );
|
||||
ERR("Failed to load bitmap %s\n", debugstr_w(name));
|
||||
msi_free( name );
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue