From: Michael Stefaniuc Subject: [PATCH] comdlg32: Use wide-char string literals. Message-Id: <20201122231551.148979-1-mstefani@winehq.org> Date: Mon, 23 Nov 2020 00:15:51 +0100 Signed-off-by: Michael Stefaniuc --- dlls/comdlg32/colordlg.c | 12 ++---- dlls/comdlg32/filedlg.c | 73 +++++++++++--------------------- dlls/comdlg32/filedlg31.c | 13 +++--- dlls/comdlg32/fontdlg.c | 87 +++++++++++++++++---------------------- dlls/comdlg32/itemdlg.c | 45 +++++++------------- dlls/comdlg32/printdlg.c | 42 +++++++------------ 6 files changed, 102 insertions(+), 170 deletions(-) diff --git a/dlls/comdlg32/colordlg.c b/dlls/comdlg32/colordlg.c index 510e0723f26..7ab5efd0962 100644 --- a/dlls/comdlg32/colordlg.c +++ b/dlls/comdlg32/colordlg.c @@ -63,9 +63,6 @@ static const COLORREF predefcolors[6][8]= 0x00808040L, 0x00C0C0C0L, 0x00400040L, 0x00FFFFFFL }, }; -static const WCHAR szColourDialogProp[] = { - 'c','o','l','o','u','r','d','i','a','l','o','g','p','r','o','p',0 }; - /* Chose Color PRIVATE Structure: * * This structure is duplicated in the 16 bit code with @@ -866,7 +863,7 @@ static LRESULT CC_WMInitDialog( HWND hDlg, WPARAM wParam, LPARAM lParam ) lpp->lpcc = cc; lpp->hwndSelf = hDlg; - SetPropW( hDlg, szColourDialogProp, lpp ); + SetPropW( hDlg, L"colourdialogprop", lpp ); if (!(lpp->lpcc->Flags & CC_SHOWHELP)) ShowWindow(GetDlgItem(hDlg, pshHelp), SW_HIDE); @@ -1194,7 +1191,7 @@ static INT_PTR CALLBACK ColorDlgProc( HWND hDlg, UINT message, { int res; - CCPRIV *lpp = GetPropW( hDlg, szColourDialogProp ); + CCPRIV *lpp = GetPropW( hDlg, L"colourdialogprop" ); if (message != WM_INITDIALOG) { @@ -1220,7 +1217,7 @@ static INT_PTR CALLBACK ColorDlgProc( HWND hDlg, UINT message, DeleteDC(lpp->hdcMem); DeleteObject(lpp->hbmMem); heap_free(lpp); - RemovePropW( hDlg, szColourDialogProp ); + RemovePropW( hDlg, L"colourdialogprop" ); break; case WM_COMMAND: if (CC_WMCommand(lpp, wParam, lParam, HIWORD(wParam), (HWND) lParam)) @@ -1301,8 +1298,7 @@ BOOL WINAPI ChooseColorW( CHOOSECOLORW *lpChCol ) { HRSRC hResInfo; HGLOBAL hDlgTmpl; - static const WCHAR wszCHOOSE_COLOR[] = {'C','H','O','O','S','E','_','C','O','L','O','R',0}; - if (!(hResInfo = FindResourceW(COMDLG32_hInstance, wszCHOOSE_COLOR, (LPWSTR)RT_DIALOG))) + if (!(hResInfo = FindResourceW(COMDLG32_hInstance, L"CHOOSE_COLOR", (LPWSTR)RT_DIALOG))) { COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE); return FALSE; diff --git a/dlls/comdlg32/filedlg.c b/dlls/comdlg32/filedlg.c index 538358bd5f9..0ada09aad96 100644 --- a/dlls/comdlg32/filedlg.c +++ b/dlls/comdlg32/filedlg.c @@ -135,18 +135,9 @@ typedef struct tagLookInInfo static const char LookInInfosStr[] = "LookInInfos"; /* LOOKIN combo box property */ static SIZE MemDialogSize = { 0, 0}; /* keep size of the (resizable) dialog */ -static const WCHAR LastVisitedMRUW[] = - {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\', - 'W','i','n','d','o','w','s','\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\', - 'E','x','p','l','o','r','e','r','\\','C','o','m','D','l','g','3','2','\\', - 'L','a','s','t','V','i','s','i','t','e','d','M','R','U',0}; -static const WCHAR MRUListW[] = {'M','R','U','L','i','s','t',0}; - -static const WCHAR filedlg_info_propnameW[] = {'F','i','l','e','O','p','e','n','D','l','g','I','n','f','o','s',0}; - FileOpenDlgInfos *get_filedlg_infoptr(HWND hwnd) { - return GetPropW(hwnd, filedlg_info_propnameW); + return GetPropW(hwnd, L"FileOpenDlgInfos"); } static BOOL is_dialog_hooked(const FileOpenDlgInfos *info) @@ -268,7 +259,6 @@ static BOOL get_config_key_string(HKEY hkey, const WCHAR *name, WCHAR **value) static BOOL is_places_bar_enabled(const FileOpenDlgInfos *fodInfos) { - static const WCHAR noplacesbarW[] = {'N','o','P','l','a','c','e','s','B','a','r',0}; DWORD value; HKEY hkey; @@ -283,7 +273,7 @@ static BOOL is_places_bar_enabled(const FileOpenDlgInfos *fodInfos) return TRUE; value = 0; - get_config_key_as_dword(hkey, noplacesbarW, &value); + get_config_key_as_dword(hkey, L"NoPlacesBar", &value); RegCloseKey(hkey); return value == 0; } @@ -304,13 +294,12 @@ static void filedlg_collect_places_pidls(FileOpenDlgInfos *fodInfos) { for (i = 0; i < ARRAY_SIZE(fodInfos->places); i++) { - static const WCHAR placeW[] = {'P','l','a','c','e','%','d',0}; WCHAR nameW[8]; DWORD value; HRESULT hr; WCHAR *str; - swprintf(nameW, ARRAY_SIZE(nameW), placeW, i); + swprintf(nameW, ARRAY_SIZE(nameW), L"Place%d", i); if (get_config_key_dword(hkey, nameW, &value)) { hr = SHGetSpecialFolderLocation(NULL, value, &fodInfos->places[i]); @@ -1304,7 +1293,7 @@ INT_PTR CALLBACK FileOpenDlgProc95(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM l if (SUCCEEDED(OleInitialize(NULL))) fodInfos->ole_initialized = TRUE; - SetPropW(hwnd, filedlg_info_propnameW, fodInfos); + SetPropW(hwnd, L"FileOpenDlgInfos", fodInfos); FILEDLG95_InitControls(hwnd); @@ -1431,7 +1420,7 @@ INT_PTR CALLBACK FileOpenDlgProc95(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM l } case WM_NCDESTROY: - RemovePropW(hwnd, filedlg_info_propnameW); + RemovePropW(hwnd, L"FileOpenDlgInfos"); return 0; case WM_NOTIFY: @@ -1497,8 +1486,6 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd) BOOL win98plus = FALSE; BOOL handledPath = FALSE; OSVERSIONINFOW osVi; - static const WCHAR szwSlash[] = { '\\', 0 }; - static const WCHAR szwStar[] = { '*',0 }; static const TBBUTTON tbb[] = { @@ -1659,7 +1646,7 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd) { /* 1. If win2000 or higher and filename contains a path, use it in preference over the lpstrInitialDir */ - if (win2000plus && *fodInfos->filename && wcspbrk(fodInfos->filename, szwSlash)) { + if (win2000plus && *fodInfos->filename && wcspbrk(fodInfos->filename, L"\\")) { WCHAR tmpBuf[MAX_PATH]; WCHAR *nameBit; DWORD result; @@ -1707,7 +1694,7 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd) * specified, the dir part is taken */ if (PathIsDirectoryW(tmpBuf)) { PathAddBackslashW(tmpBuf); - lstrcatW(tmpBuf, szwStar); + lstrcatW(tmpBuf, L"*"); } result = GetFullPathNameW(tmpBuf, MAX_PATH, tmpBuf2, &nameBit); if (result) { @@ -1730,9 +1717,8 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd) if (!handledPath && (!fodInfos->initdir || !*fodInfos->initdir)) { /* 3. All except w2k+: if filename contains a path use it */ - if (!win2000plus && fodInfos->filename && - *fodInfos->filename && - wcspbrk(fodInfos->filename, szwSlash)) { + if (!win2000plus && fodInfos->filename && *fodInfos->filename && + wcspbrk(fodInfos->filename, L"\\")) { WCHAR tmpBuf[MAX_PATH]; WCHAR *nameBit; DWORD result; @@ -2173,15 +2159,14 @@ BOOL FILEDLG95_OnOpenMultipleFiles(HWND hwnd, LPWSTR lpstrFileList, UINT nFileCo WCHAR lpstrNotFound[100]; WCHAR lpstrMsg[100]; WCHAR tmp[400]; - static const WCHAR nl[] = {'\n',0}; LoadStringW(COMDLG32_hInstance, IDS_FILENOTFOUND, lpstrNotFound, 100); LoadStringW(COMDLG32_hInstance, IDS_VERIFYFILE, lpstrMsg, 100); lstrcpyW(tmp, lpstrTemp); - lstrcatW(tmp, nl); + lstrcatW(tmp, L"\n"); lstrcatW(tmp, lpstrNotFound); - lstrcatW(tmp, nl); + lstrcatW(tmp, L"\n"); lstrcatW(tmp, lpstrMsg); MessageBoxW(hwnd, tmp, fodInfos->title, MB_OK | MB_ICONEXCLAMATION); @@ -2265,13 +2250,14 @@ static WCHAR FILEDLG95_MRU_get_slot(LPCWSTR module_name, LPWSTR stored_path, PHK if(stored_path) *stored_path = '\0'; - ret = RegCreateKeyW(HKEY_CURRENT_USER, LastVisitedMRUW, hkey); + ret = RegCreateKeyW(HKEY_CURRENT_USER, + L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ComDlg32\\LastVisitedMRU", hkey); if(ret){ WARN("Unable to create MRU key: %d\n", ret); return 0; } - ret = RegGetValueW(*hkey, NULL, MRUListW, RRF_RT_REG_SZ, &key_type, + ret = RegGetValueW(*hkey, NULL, L"MRUList", RRF_RT_REG_SZ, &key_type, (LPBYTE)mru_list, &mru_list_size); if(ret || key_type != REG_SZ){ if(ret == ERROR_FILE_NOT_FOUND) @@ -2378,7 +2364,7 @@ static void FILEDLG95_MRU_save_filename(LPCWSTR filename) WCHAR *old_mru_slot, *new_mru_slot = new_mru_list; DWORD mru_list_size = sizeof(old_mru_list), key_type; - ret = RegGetValueW(hkey, NULL, MRUListW, RRF_RT_ANY, &key_type, + ret = RegGetValueW(hkey, NULL, L"MRUList", RRF_RT_ANY, &key_type, (LPBYTE)old_mru_list, &mru_list_size); if(ret || key_type != REG_SZ){ if(ret == ERROR_FILE_NOT_FOUND){ @@ -2400,7 +2386,7 @@ static void FILEDLG95_MRU_save_filename(LPCWSTR filename) *new_mru_slot = '\0'; } - ret = RegSetValueExW(hkey, MRUListW, 0, REG_SZ, (LPBYTE)new_mru_list, + ret = RegSetValueExW(hkey, L"MRUList", 0, REG_SZ, (LPBYTE)new_mru_list, (lstrlenW(new_mru_list) + 1) * sizeof(WCHAR)); if(ret){ WARN("Error saving MRUList data: %d\n", ret); @@ -2449,10 +2435,9 @@ int FILEDLG95_ValidatePathAction(LPWSTR lpstrPathAndFile, IShellFolder **ppsf, int nOpenAction = defAction; LPWSTR lpszTemp, lpszTemp1; LPITEMIDLIST pidl = NULL; - static const WCHAR szwInvalid[] = { '/',':','<','>','|', 0}; /* check for invalid chars */ - if((wcspbrk(lpstrPathAndFile+3, szwInvalid) != NULL) && !(flags & OFN_NOVALIDATE)) + if((wcspbrk(lpstrPathAndFile+3, L"/:<>|") != NULL) && !(flags & OFN_NOVALIDATE)) { FILEDLG95_OnOpenMessage(hwnd, IDS_INVALID_FILENAME_TITLE, IDS_INVALID_FILENAME); return FALSE; @@ -2479,9 +2464,8 @@ int FILEDLG95_ValidatePathAction(LPWSTR lpstrPathAndFile, IShellFolder **ppsf, /* There are no wildcards when OFN_NOVALIDATE is set */ if(*lpszTemp==0 && !(flags & OFN_NOVALIDATE)) { - static const WCHAR wszWild[] = { '*', '?', 0 }; /* if the last element is a wildcard do a search */ - if(wcspbrk(lpszTemp1, wszWild) != NULL) + if(wcspbrk(lpszTemp1, L"*?") != NULL) { nOpenAction = ONOPEN_SEARCH; break; @@ -2722,7 +2706,6 @@ BOOL FILEDLG95_OnOpen(HWND hwnd) WCHAR *filterExt = NULL; LPWSTR lpstrFilter = NULL; - static const WCHAR szwDot[] = {'.',0}; int PathLength = lstrlenW(lpstrPathAndFile); /*Get the file extension from file type filter*/ @@ -2769,7 +2752,7 @@ BOOL FILEDLG95_OnOpen(HWND hwnd) if (*filterExt) /* ignore filterExt="" */ { /* Attach the dot*/ - lstrcatW(lpstrPathAndFile, szwDot); + lstrcatW(lpstrPathAndFile, L"."); /* Attach the extension */ lstrcatW(lpstrPathAndFile, filterExt); } @@ -3285,17 +3268,12 @@ static void FILEDLG95_FILETYPE_Clean(HWND hwnd) */ static inline BOOL FILEDLG95_unixfs_is_rooted_at_desktop(void) { HKEY hKey; - static const WCHAR wszRootedAtDesktop[] = { 'S','o','f','t','w','a','r','e','\\', - 'M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\', - 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\', - 'E','x','p','l','o','r','e','r','\\','D','e','s','k','t','o','p','\\', - 'N','a','m','e','S','p','a','c','e','\\','{','9','D','2','0','A','A','E','8', - '-','0','6','2','5','-','4','4','B','0','-','9','C','A','7','-', - '7','1','8','8','9','C','2','2','5','4','D','9','}',0 }; - - if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, wszRootedAtDesktop, 0, KEY_READ, &hKey) != ERROR_SUCCESS) + + if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, + L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Desktop\\NameSpace\\" + "{9D20AAE8-0625-44B0-9CA7-71889C2254D9}", 0, KEY_READ, &hKey) != ERROR_SUCCESS) return FALSE; - + RegCloseKey(hKey); return TRUE; } @@ -4331,7 +4309,6 @@ short WINAPI GetFileTitleA(LPCSTR lpFile, LPSTR lpTitle, WORD cbBuf) short WINAPI GetFileTitleW(LPCWSTR lpFile, LPWSTR lpTitle, WORD cbBuf) { int i, len; - static const WCHAR brkpoint[] = {'*','[',']',0}; TRACE("(%p %p %d);\n", lpFile, lpTitle, cbBuf); if(lpFile == NULL || lpTitle == NULL) @@ -4342,7 +4319,7 @@ short WINAPI GetFileTitleW(LPCWSTR lpFile, LPWSTR lpTitle, WORD cbBuf) if (len == 0) return -1; - if(wcspbrk(lpFile, brkpoint)) + if(wcspbrk(lpFile, L"*[]")) return -1; len--; diff --git a/dlls/comdlg32/filedlg31.c b/dlls/comdlg32/filedlg31.c index 53ef3eeb481..b134814ab03 100644 --- a/dlls/comdlg32/filedlg31.c +++ b/dlls/comdlg32/filedlg31.c @@ -43,9 +43,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(commdlg); #define BUFFILE 512 #define BUFFILEALLOC 512 * sizeof(WCHAR) -static const WCHAR FILE_star[] = {'*','.','*', 0}; -static const WCHAR FILE_bslash[] = {'\\', 0}; -static const WCHAR FILE_specc[] = {'%','c',':', 0}; static const int fldrHeight = 16; static const int fldrWidth = 20; @@ -167,7 +164,7 @@ static LPCWSTR FD31_GetFileType(LPCWSTR cfptr, LPCWSTR fptr, const WORD index) return fptr; fptr += lstrlenW(fptr) + 1; } - return FILE_star; /* FIXME */ + return L"*.*"; /* FIXME */ } /*********************************************************************** @@ -210,7 +207,7 @@ static BOOL FD31_ScanDir(const OPENFILENAMEW *ofn, HWND hWnd, LPCWSTR newPath) } /* list of directories */ - lstrcpyW(buffer, FILE_star); + lstrcpyW(buffer, L"*.*"); if (GetDlgItem(hWnd, lst2) != 0) { lRet = DlgDirListW(hWnd, buffer, lst2, stc1, DDL_EXCLUSIVE | DDL_DIRECTORY); @@ -429,7 +426,7 @@ static LRESULT FD31_DirListDblClick( const FD31_DATA *lfs ) tmpstr[lstrlenW(tmpstr) - 1] = 0; lstrcpyW(tmpstr,tmpstr+1); } - lstrcatW(tmpstr, FILE_bslash); + lstrcatW(tmpstr, L"\\"); FD31_ScanDir(lfs->ofnW, hWnd, tmpstr); /* notify the app */ @@ -515,7 +512,7 @@ static LRESULT FD31_TestPath( const FD31_DATA *lfs, LPWSTR path ) pstr2 = path + lstrlenW(path); if (pBeginFileName == NULL || *(pBeginFileName + 1) != 0) - lstrcatW(path, FILE_bslash); + lstrcatW(path, L"\\"); /* if ScanDir succeeds, we have changed the directory */ if (FD31_ScanDir(lfs->ofnW, hWnd, path)) @@ -627,7 +624,7 @@ static LRESULT FD31_DiskChange( const FD31_DATA *lfs ) pstr = heap_alloc(BUFFILEALLOC); SendDlgItemMessageW(hWnd, cmb2, CB_GETLBTEXT, lRet, (LPARAM)pstr); - wsprintfW(diskname, FILE_specc, pstr[2]); + wsprintfW(diskname, L"%c:", pstr[2]); heap_free(pstr); return FD31_Validate( lfs, diskname, cmb2, lRet, TRUE ); diff --git a/dlls/comdlg32/fontdlg.c b/dlls/comdlg32/fontdlg.c index db2780e1218..a518c78fb17 100644 --- a/dlls/comdlg32/fontdlg.c +++ b/dlls/comdlg32/fontdlg.c @@ -47,11 +47,8 @@ typedef struct } CFn_ENUMSTRUCT, *LPCFn_ENUMSTRUCT; -static const WCHAR strWineFontData[] = {'_','_','W','I','N','E','_','F','O','N','T','D','L','G','D','A','T','A',0}; -static const WCHAR strWineFontData_a[] = - {'_','_','W','I','N','E','_','F','O','N','T','D','L','G','D','A','T','A','_','A',0}; -static const WCHAR chooseFontW[] = {'C','H','O','O','S','E','_','F','O','N','T',0}; -static const WCHAR fontsizefmtW[] = {'%','d',0}; +static const WCHAR strWineFontData[] = L"__WINE_FONTDLGDATA"; +static const WCHAR strWineFontData_a[] = L"__WINE_FONTDLGDATA_A"; /* image list with TrueType bitmaps and more */ static HIMAGELIST himlTT = 0; @@ -67,43 +64,37 @@ static INT_PTR CALLBACK FormatCharDlgProcW(HWND hDlg, UINT uMsg, WPARAM wParam, #define CI(cs) ((IDS_CHARSET_##cs)-IDS_CHARSET_ANSI) - -static const WCHAR stWestern[]={'A','a','B','b','Y','y','Z','z',0}; /* Western and default */ -static const WCHAR stSymbol[]={'S','y','m','b','o','l',0}; /* Symbol */ -static const WCHAR stShiftJis[]={'A','a',0x3042,0x3041,0x30a2,0x30a1,0x4e9c,0x5b87,0}; /* Shift JIS */ -static const WCHAR stHangul[]={0xac00,0xb098,0xb2e4,'A','a','B','Y','y','Z','z',0}; /* Hangul */ -static const WCHAR stGB2312[]={0x5fae,0x8f6f,0x4e2d,0x6587,0x8f6f,0x4ef6,0}; /* GB2312 */ -static const WCHAR stBIG5[]={0x4e2d,0x6587,0x5b57,0x578b,0x7bc4,0x4f8b,0}; /* BIG5 */ -static const WCHAR stGreek[]={'A','a','B','b',0x0391,0x03b1,0x0392,0x03b2,0}; /* Greek */ -static const WCHAR stTurkish[]={'A','a','B','b',0x011e,0x011f,0x015e,0x015f,0}; /* Turkish */ -static const WCHAR stHebrew[]={'A','a','B','b',0x05e0,0x05e1,0x05e9,0x05ea,0}; /* Hebrew */ -static const WCHAR stArabic[]={'A','a','B','b',0x0627,0x0628,0x062c,0x062f,0x0647,0x0648,0x0632,0};/* Arabic */ -static const WCHAR stBaltic[]={'A','a','B','b','Y','y','Z','z',0}; /* Baltic */ -static const WCHAR stVietname[]={'A','a','B','b',0x01a0,0x01a1,0x01af,0x01b0,0}; /* Vietnamese */ -static const WCHAR stCyrillic[]={'A','a','B','b',0x0411,0x0431,0x0424,0x0444,0}; /* Cyrillic */ -static const WCHAR stEastEur[]={'A','a','B','b',0xc1,0xe1,0xd4,0xf4,0}; /* East European */ -static const WCHAR stThai[]={'A','a','B','b',0x0e2d,0x0e31,0x0e01,0x0e29,0x0e23,0x0e44,0x0e17,0x0e22,0}; /* Thai */ -static const WCHAR stJohab[]={0xac00,0xb098,0xb2e4,'A','a','B','Y','y','Z','z',0}; /* Johab */ -static const WCHAR stMac[]={'A','a','B','b','Y','y','Z','z',0}; /* Mac */ -static const WCHAR stOEM[]={'A','a','B','b',0xf8,0xf1,0xfd,0}; /* OEM */ -/* the following character sets actually behave different (Win2K observation): - * the sample string is 'sticky': it uses the sample string of the previous - * selected character set. That behaviour looks like some default, which is - * not (yet) implemented. */ -static const WCHAR stVISCII[]={'A','a','B','b',0}; /* VISCII */ -static const WCHAR stTCVN[]={'A','a','B','b',0}; /* TCVN */ -static const WCHAR stKOI8[]={'A','a','B','b',0}; /* KOI-8 */ -static const WCHAR stIso88593[]={'A','a','B','b',0}; /* ISO-8859-3 */ -static const WCHAR stIso88594[]={'A','a','B','b',0}; /* ISO-8859-4 */ -static const WCHAR stIso885910[]={'A','a','B','b',0}; /* ISO-8859-10 */ -static const WCHAR stCeltic[]={'A','a','B','b',0};/* Celtic */ - static const WCHAR * const sample_lang_text[]={ - stWestern,stSymbol,stShiftJis,stHangul,stGB2312, - stBIG5,stGreek,stTurkish,stHebrew,stArabic, - stBaltic,stVietname,stCyrillic,stEastEur,stThai, - stJohab,stMac,stOEM,stVISCII,stTCVN, - stKOI8,stIso88593,stIso88594,stIso885910,stCeltic}; + L"AaBbYyZz", /* Western and default */ + L"Symbol", /* Symbol */ + L"Aa\x3042\x3041\x30a2\x30a1\x4e9c\x5b87", /* Shift JIS */ + L"\xac00\xb098\xb2e4" "AaBYyZz", /* Hangul */ + L"\x5fae\x8f6f\x4e2d\x6587\x8f6f\x4ef6", /* GB2312 */ + L"\x4e2d\x6587\x5b57\x578b\x7bc4\x4f8b", /* BIG5 */ + L"AaBb\x0391\x03b1\x0392\x03b2", /* Greek */ + L"AaBb\x011e\x011f\x015e\x015f", /* Turkish */ + L"AaBb\x05e0\x05e1\x05e9\x05ea", /* Hebrew */ + L"AaBb\x0627\x0628\x062c\x062f\x0647\x0648\x0632", /* Arabic */ + L"AaBbYyZz", /* Baltic */ + L"AaBb\x01a0\x01a1\x01af\x01b0", /* Vietnamese */ + L"AaBb\x0411\x0431\x0424\x0444", /* Cyrillic */ + L"AaBb\x00c1\x00e1\x00d4\x00f4", /* East European */ + L"AaBb\x0e2d\x0e31\x0e01\x0e29\x0e23\x0e44\x0e17\x0e22", /* Thai */ + L"\xac00\xb098\xb2e4" "AaBYyZz", /* Johab */ + L"AaBbYyZz", /* Mac */ + L"AaBb\x00f8\x00f1\x00fd", /* OEM */ + /* the following character sets actually behave different (Win2K observation): + * the sample string is 'sticky': it uses the sample string of the previous + * selected character set. That behaviour looks like some default, which is + * not (yet) implemented. */ + L"AaBb", /* VISCII */ + L"AaBb", /* TCVN */ + L"AaBb", /* KOI-8 */ + L"AaBb", /* ISO-8859-3 */ + L"AaBb", /* ISO-8859-4 */ + L"AaBb", /* ISO-8859-10 */ + L"AaBb" /* Celtic */ +}; static const BYTE CHARSET_ORDER[256]={ @@ -207,7 +198,7 @@ BOOL WINAPI ChooseFontW(LPCHOOSEFONTW lpChFont) } else { hDlginst=COMDLG32_hInstance; - if (!(hResInfo = FindResourceW(hDlginst, chooseFontW, (LPWSTR)RT_DIALOG))) + if (!(hResInfo = FindResourceW(hDlginst, L"CHOOSE_FONT", (LPWSTR)RT_DIALOG))) { COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE); return FALSE; @@ -261,7 +252,7 @@ BOOL WINAPI ChooseFontA(LPCHOOSEFONTA lpChFont) } else { hDlginst=COMDLG32_hInstance; - if (!(hResInfo = FindResourceW(hDlginst, chooseFontW, (LPWSTR)RT_DIALOG))) + if (!(hResInfo = FindResourceW(hDlginst, L"CHOOSE_FONT", (LPWSTR)RT_DIALOG))) { COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE); return FALSE; @@ -422,7 +413,7 @@ static BOOL AddFontSizeToCombo3(HWND hwnd, UINT h, const CHOOSEFONTW *lpcf) if ( (!(lpcf->Flags & CF_LIMITSIZE)) || ((lpcf->Flags & CF_LIMITSIZE) && (h >= lpcf->nSizeMin) && (h <= lpcf->nSizeMax))) { - swprintf(buffer, ARRAY_SIZE(buffer), fontsizefmtW, h); + swprintf(buffer, ARRAY_SIZE(buffer), L"%d", h); j=SendMessageW(hwnd, CB_FINDSTRINGEXACT, -1, (LPARAM)buffer); if (j==CB_ERR) { @@ -625,7 +616,6 @@ static LRESULT CFn_WMInitDialog(HWND hDlg, LPARAM lParam, LPCHOOSEFONTW lpcf) CFn_ENUMSTRUCT s; LPLOGFONTW lpxx; HCURSOR hcursor=SetCursor(LoadCursorW(0,(LPWSTR)IDC_WAIT)); - static const WCHAR strColorName[] = {'[','c','o','l','o','r',' ','n','a','m','e',']',0}; SetPropW(hDlg, strWineFontData, lpcf); lpxx=lpcf->lpLogFont; @@ -662,11 +652,8 @@ static LRESULT CFn_WMInitDialog(HWND hDlg, LPARAM lParam, LPCHOOSEFONTW lpcf) { WCHAR name[30]; - if( LoadStringW(COMDLG32_hInstance, IDS_COLOR_BLACK+i, name, - ARRAY_SIZE(name)) == 0 ) - { - memcpy(name, strColorName, sizeof(strColorName)); - } + if (LoadStringW(COMDLG32_hInstance, IDS_COLOR_BLACK+i, name, ARRAY_SIZE(name)) == 0) + lstrcpyW(name, L"[color name]"); j=SendDlgItemMessageW(hDlg, cmb4, CB_ADDSTRING, 0, (LPARAM)name); SendDlgItemMessageW(hDlg, cmb4, CB_SETITEMDATA, j, textcolors[i]); /* look for a fitting value in color combobox */ diff --git a/dlls/comdlg32/itemdlg.c b/dlls/comdlg32/itemdlg.c index f17c2f926d6..eb85aa10d64 100644 --- a/dlls/comdlg32/itemdlg.c +++ b/dlls/comdlg32/itemdlg.c @@ -48,10 +48,6 @@ DEFINE_GUID(IID_IFileDialogCustomizeAlt, 0x8016B7B3, 0x3D49, 0x4504, 0xA0,0xAA, WINE_DEFAULT_DEBUG_CHANNEL(commdlg); -static const WCHAR notifysink_childW[] = {'n','f','s','_','c','h','i','l','d',0}; -static const WCHAR floatnotifysinkW[] = {'F','l','o','a','t','N','o','t','i','f','y','S','i','n','k',0}; -static const WCHAR radiobuttonlistW[] = {'R','a','d','i','o','B','u','t','t','o','n','L','i','s','t',0}; - enum ITEMDLG_TYPE { ITEMDLG_TYPE_OPEN, ITEMDLG_TYPE_SAVE @@ -555,8 +551,6 @@ static HRESULT on_default_action(FileDialogImpl *This) /* Add the proper extension */ if(open_action == ONOPEN_OPEN) { - static const WCHAR dotW[] = {'.',0}; - if(This->dlg_type == ITEMDLG_TYPE_SAVE) { WCHAR extbuf[MAX_PATH], *newext = NULL; @@ -567,7 +561,7 @@ static HRESULT on_default_action(FileDialogImpl *This) } else if(This->default_ext) { - lstrcpyW(extbuf, dotW); + lstrcpyW(extbuf, L"."); lstrcatW(extbuf, This->default_ext); newext = extbuf; } @@ -586,7 +580,7 @@ static HRESULT on_default_action(FileDialogImpl *This) { if(This->default_ext) { - lstrcatW(canon_filename, dotW); + lstrcatW(canon_filename, L"."); lstrcatW(canon_filename, This->default_ext); if(!PathFileExistsW(canon_filename)) @@ -1122,7 +1116,7 @@ static LRESULT CALLBACK notifysink_proc(HWND hwnd, UINT message, WPARAM wparam, case WM_COMMAND: return notifysink_on_wm_command(This, hwnd, wparam, lparam); case WM_NOTIFY: return notifysink_on_wm_notify(This, hwnd, wparam, lparam); case WM_SIZE: - hwnd_child = GetPropW(hwnd, notifysink_childW); + hwnd_child = GetPropW(hwnd, L"nfs_child"); ctrl = (customctrl*)GetWindowLongPtrW(hwnd_child, GWLP_USERDATA); if(ctrl && ctrl->type != IDLG_CCTRL_VISUALGROUP) { @@ -1151,7 +1145,7 @@ static HRESULT cctrl_create_new(FileDialogImpl *This, DWORD id, else parent_hwnd = This->cctrls_hwnd; - ns_hwnd = CreateWindowExW(0, floatnotifysinkW, NULL, wsflags, + ns_hwnd = CreateWindowExW(0, L"FloatNotifySink", NULL, wsflags, 0, 0, This->cctrl_width, height, parent_hwnd, (HMENU)This->cctrl_next_dlgid, COMDLG32_hInstance, This); control_hwnd = CreateWindowExW(ctrl_exflags, wndclass, text, wsflags | ctrl_wsflags, @@ -1167,7 +1161,7 @@ static HRESULT cctrl_create_new(FileDialogImpl *This, DWORD id, return E_FAIL; } - SetPropW(ns_hwnd, notifysink_childW, control_hwnd); + SetPropW(ns_hwnd, L"nfs_child", control_hwnd); ctrl = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(customctrl)); if(!ctrl) @@ -1492,8 +1486,7 @@ static HRESULT init_custom_controls(FileDialogImpl *This) { WNDCLASSW wc; HDC hdc; - static const WCHAR ctrl_container_classname[] = - {'i','d','l','g','_','c','o','n','t','a','i','n','e','r','_','p','a','n','e',0}; + static const WCHAR ctrl_container_classname[] = L"idlg_container_pane"; InitCommonControlsEx(NULL); @@ -1537,7 +1530,7 @@ static HRESULT init_custom_controls(FileDialogImpl *This) SetWindowLongW(This->cctrls_hwnd, GWL_STYLE, WS_TABSTOP); /* Register class for */ - if( !GetClassInfoW(COMDLG32_hInstance, floatnotifysinkW, &wc) || + if (!GetClassInfoW(COMDLG32_hInstance, L"FloatNotifySink", &wc) || wc.hInstance != COMDLG32_hInstance) { wc.style = CS_HREDRAW | CS_VREDRAW; @@ -1549,13 +1542,13 @@ static HRESULT init_custom_controls(FileDialogImpl *This) wc.hCursor = LoadCursorW(0, (LPWSTR)IDC_ARROW); wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); wc.lpszMenuName = NULL; - wc.lpszClassName = floatnotifysinkW; + wc.lpszClassName = L"FloatNotifySink"; if (!RegisterClassW(&wc)) ERR("Failed to register FloatNotifySink window class.\n"); } - if( !GetClassInfoW(COMDLG32_hInstance, radiobuttonlistW, &wc) || + if (!GetClassInfoW(COMDLG32_hInstance, L"RadioButtonList", &wc) || wc.hInstance != COMDLG32_hInstance) { wc.style = CS_HREDRAW | CS_VREDRAW; @@ -1567,7 +1560,7 @@ static HRESULT init_custom_controls(FileDialogImpl *This) wc.hCursor = LoadCursorW(0, (LPWSTR)IDC_ARROW); wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); wc.lpszMenuName = NULL; - wc.lpszClassName = radiobuttonlistW; + wc.lpszClassName = L"RadioButtonList"; if (!RegisterClassW(&wc)) ERR("Failed to register RadioButtonList window class.\n"); @@ -1970,12 +1963,9 @@ static void update_control_text(FileDialogImpl *This) static LRESULT CALLBACK dropdown_subclass_proc(HWND hwnd, UINT umessage, WPARAM wparam, LPARAM lparam) { - static const WCHAR prop_this[] = {'i','t','e','m','d','l','g','_','T','h','i','s',0}; - static const WCHAR prop_oldwndproc[] = {'i','t','e','m','d','l','g','_','o','l','d','w','n','d','p','r','o','c',0}; - if (umessage == WM_LBUTTONDOWN) { - FileDialogImpl *This = GetPropW(hwnd, prop_this); + FileDialogImpl *This = GetPropW(hwnd, L"itemdlg_This"); SendMessageW(hwnd, BM_SETCHECK, BST_CHECKED, 0); show_opendropdown(This); @@ -1984,7 +1974,7 @@ static LRESULT CALLBACK dropdown_subclass_proc(HWND hwnd, UINT umessage, WPARAM return 0; } - return CallWindowProcW((WNDPROC)GetPropW(hwnd, prop_oldwndproc), hwnd, umessage, wparam, lparam); + return CallWindowProcW((WNDPROC)GetPropW(hwnd, L"itemdlg_oldwndproc"), hwnd, umessage, wparam, lparam); } static LRESULT on_wm_initdialog(HWND hwnd, LPARAM lParam) @@ -2047,9 +2037,6 @@ static LRESULT on_wm_initdialog(HWND hwnd, LPARAM lParam) HWND dropdown_hwnd; LOGFONTW lfw, lfw_marlett; HFONT dialog_font; - static const WCHAR marlett[] = {'M','a','r','l','e','t','t',0}; - static const WCHAR prop_this[] = {'i','t','e','m','d','l','g','_','T','h','i','s',0}; - static const WCHAR prop_oldwndproc[] = {'i','t','e','m','d','l','g','_','o','l','d','w','n','d','p','r','o','c',0}; dropdown_hwnd = GetDlgItem(This->dlg_hwnd, psh1); @@ -2059,7 +2046,7 @@ static LRESULT on_wm_initdialog(HWND hwnd, LPARAM lParam) GetObjectW(dialog_font, sizeof(lfw), &lfw); memset(&lfw_marlett, 0, sizeof(lfw_marlett)); - lstrcpyW(lfw_marlett.lfFaceName, marlett); + lstrcpyW(lfw_marlett.lfFaceName, L"Marlett"); lfw_marlett.lfHeight = lfw.lfHeight; lfw_marlett.lfCharSet = SYMBOL_CHARSET; @@ -2068,8 +2055,8 @@ static LRESULT on_wm_initdialog(HWND hwnd, LPARAM lParam) SendMessageW(dropdown_hwnd, WM_SETFONT, (LPARAM)This->hfont_opendropdown, 0); /* Subclass button so we can handle LBUTTONDOWN */ - SetPropW(dropdown_hwnd, prop_this, This); - SetPropW(dropdown_hwnd, prop_oldwndproc, + SetPropW(dropdown_hwnd, L"itemdlg_This", This); + SetPropW(dropdown_hwnd, L"itemdlg_oldwndproc", (HANDLE)SetWindowLongPtrW(dropdown_hwnd, GWLP_WNDPROC, (LONG_PTR)dropdown_subclass_proc)); } @@ -3837,7 +3824,7 @@ static HRESULT WINAPI IFileDialogCustomize_fnAddRadioButtonList(IFileDialogCusto HRESULT hr; TRACE("%p (%d)\n", This, dwIDCtl); - hr = cctrl_create_new(This, dwIDCtl, NULL, radiobuttonlistW, 0, 0, 0, &ctrl); + hr = cctrl_create_new(This, dwIDCtl, NULL, L"RadioButtonList", 0, 0, 0, &ctrl); if(SUCCEEDED(hr)) { ctrl->type = IDLG_CCTRL_RADIOBUTTONLIST; diff --git a/dlls/comdlg32/printdlg.c b/dlls/comdlg32/printdlg.c index 0da728b1247..8d5ffc0e972 100644 --- a/dlls/comdlg32/printdlg.c +++ b/dlls/comdlg32/printdlg.c @@ -141,13 +141,8 @@ static WNDPROC lpfnStaticWndProc; static WNDPROC edit_wndproc; /* the text of the fake document to render for the Page Setup dialog */ static WCHAR wszFakeDocumentText[1024]; -static const WCHAR pd32_collateW[] = { 'P', 'D', '3', '2', '_', 'C', 'O', 'L', 'L', 'A', 'T', 'E', 0 }; -static const WCHAR pd32_nocollateW[] = { 'P', 'D', '3', '2', '_', 'N', 'O', 'C', 'O', 'L', 'L', 'A', 'T', 'E', 0 }; -static const WCHAR pd32_portraitW[] = { 'P', 'D', '3', '2', '_', 'P', 'O', 'R', 'T', 'R', 'A', 'I', 'T', 0 }; -static const WCHAR pd32_landscapeW[] = { 'P', 'D', '3', '2', '_', 'L', 'A', 'N', 'D', 'S', 'C', 'A', 'P', 'E', 0 }; -static const WCHAR printdlg_prop[] = {'_','_','W','I','N','E','_','P','R','I','N','T','D','L','G','D','A','T','A',0}; -static const WCHAR pagesetupdlg_prop[] = { '_', '_', 'W', 'I', 'N', 'E', '_', 'P', 'A', 'G', 'E', - 'S', 'E', 'T', 'U', 'P', 'D', 'L', 'G', 'D', 'A', 'T', 'A', 0 }; +static const WCHAR printdlg_prop[] = L"__WINE_PRINTDLGDATA"; +static const WCHAR pagesetupdlg_prop[] = L"__WINE_PAGESETUPDLGDATA"; static LPWSTR strdupW(LPCWSTR p) @@ -735,7 +730,7 @@ static BOOL PRINTDLG_UpdatePrintDlgW(HWND hDlg, lppd->Flags &= ~PD_SELECTION; if (IsDlgButtonChecked(hDlg, chx1) == BST_CHECKED) {/* Print to file */ - static WCHAR file[] = {'F','I','L','E',':',0}; + static WCHAR file[] = L"FILE:"; lppd->Flags |= PD_PRINTTOFILE; pi->pPortName = file; } @@ -1039,7 +1034,6 @@ static void PRINTDLG_UpdatePrinterInfoTextsW(HWND hDlg, const PRINTER_INFO_2W *p { WCHAR StatusMsg[256]; WCHAR ResourceString[256]; - static const WCHAR emptyW[] = {0}; int i; /* Status Message */ @@ -1067,7 +1061,7 @@ static void PRINTDLG_UpdatePrinterInfoTextsW(HWND hDlg, const PRINTER_INFO_2W *p SetDlgItemTextW(hDlg, stc14, pi->pLocation); else SetDlgItemTextW(hDlg, stc14, pi->pPortName); - SetDlgItemTextW(hDlg, stc13, pi->pComment ? pi->pComment : emptyW); + SetDlgItemTextW(hDlg, stc13, pi->pComment ? pi->pComment : L""); } @@ -1582,15 +1576,15 @@ static LRESULT PRINTDLG_WMInitDialogW(HWND hDlg, /* We load these with LoadImage because they are not a standard size and we don't want them rescaled */ PrintStructures->hCollateIcon = - LoadImageW(COMDLG32_hInstance, pd32_collateW, IMAGE_ICON, 0, 0, 0); + LoadImageW(COMDLG32_hInstance, L"PD32_COLLATE", IMAGE_ICON, 0, 0, 0); PrintStructures->hNoCollateIcon = - LoadImageW(COMDLG32_hInstance, pd32_nocollateW, IMAGE_ICON, 0, 0, 0); + LoadImageW(COMDLG32_hInstance, L"PD32_NOCOLLATE", IMAGE_ICON, 0, 0, 0); /* These can be done with LoadIcon */ PrintStructures->hPortraitIcon = - LoadIconW(COMDLG32_hInstance, pd32_portraitW); + LoadIconW(COMDLG32_hInstance, L"PD32_PORTRAIT"); PrintStructures->hLandscapeIcon = - LoadIconW(COMDLG32_hInstance, pd32_landscapeW); + LoadIconW(COMDLG32_hInstance, L"PD32_LANDSCAPE"); /* display the collate/no_collate icon */ SendDlgItemMessageW(hDlg, ico3, STM_SETIMAGE, IMAGE_ICON, @@ -2140,8 +2134,6 @@ static HGLOBAL PRINTDLG_GetDlgTemplateW(const PRINTDLGW *lppd) { HRSRC hResInfo; HGLOBAL hDlgTmpl; - static const WCHAR xpsetup[] = { 'P','R','I','N','T','3','2','_','S','E','T','U','P',0}; - static const WCHAR xprint[] = { 'P','R','I','N','T','3','2',0}; if (lppd->Flags & PD_PRINTSETUP) { if(lppd->Flags & PD_ENABLESETUPTEMPLATEHANDLE) { @@ -2151,7 +2143,7 @@ static HGLOBAL PRINTDLG_GetDlgTemplateW(const PRINTDLGW *lppd) lppd->lpSetupTemplateName, (LPWSTR)RT_DIALOG); hDlgTmpl = LoadResource(lppd->hInstance, hResInfo); } else { - hResInfo = FindResourceW(COMDLG32_hInstance, xpsetup, (LPWSTR)RT_DIALOG); + hResInfo = FindResourceW(COMDLG32_hInstance, L"PRINT32_SETUP", (LPWSTR)RT_DIALOG); hDlgTmpl = LoadResource(COMDLG32_hInstance, hResInfo); } } else { @@ -2163,7 +2155,7 @@ static HGLOBAL PRINTDLG_GetDlgTemplateW(const PRINTDLGW *lppd) (LPWSTR)RT_DIALOG); hDlgTmpl = LoadResource(lppd->hInstance, hResInfo); } else { - hResInfo = FindResourceW(COMDLG32_hInstance, xprint, (LPWSTR)RT_DIALOG); + hResInfo = FindResourceW(COMDLG32_hInstance, L"PRINT32", (LPWSTR)RT_DIALOG); hDlgTmpl = LoadResource(COMDLG32_hInstance, hResInfo); } } @@ -2608,7 +2600,7 @@ static WCHAR get_decimal_sep(void) if(!sep) { - WCHAR buf[] = {'.', 0}; + WCHAR buf[] = L"."; GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, buf, ARRAY_SIZE(buf)); sep = buf[0]; } @@ -2617,25 +2609,21 @@ static WCHAR get_decimal_sep(void) static void size2str(const pagesetup_data *data, DWORD size, LPWSTR strout) { - static const WCHAR integer_fmt[] = {'%','d',0}; - static const WCHAR hundredths_fmt[] = {'%','d','%','c','%','0','2','d',0}; - static const WCHAR thousandths_fmt[] = {'%','d','%','c','%','0','3','d',0}; - /* FIXME use LOCALE_SDECIMAL when the edit parsing code can cope */ if (is_metric(data)) { if(size % 100) - wsprintfW(strout, hundredths_fmt, size / 100, get_decimal_sep(), size % 100); + wsprintfW(strout, L"%d%c%02d", size / 100, get_decimal_sep(), size % 100); else - wsprintfW(strout, integer_fmt, size / 100); + wsprintfW(strout, L"%d", size / 100); } else { if(size % 1000) - wsprintfW(strout, thousandths_fmt, size / 1000, get_decimal_sep(), size % 1000); + wsprintfW(strout, L"%d%c%03d", size / 1000, get_decimal_sep(), size % 1000); else - wsprintfW(strout, integer_fmt, size / 1000); + wsprintfW(strout, L"%d", size / 1000); } } -- 2.26.2