From edf44bfb1e74e0d4b9fd5f5e973c8c4152f311dc Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Fri, 20 Jan 2012 12:42:33 +0100 Subject: [PATCH] winecfg: Avoid Unicode macros. --- programs/winecfg/Makefile.in | 1 + programs/winecfg/about.c | 16 ++++---- programs/winecfg/appdefaults.c | 84 +++++++++++++++++++++--------------------- programs/winecfg/audio.c | 14 +++---- programs/winecfg/drive.c | 20 +++++----- programs/winecfg/drivedetect.c | 12 +++--- programs/winecfg/driveui.c | 68 +++++++++++++++++++--------------- programs/winecfg/libraries.c | 83 ++++++++++++++++++++--------------------- programs/winecfg/theme.c | 69 +++++++++++++++++----------------- programs/winecfg/winecfg.c | 10 ++--- programs/winecfg/winecfg.h | 6 +-- programs/winecfg/winecfg.rc | 6 +-- programs/winecfg/x11drvdlg.c | 59 +++++++++++++++-------------- 13 files changed, 232 insertions(+), 216 deletions(-) diff --git a/programs/winecfg/Makefile.in b/programs/winecfg/Makefile.in index 0190854f00c..265d8f91d2b 100644 --- a/programs/winecfg/Makefile.in +++ b/programs/winecfg/Makefile.in @@ -1,5 +1,6 @@ MODULE = winecfg.exe APPMODE = -mwindows +EXTRADEFS = -DWINE_NO_UNICODE_MACROS IMPORTS = uuid comdlg32 comctl32 shell32 ole32 winmm shlwapi uxtheme user32 gdi32 advapi32 C_SRCS = \ diff --git a/programs/winecfg/about.c b/programs/winecfg/about.c index e25d50a1961..09cc0151574 100644 --- a/programs/winecfg/about.c +++ b/programs/winecfg/about.c @@ -87,10 +87,10 @@ AboutDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) org = get_reg_key(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows NT\\CurrentVersion", "RegisteredOrganization", ""); - SetDlgItemText(hDlg, IDC_ABT_OWNER, owner); - SetDlgItemText(hDlg, IDC_ABT_ORG, org); + SetDlgItemTextA(hDlg, IDC_ABT_OWNER, owner); + SetDlgItemTextA(hDlg, IDC_ABT_ORG, org); - SendMessage(GetParent(hDlg), PSM_UNCHANGED, 0, 0); + SendMessageW(GetParent(hDlg), PSM_UNCHANGED, 0, 0); HeapFree(GetProcessHeap(), 0, owner); HeapFree(GetProcessHeap(), 0, org); @@ -111,11 +111,11 @@ AboutDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) hWnd = GetDlgItem(hDlg, IDC_ABT_TITLE_TEXT); if(hWnd) { - titleFont = CreateFont( + static const WCHAR tahomaW[] = {'T','a','h','o','m','a',0}; + titleFont = CreateFontW( -MulDiv(24, GetDeviceCaps(hDC, LOGPIXELSY), 72), - 0, 0, 0, 0, FALSE, 0, 0, 0, 0, 0, 0, 0, - "Tahoma"); - SendMessage(hWnd, WM_SETFONT, (WPARAM)titleFont, TRUE); + 0, 0, 0, 0, FALSE, 0, 0, 0, 0, 0, 0, 0, tahomaW); + SendMessageW(hWnd, WM_SETFONT, (WPARAM)titleFont, TRUE); SetWindowTextA(hWnd, PACKAGE_NAME); } SetDlgItemTextA(hDlg, IDC_ABT_PANEL_TEXT, PACKAGE_VERSION); @@ -147,7 +147,7 @@ AboutDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { case EN_CHANGE: /* enable apply button */ - SendMessage(GetParent(hDlg), PSM_CHANGED, 0, 0); + SendMessageW(GetParent(hDlg), PSM_CHANGED, 0, 0); break; } break; diff --git a/programs/winecfg/appdefaults.c b/programs/winecfg/appdefaults.c index bee2ae5eb42..80df90c3acd 100644 --- a/programs/winecfg/appdefaults.c +++ b/programs/winecfg/appdefaults.c @@ -136,7 +136,7 @@ static void update_comboboxes(HWND dialog) if (current_app) /* no explicit setting */ { WINE_TRACE("setting winver combobox to default\n"); - SendDlgItemMessage (dialog, IDC_WINVER, CB_SETCURSEL, 0, 0); + SendDlgItemMessageW(dialog, IDC_WINVER, CB_SETCURSEL, 0, 0); return; } if (ver != -1) winver = strdupA( win_versions[ver].szVersion ); @@ -149,7 +149,7 @@ static void update_comboboxes(HWND dialog) { if (!strcasecmp (win_versions[i].szVersion, winver)) { - SendDlgItemMessage (dialog, IDC_WINVER, CB_SETCURSEL, + SendDlgItemMessageW(dialog, IDC_WINVER, CB_SETCURSEL, i + (current_app?1:0), 0); WINE_TRACE("match with %s\n", win_versions[i].szVersion); break; @@ -164,20 +164,20 @@ init_comboboxes (HWND dialog) { int i; - SendDlgItemMessage(dialog, IDC_WINVER, CB_RESETCONTENT, 0, 0); + SendDlgItemMessageW(dialog, IDC_WINVER, CB_RESETCONTENT, 0, 0); /* add the default entries (automatic) which correspond to no setting */ if (current_app) { WCHAR str[256]; - LoadStringW (GetModuleHandle (NULL), IDS_USE_GLOBAL_SETTINGS, str, + LoadStringW (GetModuleHandleW(NULL), IDS_USE_GLOBAL_SETTINGS, str, sizeof(str)/sizeof(str[0])); SendDlgItemMessageW (dialog, IDC_WINVER, CB_ADDSTRING, 0, (LPARAM)str); } for (i = 0; i < NB_VERSIONS; i++) { - SendDlgItemMessage (dialog, IDC_WINVER, CB_ADDSTRING, + SendDlgItemMessageA(dialog, IDC_WINVER, CB_ADDSTRING, 0, (LPARAM) win_versions[i].szDescription); } } @@ -190,16 +190,17 @@ static void add_listview_item(HWND listview, WCHAR *text, void *association) item.pszText = text; item.cchTextMax = lstrlenW(text); item.lParam = (LPARAM) association; - item.iItem = ListView_GetItemCount(listview); + item.iItem = SendMessageW( listview, LVM_GETITEMCOUNT, 0, 0 ); item.iSubItem = 0; - SendMessage(listview, LVM_INSERTITEMW, 0, (LPARAM) &item); + SendMessageW(listview, LVM_INSERTITEMW, 0, (LPARAM) &item); } /* Called when the application is initialized (cannot reinit!) */ static void init_appsheet(HWND dialog) { HWND listview; + LVITEMW item; HKEY key; int i; DWORD size; @@ -211,12 +212,12 @@ static void init_appsheet(HWND dialog) /* we use the lparam field of the item so we can alter the presentation later and not change code * for instance, to use the tile view or to display the EXEs embedded 'display name' */ - LoadStringW (GetModuleHandle (NULL), IDS_DEFAULT_SETTINGS, appname, + LoadStringW (GetModuleHandleW(NULL), IDS_DEFAULT_SETTINGS, appname, sizeof(appname)/sizeof(appname[0])); add_listview_item(listview, appname, NULL); /* because this list is only populated once, it's safe to bypass the settings list here */ - if (RegOpenKey(config_key, "AppDefaults", &key) == ERROR_SUCCESS) + if (RegOpenKeyA(config_key, "AppDefaults", &key) == ERROR_SUCCESS) { i = 0; size = sizeof(appname)/sizeof(appname[0]); @@ -234,29 +235,24 @@ static void init_appsheet(HWND dialog) init_comboboxes(dialog); /* Select the default settings listview item */ - { - LVITEM item; - - item.iItem = 0; - item.iSubItem = 0; - item.mask = LVIF_STATE; - item.state = LVIS_SELECTED | LVIS_FOCUSED; - item.stateMask = LVIS_SELECTED | LVIS_FOCUSED; + item.iItem = 0; + item.iSubItem = 0; + item.mask = LVIF_STATE; + item.state = LVIS_SELECTED | LVIS_FOCUSED; + item.stateMask = LVIS_SELECTED | LVIS_FOCUSED; - SendMessage(listview, LVM_SETITEM, 0, (LPARAM) &item); - } - + SendMessageW(listview, LVM_SETITEMW, 0, (LPARAM) &item); } /* there has to be an easier way than this */ static int get_listview_selection(HWND listview) { - int count = ListView_GetItemCount(listview); + int count = SendMessageW(listview, LVM_GETITEMCOUNT, 0, 0); int i; - + for (i = 0; i < count; i++) { - if (ListView_GetItemState(listview, i, LVIS_SELECTED)) return i; + if (SendMessageW( listview, LVM_GETITEMSTATE, i, LVIS_SELECTED )) return i; } return -1; @@ -266,7 +262,7 @@ static int get_listview_selection(HWND listview) /* called when the user selects a different application */ static void on_selection_change(HWND dialog, HWND listview) { - LVITEM item; + LVITEMW item; WCHAR* oldapp = current_app; WINE_TRACE("()\n"); @@ -278,8 +274,8 @@ static void on_selection_change(HWND dialog, HWND listview) WINE_TRACE("item.iItem=%d\n", item.iItem); if (item.iItem == -1) return; - - SendMessage(listview, LVM_GETITEM, 0, (LPARAM) &item); + + SendMessageW(listview, LVM_GETITEMW, 0, (LPARAM) &item); current_app = (WCHAR*) item.lParam; @@ -330,9 +326,9 @@ static void on_add_app_click(HWND dialog) OFN_SHOWHELP | OFN_HIDEREADONLY | OFN_ENABLESIZING, 0, 0, NULL, 0, NULL }; - LoadStringW (GetModuleHandle (NULL), IDS_SELECT_EXECUTABLE, selectExecutableStr, + LoadStringW (GetModuleHandleW(NULL), IDS_SELECT_EXECUTABLE, selectExecutableStr, sizeof(selectExecutableStr)/sizeof(selectExecutableStr[0])); - LoadStringW (GetModuleHandle (NULL), IDS_EXECUTABLE_FILTER, programsFilter, + LoadStringW (GetModuleHandleW(NULL), IDS_EXECUTABLE_FILTER, programsFilter, sizeof(programsFilter)/sizeof(programsFilter[0])); snprintfW( filter, MAX_PATH, filterW, programsFilter, 0, 0 ); @@ -348,19 +344,23 @@ static void on_add_app_click(HWND dialog) if (GetOpenFileNameW (&ofn)) { HWND listview = GetDlgItem(dialog, IDC_APP_LISTVIEW); - int count = ListView_GetItemCount(listview); + int count = SendMessageW(listview, LVM_GETITEMCOUNT, 0, 0); WCHAR* new_app; - + LVITEMW item; + if (list_contains_file(listview, filetitle)) return; - + new_app = strdupW(filetitle); WINE_TRACE("adding %s\n", wine_dbgstr_w (new_app)); - + add_listview_item(listview, new_app, new_app); - ListView_SetItemState(listview, count, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED); + item.mask = LVIF_STATE; + item.state = LVIS_SELECTED | LVIS_FOCUSED; + item.stateMask = LVIS_SELECTED | LVIS_FOCUSED; + SendMessageW(listview, LVM_SETITEMSTATE, count, (LPARAM)&item ); SetFocus(listview); } @@ -384,19 +384,21 @@ static void on_remove_app_click(HWND dialog) section[strlen(section)] = '\0'; /* remove last backslash */ set_reg_key(config_key, section, NULL, NULL); /* delete the section */ - SendMessage(listview, LVM_GETITEMW, 0, (LPARAM) &item); + SendMessageW(listview, LVM_GETITEMW, 0, (LPARAM) &item); HeapFree (GetProcessHeap(), 0, (void*)item.lParam); - SendMessage(listview, LVM_DELETEITEM, selection, 0); - ListView_SetItemState(listview, selection - 1, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED); + SendMessageW(listview, LVM_DELETEITEM, selection, 0); + item.mask = LVIF_STATE; + item.state = LVIS_SELECTED | LVIS_FOCUSED; + item.stateMask = LVIS_SELECTED | LVIS_FOCUSED; + SendMessageW(listview, LVM_SETITEMSTATE, -1, (LPARAM)&item); SetFocus(listview); - - SendMessage(GetParent(dialog), PSM_CHANGED, (WPARAM) dialog, 0); + SendMessageW(GetParent(dialog), PSM_CHANGED, (WPARAM) dialog, 0); } static void on_winver_change(HWND dialog) { - int selection = SendDlgItemMessage(dialog, IDC_WINVER, CB_GETCURSEL, 0, 0); + int selection = SendDlgItemMessageW(dialog, IDC_WINVER, CB_GETCURSEL, 0, 0); if (current_app) { @@ -475,7 +477,7 @@ static void on_winver_change(HWND dialog) } /* enable the apply button */ - SendMessage(GetParent(dialog), PSM_CHANGED, (WPARAM) dialog, 0); + SendMessageW(GetParent(dialog), PSM_CHANGED, (WPARAM) dialog, 0); } INT_PTR CALLBACK @@ -499,7 +501,7 @@ AppDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) break; case PSN_APPLY: apply(); - SetWindowLongPtr(hDlg, DWLP_MSGRESULT, PSNRET_NOERROR); + SetWindowLongPtrW(hDlg, DWLP_MSGRESULT, PSNRET_NOERROR); break; } diff --git a/programs/winecfg/audio.c b/programs/winecfg/audio.c index 944abcbeb6e..4e3158c5ce0 100644 --- a/programs/winecfg/audio.c +++ b/programs/winecfg/audio.c @@ -188,11 +188,11 @@ static void initAudioDlg (HWND hDlg) WINE_TRACE("\n"); - LoadStringW(GetModuleHandle(NULL), IDS_AUDIO_DRIVER, + LoadStringW(GetModuleHandleW(NULL), IDS_AUDIO_DRIVER, format_str, sizeof(format_str) / sizeof(*format_str)); - LoadStringW(GetModuleHandle(NULL), IDS_AUDIO_DRIVER_NONE, + LoadStringW(GetModuleHandleW(NULL), IDS_AUDIO_DRIVER_NONE, disabled_str, sizeof(disabled_str) / sizeof(*disabled_str)); - LoadStringW(GetModuleHandle(NULL), IDS_AUDIO_SYSDEFAULT, + LoadStringW(GetModuleHandleW(NULL), IDS_AUDIO_SYSDEFAULT, sysdefault_str, sizeof(sysdefault_str) / sizeof(*sysdefault_str)); hr = CoCreateInstance(&CLSID_MMDeviceEnumerator, NULL, @@ -308,9 +308,9 @@ static void test_sound(void) if(!PlaySoundW(MAKEINTRESOURCEW(IDW_TESTSOUND), NULL, SND_RESOURCE | SND_ASYNC)){ WCHAR error_str[256], title_str[256]; - LoadStringW(GetModuleHandle(NULL), IDS_AUDIO_TEST_FAILED, + LoadStringW(GetModuleHandleW(NULL), IDS_AUDIO_TEST_FAILED, error_str, sizeof(error_str) / sizeof(*error_str)); - LoadStringW(GetModuleHandle(NULL), IDS_AUDIO_TEST_FAILED_TITLE, + LoadStringW(GetModuleHandleW(NULL), IDS_AUDIO_TEST_FAILED_TITLE, title_str, sizeof(title_str) / sizeof(*title_str)); MessageBoxW(NULL, error_str, title_str, MB_OK | MB_ICONERROR); @@ -360,11 +360,11 @@ AudioDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_NOTIFY: switch(((LPNMHDR)lParam)->code) { case PSN_KILLACTIVE: - SetWindowLongPtr(hDlg, DWLP_MSGRESULT, FALSE); + SetWindowLongPtrW(hDlg, DWLP_MSGRESULT, FALSE); break; case PSN_APPLY: apply(); - SetWindowLongPtr(hDlg, DWLP_MSGRESULT, PSNRET_NOERROR); + SetWindowLongPtrW(hDlg, DWLP_MSGRESULT, PSNRET_NOERROR); break; case PSN_SETACTIVE: break; diff --git a/programs/winecfg/drive.c b/programs/winecfg/drive.c index f536bd64395..8cad14a9c2d 100644 --- a/programs/winecfg/drive.c +++ b/programs/winecfg/drive.c @@ -139,7 +139,7 @@ static DWORD get_drive_type( char letter ) sprintf(driveValue, "%c:", letter); - if (RegOpenKey(HKEY_LOCAL_MACHINE, "Software\\Wine\\Drives", &hKey) != ERROR_SUCCESS) + if (RegOpenKeyA(HKEY_LOCAL_MACHINE, "Software\\Wine\\Drives", &hKey) != ERROR_SUCCESS) WINE_TRACE(" Unable to open Software\\Wine\\Drives\n" ); else { @@ -149,10 +149,10 @@ static DWORD get_drive_type( char letter ) if (!RegQueryValueExA( hKey, driveValue, NULL, NULL, (LPBYTE)buffer, &size )) { WINE_TRACE("Got type '%s' for %s\n", buffer, driveValue ); - if (!lstrcmpi( buffer, "hd" )) ret = DRIVE_FIXED; - else if (!lstrcmpi( buffer, "network" )) ret = DRIVE_REMOTE; - else if (!lstrcmpi( buffer, "floppy" )) ret = DRIVE_REMOVABLE; - else if (!lstrcmpi( buffer, "cdrom" )) ret = DRIVE_CDROM; + if (!lstrcmpiA( buffer, "hd" )) ret = DRIVE_FIXED; + else if (!lstrcmpiA( buffer, "network" )) ret = DRIVE_REMOTE; + else if (!lstrcmpiA( buffer, "floppy" )) ret = DRIVE_REMOVABLE; + else if (!lstrcmpiA( buffer, "cdrom" )) ret = DRIVE_CDROM; } RegCloseKey(hKey); } @@ -181,15 +181,15 @@ static void set_drive_label( char letter, const WCHAR *label ) } /* set the drive serial number via a .windows-serial file */ -static void set_drive_serial( char letter, DWORD serial ) +static void set_drive_serial( WCHAR letter, DWORD serial ) { - char filename[] = "a:\\.windows-serial"; + WCHAR filename[] = {'a',':','\\','.','w','i','n','d','o','w','s','-','s','e','r','i','a','l',0}; HANDLE hFile; filename[0] = letter; - WINE_TRACE("Putting serial number of %08X into file '%s'\n", serial, filename); - hFile = CreateFile(filename, GENERIC_WRITE, FILE_SHARE_READ, NULL, - CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + WINE_TRACE("Putting serial number of %08X into file %s\n", serial, wine_dbgstr_w(filename)); + hFile = CreateFileW(filename, GENERIC_WRITE, FILE_SHARE_READ, NULL, + CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if (hFile != INVALID_HANDLE_VALUE) { DWORD w; diff --git a/programs/winecfg/drivedetect.c b/programs/winecfg/drivedetect.c index c7e2f78d695..34b113e043a 100644 --- a/programs/winecfg/drivedetect.c +++ b/programs/winecfg/drivedetect.c @@ -178,7 +178,7 @@ static void report_error(int code) len = snprintf(NULL, 0, s, strerror(errno)); buffer = HeapAlloc(GetProcessHeap(), 0, len + 1); snprintf(buffer, len, s, strerror(errno)); - MessageBox(NULL, s, "", MB_OK | MB_ICONEXCLAMATION); + MessageBoxA(NULL, s, "", MB_OK | MB_ICONEXCLAMATION); HeapFree(GetProcessHeap(), 0, buffer); } else @@ -188,12 +188,12 @@ static void report_error(int code) break; case NO_MORE_LETTERS: - if (gui_mode) MessageBox(NULL, "No more letters are available to auto-detect available drives with.", "", MB_OK | MB_ICONEXCLAMATION); + if (gui_mode) MessageBoxA(NULL, "No more letters are available to auto-detect available drives with.", "", MB_OK | MB_ICONEXCLAMATION); fprintf(stderr, "winecfg: no more available letters while scanning /etc/fstab\n"); break; case NO_ROOT: - if (gui_mode) MessageBox(NULL, "Could not ensure that the root directory was mapped.\n\n" + if (gui_mode) MessageBoxA(NULL, "Could not ensure that the root directory was mapped.\n\n" "This can happen if you run out of drive letters. " "It's important to have the root directory mapped, otherwise Wine" "will not be able to always find the programs you want to run. " @@ -204,13 +204,13 @@ static void report_error(int code) case NO_DRIVE_C: if (gui_mode) - MessageBox(NULL, "No virtual drive C mapped!\n", "", MB_OK | MB_ICONEXCLAMATION); + MessageBoxA(NULL, "No virtual drive C mapped!\n", "", MB_OK | MB_ICONEXCLAMATION); else fprintf(stderr, "winecfg: no drive_c directory\n"); break; case NO_HOME: if (gui_mode) - MessageBox(NULL, "Could not ensure that your home directory was mapped.\n\n" + MessageBoxA(NULL, "Could not ensure that your home directory was mapped.\n\n" "This can happen if you run out of drive letters. " "Try unmapping a drive letter then try again.", "", MB_OK | MB_ICONEXCLAMATION); @@ -292,7 +292,7 @@ static void ensure_drive_c_is_mapped(void) if (stat(drive_c_dir, &buf) == 0) { WCHAR label[64]; - LoadStringW (GetModuleHandle (NULL), IDS_SYSTEM_DRIVE_LABEL, label, + LoadStringW (GetModuleHandleW(NULL), IDS_SYSTEM_DRIVE_LABEL, label, sizeof(label)/sizeof(label[0])); add_drive('C', "../drive_c", NULL, label, 0, DRIVE_FIXED); } diff --git a/programs/winecfg/driveui.c b/programs/winecfg/driveui.c index ead74b6c12d..852ac609553 100644 --- a/programs/winecfg/driveui.c +++ b/programs/winecfg/driveui.c @@ -65,21 +65,31 @@ static DWORD driveui_msgbox (HWND parent, UINT messageId, DWORD flags) /* clears the item at index in the listview */ static void lv_clear_curr_select(HWND dialog, int index) { - ListView_SetItemState(GetDlgItem(dialog, IDC_LIST_DRIVES), index, 0, LVIS_SELECTED); + LVITEMW item; + + item.mask = LVIF_STATE; + item.state = 0; + item.stateMask = LVIS_SELECTED; + SendDlgItemMessageW( dialog, IDC_LIST_DRIVES, LVM_SETITEMSTATE, index, (LPARAM)&item ); } /* selects the item at index in the listview */ static void lv_set_curr_select(HWND dialog, int index) { + LVITEMW item; + /* no more than one item can be selected in our listview */ lv_clear_curr_select(dialog, -1); - ListView_SetItemState(GetDlgItem(dialog, IDC_LIST_DRIVES), index, LVIS_SELECTED, LVIS_SELECTED); + item.mask = LVIF_STATE; + item.state = LVIS_SELECTED; + item.stateMask = LVIS_SELECTED; + SendDlgItemMessageW( dialog, IDC_LIST_DRIVES, LVM_SETITEMSTATE, index, (LPARAM)&item ); } /* returns the currently selected item in the listview */ static int lv_get_curr_select(HWND dialog) { - return SendDlgItemMessage(dialog, IDC_LIST_DRIVES, LVM_GETNEXTITEM, -1, LVNI_SELECTED); + return SendDlgItemMessageW(dialog, IDC_LIST_DRIVES, LVM_GETNEXTITEM, -1, LVNI_SELECTED); } /* sets the item in the listview at item->iIndex */ @@ -121,12 +131,12 @@ static void set_advanced(HWND dialog) if (advanced) { state = SW_NORMAL; - LoadStringW(GetModuleHandle(NULL), IDS_HIDE_ADVANCED, text, 256); + LoadStringW(GetModuleHandleW(NULL), IDS_HIDE_ADVANCED, text, 256); } else { state = SW_HIDE; - LoadStringW(GetModuleHandle(NULL), IDS_SHOW_ADVANCED, text, 256); + LoadStringW(GetModuleHandleW(NULL), IDS_SHOW_ADVANCED, text, 256); } ShowWindow(GetDlgItem(dialog, IDC_EDIT_DEVICE), state); @@ -195,7 +205,7 @@ static int fill_drives_list(HWND dialog) prevsel = lv_get_curr_select(dialog); /* Clear the listbox */ - SendDlgItemMessage(dialog, IDC_LIST_DRIVES, LVM_DELETEALLITEMS, 0, 0); + SendDlgItemMessageW(dialog, IDC_LIST_DRIVES, LVM_DELETEALLITEMS, 0, 0); for(i = 0; i < 26; i++) { @@ -252,7 +262,7 @@ static void on_options_click(HWND dialog) else set_reg_key(config_key, "", "ShowDotFiles", "N"); - SendMessage(GetParent(dialog), PSM_CHANGED, 0, 0); + SendMessageW(GetParent(dialog), PSM_CHANGED, 0, 0); } static INT_PTR CALLBACK drivechoose_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) @@ -320,7 +330,7 @@ static void on_add_click(HWND dialog) } - ret = DialogBoxParam(0, MAKEINTRESOURCE(IDD_DRIVECHOOSE), dialog, drivechoose_dlgproc, new); + ret = DialogBoxParamW(0, MAKEINTRESOURCEW(IDD_DRIVECHOOSE), dialog, drivechoose_dlgproc, new); if( ret == -1) return; new = ret; @@ -330,7 +340,7 @@ static void on_add_click(HWND dialog) if (new == 'C') { WCHAR label[64]; - LoadStringW (GetModuleHandle (NULL), IDS_SYSTEM_DRIVE_LABEL, label, + LoadStringW (GetModuleHandleW(NULL), IDS_SYSTEM_DRIVE_LABEL, label, sizeof(label)/sizeof(label[0])); add_drive(new, "../drive_c", NULL, label, 0, DRIVE_FIXED); } @@ -351,7 +361,7 @@ static void on_add_click(HWND dialog) SetFocus(GetDlgItem(dialog, IDC_LIST_DRIVES)); update_controls(dialog); - SendMessage(GetParent(dialog), PSM_CHANGED, (WPARAM) dialog, 0); + SendMessageW(GetParent(dialog), PSM_CHANGED, (WPARAM) dialog, 0); } static void on_remove_click(HWND dialog) @@ -390,7 +400,7 @@ static void on_remove_click(HWND dialog) SetFocus(GetDlgItem(dialog, IDC_LIST_DRIVES)); update_controls(dialog); - SendMessage(GetParent(dialog), PSM_CHANGED, (WPARAM) dialog, 0); + SendMessageW(GetParent(dialog), PSM_CHANGED, (WPARAM) dialog, 0); } static void update_controls(HWND dialog) @@ -429,12 +439,12 @@ static void update_controls(HWND dialog) /* drive type */ type = current_drive->type; - SendDlgItemMessage(dialog, IDC_COMBO_TYPE, CB_RESETCONTENT, 0, 0); + SendDlgItemMessageW(dialog, IDC_COMBO_TYPE, CB_RESETCONTENT, 0, 0); for (i = 0; i < sizeof(type_pairs) / sizeof(struct drive_typemap); i++) { WCHAR driveDesc[64]; - LoadStringW (GetModuleHandle (NULL), type_pairs[i].idDesc, driveDesc, + LoadStringW (GetModuleHandleW(NULL), type_pairs[i].idDesc, driveDesc, sizeof(driveDesc)/sizeof(driveDesc[0])); SendDlgItemMessageW (dialog, IDC_COMBO_TYPE, CB_ADDSTRING, 0, (LPARAM)driveDesc); @@ -445,7 +455,7 @@ static void update_controls(HWND dialog) } if (selection == -1) selection = DRIVE_TYPE_DEFAULT; - SendDlgItemMessage(dialog, IDC_COMBO_TYPE, CB_SETCURSEL, selection, 0); + SendDlgItemMessageW(dialog, IDC_COMBO_TYPE, CB_SETCURSEL, selection, 0); EnableWindow( GetDlgItem( dialog, IDC_BUTTON_REMOVE ), (current_drive->letter != 'C') ); EnableWindow( GetDlgItem( dialog, IDC_EDIT_PATH ), (current_drive->letter != 'C') ); @@ -489,7 +499,7 @@ static void on_edit_changed(HWND dialog, WORD id) WINE_TRACE("set label to %s\n", wine_dbgstr_w(current_drive->label)); /* enable the apply button */ - SendMessage(GetParent(dialog), PSM_CHANGED, (WPARAM) dialog, 0); + SendMessageW(GetParent(dialog), PSM_CHANGED, (WPARAM) dialog, 0); break; } @@ -522,7 +532,7 @@ static void on_edit_changed(HWND dialog, WORD id) HeapFree(GetProcessHeap(), 0, wpath); /* enable the apply button */ - SendMessage(GetParent(dialog), PSM_CHANGED, (WPARAM) dialog, 0); + SendMessageW(GetParent(dialog), PSM_CHANGED, (WPARAM) dialog, 0); break; } @@ -538,7 +548,7 @@ static void on_edit_changed(HWND dialog, WORD id) WINE_TRACE("set serial to %08X\n", current_drive->serial); /* enable the apply button */ - SendMessage(GetParent(dialog), PSM_CHANGED, (WPARAM) dialog, 0); + SendMessageW(GetParent(dialog), PSM_CHANGED, (WPARAM) dialog, 0); break; } @@ -571,9 +581,9 @@ BOOL browse_for_unix_folder(HWND dialog, WCHAR *pszPath) IShellFolder *pDesktop; LPITEMIDLIST pidlUnixRoot, pidlSelectedPath; HRESULT hr; - - LoadStringW(GetModuleHandle(NULL), IDS_CHOOSE_PATH, pszChoosePath, FILENAME_MAX); - + + LoadStringW(GetModuleHandleW(NULL), IDS_CHOOSE_PATH, pszChoosePath, FILENAME_MAX); + hr = SHGetDesktopFolder(&pDesktop); if (FAILED(hr)) return FALSE; @@ -623,7 +633,7 @@ static void init_listview_columns(HWND dialog) GetClientRect(GetDlgItem(dialog, IDC_LIST_DRIVES), &viewRect); width = (viewRect.right - viewRect.left) / 6 - 5; - LoadStringW (GetModuleHandle (NULL), IDS_COL_DRIVELETTER, column, + LoadStringW (GetModuleHandleW(NULL), IDS_COL_DRIVELETTER, column, sizeof(column)/sizeof(column[0])); listColumn.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM; listColumn.pszText = column; @@ -632,7 +642,7 @@ static void init_listview_columns(HWND dialog) SendDlgItemMessageW (dialog, IDC_LIST_DRIVES, LVM_INSERTCOLUMNW, 0, (LPARAM) &listColumn); - LoadStringW (GetModuleHandle (NULL), IDS_COL_DRIVEMAPPING, column, + LoadStringW (GetModuleHandleW(NULL), IDS_COL_DRIVEMAPPING, column, sizeof(column)/sizeof(column[0])); listColumn.cx = viewRect.right - viewRect.left - width; listColumn.pszText = column; @@ -704,7 +714,7 @@ DriveDlgProc (HWND dialog, UINT msg, WPARAM wParam, LPARAM lParam) break; case CBN_SELCHANGE: - SendMessage(GetParent(dialog), PSM_CHANGED, 0, 0); + SendMessageW(GetParent(dialog), PSM_CHANGED, 0, 0); break; } @@ -722,14 +732,14 @@ DriveDlgProc (HWND dialog, UINT msg, WPARAM wParam, LPARAM lParam) case IDC_BUTTON_EDIT: if (HIWORD(wParam) != BN_CLICKED) break; - item = SendMessage(GetDlgItem(dialog, IDC_LIST_DRIVES), LB_GETCURSEL, 0, 0); - SendMessage(GetDlgItem(dialog, IDC_LIST_DRIVES), LB_GETITEMDATA, item, 0); + item = SendMessageW(GetDlgItem(dialog, IDC_LIST_DRIVES), LB_GETCURSEL, 0, 0); + SendMessageW(GetDlgItem(dialog, IDC_LIST_DRIVES), LB_GETITEMDATA, item, 0); break; case IDC_BUTTON_AUTODETECT: autodetect_drives(); fill_drives_list(dialog); - SendMessage(GetParent(dialog), PSM_CHANGED, 0, 0); + SendMessageW(GetParent(dialog), PSM_CHANGED, 0, 0); break; case IDC_BUTTON_SHOW_HIDE_ADVANCED: @@ -752,7 +762,7 @@ DriveDlgProc (HWND dialog, UINT msg, WPARAM wParam, LPARAM lParam) if (HIWORD(wParam) != CBN_SELCHANGE) break; - selection = SendDlgItemMessage(dialog, IDC_COMBO_TYPE, CB_GETCURSEL, 0, 0); + selection = SendDlgItemMessageW(dialog, IDC_COMBO_TYPE, CB_GETCURSEL, 0, 0); if (selection >= 0 && (type_pairs[selection].sCode == DRIVE_CDROM || @@ -776,11 +786,11 @@ DriveDlgProc (HWND dialog, UINT msg, WPARAM wParam, LPARAM lParam) { case PSN_KILLACTIVE: WINE_TRACE("PSN_KILLACTIVE\n"); - SetWindowLongPtr(dialog, DWLP_MSGRESULT, FALSE); + SetWindowLongPtrW(dialog, DWLP_MSGRESULT, FALSE); break; case PSN_APPLY: apply_drive_changes(); - SetWindowLongPtr(dialog, DWLP_MSGRESULT, PSNRET_NOERROR); + SetWindowLongPtrW(dialog, DWLP_MSGRESULT, PSNRET_NOERROR); break; case PSN_SETACTIVE: break; diff --git a/programs/winecfg/libraries.c b/programs/winecfg/libraries.c index aa11b464e80..3b5020336df 100644 --- a/programs/winecfg/libraries.c +++ b/programs/winecfg/libraries.c @@ -97,6 +97,8 @@ struct dll enum dllmode mode; }; +static const WCHAR emptyW[1]; + /* Convert a registry string to a dllmode */ static enum dllmode string_to_mode(char *in) { @@ -234,17 +236,16 @@ static void set_controls_from_selection(HWND dialog) static void clear_settings(HWND dialog) { - int count = SendDlgItemMessage(dialog, IDC_DLLS_LIST, LB_GETCOUNT, 0, 0); + int count = SendDlgItemMessageW(dialog, IDC_DLLS_LIST, LB_GETCOUNT, 0, 0); int i; WINE_TRACE("count=%d\n", count); for (i = 0; i < count; i++) { - struct dll *dll = (struct dll *) SendDlgItemMessage(dialog, IDC_DLLS_LIST, LB_GETITEMDATA, 0, 0); - - SendDlgItemMessage(dialog, IDC_DLLS_LIST, LB_DELETESTRING, 0, 0); - + struct dll *dll = (struct dll *) SendDlgItemMessageW(dialog, IDC_DLLS_LIST, LB_GETITEMDATA, 0, 0); + + SendDlgItemMessageW(dialog, IDC_DLLS_LIST, LB_DELETESTRING, 0, 0); HeapFree(GetProcessHeap(), 0, dll->name); HeapFree(GetProcessHeap(), 0, dll); } @@ -303,7 +304,7 @@ static void load_library_list( HWND dialog ) unsigned int i = 0; const char *path, *build_dir = wine_get_build_dir(); char item1[256], item2[256]; - HCURSOR old_cursor = SetCursor( LoadCursor(0, IDC_WAIT) ); + HCURSOR old_cursor = SetCursor( LoadCursorW(0, (LPWSTR)IDC_WAIT) ); if (build_dir) { @@ -342,7 +343,7 @@ static void load_library_settings(HWND dialog) char **p; int sel, count = 0; - sel = SendDlgItemMessage(dialog, IDC_DLLS_LIST, LB_GETCURSEL, 0, 0); + sel = SendDlgItemMessageW(dialog, IDC_DLLS_LIST, LB_GETCURSEL, 0, 0); WINE_TRACE("sel=%d\n", sel); @@ -381,8 +382,8 @@ static void load_library_settings(HWND dialog) dll->name = *p; dll->mode = string_to_mode(value); - index = SendDlgItemMessage(dialog, IDC_DLLS_LIST, LB_ADDSTRING, (WPARAM) -1, (LPARAM) str); - SendDlgItemMessage(dialog, IDC_DLLS_LIST, LB_SETITEMDATA, index, (LPARAM) dll); + index = SendDlgItemMessageA(dialog, IDC_DLLS_LIST, LB_ADDSTRING, (WPARAM) -1, (LPARAM) str); + SendDlgItemMessageW(dialog, IDC_DLLS_LIST, LB_SETITEMDATA, index, (LPARAM) dll); HeapFree(GetProcessHeap(), 0, str); @@ -394,8 +395,8 @@ static void load_library_settings(HWND dialog) /* restore the previous selection, if possible */ if (sel >= count - 1) sel = count - 1; else if (sel == -1) sel = 0; - - SendDlgItemMessage(dialog, IDC_DLLS_LIST, LB_SETCURSEL, sel, 0); + + SendDlgItemMessageW(dialog, IDC_DLLS_LIST, LB_SETCURSEL, sel, 0); set_controls_from_selection(dialog); } @@ -404,22 +405,22 @@ static void load_library_settings(HWND dialog) static void init_libsheet(HWND dialog) { /* clear the add dll controls */ - SendDlgItemMessage(dialog, IDC_DLLCOMBO, WM_SETTEXT, 1, (LPARAM) ""); + SendDlgItemMessageW(dialog, IDC_DLLCOMBO, WM_SETTEXT, 1, (LPARAM)emptyW); load_library_list( dialog ); disable(IDC_DLLS_ADDDLL); } static void on_add_combo_change(HWND dialog) { - char buffer[1024]; + WCHAR buffer[1024]; int sel, len; - SendDlgItemMessage(dialog, IDC_DLLCOMBO, WM_GETTEXT, sizeof(buffer), (LPARAM) buffer); + SendDlgItemMessageW(dialog, IDC_DLLCOMBO, WM_GETTEXT, sizeof(buffer)/sizeof(WCHAR), (LPARAM) buffer); /* if lib was chosen from combobox, we receive an empty buffer, check manually */ - sel=SendDlgItemMessage(dialog, IDC_DLLCOMBO, CB_GETCURSEL, 0, 0); - len=SendDlgItemMessage(dialog, IDC_DLLCOMBO, CB_GETLBTEXTLEN, sel, 0); + sel=SendDlgItemMessageW(dialog, IDC_DLLCOMBO, CB_GETCURSEL, 0, 0); + len=SendDlgItemMessageW(dialog, IDC_DLLCOMBO, CB_GETLBTEXTLEN, sel, 0); - if (strlen(buffer)>0 || len>0) + if (buffer[0] || len>0) enable(IDC_DLLS_ADDDLL) else disable(IDC_DLLS_ADDDLL); @@ -434,15 +435,15 @@ static void set_dllmode(HWND dialog, DWORD id) mode = id_to_mode(id); - sel = SendDlgItemMessage(dialog, IDC_DLLS_LIST, LB_GETCURSEL, 0, 0); + sel = SendDlgItemMessageW(dialog, IDC_DLLS_LIST, LB_GETCURSEL, 0, 0); if (sel == -1) return; - - dll = (struct dll *) SendDlgItemMessage(dialog, IDC_DLLS_LIST, LB_GETITEMDATA, sel, 0); + + dll = (struct dll *) SendDlgItemMessageW(dialog, IDC_DLLS_LIST, LB_GETITEMDATA, sel, 0); str = mode_to_string(mode); WINE_TRACE("Setting %s to %s\n", dll->name, str); - - SendMessage(GetParent(dialog), PSM_CHANGED, 0, 0); + + SendMessageW(GetParent(dialog), PSM_CHANGED, 0, 0); set_reg_key(config_key, keypath("DllOverrides"), dll->name, str); load_library_settings(dialog); /* ... and refresh */ @@ -455,7 +456,7 @@ static void on_add_click(HWND dialog) ZeroMemory(buffer, sizeof(buffer)); - SendDlgItemMessage(dialog, IDC_DLLCOMBO, WM_GETTEXT, sizeof(buffer), (LPARAM) buffer); + SendDlgItemMessageA(dialog, IDC_DLLCOMBO, WM_GETTEXT, sizeof(buffer), (LPARAM) buffer); if (lstrlenA(buffer) >= sizeof(dotDll)) { ptr = buffer + lstrlenA(buffer) - sizeof(dotDll) + 1; @@ -489,17 +490,17 @@ static void on_add_click(HWND dialog) if (MessageBoxIndirectA( ¶ms ) != IDYES) return; } - SendDlgItemMessage(dialog, IDC_DLLCOMBO, WM_SETTEXT, 0, (LPARAM) ""); + SendDlgItemMessageW(dialog, IDC_DLLCOMBO, WM_SETTEXT, 0, (LPARAM)emptyW); disable(IDC_DLLS_ADDDLL); WINE_TRACE("Adding %s as native, builtin\n", buffer); - - SendMessage(GetParent(dialog), PSM_CHANGED, 0, 0); + + SendMessageW(GetParent(dialog), PSM_CHANGED, 0, 0); set_reg_key(config_key, keypath("DllOverrides"), buffer, "native,builtin"); load_library_settings(dialog); - SendDlgItemMessage(dialog, IDC_DLLS_LIST, LB_SELECTSTRING, 0, (LPARAM) buffer); + SendDlgItemMessageA(dialog, IDC_DLLS_LIST, LB_SELECTSTRING, 0, (LPARAM) buffer); set_controls_from_selection(dialog); } @@ -539,42 +540,42 @@ static INT_PTR CALLBACK loadorder_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam static void on_edit_click(HWND hwnd) { - INT_PTR ret; - int index = SendDlgItemMessage(hwnd, IDC_DLLS_LIST, LB_GETCURSEL, 0, 0); + INT_PTR ret; + int index = SendDlgItemMessageW(hwnd, IDC_DLLS_LIST, LB_GETCURSEL, 0, 0); struct dll *dll; DWORD id; /* if no override is selected the edit button should be disabled... */ assert(index != -1); - dll = (struct dll *) SendDlgItemMessage(hwnd, IDC_DLLS_LIST, LB_GETITEMDATA, index, 0); + dll = (struct dll *) SendDlgItemMessageW(hwnd, IDC_DLLS_LIST, LB_GETITEMDATA, index, 0); id = mode_to_id(dll->mode); - - ret = DialogBoxParam(0, MAKEINTRESOURCE(IDD_LOADORDER), hwnd, loadorder_dlgproc, id); - + + ret = DialogBoxParamW(0, MAKEINTRESOURCEW(IDD_LOADORDER), hwnd, loadorder_dlgproc, id); + if(ret != IDCANCEL) set_dllmode(hwnd, ret); } static void on_remove_click(HWND dialog) { - int sel = SendDlgItemMessage(dialog, IDC_DLLS_LIST, LB_GETCURSEL, 0, 0); + int sel = SendDlgItemMessageW(dialog, IDC_DLLS_LIST, LB_GETCURSEL, 0, 0); struct dll *dll; if (sel == LB_ERR) return; - - dll = (struct dll *) SendDlgItemMessage(dialog, IDC_DLLS_LIST, LB_GETITEMDATA, sel, 0); - - SendDlgItemMessage(dialog, IDC_DLLS_LIST, LB_DELETESTRING, sel, 0); - SendMessage(GetParent(dialog), PSM_CHANGED, 0, 0); + dll = (struct dll *) SendDlgItemMessageW(dialog, IDC_DLLS_LIST, LB_GETITEMDATA, sel, 0); + + SendDlgItemMessageW(dialog, IDC_DLLS_LIST, LB_DELETESTRING, sel, 0); + + SendMessageW(GetParent(dialog), PSM_CHANGED, 0, 0); set_reg_key(config_key, keypath("DllOverrides"), dll->name, NULL); HeapFree(GetProcessHeap(), 0, dll->name); HeapFree(GetProcessHeap(), 0, dll); - if (SendDlgItemMessage(dialog, IDC_DLLS_LIST, LB_GETCOUNT, 0, 0) > 0) - SendDlgItemMessage(dialog, IDC_DLLS_LIST, LB_SETCURSEL, max(sel - 1, 0), 0); + if (SendDlgItemMessageW(dialog, IDC_DLLS_LIST, LB_GETCOUNT, 0, 0) > 0) + SendDlgItemMessageW(dialog, IDC_DLLS_LIST, LB_SETCURSEL, max(sel - 1, 0), 0); else { disable(IDC_DLLS_EDITDLL); diff --git a/programs/winecfg/theme.c b/programs/winecfg/theme.c index 4ab3689f5b1..cf284c939fc 100644 --- a/programs/winecfg/theme.c +++ b/programs/winecfg/theme.c @@ -294,7 +294,7 @@ static BOOL fill_theme_list (HWND comboTheme, HWND comboColor, HWND comboSize) WCHAR currentSize[MAX_PATH]; ThemeFile* theme = NULL; - LoadStringW (GetModuleHandle (NULL), IDS_NOTHEME, textNoTheme, + LoadStringW (GetModuleHandleW(NULL), IDS_NOTHEME, textNoTheme, sizeof(textNoTheme) / sizeof(WCHAR)); SendMessageW (comboTheme, CB_RESETCONTENT, 0, 0); @@ -620,11 +620,11 @@ static void on_theme_install(HWND dialog) WCHAR filter[100]; WCHAR title[100]; - LoadStringW (GetModuleHandle (NULL), IDS_THEMEFILE, + LoadStringW (GetModuleHandleW(NULL), IDS_THEMEFILE, filter, sizeof (filter) / sizeof (filter[0]) - filterMaskLen); memcpy (filter + lstrlenW (filter), filterMask, filterMaskLen * sizeof (WCHAR)); - LoadStringW (GetModuleHandle (NULL), IDS_THEMEFILE_SELECT, + LoadStringW (GetModuleHandleW(NULL), IDS_THEMEFILE_SELECT, title, sizeof (title) / sizeof (title[0])); ofn.lStructSize = sizeof(OPENFILENAMEW); @@ -663,7 +663,7 @@ static void on_theme_install(HWND dialog) if (lstrcmpiW(PathFindExtensionW(filetitle), themeExt)==0) { do_parse_theme(file); - SendMessage(GetParent(dialog), PSM_CHANGED, 0, 0); + SendMessageW(GetParent(dialog), PSM_CHANGED, 0, 0); return; } @@ -733,30 +733,30 @@ static struct ShellFolderInfo *psfiSelected = NULL; #define NUM_ELEMS(x) (sizeof(x)/sizeof(*(x))) static void init_shell_folder_listview_headers(HWND dialog) { - LVCOLUMN listColumn; + LVCOLUMNW listColumn; RECT viewRect; - char szShellFolder[64] = "Shell Folder"; - char szLinksTo[64] = "Links to"; + WCHAR szShellFolder[64] = {'S','h','e','l','l',' ','F','o','l','d','e','r',0}; + WCHAR szLinksTo[64] = {'L','i','n','k','s',' ','t','o',0}; int width; - LoadString(GetModuleHandle(NULL), IDS_SHELL_FOLDER, szShellFolder, sizeof(szShellFolder)); - LoadString(GetModuleHandle(NULL), IDS_LINKS_TO, szLinksTo, sizeof(szLinksTo)); - + LoadStringW(GetModuleHandleW(NULL), IDS_SHELL_FOLDER, szShellFolder, sizeof(szShellFolder)/sizeof(WCHAR)); + LoadStringW(GetModuleHandleW(NULL), IDS_LINKS_TO, szLinksTo, sizeof(szLinksTo)/sizeof(WCHAR)); + GetClientRect(GetDlgItem(dialog, IDC_LIST_SFPATHS), &viewRect); width = (viewRect.right - viewRect.left) / 4; listColumn.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM; listColumn.pszText = szShellFolder; - listColumn.cchTextMax = lstrlen(listColumn.pszText); + listColumn.cchTextMax = strlenW(listColumn.pszText); listColumn.cx = width; - SendDlgItemMessage(dialog, IDC_LIST_SFPATHS, LVM_INSERTCOLUMN, 0, (LPARAM) &listColumn); + SendDlgItemMessageW(dialog, IDC_LIST_SFPATHS, LVM_INSERTCOLUMNW, 0, (LPARAM) &listColumn); listColumn.pszText = szLinksTo; - listColumn.cchTextMax = lstrlen(listColumn.pszText); + listColumn.cchTextMax = strlenW(listColumn.pszText); listColumn.cx = viewRect.right - viewRect.left - width - 1; - SendDlgItemMessage(dialog, IDC_LIST_SFPATHS, LVM_INSERTCOLUMN, 1, (LPARAM) &listColumn); + SendDlgItemMessageW(dialog, IDC_LIST_SFPATHS, LVM_INSERTCOLUMNW, 1, (LPARAM) &listColumn); } /* Reads the currently set shell folder symbol link targets into asfiInfo. */ @@ -786,10 +786,10 @@ static void read_shell_folder_link_targets(void) { static void update_shell_folder_listview(HWND dialog) { int i; LVITEMW item; - LONG lSelected = SendDlgItemMessage(dialog, IDC_LIST_SFPATHS, LVM_GETNEXTITEM, -1, + LONG lSelected = SendDlgItemMessageW(dialog, IDC_LIST_SFPATHS, LVM_GETNEXTITEM, -1, MAKELPARAM(LVNI_SELECTED,0)); - - SendDlgItemMessage(dialog, IDC_LIST_SFPATHS, LVM_DELETEALLITEMS, 0, 0); + + SendDlgItemMessageW(dialog, IDC_LIST_SFPATHS, LVM_DELETEALLITEMS, 0, 0); for (i=0; iszLinkTarget, FILENAME_MAX, NULL, NULL); update_shell_folder_listview(hDlg); - SendMessage(GetParent(hDlg), PSM_CHANGED, 0, 0); + SendMessageW(GetParent(hDlg), PSM_CHANGED, 0, 0); } break; } @@ -1195,14 +1194,14 @@ ThemeDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) psfiSelected->szLinkTarget, FILENAME_MAX, NULL, NULL); update_shell_folder_listview(hDlg); - SendMessage(GetParent(hDlg), PSM_CHANGED, 0, 0); + SendMessageW(GetParent(hDlg), PSM_CHANGED, 0, 0); } else { CheckDlgButton(hDlg, IDC_LINK_SFPATH, BST_UNCHECKED); } } else { psfiSelected->szLinkTarget[0] = '\0'; update_shell_folder_listview(hDlg); - SendMessage(GetParent(hDlg), PSM_CHANGED, 0, 0); + SendMessageW(GetParent(hDlg), PSM_CHANGED, 0, 0); } break; @@ -1225,7 +1224,7 @@ ThemeDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) metrics[index].color = c_color.rgbResult; save_sys_color(index, metrics[index].color); InvalidateRect(GetDlgItem(hDlg, IDC_SYSPARAM_COLOR), NULL, TRUE); - SendMessage(GetParent(hDlg), PSM_CHANGED, 0, 0); + SendMessageW(GetParent(hDlg), PSM_CHANGED, 0, 0); } break; } @@ -1237,7 +1236,7 @@ ThemeDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_NOTIFY: switch (((LPNMHDR)lParam)->code) { case PSN_KILLACTIVE: { - SetWindowLongPtr(hDlg, DWLP_MSGRESULT, FALSE); + SetWindowLongPtrW(hDlg, DWLP_MSGRESULT, FALSE); break; } case PSN_APPLY: { @@ -1247,7 +1246,7 @@ ThemeDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) apply_sysparams(); read_shell_folder_link_targets(); update_shell_folder_listview(hDlg); - SetWindowLongPtr(hDlg, DWLP_MSGRESULT, PSNRET_NOERROR); + SetWindowLongPtrW(hDlg, DWLP_MSGRESULT, PSNRET_NOERROR); break; } case LVN_ITEMCHANGED: { diff --git a/programs/winecfg/winecfg.c b/programs/winecfg/winecfg.c index cdf3a846ec4..fa18e9bcfc1 100644 --- a/programs/winecfg/winecfg.c +++ b/programs/winecfg/winecfg.c @@ -62,13 +62,13 @@ void set_window_title(HWND dialog) if (current_app) { WCHAR apptitle[256]; - LoadStringW (GetModuleHandle(NULL), IDS_WINECFG_TITLE_APP, apptitle, + LoadStringW (GetModuleHandleW(NULL), IDS_WINECFG_TITLE_APP, apptitle, sizeof(apptitle)/sizeof(apptitle[0])); wsprintfW (newtitle, apptitle, current_app); } else { - LoadStringW (GetModuleHandle(NULL), IDS_WINECFG_TITLE, newtitle, + LoadStringW (GetModuleHandleW(NULL), IDS_WINECFG_TITLE, newtitle, sizeof(newtitle)/sizeof(newtitle[0])); } @@ -83,7 +83,7 @@ WCHAR* load_string (UINT id) int len; WCHAR* newStr; - LoadStringW (GetModuleHandle (NULL), id, buf, sizeof(buf)/sizeof(buf[0])); + LoadStringW (GetModuleHandleW(NULL), id, buf, sizeof(buf)/sizeof(buf[0])); len = lstrlenW (buf); newStr = HeapAlloc (GetProcessHeap(), 0, (len + 1) * sizeof (WCHAR)); @@ -697,7 +697,7 @@ char *keypath(const char *section) if (current_app) { result = HeapAlloc(GetProcessHeap(), 0, strlen("AppDefaults\\") + lstrlenW(current_app)*2 + 2 /* \\ */ + strlen(section) + 1 /* terminator */); - wsprintf(result, "AppDefaults\\%ls", current_app); + wsprintfA(result, "AppDefaults\\%ls", current_app); if (section[0]) sprintf( result + strlen(result), "\\%s", section ); } else @@ -752,7 +752,7 @@ void PRINTERROR(void) int initialize(HINSTANCE hInstance) { - DWORD res = RegCreateKey(HKEY_CURRENT_USER, WINE_KEY_ROOT, &config_key); + DWORD res = RegCreateKeyA(HKEY_CURRENT_USER, WINE_KEY_ROOT, &config_key); if (res != ERROR_SUCCESS) { WINE_ERR("RegOpenKey failed on wine config key (%d)\n", res); diff --git a/programs/winecfg/winecfg.h b/programs/winecfg/winecfg.h index 195940977fd..e8289ea5ea9 100644 --- a/programs/winecfg/winecfg.h +++ b/programs/winecfg/winecfg.h @@ -152,9 +152,9 @@ static inline WCHAR *strdupU2W(const char *unix_str) static inline char *get_text(HWND dialog, WORD id) { HWND item = GetDlgItem(dialog, id); - int len = GetWindowTextLength(item) + 1; + int len = GetWindowTextLengthA(item) + 1; char *result = len ? HeapAlloc(GetProcessHeap(), 0, len) : NULL; - if (!result || GetWindowText(item, result, len) == 0) return NULL; + if (!result || GetWindowTextA(item, result, len) == 0) return NULL; return result; } @@ -169,7 +169,7 @@ static inline WCHAR *get_textW(HWND dialog, WORD id) static inline void set_text(HWND dialog, WORD id, const char *text) { - SetWindowText(GetDlgItem(dialog, id), text); + SetWindowTextA(GetDlgItem(dialog, id), text); } static inline void set_textW(HWND dialog, WORD id, const WCHAR *text) diff --git a/programs/winecfg/winecfg.rc b/programs/winecfg/winecfg.rc index 4ded3080a5e..9f69287a7f5 100644 --- a/programs/winecfg/winecfg.rc +++ b/programs/winecfg/winecfg.rc @@ -168,11 +168,11 @@ BEGIN EDITTEXT IDC_DESKTOP_WIDTH,84,68,40,12,ES_AUTOHSCROLL | ES_NUMBER | WS_DISABLED EDITTEXT IDC_DESKTOP_HEIGHT,137,68,40,12,ES_AUTOHSCROLL | ES_NUMBER | WS_DISABLED - GROUPBOX "Screen resolution",IDC_STATIC,8,95,244,63 + GROUPBOX "Screen resolution",IDC_STATIC,8,95,244,84 CONTROL "", IDC_RES_TRACKBAR, "msctls_trackbar32",WS_TABSTOP,12,105,171,15 EDITTEXT IDC_RES_DPIEDIT,188,105,23,13,ES_NUMBER|WS_TABSTOP LTEXT "#msgctxt#unit: dots/inch#dpi",IDC_STATIC,215,107,30,8 - LTEXT "This is a sample text using 10 point Tahoma",IDC_RES_FONT_PREVIEW,15,124,230,28 + LTEXT "This is a sample text using 10 point Tahoma",IDC_RES_FONT_PREVIEW,15,124,230,49 END IDD_DLLCFG DIALOG 0, 0, 260, 220 @@ -285,7 +285,7 @@ BEGIN PUSHBUTTON "",IDC_SYSPARAM_COLOR,133,90,25,13,WS_DISABLED | BS_OWNERDRAW LTEXT "Si&ze:",IDC_SYSPARAM_SIZE_TEXT,164,80,30,8,WS_DISABLED EDITTEXT IDC_SYSPARAM_SIZE,164,90,23,13,ES_AUTOHSCROLL | WS_TABSTOP | WS_DISABLED - CONTROL "",IDC_SYSPARAM_SIZE_UD,UPDOWN_CLASS,UDS_SETBUDDYINT | WS_DISABLED,185,90,15,13 + CONTROL "",IDC_SYSPARAM_SIZE_UD,UPDOWN_CLASSA,UDS_SETBUDDYINT | WS_DISABLED,185,90,15,13 PUSHBUTTON "&Font...",IDC_SYSPARAM_FONT,200,90,45,13,WS_DISABLED GROUPBOX "Folders",IDC_STATIC,8,114,244,100 CONTROL "",IDC_LIST_SFPATHS,"SysListView32",LVS_REPORT | LVS_AUTOARRANGE | LVS_ALIGNLEFT | diff --git a/programs/winecfg/x11drvdlg.c b/programs/winecfg/x11drvdlg.c index 2066fedab28..2bd46091d15 100644 --- a/programs/winecfg/x11drvdlg.c +++ b/programs/winecfg/x11drvdlg.c @@ -85,8 +85,8 @@ static void update_gui_for_desktop_mode(HWND dialog) SetWindowTextW(GetDlgItem(dialog, IDC_DESKTOP_WIDTH), buf); SetWindowTextW(GetDlgItem(dialog, IDC_DESKTOP_HEIGHT), bufindex); } else { - SetWindowText(GetDlgItem(dialog, IDC_DESKTOP_WIDTH), "800"); - SetWindowText(GetDlgItem(dialog, IDC_DESKTOP_HEIGHT), "600"); + SetWindowTextA(GetDlgItem(dialog, IDC_DESKTOP_WIDTH), "800"); + SetWindowTextA(GetDlgItem(dialog, IDC_DESKTOP_HEIGHT), "600"); } HeapFree(GetProcessHeap(), 0, buf); @@ -119,9 +119,9 @@ static void init_dialog(HWND dialog) update_gui_for_desktop_mode(dialog); updating_ui = TRUE; - - SendDlgItemMessage(dialog, IDC_DESKTOP_WIDTH, EM_LIMITTEXT, RES_MAXLEN, 0); - SendDlgItemMessage(dialog, IDC_DESKTOP_HEIGHT, EM_LIMITTEXT, RES_MAXLEN, 0); + + SendDlgItemMessageW(dialog, IDC_DESKTOP_WIDTH, EM_LIMITTEXT, RES_MAXLEN, 0); + SendDlgItemMessageW(dialog, IDC_DESKTOP_HEIGHT, EM_LIMITTEXT, RES_MAXLEN, 0); buf = get_reg_key(config_key, keypath("X11 Driver"), "GrabFullscreen", "N"); if (IS_OPTION_TRUE(*buf)) @@ -246,16 +246,17 @@ static INT read_logpixels_reg(void) static void init_dpi_editbox(HWND hDlg) { + static const WCHAR fmtW[] = {'%','u',0}; DWORD dwLogpixels; - char szLogpixels[MAXBUFLEN]; + WCHAR szLogpixels[MAXBUFLEN]; updating_ui = TRUE; dwLogpixels = read_logpixels_reg(); WINE_TRACE("%u\n", dwLogpixels); - sprintf(szLogpixels, "%u", dwLogpixels); - SetDlgItemText(hDlg, IDC_RES_DPIEDIT, szLogpixels); + sprintfW(szLogpixels, fmtW, dwLogpixels); + SetDlgItemTextW(hDlg, IDC_RES_DPIEDIT, szLogpixels); updating_ui = FALSE; } @@ -277,6 +278,7 @@ static void init_trackbar(HWND hDlg) static void update_dpi_trackbar_from_edit(HWND hDlg, BOOL fix) { + static const WCHAR fmtW[] = {'%','u',0}; DWORD dpi; updating_ui = TRUE; @@ -292,17 +294,17 @@ static void update_dpi_trackbar_from_edit(HWND hDlg, BOOL fix) if (fixed_dpi != dpi) { - char buf[16]; + WCHAR buf[16]; dpi = fixed_dpi; - sprintf(buf, "%u", dpi); - SetDlgItemText(hDlg, IDC_RES_DPIEDIT, buf); + sprintfW(buf, fmtW, dpi); + SetDlgItemTextW(hDlg, IDC_RES_DPIEDIT, buf); } } if (dpi >= MINDPI && dpi <= MAXDPI) { - SendDlgItemMessage(hDlg, IDC_RES_TRACKBAR, TBM_SETPOS, TRUE, dpi); + SendDlgItemMessageW(hDlg, IDC_RES_TRACKBAR, TBM_SETPOS, TRUE, dpi); set_reg_key_dwordW(HKEY_LOCAL_MACHINE, logpixels_reg, logpixels, dpi); } @@ -319,21 +321,21 @@ static void update_font_preview(HWND hDlg) if (dpi >= MINDPI && dpi <= MAXDPI) { - LOGFONT lf; + static const WCHAR tahomaW[] = {'T','a','h','o','m','a',0}; + LOGFONTW lf; HFONT hfont; - hfont = (HFONT)SendDlgItemMessage(hDlg, IDC_RES_FONT_PREVIEW, WM_GETFONT, 0, 0); + hfont = (HFONT)SendDlgItemMessageW(hDlg, IDC_RES_FONT_PREVIEW, WM_GETFONT, 0, 0); - GetObject(hfont, sizeof(lf), &lf); + GetObjectW(hfont, sizeof(lf), &lf); - if (lstrcmp(lf.lfFaceName, "Tahoma") != 0) - lstrcpy(lf.lfFaceName, "Tahoma"); + if (strcmpW(lf.lfFaceName, tahomaW) != 0) + strcpyW(lf.lfFaceName, tahomaW); else DeleteObject(hfont); - lf.lfHeight = MulDiv(-10, dpi, 72); - hfont = CreateFontIndirect(&lf); - SendDlgItemMessage(hDlg, IDC_RES_FONT_PREVIEW, WM_SETFONT, (WPARAM)hfont, 1); + hfont = CreateFontIndirectW(&lf); + SendDlgItemMessageW(hDlg, IDC_RES_FONT_PREVIEW, WM_SETFONT, (WPARAM)hfont, 1); } updating_ui = FALSE; @@ -366,7 +368,7 @@ GraphDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) switch(HIWORD(wParam)) { case EN_CHANGE: { if (updating_ui) break; - SendMessage(GetParent(hDlg), PSM_CHANGED, 0, 0); + SendMessageW(GetParent(hDlg), PSM_CHANGED, 0, 0); if ( ((LOWORD(wParam) == IDC_DESKTOP_WIDTH) || (LOWORD(wParam) == IDC_DESKTOP_HEIGHT)) && !updating_ui ) set_from_desktop_edits(hDlg); else if (LOWORD(wParam) == IDC_RES_DPIEDIT) @@ -379,7 +381,7 @@ GraphDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) } case BN_CLICKED: { if (updating_ui) break; - SendMessage(GetParent(hDlg), PSM_CHANGED, 0, 0); + SendMessageW(GetParent(hDlg), PSM_CHANGED, 0, 0); switch(LOWORD(wParam)) { case IDC_ENABLE_DESKTOP: on_enable_desktop_clicked(hDlg); break; case IDC_ENABLE_MANAGED: on_enable_managed_clicked(hDlg); break; @@ -389,7 +391,7 @@ GraphDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) break; } case CBN_SELCHANGE: { - SendMessage(GetParent(hDlg), PSM_CHANGED, 0, 0); + SendMessageW(GetParent(hDlg), PSM_CHANGED, 0, 0); break; } @@ -402,12 +404,12 @@ GraphDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_NOTIFY: switch (((LPNMHDR)lParam)->code) { case PSN_KILLACTIVE: { - SetWindowLongPtr(hDlg, DWLP_MSGRESULT, FALSE); + SetWindowLongPtrW(hDlg, DWLP_MSGRESULT, FALSE); break; } case PSN_APPLY: { apply(); - SetWindowLongPtr(hDlg, DWLP_MSGRESULT, PSNRET_NOERROR); + SetWindowLongPtrW(hDlg, DWLP_MSGRESULT, PSNRET_NOERROR); break; } case PSN_SETACTIVE: { @@ -420,11 +422,12 @@ GraphDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_HSCROLL: switch (wParam) { default: { - char buf[MAXBUFLEN]; + static const WCHAR fmtW[] = {'%','d',0}; + WCHAR buf[MAXBUFLEN]; int i = SendMessageW(GetDlgItem(hDlg, IDC_RES_TRACKBAR), TBM_GETPOS, 0, 0); buf[0] = 0; - sprintf(buf, "%d", i); - SendMessage(GetDlgItem(hDlg, IDC_RES_DPIEDIT), WM_SETTEXT, 0, (LPARAM) buf); + sprintfW(buf, fmtW, i); + SendMessageW(GetDlgItem(hDlg, IDC_RES_DPIEDIT), WM_SETTEXT, 0, (LPARAM) buf); update_font_preview(hDlg); set_reg_key_dwordW(HKEY_LOCAL_MACHINE, logpixels_reg, logpixels, i); break; -- 2.11.4.GIT