Hans Leidekker : msi: Strip leading text style label from control text before lookup in binary table .
Alexandre Julliard
julliard at winehq.org
Wed Mar 3 11:15:47 CST 2010
Module: wine
Branch: master
Commit: 7b6858546c7a1ed05e4ea85a6f1a387b75f3bb73
URL: http://source.winehq.org/git/wine.git/?a=commit;h=7b6858546c7a1ed05e4ea85a6f1a387b75f3bb73
Author: Hans Leidekker <hans at codeweavers.com>
Date: Wed Mar 3 14:37:39 2010 +0100
msi: Strip leading text style label from control text before lookup in binary table.
---
dlls/msi/dialog.c | 61 ++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 44 insertions(+), 17 deletions(-)
diff --git a/dlls/msi/dialog.c b/dlls/msi/dialog.c
index 5fd4bbd..ac2e95a 100644
--- a/dlls/msi/dialog.c
+++ b/dlls/msi/dialog.c
@@ -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;
- /* 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 )
- SendMessageW( control->hwnd, BM_SETIMAGE, IMAGE_ICON, (LPARAM) control->hIcon );
- msi_free( text );
+ if (attributes & msidbControlAttributesIcon)
+ {
+ /* set the icon */
+ 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 );
+ }
+ 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;
}
More information about the wine-cvs
mailing list