From 9066c718b02e92f50334592302881425ab8d502d Mon Sep 17 00:00:00 2001 From: winesync Date: Sun, 13 Mar 2022 21:24:17 +0100 Subject: [PATCH] [WINESYNC] msi: Use wide character string literals in dialog.c. Signed-off-by: Hans Leidekker Signed-off-by: Alexandre Julliard wine commit id d9fbe788af65c2b2696c446d765a34ae40e3226b by Hans Leidekker --- dll/win32/msi/dialog.c | 501 ++++++++++++++--------------------------- 1 file changed, 174 insertions(+), 327 deletions(-) diff --git a/dll/win32/msi/dialog.c b/dll/win32/msi/dialog.c index fa4853eb3ce..18a92e6fb9b 100644 --- a/dll/win32/msi/dialog.c +++ b/dll/win32/msi/dialog.c @@ -117,7 +117,7 @@ struct subscriber }; typedef UINT (*msi_dialog_control_func)( msi_dialog *dialog, MSIRECORD *rec ); -struct control_handler +struct control_handler { LPCWSTR control_type; msi_dialog_control_func func; @@ -130,38 +130,6 @@ typedef struct LPWSTR propval; } radio_button_group_descr; -static const WCHAR szMsiDialogClass[] = { 'M','s','i','D','i','a','l','o','g','C','l','o','s','e','C','l','a','s','s',0 }; -static const WCHAR szMsiHiddenWindow[] = { 'M','s','i','H','i','d','d','e','n','W','i','n','d','o','w',0 }; -static const WCHAR szStatic[] = { 'S','t','a','t','i','c',0 }; -static const WCHAR szButton[] = { 'B','U','T','T','O','N', 0 }; -static const WCHAR szButtonData[] = { 'M','S','I','D','A','T','A',0 }; -static const WCHAR szProgress[] = { 'P','r','o','g','r','e','s','s',0 }; -static const WCHAR szText[] = { 'T','e','x','t',0 }; -static const WCHAR szPushButton[] = { 'P','u','s','h','B','u','t','t','o','n',0 }; -static const WCHAR szLine[] = { 'L','i','n','e',0 }; -static const WCHAR szBitmap[] = { 'B','i','t','m','a','p',0 }; -static const WCHAR szCheckBox[] = { 'C','h','e','c','k','B','o','x',0 }; -static const WCHAR szScrollableText[] = { 'S','c','r','o','l','l','a','b','l','e','T','e','x','t',0 }; -static const WCHAR szComboBox[] = { 'C','o','m','b','o','B','o','x',0 }; -static const WCHAR szEdit[] = { 'E','d','i','t',0 }; -static const WCHAR szMaskedEdit[] = { 'M','a','s','k','e','d','E','d','i','t',0 }; -static const WCHAR szPathEdit[] = { 'P','a','t','h','E','d','i','t',0 }; -static const WCHAR szProgressBar[] = { 'P','r','o','g','r','e','s','s','B','a','r',0 }; -static const WCHAR szSetProgress[] = { 'S','e','t','P','r','o','g','r','e','s','s',0 }; -static const WCHAR szRadioButtonGroup[] = { 'R','a','d','i','o','B','u','t','t','o','n','G','r','o','u','p',0 }; -static const WCHAR szIcon[] = { 'I','c','o','n',0 }; -static const WCHAR szSelectionTree[] = { 'S','e','l','e','c','t','i','o','n','T','r','e','e',0 }; -static const WCHAR szGroupBox[] = { 'G','r','o','u','p','B','o','x',0 }; -static const WCHAR szListBox[] = { 'L','i','s','t','B','o','x',0 }; -static const WCHAR szDirectoryCombo[] = { 'D','i','r','e','c','t','o','r','y','C','o','m','b','o',0 }; -static const WCHAR szDirectoryList[] = { 'D','i','r','e','c','t','o','r','y','L','i','s','t',0 }; -static const WCHAR szVolumeCostList[] = { 'V','o','l','u','m','e','C','o','s','t','L','i','s','t',0 }; -static const WCHAR szVolumeSelectCombo[] = { 'V','o','l','u','m','e','S','e','l','e','c','t','C','o','m','b','o',0 }; -static const WCHAR szSelectionDescription[] = {'S','e','l','e','c','t','i','o','n','D','e','s','c','r','i','p','t','i','o','n',0}; -static const WCHAR szSelectionPath[] = {'S','e','l','e','c','t','i','o','n','P','a','t','h',0}; -static const WCHAR szHyperLink[] = {'H','y','p','e','r','L','i','n','k',0}; -static const WCHAR szListView[] = {'L','i','s','t','V','i','e','w',0}; - /* dialog sequencing */ #define WM_MSI_DIALOG_CREATE (WM_USER+0x100) @@ -376,15 +344,12 @@ static UINT msi_dialog_set_font( msi_dialog *dialog, HWND hwnd, LPCWSTR name ) static UINT msi_dialog_build_font_list( msi_dialog *dialog ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','T','e','x','t','S','t','y','l','e','`',0}; MSIQUERY *view; UINT r; TRACE("dialog %p\n", dialog ); - r = MSI_OpenQuery( dialog->package->db, &view, query ); + r = MSI_OpenQuery( dialog->package->db, &view, L"SELECT * FROM `TextStyle`" ); if( r != ERROR_SUCCESS ) return r; @@ -479,31 +444,13 @@ static LPWSTR msi_dialog_get_uitext( msi_dialog *dialog, LPCWSTR key ) MSIRECORD *rec; LPWSTR text; - static const WCHAR query[] = { - 's','e','l','e','c','t',' ','*',' ', - 'f','r','o','m',' ','`','U','I','T','e','x','t','`',' ', - 'w','h','e','r','e',' ','`','K','e','y','`',' ','=',' ','\'','%','s','\'',0 - }; - - rec = MSI_QueryGetRecord( dialog->package->db, query, key ); + rec = MSI_QueryGetRecord( dialog->package->db, L"SELECT * FROM `UIText` WHERE `Key` = '%s'", key ); if (!rec) return NULL; text = strdupW( MSI_RecordGetString( rec, 2 ) ); msiobj_release( &rec->hdr ); return text; } -static MSIRECORD *msi_get_binary_record( MSIDATABASE *db, LPCWSTR name ) -{ - static const WCHAR query[] = { - 's','e','l','e','c','t',' ','*',' ', - 'f','r','o','m',' ','B','i','n','a','r','y',' ', - 'w','h','e','r','e',' ', - '`','N','a','m','e','`',' ','=',' ','\'','%','s','\'',0 - }; - - return MSI_QueryGetRecord( db, query, name ); -} - static HANDLE msi_load_image( MSIDATABASE *db, LPCWSTR name, UINT type, UINT cx, UINT cy, UINT flags ) { @@ -516,7 +463,7 @@ static HANDLE msi_load_image( MSIDATABASE *db, LPCWSTR name, UINT type, if (!(tmp = msi_create_temp_file( db ))) return NULL; - rec = msi_get_binary_record( db, name ); + rec = MSI_QueryGetRecord( db, L"SELCT * FROM `Binary` WHERE `Name` = '%s'", name ); if( rec ) { r = MSI_RecordStreamToFile( rec, 2, tmp ); @@ -580,7 +527,7 @@ static void msi_dialog_update_all_controls( msi_dialog *dialog ) static void msi_dialog_set_property( MSIPACKAGE *package, LPCWSTR property, LPCWSTR value ) { UINT r = msi_set_property( package->db, property, value, -1 ); - if (r == ERROR_SUCCESS && !wcscmp( property, szSourceDir )) + if (r == ERROR_SUCCESS && !wcscmp( property, L"SourceDir" )) msi_reset_source_folders( package ); } @@ -606,7 +553,7 @@ struct msi_selection_tree_info static MSIFEATURE *msi_seltree_get_selected_feature( msi_control *control ) { - struct msi_selection_tree_info *info = GetPropW( control->hwnd, szButtonData ); + struct msi_selection_tree_info *info = GetPropW( control->hwnd, L"MSIDATA" ); return msi_seltree_feature_from_item( control->hwnd, info->selected ); } @@ -618,7 +565,7 @@ static void dialog_handle_event( msi_dialog *dialog, const WCHAR *control, ctrl = msi_dialog_find_control( dialog, control ); if (!ctrl) return; - if( !wcscmp( attribute, szText ) ) + if( !wcscmp( attribute, L"Text" ) ) { const WCHAR *font_text, *text = NULL; WCHAR *font, *text_fmt = NULL; @@ -627,7 +574,7 @@ static void dialog_handle_event( msi_dialog *dialog, const WCHAR *control, font = msi_dialog_get_style( font_text, &text ); deformat_string( dialog->package, text, &text_fmt ); if (text_fmt) text = text_fmt; - else text = szEmpty; + else text = L""; SetWindowTextW( ctrl->hwnd, text ); @@ -635,7 +582,7 @@ static void dialog_handle_event( msi_dialog *dialog, const WCHAR *control, msi_free( text_fmt ); msi_dialog_check_messages( NULL ); } - else if( !wcscmp( attribute, szProgress ) ) + else if( !wcscmp( attribute, L"Progress" ) ) { DWORD func, val1, val2, units; @@ -690,12 +637,12 @@ static void dialog_handle_event( msi_dialog *dialog, const WCHAR *control, break; } } - else if ( !wcscmp( attribute, szProperty ) ) + else if ( !wcscmp( attribute, L"Property" ) ) { MSIFEATURE *feature = msi_seltree_get_selected_feature( ctrl ); if (feature) msi_dialog_set_property( dialog->package, ctrl->property, feature->Directory ); } - else if ( !wcscmp( attribute, szSelectionPath ) ) + else if ( !wcscmp( attribute, L"SelectionPath" ) ) { BOOL indirect = ctrl->attributes & msidbControlAttributesIndirect; LPWSTR path = msi_dialog_dup_property( dialog, ctrl->property, indirect ); @@ -754,11 +701,6 @@ static UINT map_event( MSIRECORD *row, void *param ) static void dialog_map_events( msi_dialog *dialog, const WCHAR *control ) { - static const WCHAR queryW[] = - {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','E','v','e','n','t','M','a','p','p','i','n','g','`',' ', - 'W','H','E','R','E',' ','`','D','i','a','l','o','g','_','`',' ','=',' ','\'','%','s','\'',' ', - 'A','N','D',' ','`','C','o','n','t','r','o','l','_','`',' ','=',' ','\'','%','s','\'',0}; MSIQUERY *view; struct dialog_control dialog_control = { @@ -766,7 +708,9 @@ static void dialog_map_events( msi_dialog *dialog, const WCHAR *control ) control }; - if (!MSI_OpenQuery( dialog->package->db, &view, queryW, dialog->name, control )) + if (!MSI_OpenQuery( dialog->package->db, &view, + L"SELECT * FROM `EventMapping` WHERE `Dialog_` = '%s' AND `Control_` = '%s'", + dialog->name, control )) { MSI_IterateRecords( view, NULL, map_event, &dialog_control ); msiobj_release( &view->hdr ); @@ -784,7 +728,7 @@ static msi_control *msi_dialog_add_control( msi_dialog *dialog, name = MSI_RecordGetString( rec, 2 ); control_type = MSI_RecordGetString( rec, 3 ); attributes = MSI_RecordGetInteger( rec, 8 ); - if (wcscmp( control_type, szScrollableText )) text = MSI_RecordGetString( rec, 10 ); + if (wcscmp( control_type, L"ScrollableText" )) text = MSI_RecordGetString( rec, 10 ); TRACE("%s, %s, %08x, %s, %08x\n", debugstr_w(szCls), debugstr_w(name), attributes, debugstr_w(text), style); @@ -831,7 +775,7 @@ MSIText_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) TRACE("%p %04x %08lx %08lx\n", hWnd, msg, wParam, lParam); - info = GetPropW(hWnd, szButtonData); + info = GetPropW(hWnd, L"MSIDATA"); if( msg == WM_CTLCOLORSTATIC && ( info->attributes & msidbControlAttributesTransparent ) ) @@ -851,7 +795,7 @@ MSIText_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) break; case WM_NCDESTROY: msi_free( info ); - RemovePropW( hWnd, szButtonData ); + RemovePropW( hWnd, L"MSIDATA" ); break; } @@ -867,7 +811,7 @@ static UINT msi_dialog_text_control( msi_dialog *dialog, MSIRECORD *rec ) TRACE("%p %p\n", dialog, rec); - control = msi_dialog_add_control( dialog, rec, szStatic, SS_LEFT | WS_GROUP ); + control = msi_dialog_add_control( dialog, rec, L"Static", SS_LEFT | WS_GROUP ); if( !control ) return ERROR_FUNCTION_FAILED; @@ -891,9 +835,9 @@ static UINT msi_dialog_text_control( msi_dialog *dialog, MSIRECORD *rec ) info->oldproc = (WNDPROC) SetWindowLongPtrW( control->hwnd, GWLP_WNDPROC, (LONG_PTR)MSIText_WndProc ); - SetPropW( control->hwnd, szButtonData, info ); + SetPropW( control->hwnd, L"MSIDATA", info ); - event_subscribe( dialog, szSelectionPath, control_name, szSelectionPath ); + event_subscribe( dialog, L"SelectionPath", control_name, L"SelectionPath" ); return ERROR_SUCCESS; } @@ -920,7 +864,6 @@ static WCHAR *msi_get_binary_name( MSIPACKAGE *package, MSIRECORD *rec ) static UINT msi_dialog_set_property_event( msi_dialog *dialog, LPCWSTR event, LPCWSTR arg ) { - static const WCHAR szNullArg[] = {'{','}',0}; LPWSTR p, prop, arg_fmt = NULL; UINT len; @@ -931,8 +874,7 @@ static UINT msi_dialog_set_property_event( msi_dialog *dialog, LPCWSTR event, LP if (p && (p[1] == 0 || p[1] == ' ')) { *p = 0; - if (wcscmp( szNullArg, arg )) - deformat_string( dialog->package, arg, &arg_fmt ); + if (wcscmp( L"{}", arg )) deformat_string( dialog->package, arg, &arg_fmt ); msi_dialog_set_property( dialog->package, prop, arg_fmt ); msi_dialog_update_controls( dialog, prop ); msi_free( arg_fmt ); @@ -981,19 +923,15 @@ static UINT msi_dialog_control_event( MSIRECORD *rec, LPVOID param ) static UINT msi_dialog_button_handler( msi_dialog *dialog, msi_control *control, WPARAM param ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - 'C','o','n','t','r','o','l','E','v','e','n','t',' ','W','H','E','R','E',' ', - '`','D','i','a','l','o','g','_','`',' ','=',' ','\'','%','s','\'',' ','A','N','D',' ', - '`','C','o','n','t','r','o','l','_','`',' ','=',' ','\'','%','s','\'',' ', - 'O','R','D','E','R',' ','B','Y',' ','`','O','r','d','e','r','i','n','g','`',0}; MSIQUERY *view; UINT r; if (HIWORD(param) != BN_CLICKED) return ERROR_SUCCESS; - r = MSI_OpenQuery( dialog->package->db, &view, query, dialog->name, control->name ); + r = MSI_OpenQuery( dialog->package->db, &view, + L"SELECT * FROM `ControlEvent` WHERE `Dialog_` = '%s' AND `Control_` = '%s' ORDER BY `Ordering`", + dialog->name, control->name ); if (r != ERROR_SUCCESS) { ERR("query failed\n"); @@ -1024,7 +962,7 @@ static HBITMAP msi_load_picture( MSIDATABASE *db, const WCHAR *name, INT cx, INT BITMAP bm; UINT r; - rec = msi_get_binary_record( db, name ); + rec = MSI_QueryGetRecord( db, L"SELCT * FROM `Binary` WHERE `Name` = '%s'", name ); if (!rec) goto end; @@ -1100,7 +1038,7 @@ static UINT msi_dialog_button_control( msi_dialog *dialog, MSIRECORD *rec ) } } - control = msi_dialog_add_control( dialog, rec, szButton, style ); + control = msi_dialog_add_control( dialog, rec, L"BUTTON", style ); if (!control) return ERROR_FUNCTION_FAILED; @@ -1133,18 +1071,11 @@ static UINT msi_dialog_button_control( msi_dialog *dialog, MSIRECORD *rec ) static LPWSTR msi_get_checkbox_value( msi_dialog *dialog, LPCWSTR prop ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ', - 'F','R','O','M',' ','`','C','h','e','c','k','B','o','x','`',' ', - 'W','H','E','R','E',' ', - '`','P','r','o','p','e','r','t','y','`',' ','=',' ', - '\'','%','s','\'',0 - }; MSIRECORD *rec = NULL; LPWSTR ret = NULL; /* find if there is a value associated with the checkbox */ - rec = MSI_QueryGetRecord( dialog->package->db, query, prop ); + rec = MSI_QueryGetRecord( dialog->package->db, L"SELECT * FROM `CheckBox` WHERE `Property` = '%s'", prop ); if (!rec) return ret; @@ -1179,7 +1110,6 @@ static UINT msi_dialog_get_checkbox_state( msi_dialog *dialog, msi_control *cont static void msi_dialog_set_checkbox_state( msi_dialog *dialog, msi_control *control, UINT state ) { - static const WCHAR szState[] = {'1',0}; LPCWSTR val; /* if uncheck then the property is set to NULL */ @@ -1193,7 +1123,7 @@ static void msi_dialog_set_checkbox_state( msi_dialog *dialog, msi_control *cont if (control->value && control->value[0]) val = control->value; else - val = szState; + val = L"1"; msi_dialog_set_property( dialog->package, control->property, val ); } @@ -1228,7 +1158,7 @@ static UINT msi_dialog_checkbox_control( msi_dialog *dialog, MSIRECORD *rec ) TRACE("%p %p\n", dialog, rec); - control = msi_dialog_add_control( dialog, rec, szButton, BS_CHECKBOX | BS_MULTILINE | WS_TABSTOP ); + control = msi_dialog_add_control( dialog, rec, L"BUTTON", BS_CHECKBOX | BS_MULTILINE | WS_TABSTOP ); control->handler = msi_dialog_checkbox_handler; control->update = msi_dialog_checkbox_sync_state; prop = MSI_RecordGetString( rec, 9 ); @@ -1293,7 +1223,7 @@ static UINT msi_dialog_line_control( msi_dialog *dialog, MSIRECORD *rec ) width = msi_dialog_scale_unit( dialog, width ); height = 2; /* line is exactly 2 units in height */ - control->hwnd = CreateWindowExW( exstyle, szStatic, NULL, style, + control->hwnd = CreateWindowExW( exstyle, L"Static", NULL, style, x, y, width, height, dialog->hwnd, NULL, NULL, NULL ); TRACE("Dialog %s control %s hwnd %p\n", @@ -1319,7 +1249,7 @@ MSIScrollText_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) TRACE("%p %04x %08lx %08lx\n", hWnd, msg, wParam, lParam); - info = GetPropW( hWnd, szButtonData ); + info = GetPropW( hWnd, L"MSIDATA" ); r = CallWindowProcW( info->oldproc, hWnd, msg, wParam, lParam ); @@ -1329,7 +1259,7 @@ MSIScrollText_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) return DLGC_WANTARROWS; case WM_NCDESTROY: msi_free( info ); - RemovePropW( hWnd, szButtonData ); + RemovePropW( hWnd, L"MSIDATA" ); break; case WM_PAINT: /* native MSI sets a wait cursor here */ @@ -1382,7 +1312,6 @@ static void msi_scrolltext_add_text( msi_control *control, LPCWSTR text ) static UINT msi_dialog_scrolltext_control( msi_dialog *dialog, MSIRECORD *rec ) { - static const WCHAR szRichEdit20W[] = {'R','i','c','h','E','d','i','t','2','0','W',0}; struct msi_scrolltext_info *info; msi_control *control; HMODULE hRichedit; @@ -1397,7 +1326,7 @@ static UINT msi_dialog_scrolltext_control( msi_dialog *dialog, MSIRECORD *rec ) style = WS_BORDER | ES_MULTILINE | WS_VSCROLL | ES_READONLY | ES_AUTOVSCROLL | WS_TABSTOP; - control = msi_dialog_add_control( dialog, rec, szRichEdit20W, style ); + control = msi_dialog_add_control( dialog, rec, L"RichEdit20W", style ); if (!control) { FreeLibrary( hRichedit ); @@ -1413,7 +1342,7 @@ static UINT msi_dialog_scrolltext_control( msi_dialog *dialog, MSIRECORD *rec ) /* subclass the static control */ info->oldproc = (WNDPROC) SetWindowLongPtrW( control->hwnd, GWLP_WNDPROC, (LONG_PTR)MSIScrollText_WndProc ); - SetPropW( control->hwnd, szButtonData, info ); + SetPropW( control->hwnd, L"MSIDATA", info ); /* add the text into the richedit */ text = MSI_RecordGetString( rec, 10 ); @@ -1440,7 +1369,7 @@ static UINT msi_dialog_bitmap_control( msi_dialog *dialog, MSIRECORD *rec ) style |= SS_CENTERIMAGE; } - control = msi_dialog_add_control( dialog, rec, szStatic, style ); + control = msi_dialog_add_control( dialog, rec, L"Static", style ); cx = MSI_RecordGetInteger( rec, 6 ); cy = MSI_RecordGetInteger( rec, 7 ); cx = msi_dialog_scale_unit( dialog, cx ); @@ -1455,7 +1384,7 @@ static UINT msi_dialog_bitmap_control( msi_dialog *dialog, MSIRECORD *rec ) ERR("Failed to load bitmap %s\n", debugstr_w(name)); msi_free( name ); - + return ERROR_SUCCESS; } @@ -1467,9 +1396,9 @@ static UINT msi_dialog_icon_control( msi_dialog *dialog, MSIRECORD *rec ) TRACE("\n"); - control = msi_dialog_add_control( dialog, rec, szStatic, + control = msi_dialog_add_control( dialog, rec, L"Static", SS_ICON | SS_CENTERIMAGE | WS_GROUP ); - + attributes = MSI_RecordGetInteger( rec, 8 ); name = msi_get_binary_name( dialog->package, rec ); control->hIcon = msi_load_icon( dialog->package->db, name, attributes ); @@ -1501,7 +1430,7 @@ static LRESULT WINAPI MSIComboBox_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LP TRACE("%p %04x %08lx %08lx\n", hWnd, msg, wParam, lParam); - info = GetPropW( hWnd, szButtonData ); + info = GetPropW( hWnd, L"MSIDATA" ); if (!info) return 0; @@ -1514,7 +1443,7 @@ static LRESULT WINAPI MSIComboBox_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LP msi_free( info->items[j] ); msi_free( info->items ); msi_free( info ); - RemovePropW( hWnd, szButtonData ); + RemovePropW( hWnd, L"MSIDATA" ); break; } @@ -1541,16 +1470,12 @@ static UINT msi_combobox_add_item( MSIRECORD *rec, LPVOID param ) static UINT msi_combobox_add_items( struct msi_combobox_info *info, LPCWSTR property ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','C','o','m','b','o','B','o','x','`',' ','W','H','E','R','E',' ', - '`','P','r','o','p','e','r','t','y','`',' ','=',' ','\'','%','s','\'',' ', - 'O','R','D','E','R',' ','B','Y',' ','`','O','r','d','e','r','`',0}; MSIQUERY *view; DWORD count; UINT r; - r = MSI_OpenQuery( info->dialog->package->db, &view, query, property ); + r = MSI_OpenQuery( info->dialog->package->db, &view, + L"SELECT * FROM `ComboBox` WHERE `Property` = '%s' ORDER BY `Order`", property ); if (r != ERROR_SUCCESS) return r; @@ -1572,11 +1497,6 @@ static UINT msi_combobox_add_items( struct msi_combobox_info *info, LPCWSTR prop static UINT msi_dialog_set_control_condition( MSIRECORD *rec, LPVOID param ) { - static const WCHAR szHide[] = {'H','i','d','e',0}; - static const WCHAR szShow[] = {'S','h','o','w',0}; - static const WCHAR szDisable[] = {'D','i','s','a','b','l','e',0}; - static const WCHAR szEnable[] = {'E','n','a','b','l','e',0}; - static const WCHAR szDefault[] = {'D','e','f','a','u','l','t',0}; msi_dialog *dialog = param; msi_control *control; LPCWSTR name, action, condition; @@ -1592,15 +1512,15 @@ static UINT msi_dialog_set_control_condition( MSIRECORD *rec, LPVOID param ) TRACE("%s control %s\n", debugstr_w(action), debugstr_w(name)); /* FIXME: case sensitive? */ - if (!wcscmp( action, szHide )) + if (!wcscmp( action, L"Hide" )) ShowWindow(control->hwnd, SW_HIDE); - else if (!wcscmp( action, szShow )) + else if (!wcscmp( action, L"Show" )) ShowWindow(control->hwnd, SW_SHOW); - else if (!wcscmp( action, szDisable )) + else if (!wcscmp( action, L"Disable" )) EnableWindow(control->hwnd, FALSE); - else if (!wcscmp( action, szEnable )) + else if (!wcscmp( action, L"Enable" )) EnableWindow(control->hwnd, TRUE); - else if (!wcscmp( action, szDefault )) + else if (!wcscmp( action, L"Default" )) SetFocus(control->hwnd); else FIXME("Unhandled action %s\n", debugstr_w(action)); @@ -1610,10 +1530,6 @@ static UINT msi_dialog_set_control_condition( MSIRECORD *rec, LPVOID param ) static UINT msi_dialog_evaluate_control_conditions( msi_dialog *dialog ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - 'C','o','n','t','r','o','l','C','o','n','d','i','t','i','o','n',' ', - 'W','H','E','R','E',' ','`','D','i','a','l','o','g','_','`',' ','=',' ','\'','%','s','\'',0}; UINT r; MSIQUERY *view; MSIPACKAGE *package = dialog->package; @@ -1621,7 +1537,7 @@ static UINT msi_dialog_evaluate_control_conditions( msi_dialog *dialog ) TRACE("%p %s\n", dialog, debugstr_w(dialog->name)); /* query the Control table for all the elements of the control */ - r = MSI_OpenQuery( package->db, &view, query, dialog->name ); + r = MSI_OpenQuery( package->db, &view, L"SELECT * FROM `ControlCondition` WHERE `Dialog_` = '%s'", dialog->name ); if (r != ERROR_SUCCESS) return ERROR_SUCCESS; @@ -1639,7 +1555,7 @@ static UINT msi_dialog_combobox_handler( msi_dialog *dialog, msi_control *contro if (HIWORD(param) != CBN_SELCHANGE && HIWORD(param) != CBN_EDITCHANGE) return ERROR_SUCCESS; - info = GetPropW( control->hwnd, szButtonData ); + info = GetPropW( control->hwnd, L"MSIDATA" ); index = SendMessageW( control->hwnd, CB_GETCURSEL, 0, 0 ); if (index == CB_ERR) value = msi_get_window_text( control->hwnd ); @@ -1661,7 +1577,7 @@ static void msi_dialog_combobox_update( msi_dialog *dialog, msi_control *control LPWSTR value, tmp; DWORD j; - info = GetPropW( control->hwnd, szButtonData ); + info = GetPropW( control->hwnd, L"MSIDATA" ); value = msi_dup_property( dialog->package->db, control->property ); if (!value) @@ -1730,7 +1646,7 @@ static UINT msi_dialog_combo_control( msi_dialog *dialog, MSIRECORD *rec ) info->addpos_items = 0; info->oldproc = (WNDPROC)SetWindowLongPtrW( control->hwnd, GWLP_WNDPROC, (LONG_PTR)MSIComboBox_WndProc ); - SetPropW( control->hwnd, szButtonData, info ); + SetPropW( control->hwnd, L"MSIDATA", info ); if (control->property) msi_combobox_add_items( info, control->property ); @@ -1767,7 +1683,7 @@ static UINT msi_dialog_edit_control( msi_dialog *dialog, MSIRECORD *rec ) WCHAR num[MAX_NUM_DIGITS]; DWORD limit; - control = msi_dialog_add_control( dialog, rec, szEdit, + control = msi_dialog_add_control( dialog, rec, L"Edit", WS_BORDER | WS_TABSTOP | ES_AUTOHSCROLL ); control->handler = msi_dialog_edit_handler; @@ -1914,7 +1830,7 @@ MSIMaskedEdit_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) TRACE("%p %04x %08lx %08lx\n", hWnd, msg, wParam, lParam); - info = GetPropW(hWnd, szButtonData); + info = GetPropW(hWnd, L"MSIDATA"); r = CallWindowProcW(info->oldproc, hWnd, msg, wParam, lParam); @@ -1930,7 +1846,7 @@ MSIMaskedEdit_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) case WM_NCDESTROY: msi_free( info->prop ); msi_free( info ); - RemovePropW( hWnd, szButtonData ); + RemovePropW( hWnd, L"MSIDATA" ); break; } @@ -2053,7 +1969,7 @@ msi_maskedit_create_children( struct msi_maskedit_info *info, LPCWSTR font ) wx = 0; ww = width; } - hwnd = CreateWindowW( szEdit, NULL, style, wx, 0, ww, height, + hwnd = CreateWindowW( L"Edit", NULL, style, wx, 0, ww, height, info->hwnd, NULL, NULL, NULL ); if( !hwnd ) { @@ -2101,7 +2017,7 @@ static UINT msi_dialog_maskedit_control( msi_dialog *dialog, MSIRECORD *rec ) info->dialog = dialog; - control = msi_dialog_add_control( dialog, rec, szStatic, + control = msi_dialog_add_control( dialog, rec, L"Static", SS_OWNERDRAW | WS_GROUP | WS_VISIBLE ); if( !control ) { @@ -2116,7 +2032,7 @@ static UINT msi_dialog_maskedit_control( msi_dialog *dialog, MSIRECORD *rec ) /* subclass the static control */ info->oldproc = (WNDPROC) SetWindowLongPtrW( info->hwnd, GWLP_WNDPROC, (LONG_PTR)MSIMaskedEdit_WndProc ); - SetPropW( control->hwnd, szButtonData, info ); + SetPropW( control->hwnd, L"MSIDATA", info ); prop = MSI_RecordGetString( rec, 9 ); if( prop ) @@ -2158,7 +2074,7 @@ static UINT msi_dialog_progress_bar( msi_dialog *dialog, MSIRECORD *rec ) if( !control ) return ERROR_FUNCTION_FAILED; - event_subscribe( dialog, szSetProgress, control->name, szProgress ); + event_subscribe( dialog, L"SetProgress", control->name, L"Progress" ); return ERROR_SUCCESS; } @@ -2185,7 +2101,7 @@ static void msi_dialog_update_pathedit( msi_dialog *dialog, msi_control *control { WCHAR *path; - if (!control && !(control = msi_dialog_find_control_by_type( dialog, szPathEdit ))) + if (!control && !(control = msi_dialog_find_control_by_type( dialog, L"PathEdit" ))) return; if (!(path = get_path_property( dialog, control ))) return; @@ -2244,7 +2160,7 @@ static BOOL msi_dialog_onkillfocus( msi_dialog *dialog, msi_control *control ) static LRESULT WINAPI MSIPathEdit_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { - struct msi_pathedit_info *info = GetPropW(hWnd, szButtonData); + struct msi_pathedit_info *info = GetPropW(hWnd, L"MSIDATA"); LRESULT r = 0; TRACE("%p %04x %08lx %08lx\n", hWnd, msg, wParam, lParam); @@ -2261,7 +2177,7 @@ static LRESULT WINAPI MSIPathEdit_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LP if ( msg == WM_NCDESTROY ) { msi_free( info ); - RemovePropW( hWnd, szButtonData ); + RemovePropW( hWnd, L"MSIDATA" ); } return r; @@ -2277,7 +2193,7 @@ static UINT msi_dialog_pathedit_control( msi_dialog *dialog, MSIRECORD *rec ) if (!info) return ERROR_FUNCTION_FAILED; - control = msi_dialog_add_control( dialog, rec, szEdit, + control = msi_dialog_add_control( dialog, rec, L"Edit", WS_BORDER | WS_TABSTOP ); control->attributes = MSI_RecordGetInteger( rec, 8 ); prop = MSI_RecordGetString( rec, 9 ); @@ -2288,7 +2204,7 @@ static UINT msi_dialog_pathedit_control( msi_dialog *dialog, MSIRECORD *rec ) info->control = control; info->oldproc = (WNDPROC) SetWindowLongPtrW( control->hwnd, GWLP_WNDPROC, (LONG_PTR)MSIPathEdit_WndProc ); - SetPropW( control->hwnd, szButtonData, info ); + SetPropW( control->hwnd, L"MSIDATA", info ); msi_dialog_update_pathedit( dialog, control ); @@ -2319,7 +2235,7 @@ static UINT msi_dialog_create_radiobutton( MSIRECORD *rec, LPVOID param ) name = MSI_RecordGetString( rec, 3 ); text = MSI_RecordGetString( rec, 8 ); - control = dialog_create_window( dialog, rec, 0, szButton, name, text, style, + control = dialog_create_window( dialog, rec, 0, L"BUTTON", name, text, style, group->parent->hwnd ); if (!control) return ERROR_FUNCTION_FAILED; @@ -2343,7 +2259,7 @@ static BOOL CALLBACK msi_radioground_child_enum( HWND hWnd, LPARAM lParam ) static LRESULT WINAPI MSIRadioGroup_WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) { - WNDPROC oldproc = (WNDPROC)GetPropW( hWnd, szButtonData ); + WNDPROC oldproc = (WNDPROC)GetPropW( hWnd, L"MSIDATA" ); LRESULT r; TRACE("hWnd %p msg %04x wParam 0x%08lx lParam 0x%08lx\n", hWnd, msg, wParam, lParam); @@ -2362,10 +2278,6 @@ static LRESULT WINAPI MSIRadioGroup_WndProc( HWND hWnd, UINT msg, WPARAM wParam, static UINT msi_dialog_radiogroup_control( msi_dialog *dialog, MSIRECORD *rec ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - 'R','a','d','i','o','B','u','t','t','o','n',' ','W','H','E','R','E',' ', - '`','P','r','o','p','e','r','t','y','`',' ','=',' ','\'','%','s','\'',0}; UINT r; LPCWSTR prop; msi_control *control; @@ -2390,23 +2302,23 @@ static UINT msi_dialog_radiogroup_control( msi_dialog *dialog, MSIRECORD *rec ) style |= BS_OWNERDRAW; /* Create parent group box to hold radio buttons */ - control = msi_dialog_add_control( dialog, rec, szButton, style ); + control = msi_dialog_add_control( dialog, rec, L"BUTTON", style ); if( !control ) return ERROR_FUNCTION_FAILED; oldproc = (WNDPROC) SetWindowLongPtrW( control->hwnd, GWLP_WNDPROC, (LONG_PTR)MSIRadioGroup_WndProc ); - SetPropW(control->hwnd, szButtonData, oldproc); + SetPropW(control->hwnd, L"MSIDATA", oldproc); SetWindowLongPtrW( control->hwnd, GWL_EXSTYLE, WS_EX_CONTROLPARENT ); if( prop ) control->property = strdupW( prop ); /* query the Radio Button table for all control in this group */ - r = MSI_OpenQuery( package->db, &view, query, prop ); + r = MSI_OpenQuery( package->db, &view, L"SELECT * FROM `RadioButton` WHERE `Property` = '%s'", prop ); if( r != ERROR_SUCCESS ) { - ERR("query failed for dialog %s radio group %s\n", + ERR("query failed for dialog %s radio group %s\n", debugstr_w(dialog->name), debugstr_w(prop)); return ERROR_INVALID_PARAMETER; } @@ -2505,7 +2417,7 @@ msi_seltree_menu( HWND hwnd, HTREEITEM hItem ) } u; UINT r; - info = GetPropW(hwnd, szButtonData); + info = GetPropW(hwnd, L"MSIDATA"); package = info->dialog->package; feature = msi_seltree_feature_from_item( hwnd, hItem ); @@ -2553,7 +2465,7 @@ MSISelectionTree_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) TRACE("%p %04x %08lx %08lx\n", hWnd, msg, wParam, lParam); - info = GetPropW(hWnd, szButtonData); + info = GetPropW(hWnd, L"MSIDATA"); switch( msg ) { @@ -2573,7 +2485,7 @@ MSISelectionTree_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { case WM_NCDESTROY: msi_free( info ); - RemovePropW( hWnd, szButtonData ); + RemovePropW( hWnd, L"MSIDATA" ); break; } return r; @@ -2583,7 +2495,7 @@ static void msi_seltree_add_child_features( MSIPACKAGE *package, HWND hwnd, LPCWSTR parent, HTREEITEM hParent ) { - struct msi_selection_tree_info *info = GetPropW( hwnd, szButtonData ); + struct msi_selection_tree_info *info = GetPropW( hwnd, L"MSIDATA" ); MSIFEATURE *feature; TVINSERTSTRUCTW tvis; HTREEITEM hitem, hfirst = NULL; @@ -2671,7 +2583,7 @@ static void msi_seltree_create_imagelist( HWND hwnd ) static UINT msi_dialog_seltree_handler( msi_dialog *dialog, msi_control *control, WPARAM param ) { - struct msi_selection_tree_info *info = GetPropW( control->hwnd, szButtonData ); + struct msi_selection_tree_info *info = GetPropW( control->hwnd, L"MSIDATA" ); LPNMTREEVIEWW tv = (LPNMTREEVIEWW)param; MSIRECORD *row, *rec; MSIFOLDER *folder; @@ -2679,12 +2591,6 @@ static UINT msi_dialog_seltree_handler( msi_dialog *dialog, LPCWSTR dir, title = NULL; UINT r = ERROR_SUCCESS; - static const WCHAR select[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','F','e','a','t','u','r','e','`',' ','W','H','E','R','E',' ', - '`','T','i','t','l','e','`',' ','=',' ','\'','%','s','\'',0 - }; - if (tv->hdr.code != TVN_SELCHANGINGW) return ERROR_SUCCESS; @@ -2699,14 +2605,14 @@ static UINT msi_dialog_seltree_handler( msi_dialog *dialog, else title = tv->itemNew.pszText; - row = MSI_QueryGetRecord( dialog->package->db, select, title ); + row = MSI_QueryGetRecord( dialog->package->db, L"SELECT * FROM `Feature` WHERE `Title` = '%s'", title ); if (!row) return ERROR_FUNCTION_FAILED; rec = MSI_CreateRecord( 1 ); MSI_RecordSetStringW( rec, 1, MSI_RecordGetString( row, 4 ) ); - msi_event_fire( dialog->package, szSelectionDescription, rec ); + msi_event_fire( dialog->package, L"SelectionDescription", rec ); dir = MSI_RecordGetString( row, 7 ); if (dir) @@ -2722,7 +2628,7 @@ static UINT msi_dialog_seltree_handler( msi_dialog *dialog, else MSI_RecordSetStringW( rec, 1, NULL ); - msi_event_fire( dialog->package, szSelectionPath, rec ); + msi_event_fire( dialog->package, L"SelectionPath", rec ); done: msiobj_release(&row->hdr); @@ -2764,9 +2670,9 @@ static UINT msi_dialog_selection_tree( msi_dialog *dialog, MSIRECORD *rec ) info->hwnd = control->hwnd; info->oldproc = (WNDPROC) SetWindowLongPtrW( control->hwnd, GWLP_WNDPROC, (LONG_PTR)MSISelectionTree_WndProc ); - SetPropW( control->hwnd, szButtonData, info ); + SetPropW( control->hwnd, L"MSIDATA", info ); - event_subscribe( dialog, szSelectionPath, control_name, szProperty ); + event_subscribe( dialog, L"SelectionPath", control_name, L"Property" ); /* initialize it */ msi_seltree_create_imagelist( control->hwnd ); @@ -2810,7 +2716,7 @@ static LRESULT WINAPI MSIListBox_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPA TRACE("%p %04x %08lx %08lx\n", hWnd, msg, wParam, lParam); - info = GetPropW( hWnd, szButtonData ); + info = GetPropW( hWnd, L"MSIDATA" ); if (!info) return 0; @@ -2823,7 +2729,7 @@ static LRESULT WINAPI MSIListBox_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPA msi_free( info->items[j] ); msi_free( info->items ); msi_free( info ); - RemovePropW( hWnd, szButtonData ); + RemovePropW( hWnd, L"MSIDATA" ); break; } @@ -2849,16 +2755,12 @@ static UINT msi_listbox_add_item( MSIRECORD *rec, LPVOID param ) static UINT msi_listbox_add_items( struct msi_listbox_info *info, LPCWSTR property ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','L','i','s','t','B','o','x','`',' ','W','H','E','R','E',' ', - '`','P','r','o','p','e','r','t','y','`',' ','=',' ','\'','%','s','\'',' ', - 'O','R','D','E','R',' ','B','Y',' ','`','O','r','d','e','r','`',0}; MSIQUERY *view; DWORD count; UINT r; - r = MSI_OpenQuery( info->dialog->package->db, &view, query, property ); + r = MSI_OpenQuery( info->dialog->package->db, &view, + L"SELECT * FROM `ListBox` WHERE `Property` = '%s' ORDER BY `Order`", property ); if ( r != ERROR_SUCCESS ) return r; @@ -2888,7 +2790,7 @@ static UINT msi_dialog_listbox_handler( msi_dialog *dialog, if( HIWORD(param) != LBN_SELCHANGE ) return ERROR_SUCCESS; - info = GetPropW( control->hwnd, szButtonData ); + info = GetPropW( control->hwnd, L"MSIDATA" ); index = SendMessageW( control->hwnd, LB_GETCURSEL, 0, 0 ); value = (LPCWSTR) SendMessageW( control->hwnd, LB_GETITEMDATA, index, 0 ); @@ -2933,7 +2835,7 @@ static UINT msi_dialog_list_box( msi_dialog *dialog, MSIRECORD *rec ) info->addpos_items = 0; info->oldproc = (WNDPROC)SetWindowLongPtrW( control->hwnd, GWLP_WNDPROC, (LONG_PTR)MSIListBox_WndProc ); - SetPropW( control->hwnd, szButtonData, info ); + SetPropW( control->hwnd, L"MSIDATA", info ); if ( control->property ) msi_listbox_add_items( info, control->property ); @@ -2947,7 +2849,7 @@ static void msi_dialog_update_directory_combo( msi_dialog *dialog, msi_control * { WCHAR *path; - if (!control && !(control = msi_dialog_find_control_by_type( dialog, szDirectoryCombo ))) + if (!control && !(control = msi_dialog_find_control_by_type( dialog, L"DirectoryCombo" ))) return; if (!(path = get_path_property( dialog, control ))) return; @@ -2986,13 +2888,12 @@ static UINT msi_dialog_directory_combo( msi_dialog *dialog, MSIRECORD *rec ) static void msi_dialog_update_directory_list( msi_dialog *dialog, msi_control *control ) { - static const WCHAR asterisk[] = {'*',0}; WCHAR dir_spec[MAX_PATH], *path; WIN32_FIND_DATAW wfd; LVITEMW item; HANDLE file; - if (!control && !(control = msi_dialog_find_control_by_type( dialog, szDirectoryList ))) + if (!control && !(control = msi_dialog_find_control_by_type( dialog, L"DirectoryList" ))) return; /* clear the list-view */ @@ -3000,7 +2901,7 @@ static void msi_dialog_update_directory_list( msi_dialog *dialog, msi_control *c if (!(path = get_path_property( dialog, control ))) return; lstrcpyW( dir_spec, path ); - lstrcatW( dir_spec, asterisk ); + lstrcatW( dir_spec, L"*" ); file = FindFirstFileW( dir_spec, &wfd ); if (file == INVALID_HANDLE_VALUE) @@ -3014,7 +2915,7 @@ static void msi_dialog_update_directory_list( msi_dialog *dialog, msi_control *c if ( wfd.dwFileAttributes != FILE_ATTRIBUTE_DIRECTORY ) continue; - if ( !wcscmp( wfd.cFileName, szDot ) || !wcscmp( wfd.cFileName, szDotDot ) ) + if ( !wcscmp( wfd.cFileName, L"." ) || !wcscmp( wfd.cFileName, L".." ) ) continue; item.mask = LVIF_TEXT; @@ -3036,7 +2937,7 @@ static UINT msi_dialog_directorylist_up( msi_dialog *dialog ) LPWSTR prop, path, ptr; BOOL indirect; - control = msi_dialog_find_control_by_type( dialog, szDirectoryList ); + control = msi_dialog_find_control_by_type( dialog, L"DirectoryList" ); indirect = control->attributes & msidbControlAttributesIndirect; prop = msi_dialog_dup_property( dialog, control->property, indirect ); path = msi_dialog_dup_property( dialog, prop, TRUE ); @@ -3060,7 +2961,6 @@ static UINT msi_dialog_directorylist_up( msi_dialog *dialog ) static WCHAR *get_unique_folder_name( const WCHAR *root, int *ret_len ) { - static const WCHAR fmtW[] = {'%','s','%','s',' ','%','u',0}; WCHAR newfolder[MAX_PATH], *path, *ptr; int len, count = 2; @@ -3078,7 +2978,7 @@ static WCHAR *get_unique_folder_name( const WCHAR *root, int *ret_len ) msi_free( path ); return NULL; } - swprintf( path, len + 4, fmtW, root, newfolder, count++ ); + swprintf( path, len + 4, L"%s%s %u", root, newfolder, count++ ); } ptr = wcsrchr( path, '\\' ) + 1; @@ -3094,7 +2994,7 @@ static UINT msi_dialog_directorylist_new( msi_dialog *dialog ) LVITEMW item; int index; - control = msi_dialog_find_control_by_type( dialog, szDirectoryList ); + control = msi_dialog_find_control_by_type( dialog, L"DirectoryList" ); if (!(path = get_path_property( dialog, control ))) return ERROR_OUTOFMEMORY; @@ -3162,7 +3062,7 @@ static UINT msi_dialog_dirlist_handler( msi_dialog *dialog, msi_control *control lstrcpyW( new_path, path ); lstrcatW( new_path, text ); if (nmhdr->code == LVN_ENDLABELEDITW) CreateDirectoryW( new_path, NULL ); - lstrcatW( new_path, szBackSlash ); + lstrcatW( new_path, L"\\" ); msi_dialog_set_property( dialog->package, prop, new_path ); @@ -3219,11 +3119,11 @@ static BOOL str_is_number( LPCWSTR str ) static const WCHAR column_keys[][80] = { - {'V','o','l','u','m','e','C','o','s','t','V','o','l','u','m','e',0}, - {'V','o','l','u','m','e','C','o','s','t','S','i','z','e',0}, - {'V','o','l','u','m','e','C','o','s','t','A','v','a','i','l','a','b','l','e',0}, - {'V','o','l','u','m','e','C','o','s','t','R','e','q','u','i','r','e','d',0}, - {'V','o','l','u','m','e','C','o','s','t','D','i','f','f','e','r','e','n','c','e',0} + L"VolumeCostVolume", + L"VolumeCostSize", + L"VolumeCostAvailable", + L"VolumeCostRequired", + L"VolumeCostDifference", }; static void msi_dialog_vcl_add_columns( msi_dialog *dialog, msi_control *control, MSIRECORD *rec ) @@ -3234,8 +3134,6 @@ static void msi_dialog_vcl_add_columns( msi_dialog *dialog, msi_control *control LVCOLUMNW lvc; DWORD count = 0; - static const WCHAR negative[] = {'-',0}; - if (!text) return; while ((begin = wcschr( begin, '{' )) && count < 5) @@ -3250,8 +3148,8 @@ static void msi_dialog_vcl_add_columns( msi_dialog *dialog, msi_control *control lstrcpynW( num, begin + 1, end - begin ); begin += end - begin + 1; - /* empty braces or '0' hides the column */ - if ( !num[0] || !wcscmp( num, szZero ) ) + /* empty braces or '0' hides the column */ + if ( !num[0] || !wcscmp( num, L"0" ) ) { count++; msi_free( num ); @@ -3261,7 +3159,7 @@ static void msi_dialog_vcl_add_columns( msi_dialog *dialog, msi_control *control /* the width must be a positive number * if a width is invalid, all remaining columns are hidden */ - if ( !wcsncmp( num, negative, 1 ) || !str_is_number( num ) ) { + if ( !wcsncmp( num, L"-", 1 ) || !str_is_number( num ) ) { msi_free( num ); return; } @@ -3471,9 +3369,7 @@ static UINT msi_dialog_volumeselect_combo( msi_dialog *dialog, MSIRECORD *rec ) static UINT msi_dialog_hyperlink_handler( msi_dialog *dialog, msi_control *control, WPARAM param ) { - static const WCHAR hrefW[] = {'h','r','e','f'}; - static const WCHAR openW[] = {'o','p','e','n',0}; - int len, len_href = ARRAY_SIZE( hrefW ); + int len, len_href = ARRAY_SIZE( L"href" ) - 1; const WCHAR *p, *q; WCHAR quote = 0; LITEM item; @@ -3491,7 +3387,7 @@ static UINT msi_dialog_hyperlink_handler( msi_dialog *dialog, msi_control *contr while (*p && iswspace( *p )) p++; len = lstrlenW( p ); - if (len > len_href && !wcsnicmp( p, hrefW, len_href )) + if (len > len_href && !wcsnicmp( p, L"href", len_href )) { p += len_href; while (*p && iswspace( *p )) p++; @@ -3511,7 +3407,7 @@ static UINT msi_dialog_hyperlink_handler( msi_dialog *dialog, msi_control *contr if (!*q) return ERROR_SUCCESS; } item.szUrl[q - item.szUrl] = 0; - ShellExecuteW( NULL, openW, p, NULL, NULL, SW_SHOWNORMAL ); + ShellExecuteW( NULL, L"open", p, NULL, NULL, SW_SHOWNORMAL ); } return ERROR_SUCCESS; } @@ -3587,15 +3483,11 @@ static UINT msi_listview_add_item( MSIRECORD *rec, LPVOID param ) static UINT msi_listview_add_items( msi_dialog *dialog, msi_control *control ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','L','i','s','t','V','i','e','w','`',' ','W','H','E','R','E',' ', - '`','P','r','o','p','e','r','t','y','`',' ','=',' ','\'','%','s','\'',' ', - 'O','R','D','E','R',' ','B','Y',' ','`','O','r','d','e','r','`',0}; MSIQUERY *view; struct listview_param lv_param = { dialog, control }; - if (MSI_OpenQuery( dialog->package->db, &view, query, control->property ) == ERROR_SUCCESS) + if (MSI_OpenQuery( dialog->package->db, &view, L"SELECT * FROM `ListView` WHERE `Property` = '%s' ORDER BY `Order`", + control->property ) == ERROR_SUCCESS) { MSI_IterateRecords( view, NULL, msi_listview_add_item, &lv_param ); msiobj_release( &view->hdr ); @@ -3646,28 +3538,28 @@ static UINT msi_dialog_listview( msi_dialog *dialog, MSIRECORD *rec ) static const struct control_handler msi_dialog_handler[] = { - { szText, msi_dialog_text_control }, - { szPushButton, msi_dialog_button_control }, - { szLine, msi_dialog_line_control }, - { szBitmap, msi_dialog_bitmap_control }, - { szCheckBox, msi_dialog_checkbox_control }, - { szScrollableText, msi_dialog_scrolltext_control }, - { szComboBox, msi_dialog_combo_control }, - { szEdit, msi_dialog_edit_control }, - { szMaskedEdit, msi_dialog_maskedit_control }, - { szPathEdit, msi_dialog_pathedit_control }, - { szProgressBar, msi_dialog_progress_bar }, - { szRadioButtonGroup, msi_dialog_radiogroup_control }, - { szIcon, msi_dialog_icon_control }, - { szSelectionTree, msi_dialog_selection_tree }, - { szGroupBox, msi_dialog_group_box }, - { szListBox, msi_dialog_list_box }, - { szDirectoryCombo, msi_dialog_directory_combo }, - { szDirectoryList, msi_dialog_directory_list }, - { szVolumeCostList, msi_dialog_volumecost_list }, - { szVolumeSelectCombo, msi_dialog_volumeselect_combo }, - { szHyperLink, msi_dialog_hyperlink }, - { szListView, msi_dialog_listview } + { L"Text", msi_dialog_text_control }, + { L"PushButton", msi_dialog_button_control }, + { L"Line", msi_dialog_line_control }, + { L"Bitmap", msi_dialog_bitmap_control }, + { L"CheckBox", msi_dialog_checkbox_control }, + { L"ScrollableText", msi_dialog_scrolltext_control }, + { L"ComboBox", msi_dialog_combo_control }, + { L"Edit", msi_dialog_edit_control }, + { L"MaskedEdit", msi_dialog_maskedit_control }, + { L"PathEdit", msi_dialog_pathedit_control }, + { L"ProgressBar", msi_dialog_progress_bar }, + { L"RadioButtonGroup", msi_dialog_radiogroup_control }, + { L"Icon", msi_dialog_icon_control }, + { L"SelectionTree", msi_dialog_selection_tree }, + { L"GroupBox", msi_dialog_group_box }, + { L"ListBox", msi_dialog_list_box }, + { L"DirectoryCombo", msi_dialog_directory_combo }, + { L"DirectoryList", msi_dialog_directory_list }, + { L"VolumeCostList", msi_dialog_volumecost_list }, + { L"VolumeSelectCombo", msi_dialog_volumeselect_combo }, + { L"HyperLink", msi_dialog_hyperlink }, + { L"ListView", msi_dialog_listview } }; static UINT msi_dialog_create_controls( MSIRECORD *rec, LPVOID param ) @@ -3691,10 +3583,6 @@ static UINT msi_dialog_create_controls( MSIRECORD *rec, LPVOID param ) static UINT msi_dialog_fill_controls( msi_dialog *dialog ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - 'C','o','n','t','r','o','l',' ','W','H','E','R','E',' ', - '`','D','i','a','l','o','g','_','`',' ','=',' ','\'','%','s','\'',0}; UINT r; MSIQUERY *view; MSIPACKAGE *package = dialog->package; @@ -3702,7 +3590,7 @@ static UINT msi_dialog_fill_controls( msi_dialog *dialog ) TRACE("%p %s\n", dialog, debugstr_w(dialog->name) ); /* query the Control table for all the elements of the control */ - r = MSI_OpenQuery( package->db, &view, query, dialog->name ); + r = MSI_OpenQuery( package->db, &view, L"SELECT * FROM `Control` WHERE `Dialog_` = '%s'", dialog->name ); if( r != ERROR_SUCCESS ) { ERR("query failed for dialog %s\n", debugstr_w(dialog->name)); @@ -3723,8 +3611,6 @@ static UINT msi_dialog_reset( msi_dialog *dialog ) /* figure out the height of 10 point MS Sans Serif */ static INT msi_dialog_get_sans_serif_height( HWND hwnd ) { - static const WCHAR szSansSerif[] = { - 'M','S',' ','S','a','n','s',' ','S','e','r','i','f',0 }; LOGFONTW lf; TEXTMETRICW tm; BOOL r; @@ -3737,7 +3623,7 @@ static INT msi_dialog_get_sans_serif_height( HWND hwnd ) { memset( &lf, 0, sizeof lf ); lf.lfHeight = MulDiv(12, GetDeviceCaps(hdc, LOGPIXELSY), 72); - lstrcpyW( lf.lfFaceName, szSansSerif ); + lstrcpyW( lf.lfFaceName, L"MS Sans Serif" ); hFont = CreateFontIndirectW(&lf); if (hFont) { @@ -3756,17 +3642,12 @@ static INT msi_dialog_get_sans_serif_height( HWND hwnd ) /* fetch the associated record from the Dialog table */ static MSIRECORD *msi_get_dialog_record( msi_dialog *dialog ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ', - 'F','R','O','M',' ','D','i','a','l','o','g',' ', - 'W','H','E','R','E',' ', - '`','D','i','a','l','o','g','`',' ','=',' ','\'','%','s','\'',0}; MSIPACKAGE *package = dialog->package; MSIRECORD *rec = NULL; TRACE("%p %s\n", dialog, debugstr_w(dialog->name) ); - rec = MSI_QueryGetRecord( package->db, query, dialog->name ); + rec = MSI_QueryGetRecord( package->db, L"SELECT * FROM `Dialog` WHERE `Dialog` = '%s'", dialog->name ); if( !rec ) WARN("query failed for dialog %s\n", debugstr_w(dialog->name)); @@ -3775,9 +3656,6 @@ static MSIRECORD *msi_get_dialog_record( msi_dialog *dialog ) static void msi_dialog_adjust_dialog_pos( msi_dialog *dialog, MSIRECORD *rec, LPRECT pos ) { - static const WCHAR szScreenX[] = {'S','c','r','e','e','n','X',0}; - static const WCHAR szScreenY[] = {'S','c','r','e','e','n','Y',0}; - UINT xres, yres; POINT center; SIZE sz; @@ -3792,8 +3670,8 @@ static void msi_dialog_adjust_dialog_pos( msi_dialog *dialog, MSIRECORD *rec, LP sz.cx = msi_dialog_scale_unit( dialog, sz.cx ); sz.cy = msi_dialog_scale_unit( dialog, sz.cy ); - xres = msi_get_property_int( dialog->package->db, szScreenX, 0 ); - yres = msi_get_property_int( dialog->package->db, szScreenY, 0 ); + xres = msi_get_property_int( dialog->package->db, L"ScreenX", 0 ); + yres = msi_get_property_int( dialog->package->db, L"ScreenY", 0 ); center.x = MulDiv( center.x, xres, 100 ); center.y = MulDiv( center.y, yres, 100 ); @@ -3859,10 +3737,6 @@ static void msi_dialog_set_tab_order( msi_dialog *dialog, LPCWSTR first ) static LRESULT msi_dialog_oncreate( HWND hwnd, LPCREATESTRUCTW cs ) { - static const WCHAR df[] = { - 'D','e','f','a','u','l','t','U','I','F','o','n','t',0 }; - static const WCHAR dfv[] = { - 'M','S',' ','S','h','e','l','l',' ','D','l','g',0 }; msi_dialog *dialog = cs->lpCreateParams; MSIRECORD *rec = NULL; LPWSTR title = NULL; @@ -3886,10 +3760,10 @@ static LRESULT msi_dialog_oncreate( HWND hwnd, LPCREATESTRUCTW cs ) dialog->attributes = MSI_RecordGetInteger( rec, 6 ); - dialog->default_font = msi_dup_property( dialog->package->db, df ); + dialog->default_font = msi_dup_property( dialog->package->db, L"DefaultUIFont" ); if (!dialog->default_font) { - dialog->default_font = strdupW(dfv); + dialog->default_font = strdupW( L"MS Shell Dlg" ); if (!dialog->default_font) { msiobj_release( &rec->hdr ); @@ -3928,7 +3802,7 @@ static LRESULT msi_dialog_oncommand( msi_dialog *dialog, WPARAM param, HWND hwnd case 2: /* escape */ control = msi_dialog_find_control( dialog, dialog->control_cancel ); break; - default: + default: control = msi_dialog_find_control_by_hwnd( dialog, hwnd ); } @@ -4045,10 +3919,9 @@ static UINT dialog_run_message_loop( msi_dialog *dialog ) parent = dialog->parent ? dialog->parent->hwnd : 0; - hwnd = CreateWindowW( szMsiDialogClass, dialog->name, style, + hwnd = CreateWindowW( L"MsiDialogCloseClass", dialog->name, style, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, parent, NULL, NULL, dialog ); - if( !hwnd ) { ERR("Failed to create dialog %s\n", debugstr_w( dialog->name )); @@ -4101,20 +3974,20 @@ static BOOL dialog_register_class( void ) cls.hCursor = LoadCursorW(0, (LPWSTR)IDC_ARROW); cls.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1); cls.lpszMenuName = NULL; - cls.lpszClassName = szMsiDialogClass; + cls.lpszClassName = L"MsiDialogCloseClass"; if( !RegisterClassW( &cls ) ) return FALSE; cls.lpfnWndProc = MSIHiddenWindowProc; - cls.lpszClassName = szMsiHiddenWindow; + cls.lpszClassName = L"MsiHiddenWindow"; if( !RegisterClassW( &cls ) ) return FALSE; uiThreadId = GetCurrentThreadId(); - hMsiHiddenWindow = CreateWindowW( szMsiHiddenWindow, NULL, WS_OVERLAPPED, + hMsiHiddenWindow = CreateWindowW( L"MsiHiddenWindow", NULL, WS_OVERLAPPED, 0, 0, 100, 100, NULL, NULL, NULL, NULL ); if( !hMsiHiddenWindow ) return FALSE; @@ -4125,8 +3998,6 @@ static BOOL dialog_register_class( void ) static msi_dialog *dialog_create( MSIPACKAGE *package, const WCHAR *name, msi_dialog *parent, control_event_handler event_handler ) { - static const WCHAR szDialogCreated[] = - {'D','i','a','l','o','g',' ','c','r','e','a','t','e','d',0}; MSIRECORD *rec = NULL; msi_dialog *dialog; @@ -4165,7 +4036,7 @@ static msi_dialog *dialog_create( MSIPACKAGE *package, const WCHAR *name, msi_di return NULL; } MSI_RecordSetStringW(rec, 1, name); - MSI_RecordSetStringW(rec, 2, szDialogCreated); + MSI_RecordSetStringW(rec, 2, L"Dialog created"); MSI_ProcessMessage(package, INSTALLMESSAGE_ACTIONSTART, rec); msiobj_release(&rec->hdr); @@ -4295,8 +4166,8 @@ void msi_dialog_unregister_class( void ) { DestroyWindow( hMsiHiddenWindow ); hMsiHiddenWindow = NULL; - UnregisterClassW( szMsiDialogClass, NULL ); - UnregisterClassW( szMsiHiddenWindow, NULL ); + UnregisterClassW( L"MsiDialogCloseClass", NULL ); + UnregisterClassW( L"MsiHiddenWindow", NULL ); uiThreadId = 0; } @@ -4480,18 +4351,13 @@ static INT event_do_dialog( MSIPACKAGE *package, const WCHAR *name, msi_dialog * /* end a modal dialog box */ static UINT event_end_dialog( msi_dialog *dialog, const WCHAR *argument ) { - static const WCHAR exitW[] = {'E','x','i','t',0}; - static const WCHAR retryW[] = {'R','e','t','r','y',0}; - static const WCHAR ignoreW[] = {'I','g','n','o','r','e',0}; - static const WCHAR returnW[] = {'R','e','t','u','r','n',0}; - - if (!wcscmp( argument, exitW )) + if (!wcscmp( argument, L"Exit" )) dialog->retval = IDCANCEL; - else if (!wcscmp( argument, retryW )) + else if (!wcscmp( argument, L"Retry" )) dialog->retval = IDRETRY; - else if (!wcscmp( argument, ignoreW )) + else if (!wcscmp( argument, L"Ignore" )) dialog->retval = IDOK; - else if (!wcscmp( argument, returnW )) + else if (!wcscmp( argument, L"Return" )) dialog->retval = 0; else { @@ -4573,10 +4439,10 @@ static UINT event_add_local( msi_dialog *dialog, const WCHAR *argument ) LIST_FOR_EACH_ENTRY( feature, &dialog->package->features, MSIFEATURE, entry ) { - if (!wcscmp( argument, feature->Feature ) || !wcscmp( argument, szAll )) + if (!wcscmp( argument, feature->Feature ) || !wcscmp( argument, L"ALL" )) { if (feature->ActionRequest != INSTALLSTATE_LOCAL) - msi_set_property( dialog->package->db, szPreselected, szOne, -1 ); + msi_set_property( dialog->package->db, L"Preselected", L"1", -1 ); MSI_SetFeatureStateW( dialog->package, feature->Feature, INSTALLSTATE_LOCAL ); } } @@ -4589,10 +4455,10 @@ static UINT event_remove( msi_dialog *dialog, const WCHAR *argument ) LIST_FOR_EACH_ENTRY( feature, &dialog->package->features, MSIFEATURE, entry ) { - if (!wcscmp( argument, feature->Feature ) || !wcscmp( argument, szAll )) + if (!wcscmp( argument, feature->Feature ) || !wcscmp( argument, L"ALL" )) { if (feature->ActionRequest != INSTALLSTATE_ABSENT) - msi_set_property( dialog->package->db, szPreselected, szOne, -1 ); + msi_set_property( dialog->package->db, L"Preselected", L"1", -1 ); MSI_SetFeatureStateW( dialog->package, feature->Feature, INSTALLSTATE_ABSENT ); } } @@ -4605,10 +4471,10 @@ static UINT event_add_source( msi_dialog *dialog, const WCHAR *argument ) LIST_FOR_EACH_ENTRY( feature, &dialog->package->features, MSIFEATURE, entry ) { - if (!wcscmp( argument, feature->Feature ) || !wcscmp( argument, szAll )) + if (!wcscmp( argument, feature->Feature ) || !wcscmp( argument, L"ALL" )) { if (feature->ActionRequest != INSTALLSTATE_SOURCE) - msi_set_property( dialog->package->db, szPreselected, szOne, -1 ); + msi_set_property( dialog->package->db, L"Preselected", L"1", -1 ); MSI_SetFeatureStateW( dialog->package, feature->Feature, INSTALLSTATE_SOURCE ); } } @@ -4635,7 +4501,7 @@ static UINT event_set_target_path( msi_dialog *dialog, const WCHAR *argument ) UINT r = ERROR_SUCCESS; MSI_RecordSetStringW( rec, 1, path ); - msi_event_fire( dialog->package, szSelectionPath, rec ); + msi_event_fire( dialog->package, L"SelectionPath", rec ); if (path) { /* failure to set the path halts the executing of control events */ @@ -4654,11 +4520,10 @@ static UINT event_reset( msi_dialog *dialog, const WCHAR *argument ) INT ACTION_ShowDialog( MSIPACKAGE *package, const WCHAR *dialog ) { - static const WCHAR szDialog[] = {'D','i','a','l','o','g',0}; MSIRECORD *row; INT rc; - if (!TABLE_Exists(package->db, szDialog)) return 0; + if (!TABLE_Exists(package->db, L"Dialog")) return 0; row = MSI_CreateRecord(0); if (!row) return -1; @@ -4725,12 +4590,12 @@ static UINT event_directory_list_new( msi_dialog *dialog, const WCHAR *argument static UINT event_reinstall_mode( msi_dialog *dialog, const WCHAR *argument ) { - return msi_set_property( dialog->package->db, szReinstallMode, argument, -1 ); + return msi_set_property( dialog->package->db, L"REINSTALLMODE", argument, -1 ); } static UINT event_reinstall( msi_dialog *dialog, const WCHAR *argument ) { - return msi_set_property( dialog->package->db, szReinstall, argument, -1 ); + return msi_set_property( dialog->package->db, L"REINSTALL", argument, -1 ); } static UINT event_validate_product_id( msi_dialog *dialog, const WCHAR *argument ) @@ -4738,43 +4603,25 @@ static UINT event_validate_product_id( msi_dialog *dialog, const WCHAR *argument return msi_validate_product_id( dialog->package ); } -static const WCHAR end_dialogW[] = {'E','n','d','D','i','a','l','o','g',0}; -static const WCHAR new_dialogW[] = {'N','e','w','D','i','a','l','o','g',0}; -static const WCHAR spawn_dialogW[] = {'S','p','a','w','n','D','i','a','l','o','g',0}; -static const WCHAR spawn_wait_dialogW[] = {'S','p','a','w','n','W','a','i','t','D','i','a','l','o','g',0}; -static const WCHAR do_actionW[] = {'D','o','A','c','t','i','o','n',0}; -static const WCHAR add_localW[] = {'A','d','d','L','o','c','a','l',0}; -static const WCHAR removeW[] = {'R','e','m','o','v','e',0}; -static const WCHAR add_sourceW[] = {'A','d','d','S','o','u','r','c','e',0}; -static const WCHAR set_target_pathW[] = {'S','e','t','T','a','r','g','e','t','P','a','t','h',0}; -static const WCHAR resetW[] = {'R','e','s','e','t',0}; -static const WCHAR set_install_levelW[] = {'S','e','t','I','n','s','t','a','l','l','L','e','v','e','l',0}; -static const WCHAR directory_list_upW[] = {'D','i','r','e','c','t','o','r','y','L','i','s','t','U','p',0}; -static const WCHAR directory_list_newW[] = {'D','i','r','e','c','t','o','r','y','L','i','s','t','N','e','w',0}; -static const WCHAR selection_browseW[] = {'S','e','l','e','c','t','i','o','n','B','r','o','w','s','e',0}; -static const WCHAR reinstall_modeW[] = {'R','e','i','n','s','t','a','l','l','M','o','d','e',0}; -static const WCHAR reinstallW[] = {'R','e','i','n','s','t','a','l','l',0}; -static const WCHAR validate_product_idW[] = {'V','a','l','i','d','a','t','e','P','r','o','d','u','c','t','I','D',0}; - static const struct control_event control_events[] = { - { end_dialogW, pending_event_end_dialog }, - { new_dialogW, pending_event_new_dialog }, - { spawn_dialogW, pending_event_spawn_dialog }, - { spawn_wait_dialogW, event_spawn_wait_dialog }, - { do_actionW, event_do_action }, - { add_localW, event_add_local }, - { removeW, event_remove }, - { add_sourceW, event_add_source }, - { set_target_pathW, event_set_target_path }, - { resetW, event_reset }, - { set_install_levelW, event_set_install_level }, - { directory_list_upW, event_directory_list_up }, - { directory_list_newW, event_directory_list_new }, - { selection_browseW, event_spawn_dialog }, - { reinstall_modeW, event_reinstall_mode }, - { reinstallW, event_reinstall }, - { validate_product_idW, event_validate_product_id }, + { L"EndDialog", pending_event_end_dialog }, + { L"NewDialog", pending_event_new_dialog }, + { L"SpawnDialog", pending_event_spawn_dialog }, + { L"SpawnWaitDialog", event_spawn_wait_dialog }, + { L"DoAction", event_do_action }, + { L"AddLocal", event_add_local }, + { L"Remove", event_remove }, + { L"AddSource", event_add_source }, + { L"SetTargetPath", event_set_target_path }, + { L"Reset", event_reset }, + { L"SetInstallLevel", event_set_install_level }, + { L"DirectoryListUp", event_directory_list_up }, + { L"DirectoryListNew", event_directory_list_new }, + { L"SelectionBrowse", event_spawn_dialog }, + { L"ReinstallMode", event_reinstall_mode }, + { L"Reinstall", event_reinstall }, + { L"ValidateProductID", event_validate_product_id }, { NULL, NULL } };