diff --git a/dlls/shell32/appbar.c b/dlls/shell32/appbar.c index 40bafdbc98e..fc6e26f3c6e 100644 --- a/dlls/shell32/appbar.c +++ b/dlls/shell32/appbar.c @@ -67,8 +67,6 @@ UINT_PTR WINAPI SHAppBarMessage(DWORD msg, PAPPBARDATA data) HWND appbarmsg_window; COPYDATASTRUCT cds; DWORD_PTR msg_result; - static const WCHAR classname[] = {'W','i','n','e','A','p','p','B','a','r',0}; - UINT_PTR ret = 0; TRACE("msg=%d, data={cb=%d, hwnd=%p}\n", msg, data->cbSize, data->hWnd); @@ -124,7 +122,7 @@ UINT_PTR WINAPI SHAppBarMessage(DWORD msg, PAPPBARDATA data) command.return_process = GetCurrentProcessId(); - appbarmsg_window = FindWindowW(classname, NULL); + appbarmsg_window = FindWindowW(L"WineAppBar", NULL); if (appbarmsg_window == NULL) { ERR("couldn't find appbar window\n"); diff --git a/dlls/shell32/assoc.c b/dlls/shell32/assoc.c index 8b7fef000ed..6b0de1d04c4 100644 --- a/dlls/shell32/assoc.c +++ b/dlls/shell32/assoc.c @@ -182,7 +182,6 @@ static HRESULT WINAPI IQueryAssociations_fnInit( HKEY hkeyProgid, HWND hWnd) { - static const WCHAR szProgID[] = {'P','r','o','g','I','D',0}; IQueryAssociationsImpl *This = impl_from_IQueryAssociations(iface); LONG ret; @@ -233,11 +232,7 @@ static HRESULT WINAPI IQueryAssociations_fnInit( { HKEY progIdKey; /* for a clsid, the progid is the default value of the ProgID subkey */ - ret = RegOpenKeyExW(This->hkeySource, - szProgID, - 0, - KEY_READ, - &progIdKey); + ret = RegOpenKeyExW(This->hkeySource, L"ProgID", 0, KEY_READ, &progIdKey); if (ret != ERROR_SUCCESS) return S_OK; hr = ASSOC_GetValue(progIdKey, NULL, (void**)&progId, NULL); @@ -300,8 +295,6 @@ static HRESULT ASSOC_GetCommand(IQueryAssociationsImpl *This, const WCHAR *extra LONG ret; WCHAR *extra_from_reg = NULL; WCHAR *filetype; - static const WCHAR commandW[] = { 'c','o','m','m','a','n','d',0 }; - static const WCHAR shellW[] = { 's','h','e','l','l',0 }; /* When looking for file extension it's possible to have a default value that points to another key that contains 'shell//command' subtree. */ @@ -315,14 +308,14 @@ static HRESULT ASSOC_GetCommand(IQueryAssociationsImpl *This, const WCHAR *extra if (ret == ERROR_SUCCESS) { - ret = RegOpenKeyExW(hkeyFile, shellW, 0, KEY_READ, &hkeyShell); + ret = RegOpenKeyExW(hkeyFile, L"shell", 0, KEY_READ, &hkeyShell); RegCloseKey(hkeyFile); } else - ret = RegOpenKeyExW(This->hkeySource, shellW, 0, KEY_READ, &hkeyShell); + ret = RegOpenKeyExW(This->hkeySource, L"shell", 0, KEY_READ, &hkeyShell); } else - ret = RegOpenKeyExW(This->hkeySource, shellW, 0, KEY_READ, &hkeyShell); + ret = RegOpenKeyExW(This->hkeySource, L"shell", 0, KEY_READ, &hkeyShell); if (ret) return HRESULT_FROM_WIN32(ret); @@ -368,7 +361,7 @@ static HRESULT ASSOC_GetCommand(IQueryAssociationsImpl *This, const WCHAR *extra if (ret) return HRESULT_FROM_WIN32(ret); /* open command subkey */ - ret = RegOpenKeyExW(hkeyVerb, commandW, 0, KEY_READ, &hkeyCommand); + ret = RegOpenKeyExW(hkeyVerb, L"command", 0, KEY_READ, &hkeyCommand); RegCloseKey(hkeyVerb); if (ret) return HRESULT_FROM_WIN32(ret); @@ -563,15 +556,6 @@ static HRESULT WINAPI IQueryAssociations_fnGetString( DWORD size, retval = 0; UINT flen; WCHAR *bufW; - static const WCHAR translationW[] = { - '\\','V','a','r','F','i','l','e','I','n','f','o', - '\\','T','r','a','n','s','l','a','t','i','o','n',0 - }; - static const WCHAR fileDescFmtW[] = { - '\\','S','t','r','i','n','g','F','i','l','e','I','n','f','o', - '\\','%','0','4','x','%','0','4','x', - '\\','F','i','l','e','D','e','s','c','r','i','p','t','i','o','n',0 - }; WCHAR fileDescW[41]; hr = ASSOC_GetExecutable(This, pszExtra, path, MAX_PATH, &len); @@ -586,14 +570,14 @@ static HRESULT WINAPI IQueryAssociations_fnGetString( return E_OUTOFMEMORY; if (!GetFileVersionInfoW(path, 0, retval, verinfoW)) goto get_friendly_name_fail; - if (VerQueryValueW(verinfoW, translationW, (LPVOID *)&bufW, &flen)) + if (VerQueryValueW(verinfoW, L"\\VarFileInfo\\Translation", (LPVOID *)&bufW, &flen)) { UINT i; DWORD *langCodeDesc = (DWORD *)bufW; for (i = 0; i < flen / sizeof(DWORD); i++) { - swprintf(fileDescW, ARRAY_SIZE(fileDescW), fileDescFmtW, LOWORD(langCodeDesc[i]), - HIWORD(langCodeDesc[i])); + swprintf(fileDescW, ARRAY_SIZE(fileDescW), L"\\StringFileInfo\\%04x%04x\\FileDescription", + LOWORD(langCodeDesc[i]), HIWORD(langCodeDesc[i])); if (VerQueryValueW(verinfoW, fileDescW, (LPVOID *)&bufW, &flen)) { /* Does lstrlenW(bufW) == 0 mean we use the filename? */ @@ -616,19 +600,18 @@ get_friendly_name_fail: case ASSOCSTR_CONTENTTYPE: { - static const WCHAR Content_TypeW[] = {'C','o','n','t','e','n','t',' ','T','y','p','e',0}; WCHAR *contentType; DWORD ret; DWORD size; size = 0; - ret = RegGetValueW(This->hkeySource, NULL, Content_TypeW, RRF_RT_REG_SZ, NULL, NULL, &size); + ret = RegGetValueW(This->hkeySource, NULL, L"Content Type", RRF_RT_REG_SZ, NULL, NULL, &size); if (ret != ERROR_SUCCESS) return HRESULT_FROM_WIN32(ret); contentType = heap_alloc(size); if (contentType != NULL) { - ret = RegGetValueW(This->hkeySource, NULL, Content_TypeW, RRF_RT_REG_SZ, NULL, contentType, &size); + ret = RegGetValueW(This->hkeySource, NULL, L"Content Type", RRF_RT_REG_SZ, NULL, contentType, &size); if (ret == ERROR_SUCCESS) hr = ASSOC_ReturnString(flags, pszOut, pcchOut, contentType, lstrlenW(contentType) + 1); else @@ -642,19 +625,17 @@ get_friendly_name_fail: case ASSOCSTR_DEFAULTICON: { - static const WCHAR DefaultIconW[] = {'D','e','f','a','u','l','t','I','c','o','n',0}; - static const WCHAR documentIcon[] = {'s','h','e','l','l','3','2','.','d','l','l',',','0',0}; DWORD ret; DWORD size; size = 0; - ret = RegGetValueW(This->hkeyProgID, DefaultIconW, NULL, RRF_RT_REG_SZ, NULL, NULL, &size); + ret = RegGetValueW(This->hkeyProgID, L"DefaultIcon", NULL, RRF_RT_REG_SZ, NULL, NULL, &size); if (ret == ERROR_SUCCESS) { WCHAR *icon = heap_alloc(size); if (icon) { - ret = RegGetValueW(This->hkeyProgID, DefaultIconW, NULL, RRF_RT_REG_SZ, NULL, icon, &size); + ret = RegGetValueW(This->hkeyProgID, L"DefaultIcon", NULL, RRF_RT_REG_SZ, NULL, icon, &size); if (ret == ERROR_SUCCESS) hr = ASSOC_ReturnString(flags, pszOut, pcchOut, icon, lstrlenW(icon) + 1); else @@ -666,7 +647,7 @@ get_friendly_name_fail: } else { /* there is no DefaultIcon subkey or hkeyProgID is NULL, so return the default document icon */ if (This->hkeyProgID == NULL) - hr = ASSOC_ReturnString(flags, pszOut, pcchOut, documentIcon, lstrlenW(documentIcon) + 1); + hr = ASSOC_ReturnString(flags, pszOut, pcchOut, L"shell32.dll,0", lstrlenW(L"shell32.dll,0") + 1); else return HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION); } @@ -674,8 +655,7 @@ get_friendly_name_fail: } case ASSOCSTR_SHELLEXTENSION: { - static const WCHAR shellexW[] = {'S','h','e','l','l','E','x','\\',0}; - WCHAR keypath[ARRAY_SIZE(shellexW) + 39], guid[39]; + WCHAR keypath[ARRAY_SIZE(L"ShellEx\\") + 39], guid[39]; CLSID clsid; HKEY hkey; DWORD size; @@ -684,7 +664,7 @@ get_friendly_name_fail: hr = CLSIDFromString(pszExtra, &clsid); if (FAILED(hr)) return hr; - lstrcpyW(keypath, shellexW); + lstrcpyW(keypath, L"ShellEx\\"); lstrcatW(keypath, pszExtra); ret = RegOpenKeyExW(This->hkeySource, keypath, 0, KEY_READ, &hkey); if (ret) return HRESULT_FROM_WIN32(ret); @@ -754,8 +734,6 @@ static HRESULT WINAPI IQueryAssociations_fnGetData(IQueryAssociations *iface, ASSOCF cfFlags, ASSOCDATA assocdata, LPCWSTR pszExtra, LPVOID pvOut, DWORD *pcbOut) { - static const WCHAR edit_flags[] = {'E','d','i','t','F','l','a','g','s',0}; - IQueryAssociationsImpl *This = impl_from_IQueryAssociations(iface); void *data = NULL; DWORD size; @@ -772,7 +750,7 @@ static HRESULT WINAPI IQueryAssociations_fnGetData(IQueryAssociations *iface, if(!This->hkeyProgID) return HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION); - hres = ASSOC_GetValue(This->hkeyProgID, edit_flags, &data, &size); + hres = ASSOC_GetValue(This->hkeyProgID, L"EditFlags", &data, &size); if(SUCCEEDED(hres) && pcbOut) hres = ASSOC_ReturnData(pvOut, pcbOut, data, size); heap_free(data); @@ -887,15 +865,7 @@ static HRESULT WINAPI ApplicationAssociationRegistration_QueryCurrentDefault(IAp ASSOCIATIONTYPE type, ASSOCIATIONLEVEL level, LPWSTR *association) { IApplicationAssociationRegistrationImpl *This = impl_from_IApplicationAssociationRegistration(iface); - static WCHAR urlassoc[] = {'U','r','l','A','s','s','o','c','i','a','t','i','o','n','s',0}; - static WCHAR mimeassoc[] = {'M','I','M','E','A','s','s','o','c','i','a','t','i','o','n','s',0}; - static WCHAR associations[] = {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\', - 'W','i','n','d','o','w','s','\\','S','h','e','l','l','\\', - 'A','s','s','o','c','i','a','t','i','o','n','s',0}; - static WCHAR slash[] = {'\\',0}; - static WCHAR choice[] = {'U','s','e','r','C','h','o','i','c','e',0}; - static WCHAR propid[] = {'P','r','o','g','i','d',0}; - WCHAR path[MAX_PATH] = {0}; + WCHAR path[MAX_PATH]; DWORD ret, keytype, size; HKEY hkey = NULL; HRESULT hr = HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION); @@ -939,13 +909,13 @@ static HRESULT WINAPI ApplicationAssociationRegistration_QueryCurrentDefault(IAp } else { - ret = RegOpenKeyExW(HKEY_CURRENT_USER, associations, 0, KEY_READ, &hkey); + ret = RegOpenKeyExW(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\Shell\\Associations", 0, KEY_READ, &hkey); if(ret == ERROR_SUCCESS) { if(type == AT_URLPROTOCOL) - lstrcpyW(path, urlassoc); + swprintf( path, ARRAY_SIZE(path), L"UrlAssociations\\%s\\UserChoice", query ); else if(type == AT_MIMETYPE) - lstrcpyW(path, mimeassoc); + swprintf( path, ARRAY_SIZE(path), L"MIMEAssociations\\%s\\UserChoice", query ); else { WARN("Unsupported type (%d).\n", type); @@ -953,18 +923,13 @@ static HRESULT WINAPI ApplicationAssociationRegistration_QueryCurrentDefault(IAp return hr; } - lstrcatW(path, slash); - lstrcatW(path, query); - lstrcatW(path, slash); - lstrcatW(path, choice); - - ret = RegGetValueW(hkey, path, propid, RRF_RT_REG_SZ, &keytype, NULL, &size); + ret = RegGetValueW(hkey, path, L"Progid", RRF_RT_REG_SZ, &keytype, NULL, &size); if(ret == ERROR_SUCCESS) { *association = CoTaskMemAlloc(size); if(*association) { - ret = RegGetValueW(hkey, path, propid, RRF_RT_REG_SZ, &keytype, *association, &size); + ret = RegGetValueW(hkey, path, L"Progid", RRF_RT_REG_SZ, &keytype, *association, &size); if(ret == ERROR_SUCCESS) hr = S_OK; else diff --git a/dlls/shell32/autocomplete.c b/dlls/shell32/autocomplete.c index d838a18dd77..0718f782460 100644 --- a/dlls/shell32/autocomplete.c +++ b/dlls/shell32/autocomplete.c @@ -87,9 +87,7 @@ enum prefix_filtering prefix_filtering_all /* filter all common prefixes (protocol & www. ) */ }; -static const WCHAR autocomplete_propertyW[] = {'W','i','n','e',' ','A','u','t','o', - 'c','o','m','p','l','e','t','e',' ', - 'c','o','n','t','r','o','l',0}; +static const WCHAR autocomplete_propertyW[] = L"Wine Autocomplete control"; static inline IAutoCompleteImpl *impl_from_IAutoComplete2(IAutoComplete2 *iface) { @@ -111,11 +109,9 @@ static void set_text_and_selection(IAutoCompleteImpl *ac, HWND hwnd, WCHAR *text static inline WCHAR *filter_protocol(WCHAR *str) { - static const WCHAR http[] = {'h','t','t','p'}; - - if (!wcsncmp(str, http, ARRAY_SIZE(http))) + if (!wcsncmp(str, L"http", 4)) { - str += ARRAY_SIZE(http); + str += 4; str += (*str == 's'); /* https */ if (str[0] == ':' && str[1] == '/' && str[2] == '/') return str + 3; @@ -125,10 +121,7 @@ static inline WCHAR *filter_protocol(WCHAR *str) static inline WCHAR *filter_www(WCHAR *str) { - static const WCHAR www[] = {'w','w','w','.'}; - - if (!wcsncmp(str, www, ARRAY_SIZE(www))) - return str + ARRAY_SIZE(www); + if (!wcsncmp(str, L"www.", 4)) return str + 4; return NULL; } @@ -477,17 +470,13 @@ static BOOL aclist_expand(IAutoCompleteImpl *ac, WCHAR *txt) { /* call IACList::Expand only when needed, if the new txt and old_txt require different expansions */ - static const WCHAR empty[] = { 0 }; const WCHAR *old_txt = ac->txtbackup; WCHAR c, *p, *last_delim; size_t i = 0; - /* '/' is allowed as a delim for unix paths */ - static const WCHAR delims[] = { '\\', '/', 0 }; - /* always expand if the enumerator was reset */ - if (!ac->enum_strs) old_txt = empty; + if (!ac->enum_strs) old_txt = L""; /* skip the shared prefix */ while ((c = towlower(txt[i])) == towlower(old_txt[i])) @@ -497,16 +486,16 @@ static BOOL aclist_expand(IAutoCompleteImpl *ac, WCHAR *txt) } /* they differ at this point, check for a delim further in txt */ - for (last_delim = NULL, p = &txt[i]; (p = wcspbrk(p, delims)) != NULL; p++) + for (last_delim = NULL, p = &txt[i]; (p = wcspbrk(p, L"\\/")) != NULL; p++) last_delim = p; if (last_delim) return do_aclist_expand(ac, txt, last_delim); /* txt has no delim after i, check for a delim further in old_txt */ - if (wcspbrk(&old_txt[i], delims)) + if (wcspbrk(&old_txt[i], L"\\/")) { /* scan backwards to find the first delim before txt[i] (if any) */ while (i--) - if (wcschr(delims, txt[i])) + if (wcschr(L"\\/", txt[i])) return do_aclist_expand(ac, txt, &txt[i]); /* Windows doesn't expand without a delim, but it does reset */ diff --git a/dlls/shell32/brsfolder.c b/dlls/shell32/brsfolder.c index cea30902b4e..7800e6ee563 100644 --- a/dlls/shell32/brsfolder.c +++ b/dlls/shell32/brsfolder.c @@ -98,12 +98,6 @@ static void FillTreeView(browse_info*, LPSHELLFOLDER, static HTREEITEM InsertTreeViewItem( browse_info*, IShellFolder *, LPCITEMIDLIST, LPCITEMIDLIST, IEnumIDList*, HTREEITEM); -static const WCHAR szBrowseFolderInfo[] = { - '_','_','W','I','N','E','_', - 'B','R','S','F','O','L','D','E','R','D','L','G','_', - 'I','N','F','O',0 -}; - static inline DWORD BrowseFlagsToSHCONTF(UINT ulFlags) { return SHCONTF_FOLDERS | (ulFlags & BIF_BROWSEINCLUDEFILES ? SHCONTF_NONFOLDERS : 0); @@ -711,7 +705,7 @@ static BOOL BrsFolder_OnCreate( HWND hWnd, browse_info *info ) LPBROWSEINFOW lpBrowseInfo = info->lpBrowseInfo; info->hWnd = hWnd; - SetPropW( hWnd, szBrowseFolderInfo, info ); + SetPropW( hWnd, L"__WINE_BRSFOLDERDLG_INFO", info ); if (lpBrowseInfo->ulFlags & BIF_NEWDIALOGSTYLE) FIXME("flags BIF_NEWDIALOGSTYLE partially implemented\n"); @@ -1108,7 +1102,7 @@ static INT_PTR CALLBACK BrsFolderDlgProc( HWND hWnd, UINT msg, WPARAM wParam, if (msg == WM_INITDIALOG) return BrsFolder_OnCreate( hWnd, (browse_info*) lParam ); - info = GetPropW( hWnd, szBrowseFolderInfo ); + info = GetPropW( hWnd, L"__WINE_BRSFOLDERDLG_INFO" ); if (!info) return FALSE; @@ -1166,11 +1160,6 @@ static INT_PTR CALLBACK BrsFolderDlgProc( HWND hWnd, UINT msg, WPARAM wParam, return FALSE; } -static const WCHAR swBrowseTemplateName[] = { - 'S','H','B','R','S','F','O','R','F','O','L','D','E','R','_','M','S','G','B','O','X',0}; -static const WCHAR swNewBrowseTemplateName[] = { - 'S','H','N','E','W','B','R','S','F','O','R','F','O','L','D','E','R','_','M','S','G','B','O','X',0}; - /************************************************************************* * SHBrowseForFolderA [SHELL32.@] * SHBrowseForFolder [SHELL32.@] @@ -1244,9 +1233,9 @@ LPITEMIDLIST WINAPI SHBrowseForFolderW (LPBROWSEINFOW lpbi) hr = OleInitialize(NULL); if (lpbi->ulFlags & BIF_NEWDIALOGSTYLE) - templateName = swNewBrowseTemplateName; + templateName = L"SHNEWBRSFORFOLDER_MSGBOX"; else - templateName = swBrowseTemplateName; + templateName = L"SHBRSFORFOLDER_MSGBOX"; r = DialogBoxParamW( shell32_hInstance, templateName, lpbi->hwndOwner, BrsFolderDlgProc, (LPARAM)&info ); if (SUCCEEDED(hr)) diff --git a/dlls/shell32/changenotify.c b/dlls/shell32/changenotify.c index a87913c1f0e..f8714627eb6 100644 --- a/dlls/shell32/changenotify.c +++ b/dlls/shell32/changenotify.c @@ -416,9 +416,8 @@ void WINAPI SHChangeNotify(LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID if (wEventId & SHCNE_ASSOCCHANGED) { - static const WCHAR args[] = {' ','-','a',0 }; TRACE("refreshing file type associations\n"); - run_winemenubuilder( args ); + run_winemenubuilder( L" -a" ); } } diff --git a/dlls/shell32/classes.c b/dlls/shell32/classes.c index e2493b80559..0087cc3c276 100644 --- a/dlls/shell32/classes.c +++ b/dlls/shell32/classes.c @@ -113,10 +113,6 @@ BOOL HCR_MapTypeToValueA(LPCSTR szExtension, LPSTR szFileType, LONG len, BOOL bP return TRUE; } -static const WCHAR swShell[] = {'s','h','e','l','l','\\',0}; -static const WCHAR swOpen[] = {'o','p','e','n',0}; -static const WCHAR swCommand[] = {'\\','c','o','m','m','a','n','d',0}; - BOOL HCR_GetDefaultVerbW( HKEY hkeyClass, LPCWSTR szVerb, LPWSTR szDest, DWORD len ) { WCHAR sTemp[MAX_PATH]; @@ -133,12 +129,12 @@ BOOL HCR_GetDefaultVerbW( HKEY hkeyClass, LPCWSTR szVerb, LPWSTR szDest, DWORD l size=len; *szDest='\0'; - if (!RegQueryValueW(hkeyClass, swShell, szDest, &size) && *szDest) + if (!RegQueryValueW(hkeyClass, L"shell\\", szDest, &size) && *szDest) { /* The MSDN says to first try the default verb */ - lstrcpyW(sTemp, swShell); + lstrcpyW(sTemp, L"shell\\"); lstrcatW(sTemp, szDest); - lstrcatW(sTemp, swCommand); + lstrcatW(sTemp, L"\\command"); if (!RegOpenKeyExW(hkeyClass, sTemp, 0, 0, &hkey)) { RegCloseKey(hkey); @@ -148,13 +144,11 @@ BOOL HCR_GetDefaultVerbW( HKEY hkeyClass, LPCWSTR szVerb, LPWSTR szDest, DWORD l } /* then fallback to 'open' */ - lstrcpyW(sTemp, swShell); - lstrcatW(sTemp, swOpen); - lstrcatW(sTemp, swCommand); + lstrcpyW(sTemp, L"shell\\open\\command"); if (!RegOpenKeyExW(hkeyClass, sTemp, 0, 0, &hkey)) { RegCloseKey(hkey); - lstrcpynW(szDest, swOpen, len); + lstrcpynW(szDest, L"open", len); TRACE("default verb=open\n"); return TRUE; } @@ -186,9 +180,9 @@ BOOL HCR_GetExecuteCommandW( HKEY hkeyClass, LPCWSTR szClass, LPCWSTR szVerb, LP if (HCR_GetDefaultVerbW(hkeyClass, szVerb, sTempVerb, ARRAY_SIZE(sTempVerb))) { WCHAR sTemp[MAX_PATH]; - lstrcpyW(sTemp, swShell); + lstrcpyW(sTemp, L"shell\\"); lstrcatW(sTemp, sTempVerb); - lstrcatW(sTemp, swCommand); + lstrcatW(sTemp, L"\\command"); ret = (ERROR_SUCCESS == SHGetValueW(hkeyClass, sTemp, NULL, NULL, szDest, &len)); } if (szClass) @@ -266,7 +260,6 @@ static BOOL HCR_RegGetDefaultIconA(HKEY hkey, LPSTR szDest, DWORD len, int* pico BOOL HCR_GetDefaultIconW(LPCWSTR szClass, LPWSTR szDest, DWORD len, int* picon_idx) { - static const WCHAR swDefaultIcon[] = {'\\','D','e','f','a','u','l','t','I','c','o','n',0}; HKEY hkey; WCHAR sTemp[MAX_PATH]; BOOL ret = FALSE; @@ -274,7 +267,7 @@ BOOL HCR_GetDefaultIconW(LPCWSTR szClass, LPWSTR szDest, DWORD len, int* picon_i TRACE("%s\n",debugstr_w(szClass) ); lstrcpynW(sTemp, szClass, MAX_PATH); - lstrcatW(sTemp, swDefaultIcon); + lstrcatW(sTemp, L"\\DefaultIcon"); if (!RegOpenKeyExW(HKEY_CLASSES_ROOT, sTemp, 0, KEY_READ, &hkey)) { @@ -319,8 +312,6 @@ BOOL HCR_GetDefaultIconA(LPCSTR szClass, LPSTR szDest, DWORD len, int* picon_idx * * Gets the name of a registered class */ -static const WCHAR swEmpty[] = {0}; - BOOL HCR_GetClassNameW(REFIID riid, LPWSTR szDest, DWORD len) { HKEY hkey; @@ -330,10 +321,8 @@ BOOL HCR_GetClassNameW(REFIID riid, LPWSTR szDest, DWORD len) szDest[0] = 0; if (HCR_RegOpenClassIDKey(riid, &hkey)) { - static const WCHAR wszLocalizedString[] = - { 'L','o','c','a','l','i','z','e','d','S','t','r','i','n','g', 0 }; - if (!RegLoadMUIStringW(hkey, wszLocalizedString, szDest, len, NULL, 0, NULL) || - !RegQueryValueExW(hkey, swEmpty, 0, NULL, (LPBYTE)szDest, &len)) + if (!RegLoadMUIStringW(hkey, L"LocalizedString", szDest, len, NULL, 0, NULL) || + !RegQueryValueExW(hkey, L"", 0, NULL, (LPBYTE)szDest, &len)) { ret = TRUE; } @@ -415,12 +404,7 @@ BOOL HCR_GetFolderAttributes(LPCITEMIDLIST pidlFolder, LPDWORD pdwAttributes) LPOLESTR pwszCLSID; LONG lResult; DWORD dwTemp, dwLen; - static const WCHAR wszAttributes[] = { 'A','t','t','r','i','b','u','t','e','s',0 }; - static const WCHAR wszCallForAttributes[] = { - 'C','a','l','l','F','o','r','A','t','t','r','i','b','u','t','e','s',0 }; - WCHAR wszShellFolderKey[] = { 'C','L','S','I','D','\\','{','0','0','0','2','1','4','0','0','-', - '0','0','0','0','-','0','0','0','0','-','C','0','0','0','-','0','0','0','0','0','0','0', - '0','0','0','4','6','}','\\','S','h','e','l','l','F','o','l','d','e','r',0 }; + WCHAR wszShellFolderKey[] = L"CLSID\\{00021400-0000-0000-C000-000000000046}\\ShellFolder"; TRACE("(pidlFolder=%p, pdwAttributes=%p)\n", pidlFolder, pdwAttributes); @@ -443,7 +427,7 @@ BOOL HCR_GetFolderAttributes(LPCITEMIDLIST pidlFolder, LPDWORD pdwAttributes) if (lResult != ERROR_SUCCESS) return FALSE; dwLen = sizeof(DWORD); - lResult = RegQueryValueExW(hSFKey, wszCallForAttributes, 0, NULL, (LPBYTE)&dwTemp, &dwLen); + lResult = RegQueryValueExW(hSFKey, L"CallForAttributes", 0, NULL, (LPBYTE)&dwTemp, &dwLen); if ((lResult == ERROR_SUCCESS) && (dwTemp & *pdwAttributes)) { LPSHELLFOLDER psfDesktop, psfFolder; HRESULT hr; @@ -461,7 +445,7 @@ BOOL HCR_GetFolderAttributes(LPCITEMIDLIST pidlFolder, LPDWORD pdwAttributes) } if (FAILED(hr)) return FALSE; } else { - lResult = RegQueryValueExW(hSFKey, wszAttributes, 0, NULL, (LPBYTE)&dwTemp, &dwLen); + lResult = RegQueryValueExW(hSFKey, L"Attributes", 0, NULL, (LPBYTE)&dwTemp, &dwLen); RegCloseKey(hSFKey); if (lResult == ERROR_SUCCESS) { *pdwAttributes &= dwTemp; diff --git a/dlls/shell32/control.c b/dlls/shell32/control.c index 65ba629c099..a2b72a7f748 100644 --- a/dlls/shell32/control.c +++ b/dlls/shell32/control.c @@ -427,15 +427,13 @@ static CPlItem* Control_GetCPlItem_From_ListView(CPanel *panel) static void Control_StartApplet(HWND hWnd, CPlItem *item) { - static const WCHAR verbOpen[] = {'c','p','l','o','p','e','n',0}; - static const WCHAR format[] = {'@','%','d',0}; - WCHAR param[MAX_PATH]; + WCHAR param[12]; /* execute the applet if item is valid */ if (item) { - wsprintfW(param, format, item->id); - ShellExecuteW(hWnd, verbOpen, item->applet->cmd, param, NULL, SW_SHOW); + swprintf(param, ARRAY_SIZE(param), L"@%d", item->id); + ShellExecuteW(hWnd, L"cplopen", item->applet->cmd, param, NULL, SW_SHOW); } } @@ -605,8 +603,6 @@ static LRESULT WINAPI Control_WndProc(HWND hWnd, UINT wMsg, static void Control_DoInterface(CPanel* panel, HWND hWnd, HINSTANCE hInst) { - static const WCHAR className[] = {'S','h','e','l','l','_','C','o','n','t','r','o', - 'l','_','W','n','d','C','l','a','s','s',0}; WNDCLASSEXW wc; MSG msg; WCHAR appName[MAX_STRING_LEN]; @@ -623,7 +619,7 @@ static void Control_DoInterface(CPanel* panel, HWND hWnd, HINSTANCE hInst) wc.hCursor = LoadCursorW( 0, (LPWSTR)IDC_ARROW ); wc.hbrBackground = GetStockObject(WHITE_BRUSH); wc.lpszMenuName = NULL; - wc.lpszClassName = className; + wc.lpszClassName = L"Shell_Control_WndClass"; wc.hIconSm = LoadImageW( shell32_hInstance, MAKEINTRESOURCEW(IDI_SHELL_CONTROL_PANEL), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED); @@ -671,17 +667,13 @@ static void Control_DoWindow(CPanel* panel, HWND hWnd, HINSTANCE hInst) HANDLE h; WIN32_FIND_DATAW fd; WCHAR buffer[MAX_PATH]; - static const WCHAR wszAllCpl[] = {'*','.','c','p','l',0}; - static const WCHAR wszRegPath[] = {'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', - '\\','C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','C','p','l','s',0}; WCHAR *p; /* first add .cpl files in the system directory */ GetSystemDirectoryW( buffer, MAX_PATH ); p = buffer + lstrlenW(buffer); *p++ = '\\'; - lstrcpyW(p, wszAllCpl); + lstrcpyW(p, L"*.cpl"); if ((h = FindFirstFileW(buffer, &fd)) != INVALID_HANDLE_VALUE) { do { @@ -692,8 +684,8 @@ static void Control_DoWindow(CPanel* panel, HWND hWnd, HINSTANCE hInst) } /* now check for cpls in the registry */ - Control_RegisterRegistryApplets(hWnd, panel, HKEY_LOCAL_MACHINE, wszRegPath); - Control_RegisterRegistryApplets(hWnd, panel, HKEY_CURRENT_USER, wszRegPath); + Control_RegisterRegistryApplets(hWnd, panel, HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Control Panel\\Cpls"); + Control_RegisterRegistryApplets(hWnd, panel, HKEY_CURRENT_USER, L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Control Panel\\Cpls"); Control_DoInterface(panel, hWnd, hInst); } diff --git a/dlls/shell32/cpanelfolder.c b/dlls/shell32/cpanelfolder.c index 322412f26bf..7cd0bf6bb98 100644 --- a/dlls/shell32/cpanelfolder.c +++ b/dlls/shell32/cpanelfolder.c @@ -960,8 +960,6 @@ static HRESULT WINAPI IShellExecuteHookW_fnExecute(IShellExecuteHookW *iface, LPSHELLEXECUTEINFOW psei) { ICPanelImpl *This = impl_from_IShellExecuteHookW(iface); - static const WCHAR wCplopen[] = {'c','p','l','o','p','e','n','\0'}; - SHELLEXECUTEINFOW sei_tmp; PIDLCPanelStruct* pcpanel; WCHAR path[MAX_PATH]; @@ -994,7 +992,7 @@ static HRESULT WINAPI IShellExecuteHookW_fnExecute(IShellExecuteHookW *iface, sei_tmp.lpFile = path; sei_tmp.lpParameters = params; sei_tmp.fMask &= ~SEE_MASK_INVOKEIDLIST; - sei_tmp.lpVerb = wCplopen; + sei_tmp.lpVerb = L"cplopen"; ret = ShellExecuteExW(&sei_tmp); if (ret) diff --git a/dlls/shell32/dde.c b/dlls/shell32/dde.c index 2186cbffe9e..5ab63136092 100644 --- a/dlls/shell32/dde.c +++ b/dlls/shell32/dde.c @@ -81,7 +81,6 @@ static inline BOOL Dde_OnWildConnect(HSZ hszTopic, HSZ hszService) /* Returned string must be freed by caller */ static WCHAR *get_programs_path(const WCHAR *name) { - static const WCHAR slashW[] = {'/',0}; WCHAR *programs, *path; int len; @@ -90,7 +89,7 @@ static WCHAR *get_programs_path(const WCHAR *name) len = lstrlenW(programs) + 1 + lstrlenW(name); path = heap_alloc((len + 1) * sizeof(*path)); lstrcpyW(path, programs); - lstrcatW(path, slashW); + lstrcatW(path, L"/"); lstrcatW(path, name); CoTaskMemFree(programs); @@ -103,10 +102,6 @@ static inline HDDEDATA Dde_OnRequest(UINT uFmt, HCONV hconv, HSZ hszTopic, { if (hszTopic == hszProgmanTopic && hszItem == hszGroups && uFmt == CF_TEXT) { - static const WCHAR asteriskW[] = {'*',0}; - static const WCHAR newlineW[] = {'\r','\n',0}; - static const WCHAR dotW[] = {'.',0}; - static const WCHAR dotdotW[] = {'.','.',0}; WCHAR *programs; WIN32_FIND_DATAW finddata; HANDLE hfind; @@ -116,19 +111,19 @@ static inline HDDEDATA Dde_OnRequest(UINT uFmt, HCONV hconv, HSZ hszTopic, HDDEDATA ret; groups_data[0] = 0; - programs = get_programs_path(asteriskW); + programs = get_programs_path(L"*"); hfind = FindFirstFileW(programs, &finddata); if (hfind) { do { if ((finddata.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && - wcscmp(finddata.cFileName, dotW) && wcscmp(finddata.cFileName, dotdotW)) + wcscmp(finddata.cFileName, L".") && wcscmp(finddata.cFileName, L"..")) { len += lstrlenW(finddata.cFileName) + 2; groups_data = heap_realloc(groups_data, len * sizeof(WCHAR)); lstrcatW(groups_data, finddata.cFileName); - lstrcatW(groups_data, newlineW); + lstrcatW(groups_data, L"\r\n"); } } while (FindNextFileW(hfind, &finddata)); FindClose(hfind); @@ -158,21 +153,10 @@ static inline HDDEDATA Dde_OnRequest(UINT uFmt, HCONV hconv, HSZ hszTopic, static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv) { - static const WCHAR create_groupW[] = {'C','r','e','a','t','e','G','r','o','u','p',0}; - static const WCHAR delete_groupW[] = {'D','e','l','e','t','e','G','r','o','u','p',0}; - static const WCHAR show_groupW[] = {'S','h','o','w','G','r','o','u','p',0}; - static const WCHAR add_itemW[] = {'A','d','d','I','t','e','m',0}; - static const WCHAR delete_itemW[] = {'D','e','l','e','t','e','I','t','e','m',0}; - static const WCHAR replace_itemW[] = {'R','e','p','l','a','c','e','I','t','e','m',0}; - static const WCHAR exit_progmanW[] = {'E','x','i','t','P','r','o','g','m','a','n',0}; - - static const WCHAR dotexeW[] = {'.','e','x','e',0}; - static const WCHAR dotlnkW[] = {'.','l','n','k',0}; - static const WCHAR slashW[] = {'/',0}; - static WCHAR *last_group; + DWORD len; - if (!wcsicmp(command, create_groupW)) + if (!wcsicmp(command, L"CreateGroup")) { WCHAR *path; @@ -186,7 +170,7 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv) heap_free(last_group); last_group = path; } - else if (!wcsicmp(command, delete_groupW)) + else if (!wcsicmp(command, L"DeleteGroup")) { WCHAR *path, *path2; SHFILEOPSTRUCTW shfos = {0}; @@ -211,7 +195,7 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv) if (ret || shfos.fAnyOperationsAborted) return DDE_FNOTPROCESSED; } - else if (!wcsicmp(command, show_groupW)) + else if (!wcsicmp(command, L"ShowGroup")) { WCHAR *path; @@ -226,10 +210,9 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv) heap_free(last_group); last_group = path; } - else if (!wcsicmp(command, add_itemW)) + else if (!wcsicmp(command, L"AddItem")) { WCHAR *path, *name; - DWORD len; IShellLinkW *link; IPersistFile *file; HRESULT hres; @@ -240,14 +223,14 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv) &IID_IShellLinkW, (void **)&link); if (FAILED(hres)) return DDE_FNOTPROCESSED; - len = SearchPathW(NULL, argv[0], dotexeW, 0, NULL, NULL); + len = SearchPathW(NULL, argv[0], L".exe", 0, NULL, NULL); if (len == 0) { IShellLinkW_Release(link); return DDE_FNOTPROCESSED; } path = heap_alloc(len * sizeof(WCHAR)); - SearchPathW(NULL, argv[0], dotexeW, len, path, NULL); + SearchPathW(NULL, argv[0], L".exe", len, path, NULL); IShellLinkW_SetPath(link, path); heap_free(path); @@ -269,21 +252,16 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv) } if (argc >= 2) { - name = heap_alloc((lstrlenW(last_group) + 1 + lstrlenW(argv[1]) + 5) * sizeof(*name)); - lstrcpyW(name, last_group); - lstrcatW(name, slashW); - lstrcatW(name, argv[1]); - lstrcatW(name, dotlnkW); + len = lstrlenW(last_group) + 1 + lstrlenW(argv[1]) + 5; + name = heap_alloc(len * sizeof(*name)); + swprintf( name, len, L"%s/%s.lnk", last_group, argv[1] ); } else { const WCHAR *filename = PathFindFileNameW(argv[0]); - int len = PathFindExtensionW(filename) - filename; + len = PathFindExtensionW(filename) - filename; name = heap_alloc((lstrlenW(last_group) + 1 + len + 5) * sizeof(*name)); - lstrcpyW(name, last_group); - lstrcatW(name, slashW); - lstrcpynW(name+lstrlenW(name), filename, len + 1); - lstrcatW(name, dotlnkW); + swprintf( name, lstrlenW(last_group) + 1 + len + 5, L"%s/%.*s.lnk", last_group, len, filename ); } hres = IPersistFile_Save(file, name, TRUE); @@ -293,18 +271,16 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv) if (FAILED(hres)) return DDE_FNOTPROCESSED; } - else if (!wcsicmp(command, delete_itemW) || !wcsicmp(command, replace_itemW)) + else if (!wcsicmp(command, L"DeleteItem") || !wcsicmp(command, L"ReplaceItem")) { WCHAR *name; BOOL ret; if (argc < 1) return DDE_FNOTPROCESSED; - name = heap_alloc((lstrlenW(last_group) + 1 + lstrlenW(argv[0]) + 5) * sizeof(*name)); - lstrcpyW(name, last_group); - lstrcatW(name, slashW); - lstrcatW(name, argv[0]); - lstrcatW(name, dotlnkW); + len = lstrlenW(last_group) + 1 + lstrlenW(argv[0]) + 5; + name = heap_alloc(len * sizeof(*name)); + swprintf( name, len, L"%s/%s.lnk", last_group, argv[0]); ret = DeleteFileW(name); @@ -312,7 +288,7 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv) if (!ret) return DDE_FNOTPROCESSED; } - else if (!wcsicmp(command, exit_progmanW)) + else if (!wcsicmp(command, L"ExitProgman")) { /* do nothing */ } @@ -326,9 +302,6 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv) static DWORD parse_dde_command(HSZ hszTopic, WCHAR *command) { - static const WCHAR opcode_end[] = {' ',',','(',')','[',']','"',0}; - static const WCHAR param_end[] = {',','(',')','[',']',0}; - WCHAR *original = command; WCHAR *opcode = NULL, **argv = NULL, *p; int argc = 0, i; @@ -344,7 +317,7 @@ static DWORD parse_dde_command(HSZ hszTopic, WCHAR *command) command++; while (*command == ' ') command++; - if (!(p = wcspbrk(command, opcode_end))) goto error; + if (!(p = wcspbrk(command, L" ,()[]\""))) goto error; opcode = strndupW(command, p - command); @@ -364,7 +337,7 @@ static DWORD parse_dde_command(HSZ hszTopic, WCHAR *command) } else { - if (!(p = wcspbrk(command, param_end))) goto error; + if (!(p = wcspbrk(command, L",()[]"))) goto error; while (p[-1] == ' ') p--; } @@ -485,23 +458,15 @@ void WINAPI ShellDDEInit(BOOL bInit) if (bInit) { - static const WCHAR wszProgman[] = {'P','r','o','g','m','a','n',0}; - static const WCHAR wszAsterisk[] = {'*',0}; - static const WCHAR wszShell[] = {'S','h','e','l','l',0}; - static const WCHAR wszAppProperties[] = - {'A','p','p','P','r','o','p','e','r','t','i','e','s',0}; - static const WCHAR wszFolders[] = {'F','o','l','d','e','r','s',0}; - static const WCHAR wszGroups[] = {'G','r','o','u','p','s',0}; - DdeInitializeW(&dwDDEInst, DdeCallback, CBF_FAIL_ADVISES | CBF_FAIL_POKES, 0); - hszProgmanTopic = DdeCreateStringHandleW(dwDDEInst, wszProgman, CP_WINUNICODE); - hszProgmanService = DdeCreateStringHandleW(dwDDEInst, wszProgman, CP_WINUNICODE); - hszAsterisk = DdeCreateStringHandleW(dwDDEInst, wszAsterisk, CP_WINUNICODE); - hszShell = DdeCreateStringHandleW(dwDDEInst, wszShell, CP_WINUNICODE); - hszAppProperties = DdeCreateStringHandleW(dwDDEInst, wszAppProperties, CP_WINUNICODE); - hszFolders = DdeCreateStringHandleW(dwDDEInst, wszFolders, CP_WINUNICODE); - hszGroups = DdeCreateStringHandleW(dwDDEInst, wszGroups, CP_WINUNICODE); + hszProgmanTopic = DdeCreateStringHandleW(dwDDEInst, L"Progman", CP_WINUNICODE); + hszProgmanService = DdeCreateStringHandleW(dwDDEInst, L"Progman", CP_WINUNICODE); + hszAsterisk = DdeCreateStringHandleW(dwDDEInst, L"*", CP_WINUNICODE); + hszShell = DdeCreateStringHandleW(dwDDEInst, L"Shell", CP_WINUNICODE); + hszAppProperties = DdeCreateStringHandleW(dwDDEInst, L"AppProperties", CP_WINUNICODE); + hszFolders = DdeCreateStringHandleW(dwDDEInst, L"Folders", CP_WINUNICODE); + hszGroups = DdeCreateStringHandleW(dwDDEInst, L"Groups", CP_WINUNICODE); DdeNameService(dwDDEInst, hszFolders, 0, DNS_REGISTER); DdeNameService(dwDDEInst, hszProgmanService, 0, DNS_REGISTER); diff --git a/dlls/shell32/dialogs.c b/dlls/shell32/dialogs.c index f6291e3e55c..aa6ef7fe6a9 100644 --- a/dlls/shell32/dialogs.c +++ b/dlls/shell32/dialogs.c @@ -85,7 +85,6 @@ static void RunFileDlgW( LPCWSTR lpstrDescription, UINT uFlags) { - static const WCHAR resnameW[] = {'S','H','E','L','L','_','R','U','N','_','D','L','G',0}; RUNFILEDLGPARAMS rfdp; HRSRC hRes; LPVOID template; @@ -98,7 +97,7 @@ static void RunFileDlgW( rfdp.lpstrDescription = lpstrDescription; rfdp.uFlags = uFlags; - if (!(hRes = FindResourceW(shell32_hInstance, resnameW, (LPWSTR)RT_DIALOG)) || + if (!(hRes = FindResourceW(shell32_hInstance, L"SHELL_RUN_DLG", (LPWSTR)RT_DIALOG)) || !(template = LoadResource(shell32_hInstance, hRes))) { ERR("Couldn't load SHELL_RUN_DLG resource\n"); @@ -116,7 +115,6 @@ static LPWSTR RunDlg_GetParentDir(LPCWSTR cmdline) { const WCHAR *src; WCHAR *dest, *result, *result_end=NULL; - static const WCHAR dotexeW[] = {'.','e','x','e',0}; result = heap_alloc(sizeof(WCHAR)*(lstrlenW(cmdline)+5)); @@ -141,7 +139,7 @@ static LPWSTR RunDlg_GetParentDir(LPCWSTR cmdline) *dest = 0; if (INVALID_FILE_ATTRIBUTES != GetFileAttributesW(result)) break; - lstrcatW(dest, dotexeW); + lstrcatW(dest, L".exe"); if (INVALID_FILE_ATTRIBUTES != GetFileAttributesW(result)) break; } @@ -253,10 +251,8 @@ static INT_PTR CALLBACK RunDlgProc (HWND hwnd, UINT message, WPARAM wParam, LPAR case IDC_RUNDLG_BROWSE : { - static const WCHAR filterW[] = {'%','s','%','c','*','.','e','x','e','%','c','%','s','%','c','*','.','*','%','c',0}; HMODULE hComdlg = NULL ; LPFNOFN ofnProc = NULL ; - static const WCHAR comdlg32W[] = {'c','o','m','d','l','g','3','2',0}; WCHAR szFName[1024] = {0}; WCHAR filter_exe[256], filter_all[256], filter[MAX_PATH], szCaption[MAX_PATH]; OPENFILENAMEW ofn; @@ -264,7 +260,7 @@ static INT_PTR CALLBACK RunDlgProc (HWND hwnd, UINT message, WPARAM wParam, LPAR LoadStringW(shell32_hInstance, IDS_RUNDLG_BROWSE_FILTER_EXE, filter_exe, 256); LoadStringW(shell32_hInstance, IDS_RUNDLG_BROWSE_FILTER_ALL, filter_all, 256); LoadStringW(shell32_hInstance, IDS_RUNDLG_BROWSE_CAPTION, szCaption, MAX_PATH); - swprintf( filter, MAX_PATH, filterW, filter_exe, 0, 0, filter_all, 0, 0 ); + swprintf( filter, MAX_PATH, L"%s%c*.exe%c%s%c*.*%c", filter_exe, 0, 0, filter_all, 0, 0 ); ZeroMemory(&ofn, sizeof(ofn)); ofn.lStructSize = sizeof(OPENFILENAMEW); @@ -276,7 +272,7 @@ static INT_PTR CALLBACK RunDlgProc (HWND hwnd, UINT message, WPARAM wParam, LPAR ofn.Flags = OFN_ENABLESIZING | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_PATHMUSTEXIST; ofn.lpstrInitialDir = prfdp->lpstrDirectory; - if (NULL == (hComdlg = LoadLibraryExW (comdlg32W, NULL, 0)) || + if (NULL == (hComdlg = LoadLibraryExW (L"comdlg32.dll", NULL, 0)) || NULL == (ofnProc = (LPFNOFN)GetProcAddress (hComdlg, "GetOpenFileNameW"))) { ERR("Couldn't get GetOpenFileName function entry (lib=%p, proc=%p)\n", hComdlg, ofnProc); diff --git a/dlls/shell32/ebrowser.c b/dlls/shell32/ebrowser.c index 637104c58dc..6e0e1755b79 100644 --- a/dlls/shell32/ebrowser.c +++ b/dlls/shell32/ebrowser.c @@ -704,9 +704,8 @@ static void initialize_navpane(ExplorerBrowserImpl *This, HWND hwnd_parent, RECT WNDCLASSW wc; HWND splitter; int splitter_width = MulDiv(SPLITTER_WIDTH, This->dpix, USER_DEFAULT_SCREEN_DPI); - static const WCHAR navpane_classname[] = {'e','b','_','n','a','v','p','a','n','e',0}; - if( !GetClassInfoW(shell32_hInstance, navpane_classname, &wc) ) + if( !GetClassInfoW(shell32_hInstance, L"eb_navpane", &wc) ) { wc.style = CS_HREDRAW | CS_VREDRAW; wc.lpfnWndProc = navpane_wndproc; @@ -717,12 +716,12 @@ static void initialize_navpane(ExplorerBrowserImpl *This, HWND hwnd_parent, RECT wc.hCursor = LoadCursorW(0, (LPWSTR)IDC_SIZEWE); wc.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1); wc.lpszMenuName = NULL; - wc.lpszClassName = navpane_classname; + wc.lpszClassName = L"eb_navpane"; if (!RegisterClassW(&wc)) return; } - splitter = CreateWindowExW(0, navpane_classname, NULL, + splitter = CreateWindowExW(0, L"eb_navpane", NULL, WS_CHILD | WS_TABSTOP | WS_VISIBLE, rc->right - splitter_width, rc->top, splitter_width, rc->bottom - rc->top, @@ -861,8 +860,6 @@ static HRESULT WINAPI IExplorerBrowser_fnInitialize(IExplorerBrowser *iface, WNDCLASSW wc; LONG style; HDC parent_dc; - static const WCHAR EB_CLASS_NAME[] = - {'E','x','p','l','o','r','e','r','B','r','o','w','s','e','r','C','o','n','t','r','o','l',0}; TRACE("%p (%p, %p, %p)\n", This, hwndParent, prc, pfs); @@ -872,7 +869,7 @@ static HRESULT WINAPI IExplorerBrowser_fnInitialize(IExplorerBrowser *iface, if(!hwndParent) return E_INVALIDARG; - if( !GetClassInfoW(shell32_hInstance, EB_CLASS_NAME, &wc) ) + if( !GetClassInfoW(shell32_hInstance, L"ExplorerBrowserControl", &wc) ) { wc.style = CS_HREDRAW | CS_VREDRAW; wc.lpfnWndProc = main_wndproc; @@ -883,7 +880,7 @@ static HRESULT WINAPI IExplorerBrowser_fnInitialize(IExplorerBrowser *iface, wc.hCursor = LoadCursorW(0, (LPWSTR)IDC_ARROW); wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); wc.lpszMenuName = NULL; - wc.lpszClassName = EB_CLASS_NAME; + wc.lpszClassName = L"ExplorerBrowserControl"; if (!RegisterClassW(&wc)) return E_FAIL; } @@ -897,7 +894,7 @@ static HRESULT WINAPI IExplorerBrowser_fnInitialize(IExplorerBrowser *iface, style = WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS; if (!(This->eb_options & EBO_NOBORDER)) style |= WS_BORDER; - This->hwnd_main = CreateWindowExW(WS_EX_CONTROLPARENT, EB_CLASS_NAME, NULL, style, + This->hwnd_main = CreateWindowExW(WS_EX_CONTROLPARENT, L"ExplorerBrowserControl", NULL, style, prc->left, prc->top, prc->right - prc->left, prc->bottom - prc->top, hwndParent, 0, shell32_hInstance, This); diff --git a/dlls/shell32/enumidlist.c b/dlls/shell32/enumidlist.c index 5bd4315d89f..87ef1878303 100644 --- a/dlls/shell32/enumidlist.c +++ b/dlls/shell32/enumidlist.c @@ -68,9 +68,6 @@ BOOL CreateFolderEnumList(IEnumIDListImpl *list, LPCWSTR lpszPath, DWORD dwFlags HANDLE hFile; WCHAR szPath[MAX_PATH]; BOOL succeeded = TRUE; - static const WCHAR stars[] = { '*','.','*',0 }; - static const WCHAR dot[] = { '.',0 }; - static const WCHAR dotdot[] = { '.','.',0 }; TRACE("(%p)->(path=%s flags=0x%08x)\n", list, debugstr_w(lpszPath), dwFlags); @@ -78,7 +75,7 @@ BOOL CreateFolderEnumList(IEnumIDListImpl *list, LPCWSTR lpszPath, DWORD dwFlags lstrcpyW(szPath, lpszPath); PathAddBackslashW(szPath); - lstrcatW(szPath,stars); + lstrcatW(szPath,L"*"); hFile = FindFirstFileW(szPath,&stffile); if ( hFile != INVALID_HANDLE_VALUE ) @@ -92,7 +89,7 @@ BOOL CreateFolderEnumList(IEnumIDListImpl *list, LPCWSTR lpszPath, DWORD dwFlags { if ( (stffile.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && dwFlags & SHCONTF_FOLDERS && - wcscmp(stffile.cFileName, dot) && wcscmp(stffile.cFileName, dotdot)) + wcscmp(stffile.cFileName, L".") && wcscmp(stffile.cFileName, L"..")) { pidl = _ILCreateFromFindDataW(&stffile); succeeded = succeeded && AddToEnumList(list, pidl); diff --git a/dlls/shell32/folders.c b/dlls/shell32/folders.c index e6b587d56f0..35c5414a287 100644 --- a/dlls/shell32/folders.c +++ b/dlls/shell32/folders.c @@ -133,27 +133,22 @@ static HRESULT getIconLocationForFolder(IExtractIconWImpl *This, UINT uFlags, LP int icon_idx; WCHAR wszPath[MAX_PATH]; WCHAR wszCLSIDValue[CHARS_IN_GUID]; - static const WCHAR shellClassInfo[] = { '.','S','h','e','l','l','C','l','a','s','s','I','n','f','o',0 }; - static const WCHAR iconFile[] = { 'I','c','o','n','F','i','l','e',0 }; - static const WCHAR clsid[] = { 'C','L','S','I','D',0 }; - static const WCHAR clsid2[] = { 'C','L','S','I','D','2',0 }; - static const WCHAR iconIndex[] = { 'I','c','o','n','I','n','d','e','x',0 }; - if (SHELL32_GetCustomFolderAttribute(This->pidl, shellClassInfo, iconFile, + if (SHELL32_GetCustomFolderAttribute(This->pidl, L".ShellClassInfo", L"IconFile", wszPath, MAX_PATH)) { WCHAR wszIconIndex[10]; - SHELL32_GetCustomFolderAttribute(This->pidl, shellClassInfo, iconIndex, + SHELL32_GetCustomFolderAttribute(This->pidl, L".ShellClassInfo", L"IconIndex", wszIconIndex, 10); *piIndex = wcstol(wszIconIndex, NULL, 10); } - else if (SHELL32_GetCustomFolderAttribute(This->pidl, shellClassInfo, clsid, + else if (SHELL32_GetCustomFolderAttribute(This->pidl, L".ShellClassInfo", L"CLSID", wszCLSIDValue, CHARS_IN_GUID) && HCR_GetDefaultIconW(wszCLSIDValue, szIconFile, cchMax, &icon_idx)) { *piIndex = icon_idx; } - else if (SHELL32_GetCustomFolderAttribute(This->pidl, shellClassInfo, clsid2, + else if (SHELL32_GetCustomFolderAttribute(This->pidl, L".ShellClassInfo", L"CLSID2", wszCLSIDValue, CHARS_IN_GUID) && HCR_GetDefaultIconW(wszCLSIDValue, szIconFile, cchMax, &icon_idx)) { @@ -161,9 +156,7 @@ static HRESULT getIconLocationForFolder(IExtractIconWImpl *This, UINT uFlags, LP } else { - static const WCHAR folder[] = { 'F','o','l','d','e','r',0 }; - - if (!HCR_GetDefaultIconW(folder, szIconFile, cchMax, &icon_idx)) + if (!HCR_GetDefaultIconW(L"Folder", szIconFile, cchMax, &icon_idx)) { lstrcpynW(szIconFile, swShell32Name, cchMax); icon_idx = -IDI_SHELL_FOLDER; @@ -209,13 +202,9 @@ static HRESULT WINAPI IExtractIconW_fnGetIconLocation(IExtractIconW * iface, UIN /* my computer and other shell extensions */ else if ((riid = _ILGetGUIDPointer(pSimplePidl))) { - static const WCHAR fmt[] = { 'C','L','S','I','D','\\', - '{','%','0','8','l','x','-','%','0','4','x','-','%','0','4','x','-', - '%','0','2','x','%','0','2','x','-','%','0','2','x', '%','0','2','x', - '%','0','2','x','%','0','2','x','%','0','2','x','%','0','2','x','}',0 }; WCHAR xriid[50]; - swprintf(xriid, ARRAY_SIZE(xriid), fmt, + swprintf(xriid, ARRAY_SIZE(xriid), L"CLSID\\{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}", riid->Data1, riid->Data2, riid->Data3, riid->Data4[0], riid->Data4[1], riid->Data4[2], riid->Data4[3], riid->Data4[4], riid->Data4[5], riid->Data4[6], riid->Data4[7]); @@ -243,8 +232,6 @@ static HRESULT WINAPI IExtractIconW_fnGetIconLocation(IExtractIconW * iface, UIN else if (_ILIsDrive (pSimplePidl)) { - static const WCHAR drive[] = { 'D','r','i','v','e',0 }; - icon_idx = -1; if (_ILGetDrive(pSimplePidl, sTemp, MAX_PATH)) @@ -265,7 +252,7 @@ static HRESULT WINAPI IExtractIconW_fnGetIconLocation(IExtractIconW * iface, UIN } else { - if (HCR_GetDefaultIconW(drive, szIconFile, cchMax, &icon_idx)) + if (HCR_GetDefaultIconW(L"Drive", szIconFile, cchMax, &icon_idx)) { *piIndex = icon_idx; } diff --git a/dlls/shell32/iconcache.c b/dlls/shell32/iconcache.c index f1d95e851eb..1ca4840dc58 100644 --- a/dlls/shell32/iconcache.c +++ b/dlls/shell32/iconcache.c @@ -67,10 +67,6 @@ static CRITICAL_SECTION_DEBUG critsect_debug = static CRITICAL_SECTION SHELL32_SicCS = { &critsect_debug, -1, 0, 0, 0, 0 }; -static const WCHAR WindowMetrics[] = {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p','\\', - 'W','i','n','d','o','w','M','e','t','r','i','c','s',0}; -static const WCHAR ShellIconSize[] = {'S','h','e','l','l',' ','I','c','o','n',' ','S','i','z','e',0}; - #define SIC_COMPARE_LISTINDEX 1 /***************************************************************************** @@ -411,9 +407,9 @@ static int get_shell_icon_size(void) DWORD value = 32, size = sizeof(buf), type; HKEY key; - if (!RegOpenKeyW( HKEY_CURRENT_USER, WindowMetrics, &key )) + if (!RegOpenKeyW( HKEY_CURRENT_USER, L"Control Panel\\Desktop\\WindowMetrics", &key )) { - if (!RegQueryValueExW( key, ShellIconSize, NULL, &type, (BYTE *)buf, &size ) && type == REG_SZ) + if (!RegQueryValueExW( key, L"Shell Icon Size", NULL, &type, (BYTE *)buf, &size ) && type == REG_SZ) { if (size == sizeof(buf)) buf[size / sizeof(WCHAR) - 1] = 0; value = wcstol( buf, NULL, 10 ); @@ -578,21 +574,15 @@ static int SIC_LoadOverlayIcon(int icon_idx) LPCWSTR iconPath; int iconIdx; - static const WCHAR wszShellIcons[] = { - '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','\\','S','h','e','l','l',' ','I','c','o','n','s',0 - }; - static const WCHAR wszNumFmt[] = {'%','d',0}; - iconPath = swShell32Name; /* default: load icon from shell32.dll */ iconIdx = icon_idx; - if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, wszShellIcons, 0, KEY_READ, &hKeyShellIcons) == ERROR_SUCCESS) + if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Icons", + 0, KEY_READ, &hKeyShellIcons) == ERROR_SUCCESS) { DWORD count = sizeof(buffer); - swprintf(wszIdx, ARRAY_SIZE(wszIdx), wszNumFmt, icon_idx); + swprintf(wszIdx, ARRAY_SIZE(wszIdx), L"%d", icon_idx); /* read icon path and index */ if (RegQueryValueExW(hKeyShellIcons, wszIdx, NULL, NULL, (LPBYTE)buffer, &count) == ERROR_SUCCESS) @@ -601,7 +591,7 @@ static int SIC_LoadOverlayIcon(int icon_idx) if (!p) { - ERR("Icon index in %s/%s corrupted, no comma.\n", debugstr_w(wszShellIcons),debugstr_w(wszIdx)); + ERR("Icon index in Shell Icons/%s corrupted, no comma.\n", debugstr_w(wszIdx)); RegCloseKey(hKeyShellIcons); return -1; } @@ -1001,8 +991,6 @@ INT WINAPI SHGetIconOverlayIndexW(LPCWSTR pszIconPath, INT iIconIndex) */ HRESULT WINAPI SHGetStockIconInfo(SHSTOCKICONID id, UINT flags, SHSTOCKICONINFO *sii) { - static const WCHAR shell32dll[] = {'\\','s','h','e','l','l','3','2','.','d','l','l',0}; - FIXME("(%d, 0x%x, %p) semi-stub\n", id, flags, sii); if ((id < 0) || (id >= SIID_MAX_ICONS) || !sii || (sii->cbSize != sizeof(SHSTOCKICONINFO))) { return E_INVALIDARG; @@ -1012,7 +1000,7 @@ HRESULT WINAPI SHGetStockIconInfo(SHSTOCKICONID id, UINT flags, SHSTOCKICONINFO /* no icons defined: use default */ sii->iIcon = -IDI_SHELL_FILE; - lstrcatW(sii->szPath, shell32dll); + lstrcatW(sii->szPath, L"\\shell32.dll"); if (flags) FIXME("flags 0x%x not implemented\n", flags); diff --git a/dlls/shell32/recyclebin.c b/dlls/shell32/recyclebin.c index 21d3fcd4be7..8cfc1042fe7 100644 --- a/dlls/shell32/recyclebin.c +++ b/dlls/shell32/recyclebin.c @@ -98,11 +98,9 @@ static BOOL WINAPI init_trash_dirs( INIT_ONCE *once, void *param, void **context if (!home) return TRUE; if (is_macos()) { - static const WCHAR trashW[] = {'\\','.','T','r','a','s','h',0}; - - files = heap_alloc( (lstrlenW(home) + lstrlenW(trashW) + 1) * sizeof(WCHAR) ); + files = heap_alloc( (lstrlenW(home) + lstrlenW(L"\\.Trash") + 1) * sizeof(WCHAR) ); lstrcpyW( files, home ); - lstrcatW( files, trashW ); + lstrcatW( files, L"\\.Trash" ); files[1] = '\\'; /* change \??\ to \\?\ */ } else @@ -285,26 +283,23 @@ BOOL trash_file( const WCHAR *path ) if (trash_info_dir) { - static const WCHAR fmt[] = {'%','s','\\','%','s','.','t','r','a','s','h','i','n','f','o',0}; - static const WCHAR fmt2[] = {'%','s','\\','%','s','-','%','0','8','x','.','t','r','a','s','h','i','n','f','o',0}; HANDLE handle; ULONG infolen = lstrlenW(trash_info_dir) + lstrlenW(file) + 21; WCHAR *info = heap_alloc( infolen * sizeof(WCHAR) ); - swprintf( info, infolen, fmt, trash_info_dir, file ); + swprintf( info, infolen, L"%s\\%s.trashinfo", trash_info_dir, file ); for (i = 0; i < 1000; i++) { handle = CreateFileW( info, GENERIC_WRITE, 0, NULL, CREATE_NEW, 0, 0 ); if (handle != INVALID_HANDLE_VALUE) break; - swprintf( info, infolen, fmt2, trash_info_dir, file, RtlRandom( &random_seed )); + swprintf( info, infolen, L"%s\\%s-%08x.trashinfo", trash_info_dir, file, RtlRandom( &random_seed )); } if (handle != INVALID_HANDLE_VALUE) { if ((ret = write_trashinfo_file( handle, path ))) { - static const WCHAR fmt[] = {'%','s','%','.','*','s',0}; ULONG namelen = lstrlenW(info) - lstrlenW(trash_info_dir) - 10 /* .trashinfo */; - swprintf( dest, len, fmt, trash_dir, namelen, info + lstrlenW(trash_info_dir) ); + swprintf( dest, len, L"%s%.*s", trash_dir, namelen, info + lstrlenW(trash_info_dir) ); ret = MoveFileW( path, dest ); } CloseHandle( handle ); @@ -313,15 +308,12 @@ BOOL trash_file( const WCHAR *path ) } else { - static const WCHAR fmt[] = {'%','s','\\','%','s',0}; - static const WCHAR fmt2[] = {'%','s','\\','%','s','-','%','0','8','x',0}; - - swprintf( dest, len, fmt, trash_dir, file ); + swprintf( dest, len, L"%s\\%s", trash_dir, file ); for (i = 0; i < 1000; i++) { ret = MoveFileW( path, dest ); if (ret || GetLastError() != ERROR_ALREADY_EXISTS) break; - swprintf( dest, len, fmt2, trash_dir, file, RtlRandom( &random_seed )); + swprintf( dest, len, L"%s\\%s-%08x", trash_dir, file, RtlRandom( &random_seed )); } } if (ret) TRACE( "%s -> %s\n", debugstr_w(path), debugstr_w(dest) ); @@ -333,18 +325,15 @@ static BOOL get_trash_item_info( const WCHAR *filename, WIN32_FIND_DATAW *data ) { if (!trash_info_dir) { - static const WCHAR dsstoreW[] = {'.','D','S','_','S','t','o','r','e',0}; - - return !!wcscmp( filename, dsstoreW ); + return !!wcscmp( filename, L".DS_Store" ); } else { - static const WCHAR fmt[] = {'%','s','\\','%','s','.','t','r','a','s','h','i','n','f','o',0}; HANDLE handle; ULONG len = lstrlenW(trash_info_dir) + lstrlenW(filename) + 12; WCHAR *info = heap_alloc( len * sizeof(WCHAR) ); - swprintf( info, len, fmt, trash_info_dir, filename ); + swprintf( info, len, L"%s\\%s.trashinfo", trash_info_dir, filename ); handle = CreateFileW( info, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0 ); heap_free( info ); if (handle == INVALID_HANDLE_VALUE) return FALSE; @@ -393,7 +382,6 @@ static HRESULT add_trash_item( WIN32_FIND_DATAW *orig_data, LPITEMIDLIST **pidls static HRESULT enum_trash_items( LPITEMIDLIST **pidls, int *ret_count ) { - static const WCHAR wildcardW[] = {'\\','*',0}; HANDLE handle; WCHAR *file; WIN32_FIND_DATAW data; @@ -404,19 +392,16 @@ static HRESULT enum_trash_items( LPITEMIDLIST **pidls, int *ret_count ) InitOnceExecuteOnce( &trash_dir_once, init_trash_dirs, NULL, NULL ); if (!trash_dir) return E_FAIL; - file = heap_alloc( (lstrlenW(trash_dir) + lstrlenW(wildcardW) + 1) * sizeof(WCHAR) ); + file = heap_alloc( (lstrlenW(trash_dir) + lstrlenW(L"\\*") + 1) * sizeof(WCHAR) ); lstrcpyW( file, trash_dir ); - lstrcatW( file, wildcardW ); + lstrcatW( file, L"\\*" ); handle = FindFirstFileW( file, &data ); if (handle != INVALID_HANDLE_VALUE) { do { - static const WCHAR dotW[] = {'.',0}; - static const WCHAR dotdotW[] = {'.','.',0}; - - if (!wcscmp( data.cFileName, dotW )) continue; - if (!wcscmp( data.cFileName, dotdotW )) continue; + if (!wcscmp( data.cFileName, L"." )) continue; + if (!wcscmp( data.cFileName, L".." )) continue; hr = add_trash_item( &data, &ret, &count, &size ); } while (hr == S_OK && FindNextFileW( handle, &data )); FindClose( handle ); diff --git a/dlls/shell32/shell32_main.c b/dlls/shell32/shell32_main.c index 96eb37e1968..526c51e8a30 100644 --- a/dlls/shell32/shell32_main.c +++ b/dlls/shell32/shell32_main.c @@ -273,10 +273,6 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes, /* get the type name */ if (SUCCEEDED(hr) && (flags & SHGFI_TYPENAME)) { - static const WCHAR szFolder[] = { 'F','o','l','d','e','r',0 }; - static const WCHAR szFile[] = { 'F','i','l','e',0 }; - static const WCHAR szSpaceFile[] = { ' ','f','i','l','e',0 }; - if (!(flags & SHGFI_USEFILEATTRIBUTES) || (flags & SHGFI_PIDL)) { char ftype[80]; @@ -287,7 +283,7 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes, else { if (dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) - lstrcatW (psfi->szTypeName, szFolder); + lstrcatW (psfi->szTypeName, L"Folder"); else { WCHAR sTemp[64]; @@ -296,7 +292,7 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes, if (sTemp[0] == 0 || (sTemp[0] == '.' && sTemp[1] == 0)) { /* "name" or "name." => "File" */ - lstrcpynW (psfi->szTypeName, szFile, 64); + lstrcpynW (psfi->szTypeName, L"File", 64); } else if (!( HCR_MapTypeToValueW(sTemp, sTemp, 64, TRUE) && HCR_MapTypeToValueW(sTemp, psfi->szTypeName, 80, FALSE ))) @@ -304,11 +300,11 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes, if (sTemp[0]) { lstrcpynW (psfi->szTypeName, sTemp, 64); - lstrcatW (psfi->szTypeName, szSpaceFile); + lstrcatW (psfi->szTypeName, L" file"); } else { - lstrcpynW (psfi->szTypeName, szFile, 64); + lstrcpynW (psfi->szTypeName, L"File", 64); } } } @@ -349,7 +345,6 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes, else { WCHAR* szExt; - static const WCHAR p1W[] = {'%','1',0}; WCHAR sTemp [MAX_PATH]; szExt = PathFindExtensionW(szFullPath); @@ -358,7 +353,7 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes, HCR_MapTypeToValueW(szExt, sTemp, MAX_PATH, TRUE) && HCR_GetDefaultIconW(sTemp, sTemp, MAX_PATH, &psfi->iIcon)) { - if (wcscmp(p1W, sTemp)) + if (wcscmp(L"%1", sTemp)) lstrcpyW(psfi->szDisplayName, sTemp); else { @@ -404,7 +399,6 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes, psfi->iIcon = SIC_GetIconIndex(swShell32Name, -IDI_SHELL_FOLDER, 0); else { - static const WCHAR p1W[] = {'%','1',0}; WCHAR sTemp[MAX_PATH]; WCHAR *szExt; int icon_idx = 0; @@ -417,7 +411,7 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes, HCR_MapTypeToValueW(szExt, sTemp, MAX_PATH, TRUE) && HCR_GetDefaultIconW(sTemp, sTemp, MAX_PATH, &icon_idx)) { - if (!wcscmp(p1W,sTemp)) /* icon is in the file */ + if (!wcscmp(L"%1",sTemp)) /* icon is in the file */ lstrcpyW(sTemp, szFullPath); psfi->iIcon = SIC_GetIconIndex(sTemp, icon_idx, 0); @@ -875,10 +869,8 @@ HRESULT WINAPI SHLoadInProc (REFCLSID rclsid) static void add_authors( HWND list ) { - static const WCHAR eol[] = {'\r','\n',0}; - static const WCHAR authors[] = {'A','U','T','H','O','R','S',0}; WCHAR *strW, *start, *end; - HRSRC rsrc = FindResourceW( shell32_hInstance, authors, (LPCWSTR)RT_RCDATA ); + HRSRC rsrc = FindResourceW( shell32_hInstance, L"AUTHORS", (LPCWSTR)RT_RCDATA ); char *strA = LockResource( LoadResource( shell32_hInstance, rsrc )); DWORD sizeW, sizeA = SizeofResource( shell32_hInstance, rsrc ); @@ -888,12 +880,12 @@ static void add_authors( HWND list ) MultiByteToWideChar( CP_UTF8, 0, strA, sizeA, strW, sizeW ); strW[sizeW - 1] = 0; - start = wcspbrk( strW, eol ); /* skip the header line */ + start = wcspbrk( strW, L"\r\n" ); /* skip the header line */ while (start) { - while (*start && wcschr( eol, *start )) start++; + while (*start && wcschr( L"\r\n", *start )) start++; if (!*start) break; - end = wcspbrk( start, eol ); + end = wcspbrk( start, L"\r\n" ); if (end) *end++ = 0; SendMessageW( list, LB_ADDSTRING, -1, (LPARAM)start ); start = end; @@ -1026,8 +1018,6 @@ BOOL WINAPI ShellAboutW( HWND hWnd, LPCWSTR szApp, LPCWSTR szOtherStuff, ABOUT_INFO info; LOGFONTW logFont; BOOL bRet; - static const WCHAR wszSHELL_ABOUT_MSGBOX[] = - {'S','H','E','L','L','_','A','B','O','U','T','_','M','S','G','B','O','X',0}; TRACE("\n"); @@ -1039,7 +1029,7 @@ BOOL WINAPI ShellAboutW( HWND hWnd, LPCWSTR szApp, LPCWSTR szOtherStuff, SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0, &logFont, 0 ); info.hFont = CreateFontIndirectW( &logFont ); - bRet = DialogBoxParamW( shell32_hInstance, wszSHELL_ABOUT_MSGBOX, hWnd, AboutDlgProc, (LPARAM)&info ); + bRet = DialogBoxParamW( shell32_hInstance, L"SHELL_ABOUT_MSGBOX", hWnd, AboutDlgProc, (LPARAM)&info ); DeleteObject(info.hFont); return bRet; } diff --git a/dlls/shell32/shelllink.c b/dlls/shell32/shelllink.c index 04643ebff7f..656357bf0a9 100644 --- a/dlls/shell32/shelllink.c +++ b/dlls/shell32/shelllink.c @@ -299,7 +299,6 @@ static HRESULT WINAPI IPersistFile_fnLoad(IPersistFile* iface, LPCOLESTR pszFile BOOL run_winemenubuilder( const WCHAR *args ) { - static const WCHAR menubuilder[] = {'\\','w','i','n','e','m','e','n','u','b','u','i','l','d','e','r','.','e','x','e',0}; LONG len; LPWSTR buffer; STARTUPINFOW si; @@ -308,8 +307,8 @@ BOOL run_winemenubuilder( const WCHAR *args ) WCHAR app[MAX_PATH]; void *redir; - GetSystemDirectoryW( app, MAX_PATH - ARRAY_SIZE(menubuilder) ); - lstrcatW( app, menubuilder ); + GetSystemDirectoryW( app, MAX_PATH ); + lstrcatW( app, L"\\winemenubuilder.exe" ); len = (lstrlenW( app ) + lstrlenW( args ) + 1) * sizeof(WCHAR); buffer = heap_alloc( len ); @@ -341,17 +340,16 @@ BOOL run_winemenubuilder( const WCHAR *args ) static BOOL StartLinkProcessor( LPCOLESTR szLink ) { - static const WCHAR szFormat[] = {' ','-','w',' ','"','%','s','"',0 }; LONG len; LPWSTR buffer; BOOL ret; - len = sizeof(szFormat) + lstrlenW( szLink ) * sizeof(WCHAR); + len = (lstrlenW( szLink ) + 7) * sizeof(WCHAR); buffer = heap_alloc( len ); if( !buffer ) return FALSE; - wsprintfW( buffer, szFormat, szLink ); + swprintf( buffer, len, L" -w \"%s\"", szLink ); ret = run_winemenubuilder( buffer ); heap_free( buffer ); return ret; @@ -2429,7 +2427,6 @@ ShellLink_QueryContextMenu( IContextMenu* iface, HMENU hmenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags ) { IShellLinkImpl *This = impl_from_IContextMenu(iface); - static WCHAR szOpen[] = { 'O','p','e','n',0 }; MENUITEMINFOW mii; int id = 1; @@ -2442,7 +2439,7 @@ ShellLink_QueryContextMenu( IContextMenu* iface, HMENU hmenu, UINT indexMenu, memset( &mii, 0, sizeof mii ); mii.cbSize = sizeof mii; mii.fMask = MIIM_TYPE | MIIM_ID | MIIM_STATE; - mii.dwTypeData = szOpen; + mii.dwTypeData = (LPWSTR)L"Open"; mii.cch = lstrlenW( mii.dwTypeData ); mii.wID = idCmdFirst + id++; mii.fState = MFS_DEFAULT | MFS_ENABLED; @@ -2482,7 +2479,6 @@ static HRESULT WINAPI ShellLink_InvokeCommand( IContextMenu* iface, LPCMINVOKECOMMANDINFO lpici ) { IShellLinkImpl *This = impl_from_IContextMenu(iface); - static const WCHAR szOpen[] = { 'O','p','e','n',0 }; SHELLEXECUTEINFOW sei; HWND hwnd = NULL; /* FIXME: get using interface set from IObjectWithSite */ LPWSTR args = NULL; @@ -2530,8 +2526,7 @@ ShellLink_InvokeCommand( IContextMenu* iface, LPCMINVOKECOMMANDINFO lpici ) lstrcatW( args, This->sArgs ); if ( iciex->lpParametersW && iciex->lpParametersW[0] ) { - static const WCHAR space[] = { ' ', 0 }; - lstrcatW( args, space ); + lstrcatW( args, L" " ); lstrcatW( args, iciex->lpParametersW ); } } @@ -2544,7 +2539,7 @@ ShellLink_InvokeCommand( IContextMenu* iface, LPCMINVOKECOMMANDINFO lpici ) sei.lpIDList = This->pPidl; sei.lpDirectory = This->sWorkDir; sei.lpParameters = args; - sei.lpVerb = szOpen; + sei.lpVerb = L"Open"; if( ShellExecuteExW( &sei ) ) r = S_OK; diff --git a/dlls/shell32/shellole.c b/dlls/shell32/shellole.c index d1f1afc3780..5b72fecf07e 100644 --- a/dlls/shell32/shellole.c +++ b/dlls/shell32/shellole.c @@ -118,10 +118,7 @@ HRESULT WINAPI SHCoCreateInstance( IID iid; const CLSID * myclsid = clsid; WCHAR sKeyName[MAX_PATH]; - static const WCHAR sCLSID[] = {'C','L','S','I','D','\\','\0'}; WCHAR sClassID[60]; - static const WCHAR sInProcServer32[] = {'\\','I','n','p','r','o','c','S','e','r','v','e','r','3','2','\0'}; - static const WCHAR sLoadWithoutCOM[] = {'L','o','a','d','W','i','t','h','o','u','t','C','O','M','\0'}; WCHAR sDllPath[MAX_PATH]; HKEY hKey = 0; DWORD dwSize; @@ -150,15 +147,13 @@ HRESULT WINAPI SHCoCreateInstance( /* we look up the dll path in the registry */ SHStringFromGUIDW(myclsid, sClassID, ARRAY_SIZE(sClassID)); - lstrcpyW(sKeyName, sCLSID); - lstrcatW(sKeyName, sClassID); - lstrcatW(sKeyName, sInProcServer32); + swprintf( sKeyName, ARRAY_SIZE(sKeyName), L"CLSID\\%s\\InprocServer32", sClassID ); if (RegOpenKeyExW(HKEY_CLASSES_ROOT, sKeyName, 0, KEY_READ, &hKey)) return E_ACCESSDENIED; /* if a special registry key is set, we load a shell extension without help of OLE32 */ - if (!SHQueryValueExW(hKey, sLoadWithoutCOM, 0, 0, 0, 0)) + if (!SHQueryValueExW(hKey, L"LoadWithoutCOM", 0, 0, 0, 0)) { /* load an external dll without ole32 */ HANDLE hLibrary; diff --git a/dlls/shell32/shellord.c b/dlls/shell32/shellord.c index c0a7303c705..c4b1b17d6b3 100644 --- a/dlls/shell32/shellord.c +++ b/dlls/shell32/shellord.c @@ -1183,17 +1183,6 @@ BOOL WINAPI DAD_ShowDragImage(BOOL bShow) return FALSE; } -static const WCHAR szwCabLocation[] = { - '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','a','b','i','n','e','t','S','t','a','t','e',0 -}; - -static const WCHAR szwSettings[] = { 'S','e','t','t','i','n','g','s',0 }; - /************************************************************************* * ReadCabinetState [SHELL32.651] NT 4.0 * @@ -1208,12 +1197,11 @@ BOOL WINAPI ReadCabinetState(CABINETSTATE *cs, int length) if( (cs == NULL) || (length < (int)sizeof(*cs)) ) return FALSE; - r = RegOpenKeyW( HKEY_CURRENT_USER, szwCabLocation, &hkey ); + r = RegOpenKeyW( HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CabinetState", &hkey ); if( r == ERROR_SUCCESS ) { type = REG_BINARY; - r = RegQueryValueExW( hkey, szwSettings, - NULL, &type, (LPBYTE)cs, (LPDWORD)&length ); + r = RegQueryValueExW( hkey, L"Settings", NULL, &type, (LPBYTE)cs, (LPDWORD)&length ); RegCloseKey( hkey ); } @@ -1255,13 +1243,11 @@ BOOL WINAPI WriteCabinetState(CABINETSTATE *cs) if( cs == NULL ) return FALSE; - r = RegCreateKeyExW( HKEY_CURRENT_USER, szwCabLocation, 0, + r = RegCreateKeyExW( HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CabinetState", 0, NULL, 0, KEY_ALL_ACCESS, NULL, &hkey, NULL); if( r == ERROR_SUCCESS ) { - r = RegSetValueExW( hkey, szwSettings, 0, - REG_BINARY, (LPBYTE) cs, cs->cLength); - + r = RegSetValueExW( hkey, L"Settings", 0, REG_BINARY, (LPBYTE) cs, cs->cLength); RegCloseKey( hkey ); } @@ -1700,7 +1686,6 @@ HPSXA WINAPI SHCreatePropSheetExtArray(HKEY hKey, LPCWSTR pszSubKey, UINT max_if */ HPSXA WINAPI SHCreatePropSheetExtArrayEx(HKEY hKey, LPCWSTR pszSubKey, UINT max_iface, LPDATAOBJECT pDataObj) { - static const WCHAR szPropSheetSubKey[] = {'s','h','e','l','l','e','x','\\','P','r','o','p','e','r','t','y','S','h','e','e','t','H','a','n','d','l','e','r','s',0}; WCHAR szHandler[64]; DWORD dwHandlerLen; WCHAR szClsidHandler[39]; @@ -1723,7 +1708,7 @@ HPSXA WINAPI SHCreatePropSheetExtArrayEx(HKEY hKey, LPCWSTR pszSubKey, UINT max_ if (lRet != ERROR_SUCCESS) return NULL; - lRet = RegOpenKeyExW(hkBase, szPropSheetSubKey, 0, KEY_ENUMERATE_SUB_KEYS, &hkPropSheetHandlers); + lRet = RegOpenKeyExW(hkBase, L"shellex\\PropertySheetHandlers", 0, KEY_ENUMERATE_SUB_KEYS, &hkPropSheetHandlers); RegCloseKey(hkBase); if (lRet == ERROR_SUCCESS) { @@ -1990,8 +1975,6 @@ BOOL WINAPI SHGetNewLinkInfoW(LPCWSTR pszLinkTo, LPCWSTR pszDir, LPWSTR pszName, const WCHAR *basename; WCHAR *dst_basename; int i=2; - static const WCHAR lnkformat[] = {'%','s','.','l','n','k',0}; - static const WCHAR lnkformatnum[] = {'%','s',' ','(','%','d',')','.','l','n','k',0}; TRACE("(%s, %s, %p, %p, 0x%08x)\n", debugstr_w(pszLinkTo), debugstr_w(pszDir), pszName, pfMustCopy, uFlags); @@ -2023,11 +2006,11 @@ BOOL WINAPI SHGetNewLinkInfoW(LPCWSTR pszLinkTo, LPCWSTR pszDir, LPWSTR pszName, dst_basename = pszName + lstrlenW(pszName); - swprintf(dst_basename, pszName + MAX_PATH - dst_basename, lnkformat, basename); + swprintf(dst_basename, pszName + MAX_PATH - dst_basename, L"%s.lnk", basename); while (GetFileAttributesW(pszName) != INVALID_FILE_ATTRIBUTES) { - swprintf(dst_basename, pszName + MAX_PATH - dst_basename, lnkformatnum, basename, i); + swprintf(dst_basename, pszName + MAX_PATH - dst_basename, L"%s (%d).lnk", basename, i); i++; } diff --git a/dlls/shell32/shellpath.c b/dlls/shell32/shellpath.c index 889480790e5..7bfa504a62f 100644 --- a/dlls/shell32/shellpath.c +++ b/dlls/shell32/shellpath.c @@ -389,9 +389,7 @@ static BOOL PathIsExeW (LPCWSTR lpszPath) LPCWSTR lpszExtension = PathGetExtensionW(lpszPath); int i; static const WCHAR lpszExtensions[][4] = - {{'e','x','e','\0'}, {'c','o','m','\0'}, {'p','i','f','\0'}, - {'c','m','d','\0'}, {'b','a','t','\0'}, {'s','c','f','\0'}, - {'s','c','r','\0'}, {'\0'} }; + {L"exe", L"com", L"pif",L"cmd", L"bat", L"scf",L"scr",L"" }; TRACE("path=%s\n",debugstr_w(lpszPath)); @@ -2647,21 +2645,16 @@ static DWORD xdg_config_len; static BOOL WINAPI init_xdg_dirs( INIT_ONCE *once, void *param, void **context ) { - static const WCHAR configW[] = {'X','D','G','_','C','O','N','F','I','G','_','H','O','M','E',0}; - static const WCHAR homedirW[] = {'W','I','N','E','H','O','M','E','D','I','R',0}; - static const WCHAR home_fmtW[] = {'%','s','/','.','c','o','n','f','i','g','/','u','s','e','r','-','d','i','r','s','.','d','i','r','s',0}; - static const WCHAR config_fmtW[] = {'\\','?','?','\\','u','n','i','x','%','s','/','u','s','e','r','-','d','i','r','s','.','d','i','r','s',0}; - const WCHAR *fmt = config_fmtW; + const WCHAR *var, *fmt = L"\\??\\unix%s/user-dirs.dirs"; char *p; WCHAR *name, *ptr; HANDLE file; DWORD len; - WCHAR var[MAX_PATH]; - if (!GetEnvironmentVariableW( configW, var, MAX_PATH ) || !var[0]) + if (!(var = _wgetenv( L"XDG_CONFIG_HOME" )) || var[0] != '/') { - if (!GetEnvironmentVariableW( homedirW, var, MAX_PATH )) return TRUE; - fmt = home_fmtW; + if (!(var = _wgetenv( L"WINEHOMEDIR" ))) return TRUE; + fmt = L"%s/.config/user-dirs.dirs"; } len = lstrlenW(var) + lstrlenW(fmt); name = heap_alloc( len * sizeof(WCHAR) ); @@ -3254,37 +3247,32 @@ static HRESULT _SHRegisterCommonShellFolders(void) */ static HRESULT create_extra_folders(void) { - static const WCHAR environW[] = {'E','n','v','i','r','o','n','m','e','n','t',0}; - static const WCHAR microsoftW[] = {'M','i','c','r','o','s','o','f','t',0}; - static const WCHAR TempW[] = {'T','e','m','p',0}; - static const WCHAR TEMPW[] = {'T','E','M','P',0}; - static const WCHAR TMPW[] = {'T','M','P',0}; WCHAR path[MAX_PATH+5]; HRESULT hr; HKEY hkey; DWORD type, size, ret; - ret = RegCreateKeyW( HKEY_CURRENT_USER, environW, &hkey ); + ret = RegCreateKeyW( HKEY_CURRENT_USER, L"Environment", &hkey ); if (ret) return HRESULT_FROM_WIN32( ret ); /* FIXME: should be under AppData, but we don't want spaces in the temp path */ hr = SHGetFolderPathAndSubDirW( 0, CSIDL_PROFILE | CSIDL_FLAG_CREATE, NULL, - SHGFP_TYPE_DEFAULT, TempW, path ); + SHGFP_TYPE_DEFAULT, L"Temp", path ); if (SUCCEEDED(hr)) { size = sizeof(path); - if (RegQueryValueExW( hkey, TEMPW, NULL, &type, (LPBYTE)path, &size )) - RegSetValueExW( hkey, TEMPW, 0, REG_SZ, (LPBYTE)path, (lstrlenW(path) + 1) * sizeof(WCHAR) ); + if (RegQueryValueExW( hkey, L"TEMP", NULL, &type, (LPBYTE)path, &size )) + RegSetValueExW( hkey, L"TEMP", 0, REG_SZ, (LPBYTE)path, (lstrlenW(path) + 1) * sizeof(WCHAR) ); size = sizeof(path); - if (RegQueryValueExW( hkey, TMPW, NULL, &type, (LPBYTE)path, &size )) - RegSetValueExW( hkey, TMPW, 0, REG_SZ, (LPBYTE)path, (lstrlenW(path) + 1) * sizeof(WCHAR) ); + if (RegQueryValueExW( hkey, L"TMP", NULL, &type, (LPBYTE)path, &size )) + RegSetValueExW( hkey, L"TMP", 0, REG_SZ, (LPBYTE)path, (lstrlenW(path) + 1) * sizeof(WCHAR) ); } RegCloseKey( hkey ); if (SUCCEEDED(hr)) { hr = SHGetFolderPathAndSubDirW( 0, CSIDL_COMMON_APPDATA | CSIDL_FLAG_CREATE, NULL, - SHGFP_TYPE_DEFAULT, microsoftW, path ); + SHGFP_TYPE_DEFAULT, L"Microsoft", path ); } if (SUCCEEDED(hr)) { @@ -3302,14 +3290,6 @@ static HRESULT create_extra_folders(void) */ static HRESULT set_folder_attributes(void) { - static const WCHAR clsidW[] = {'C','L','S','I','D','\\',0 }; - static const WCHAR shellfolderW[] = {'\\','S','h','e','l','l','F','o','l','d','e','r', 0 }; - static const WCHAR wfparsingW[] = {'W','a','n','t','s','F','O','R','P','A','R','S','I','N','G',0}; - static const WCHAR wfdisplayW[] = {'W','a','n','t','s','F','O','R','D','I','S','P','L','A','Y',0}; - static const WCHAR hideasdeleteW[] = {'H','i','d','e','A','s','D','e','l','e','t','e','P','e','r','U','s','e','r',0}; - static const WCHAR cfattributesW[] = {'C','a','l','l','F','o','r','A','t','t','r','i','b','u','t','e','s',0}; - static const WCHAR emptyW[] = {0}; - static const struct { const CLSID *clsid; @@ -3335,29 +3315,29 @@ static HRESULT set_folder_attributes(void) }; unsigned int i; - WCHAR buffer[39 + ARRAY_SIZE(clsidW) + ARRAY_SIZE(shellfolderW)]; + WCHAR buffer[39 + ARRAY_SIZE(L"CLSID\\") + ARRAY_SIZE(L"\\ShellFolder")]; LONG res; HKEY hkey; for (i = 0; i < ARRAY_SIZE(folders); i++) { - lstrcpyW( buffer, clsidW ); + lstrcpyW( buffer, L"CLSID\\" ); StringFromGUID2( folders[i].clsid, buffer + lstrlenW(buffer), 39 ); - lstrcatW( buffer, shellfolderW ); + lstrcatW( buffer, L"\\ShellFolder" ); res = RegCreateKeyExW( HKEY_CLASSES_ROOT, buffer, 0, NULL, 0, KEY_READ | KEY_WRITE, NULL, &hkey, NULL); if (res) return HRESULT_FROM_WIN32( res ); if (folders[i].wfparsing) - res = RegSetValueExW( hkey, wfparsingW, 0, REG_SZ, (const BYTE *)emptyW, sizeof(emptyW) ); + res = RegSetValueExW( hkey, L"WantsFORPARSING", 0, REG_SZ, (const BYTE *)L"", sizeof(WCHAR) ); if (folders[i].wfdisplay) - res = RegSetValueExW( hkey, wfdisplayW, 0, REG_SZ, (const BYTE *)emptyW, sizeof(emptyW) ); + res = RegSetValueExW( hkey, L"WantsFORDISPLAY", 0, REG_SZ, (const BYTE *)L"", sizeof(WCHAR) ); if (folders[i].hideasdel) - res = RegSetValueExW( hkey, hideasdeleteW, 0, REG_SZ, (const BYTE *)emptyW, sizeof(emptyW) ); + res = RegSetValueExW( hkey, L"HideAsDeletePerUser", 0, REG_SZ, (const BYTE *)L"", sizeof(WCHAR) ); if (folders[i].attr) res = RegSetValueExW( hkey, L"Attributes", 0, REG_DWORD, (const BYTE *)&folders[i].attr, sizeof(DWORD)); if (folders[i].call_for_attr) - res = RegSetValueExW( hkey, cfattributesW, 0, REG_DWORD, + res = RegSetValueExW( hkey, L"CallForAttributes", 0, REG_DWORD, (const BYTE *)&folders[i].call_for_attr, sizeof(DWORD)); RegCloseKey( hkey ); } @@ -3615,7 +3595,6 @@ static HRESULT get_known_folder_registry_path( LPWSTR lpStringGuid, LPWSTR *lpPath) { - static const WCHAR sBackslash[] = {'\\',0}; HRESULT hr = S_OK; int length; WCHAR sGuid[50]; @@ -3634,8 +3613,7 @@ static HRESULT get_known_folder_registry_path( if(SUCCEEDED(hr)) { - lstrcpyW(*lpPath, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FolderDescriptions"); - lstrcatW(*lpPath, sBackslash); + lstrcpyW(*lpPath, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FolderDescriptions\\"); lstrcatW(*lpPath, sGuid); } @@ -3763,13 +3741,12 @@ static HRESULT redirect_known_folder( /* copy content if required */ if(SUCCEEDED(hr) && (flags & KF_REDIRECT_COPY_CONTENTS) ) { - static const WCHAR sWildcard[] = {'\\','*',0}; WCHAR srcPath[MAX_PATH+1], dstPath[MAX_PATH+1]; SHFILEOPSTRUCTW fileOp; ZeroMemory(srcPath, sizeof(srcPath)); lstrcpyW(srcPath, lpSrcPath); - lstrcatW(srcPath, sWildcard); + lstrcatW(srcPath, L"\\*"); ZeroMemory(dstPath, sizeof(dstPath)); lstrcpyW(dstPath, pszTargetPath); @@ -3949,7 +3926,6 @@ static HRESULT get_known_folder_path( LPWSTR registryPath, LPWSTR *ppszPath) { - static const WCHAR sBackslash[] = {'\\',0}; HRESULT hr; DWORD dwSize, dwType; WCHAR path[MAX_PATH] = {0}; @@ -3979,7 +3955,7 @@ static HRESULT get_known_folder_path( } lstrcatW(path, parentPath); - lstrcatW(path, sBackslash); + lstrcatW(path, L"\\"); heap_free(parentRegistryPath); heap_free(parentPath); diff --git a/dlls/shell32/shellstring.c b/dlls/shell32/shellstring.c index 143679d6cf9..a75b8025293 100644 --- a/dlls/shell32/shellstring.c +++ b/dlls/shell32/shellstring.c @@ -254,8 +254,6 @@ DWORD WINAPI CheckEscapesA( return ret; } -static const WCHAR strEscapedChars[] = {' ','"',',',';','^',0}; - /************************************************************************* * CheckEscapesW [SHELL32.@] * @@ -270,7 +268,7 @@ DWORD WINAPI CheckEscapesW( TRACE("%s, %u.\n", debugstr_w(string), len); - if (StrPBrkW(string, strEscapedChars) && size + 2 <= len) + if (StrPBrkW(string, L" \",;^") && size + 2 <= len) { s = &string[size - 1]; d = &string[size + 2]; diff --git a/dlls/shell32/shfldr_desktop.c b/dlls/shell32/shfldr_desktop.c index a90d3fcecf5..099651eda20 100644 --- a/dlls/shell32/shfldr_desktop.c +++ b/dlls/shell32/shfldr_desktop.c @@ -150,7 +150,6 @@ static HRESULT WINAPI ISF_Desktop_fnParseDisplayName (IShellFolder2 * iface, HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName, DWORD * pchEaten, LPITEMIDLIST * ppidl, DWORD * pdwAttributes) { - static const WCHAR unix_root[] = {'\\','\\','?','\\','u','n','i','x','\\',0}; IDesktopFolderImpl *This = impl_from_IShellFolder2(iface); WCHAR szElement[MAX_PATH]; LPCWSTR szNext = NULL; @@ -186,7 +185,7 @@ static HRESULT WINAPI ISF_Desktop_fnParseDisplayName (IShellFolder2 * iface, pidlTemp = _ILCreateMyComputer (); szNext = lpszDisplayName; } - else if (!wcsncmp( lpszDisplayName, unix_root, 9 )) + else if (!wcsncmp( lpszDisplayName, L"\\\\?\\unix\\", 9 )) { pidlTemp = _ILCreateGuid(PT_GUID, &CLSID_UnixDosFolder); szNext = lpszDisplayName; @@ -279,19 +278,11 @@ static HRESULT WINAPI ISF_Desktop_fnParseDisplayName (IShellFolder2 * iface, static void add_shell_namespace_extensions(IEnumIDListImpl *list, HKEY root) { - static const WCHAR Desktop_NameSpaceW[] = { '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','\0' }; - static const WCHAR clsidfmtW[] = {'C','L','S','I','D','\\','%','s','\\', - 'S','h','e','l','l','F','o','l','d','e','r',0}; - static const WCHAR attributesW[] = {'A','t','t','r','i','b','u','t','e','s',0}; - WCHAR guid[39], clsidkeyW[ARRAY_SIZE(clsidfmtW) + 39]; + WCHAR guid[39], clsidkeyW[60]; DWORD size, i = 0; HKEY hkey; - if (RegOpenKeyExW(root, Desktop_NameSpaceW, 0, KEY_READ, &hkey)) + if (RegOpenKeyExW(root, L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Desktop\\Namespace", 0, KEY_READ, &hkey)) return; size = ARRAY_SIZE(guid); @@ -300,8 +291,8 @@ static void add_shell_namespace_extensions(IEnumIDListImpl *list, HKEY root) DWORD attributes, value_size = sizeof(attributes); /* Check if extension is configured as nonenumerable */ - swprintf(clsidkeyW, ARRAY_SIZE(clsidkeyW), clsidfmtW, guid); - RegGetValueW(HKEY_CLASSES_ROOT, clsidkeyW, attributesW, RRF_RT_REG_DWORD | RRF_ZEROONFAILURE, + swprintf(clsidkeyW, ARRAY_SIZE(clsidkeyW), L"CLSID\\%s\\ShellFolder", guid); + RegGetValueW(HKEY_CLASSES_ROOT, clsidkeyW, L"Attributes", RRF_RT_REG_DWORD | RRF_ZEROONFAILURE, NULL, &attributes, &value_size); if (!(attributes & SFGAO_NONENUMERATED)) @@ -628,21 +619,13 @@ static HRESULT WINAPI ISF_Desktop_fnGetDisplayNameOf (IShellFolder2 * iface, else { /* get the "WantsFORPARSING" flag from the registry */ - static const WCHAR clsidW[] = - { 'C','L','S','I','D','\\',0 }; - static const WCHAR shellfolderW[] = - { '\\','s','h','e','l','l','f','o','l','d','e','r',0 }; - static const WCHAR wantsForParsingW[] = - { 'W','a','n','t','s','F','o','r','P','a','r','s','i','n', - 'g',0 }; WCHAR szRegPath[100]; LONG r; - lstrcpyW (szRegPath, clsidW); + lstrcpyW (szRegPath, L"CLSID\\"); SHELL32_GUIDToStringW (clsid, &szRegPath[6]); - lstrcatW (szRegPath, shellfolderW); - r = SHGetValueW(HKEY_CLASSES_ROOT, szRegPath, - wantsForParsingW, NULL, NULL, NULL); + lstrcatW (szRegPath, L"\\shellfolder"); + r = SHGetValueW(HKEY_CLASSES_ROOT, szRegPath, L"WantsForParsing", NULL, NULL, NULL); if (r == ERROR_SUCCESS) bWantsForParsing = TRUE; else diff --git a/dlls/shell32/shfldr_fs.c b/dlls/shell32/shfldr_fs.c index 0b680be046b..64571200493 100644 --- a/dlls/shell32/shfldr_fs.c +++ b/dlls/shell32/shfldr_fs.c @@ -226,9 +226,6 @@ static ULONG WINAPI IShellFolder_fnRelease(IShellFolder2 *iface) */ LPITEMIDLIST SHELL32_CreatePidlFromBindCtx(IBindCtx *pbc, LPCWSTR path) { - static WCHAR szfsbc[] = { - 'F','i','l','e',' ','S','y','s','t','e','m',' ', - 'B','i','n','d',' ','D','a','t','a',0 }; IFileSystemBindData *fsbd = NULL; LPITEMIDLIST pidl = NULL; IUnknown *unk = NULL; @@ -240,7 +237,7 @@ LPITEMIDLIST SHELL32_CreatePidlFromBindCtx(IBindCtx *pbc, LPCWSTR path) return NULL; /* see if the caller bound File System Bind Data */ - r = IBindCtx_GetObjectParam( pbc, szfsbc, &unk ); + r = IBindCtx_GetObjectParam( pbc, (WCHAR *)L"File System Bind Data", &unk ); if (FAILED(r)) return NULL; @@ -295,7 +292,6 @@ IShellFolder_fnParseDisplayName (IShellFolder2 * iface, DWORD * pchEaten, LPITEMIDLIST * ppidl, DWORD * pdwAttributes) { - static const WCHAR unix_root[] = {'\\','\\','?','\\','u','n','i','x','\\',0}; IGenericSFImpl *This = impl_from_IShellFolder2(iface); HRESULT hr = S_OK; @@ -317,12 +313,10 @@ IShellFolder_fnParseDisplayName (IShellFolder2 * iface, if (pbc) { - static WCHAR dataW[] = {'F','i','l','e',' ','S','y','s','t','e','m',' ', - 'B','i','n','d',' ','D','a','t','a',0 }; IUnknown *unk; /* see if the caller bound File System Bind Data */ - if (SUCCEEDED( IBindCtx_GetObjectParam( pbc, dataW, &unk ))) + if (SUCCEEDED( IBindCtx_GetObjectParam( pbc, (WCHAR *)L"File System Bind Data", &unk ))) { IUnknown_QueryInterface( unk, &IID_IFileSystemBindData, (void**)&fsbd ); IUnknown_Release( unk ); @@ -343,7 +337,7 @@ IShellFolder_fnParseDisplayName (IShellFolder2 * iface, lstrcpynW( szPath + len, lpszDisplayName + 1, MAX_PATH - len ); for (p = szPath + len; *p; p++) if (*p == '/') *p = '\\'; } - else if (!wcsnicmp( lpszDisplayName, unix_root, 9 )) + else if (!wcsnicmp( lpszDisplayName, L"\\\\?\\unix\\", 9 )) { lstrcpynW( szPath + len, lpszDisplayName + 9, MAX_PATH - len ); if ((p = wcschr( szPath + len, '\\' ))) @@ -352,7 +346,7 @@ IShellFolder_fnParseDisplayName (IShellFolder2 * iface, } /* Special case for the root folder. */ - if (!wcsicmp( szPath, unix_root )) + if (!wcsicmp( szPath, L"\\\\?\\unix\\" )) { *ppidl = SHAlloc(sizeof(USHORT)); if (!*ppidl) return E_FAIL; @@ -594,16 +588,6 @@ IShellFolder_fnGetAttributesOf (IShellFolder2 * iface, UINT cidl, static HRESULT SHELL32_CreateExtensionUIObject(IShellFolder2 *iface, LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppvOut) { - static const WCHAR reg_blockedW[] = {'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','\\', - 'S','h','e','l','l',' ','E','x','t','e','n','s','i','o','n','s','\\', - 'B','l','o','c','k','e','d',0}; - static const WCHAR formatW[] = {'.','%','s','\\','S','h','e','l','l','E','x','\\', - '{','%','0','8','x','-','%','0','4','x','-','%','0','4','x','-', - '%','0','2','x','%','0','2','x','-','%','0','2','x','%','0','2','x', - '%','0','2','x','%','0','2','x','%','0','2','x','%','0','2','x','}',0}; - IPersistFile *persist_file; char extensionA[20]; WCHAR extensionW[20], buf[MAX_PATH]; @@ -620,7 +604,8 @@ static HRESULT SHELL32_CreateExtensionUIObject(IShellFolder2 *iface, MultiByteToWideChar(CP_ACP, 0, extensionA, -1, extensionW, 20); - swprintf(buf, ARRAY_SIZE(buf), formatW, extensionW, riid->Data1, riid->Data2, riid->Data3, + swprintf(buf, ARRAY_SIZE(buf), L".%s\\ShellEx\\{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}", + extensionW, riid->Data1, riid->Data2, riid->Data3, riid->Data4[0], riid->Data4[1], riid->Data4[2], riid->Data4[3], riid->Data4[4], riid->Data4[5], riid->Data4[6], riid->Data4[7]); @@ -628,7 +613,7 @@ static HRESULT SHELL32_CreateExtensionUIObject(IShellFolder2 *iface, NULL, buf, &size) != ERROR_SUCCESS) return S_FALSE; - if(RegCreateKeyExW(HKEY_LOCAL_MACHINE, reg_blockedW, 0, 0, 0, + if(RegCreateKeyExW(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Blocked", 0, 0, 0, KEY_READ, NULL, &key, NULL) != ERROR_SUCCESS) return E_FAIL; if(RegQueryValueExW(key, buf, 0, NULL, NULL, NULL) @@ -636,7 +621,7 @@ static HRESULT SHELL32_CreateExtensionUIObject(IShellFolder2 *iface, return E_ACCESSDENIED; RegCloseKey(key); - if(RegCreateKeyExW(HKEY_CURRENT_USER, reg_blockedW, 0, 0, 0, + if(RegCreateKeyExW(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Blocked", 0, 0, 0, KEY_READ, NULL, &key, NULL) != ERROR_SUCCESS) return E_FAIL; if(RegQueryValueExW(key, buf, 0, NULL, NULL, NULL) @@ -756,15 +741,6 @@ IShellFolder_fnGetUIObjectOf (IShellFolder2 * iface, return hr; } -static const WCHAR AdvancedW[] = { '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','\\','A','d','v','a','n','c','e','d',0 }; -static const WCHAR HideFileExtW[] = { 'H','i','d','e','F','i','l','e','E','x', - 't',0 }; -static const WCHAR NeverShowExtW[] = { 'N','e','v','e','r','S','h','o','w','E', - 'x','t',0 }; - /****************************************************************************** * SHELL_FS_HideExtension [Internal] * @@ -784,9 +760,10 @@ static BOOL SHELL_FS_HideExtension(LPCWSTR szPath) DWORD dwData; DWORD dwDataSize = sizeof (DWORD); BOOL doHide = FALSE; /* The default value is FALSE (win98 at least) */ - - if (!RegCreateKeyExW(HKEY_CURRENT_USER, AdvancedW, 0, 0, 0, KEY_ALL_ACCESS, 0, &hKey, 0)) { - if (!RegQueryValueExW(hKey, HideFileExtW, 0, 0, (LPBYTE) &dwData, &dwDataSize)) + + if (!RegCreateKeyExW(HKEY_CURRENT_USER, L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced", + 0, 0, 0, KEY_ALL_ACCESS, 0, &hKey, 0)) { + if (!RegQueryValueExW(hKey, L"HideFileExt", 0, 0, (LPBYTE) &dwData, &dwDataSize)) doHide = dwData; RegCloseKey (hKey); } @@ -800,7 +777,7 @@ static BOOL SHELL_FS_HideExtension(LPCWSTR szPath) if (!RegQueryValueW(HKEY_CLASSES_ROOT, ext, classname, &classlen)) if (!RegOpenKeyW(HKEY_CLASSES_ROOT, classname, &hKey)) { - if (!RegQueryValueExW(hKey, NeverShowExtW, 0, NULL, NULL, NULL)) + if (!RegQueryValueExW(hKey, L"NeverShowExt", 0, NULL, NULL, NULL)) doHide = TRUE; RegCloseKey(hKey); } @@ -821,7 +798,6 @@ void SHELL_FS_ProcessDisplayFilename(LPWSTR szPath, DWORD dwFlags) static void get_display_name( WCHAR dest[MAX_PATH], const WCHAR *path, LPCITEMIDLIST pidl, BOOL is_unix ) { - static const WCHAR unix_root[] = {'\\','\\','?','\\','u','n','i','x','\\',0}; char *buffer; WCHAR *res; DWORD i, len; @@ -829,7 +805,7 @@ static void get_display_name( WCHAR dest[MAX_PATH], const WCHAR *path, LPCITEMID lstrcpynW( dest, path, MAX_PATH ); /* try to get a better path than the \\?\unix one */ - if (!wcsnicmp( path, unix_root, 9 )) + if (!wcsnicmp( path, L"\\\\?\\unix\\", 9 )) { if (!is_unix) { @@ -949,7 +925,6 @@ static HRESULT WINAPI IShellFolder_fnSetNameOf (IShellFolder2 * iface, DWORD dwFlags, LPITEMIDLIST * pPidlOut) { - static const WCHAR invalid_chars[] = { '\\','/',':','*','?','"','<','>','|',0 }; IGenericSFImpl *This = impl_from_IShellFolder2(iface); WCHAR szSrc[MAX_PATH + 1], szDest[MAX_PATH + 1]; LPWSTR ptr; @@ -961,7 +936,7 @@ static HRESULT WINAPI IShellFolder_fnSetNameOf (IShellFolder2 * iface, /* pidl has to contain a single non-empty SHITEMID */ if (_ILIsDesktop(pidl) || !_ILIsPidlSimple(pidl) || !_ILGetTextPointer(pidl)) return E_INVALIDARG; - if (wcspbrk( lpName, invalid_chars )) return HRESULT_FROM_WIN32(ERROR_CANCELLED); + if (wcspbrk( lpName, L"\\/:*?\"<>|" )) return HRESULT_FROM_WIN32(ERROR_CANCELLED); /* build source path */ lstrcpynW(szSrc, This->sPathTarget, MAX_PATH); @@ -1142,7 +1117,6 @@ ISFHelper_fnGetUniqueName (ISFHelper * iface, LPWSTR pwszName, UINT uLen) HRESULT hr; WCHAR wszText[MAX_PATH]; WCHAR wszNewFolder[25]; - static const WCHAR wszFormat[] = {'%','s',' ','%','d',0 }; TRACE ("(%p)(%p %u)\n", This, pwszName, uLen); @@ -1165,7 +1139,7 @@ next: dwFetched) { _ILSimpleGetTextW (pidl, wszText, MAX_PATH); if (0 == lstrcmpiW (wszText, pwszName)) { - swprintf (pwszName, uLen, wszFormat, wszNewFolder, i++); + swprintf (pwszName, uLen, L"%s %d", wszNewFolder, i++); if (i > 99) { hr = E_FAIL; break; @@ -1494,11 +1468,7 @@ IFSFldr_PersistFolder3_Initialize (IPersistFolder3 * iface, LPCITEMIDLIST pidl) if (!SHGetSpecialFolderPathW( 0, wszTemp, CSIDL_PERSONAL, FALSE )) return E_FAIL; PathAddBackslashW( wszTemp ); } - else - { - static const WCHAR unix_root[] = {'\\','\\','?','\\','u','n','i','x','\\',0}; - lstrcpyW( wszTemp, unix_root ); - } + else lstrcpyW( wszTemp, L"\\\\?\\unix\\" ); } else SHGetPathFromIDListW( pidl, wszTemp ); @@ -1668,8 +1638,6 @@ static HRESULT WINAPI PersistPropertyBag_Load(IPersistPropertyBag *iface, IPropertyBag *pPropertyBag, IErrorLog *pErrorLog) { IGenericSFImpl *This = impl_from_IPersistPropertyBag(iface); - - static const WCHAR wszTarget[] = { 'T','a','r','g','e','t', 0 }; PERSIST_FOLDER_TARGET_INFO pftiTarget; VARIANT var; HRESULT hr; @@ -1681,7 +1649,7 @@ static HRESULT WINAPI PersistPropertyBag_Load(IPersistPropertyBag *iface, /* Get 'Target' property from the property bag. */ V_VT(&var) = VT_BSTR; - hr = IPropertyBag_Read(pPropertyBag, wszTarget, &var, NULL); + hr = IPropertyBag_Read(pPropertyBag, L"Target", &var, NULL); if (FAILED(hr)) return E_FAIL; lstrcpyW(pftiTarget.szTargetParsingName, V_BSTR(&var)); diff --git a/dlls/shell32/shfldr_mycomp.c b/dlls/shell32/shfldr_mycomp.c index 004de03a088..c5004671f47 100644 --- a/dlls/shell32/shfldr_mycomp.c +++ b/dlls/shell32/shfldr_mycomp.c @@ -242,13 +242,6 @@ static HRESULT WINAPI ISF_MyComputer_fnParseDisplayName (IShellFolder2 *iface, /* retrieve a map of drives that should be displayed */ static DWORD get_drive_map(void) { - static const WCHAR policiesW[] = {'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','\\', - 'P','o','l','i','c','i','e','s','\\', - 'E','x','p','l','o','r','e','r',0}; - static const WCHAR nodrivesW[] = {'N','o','D','r','i','v','e','s',0}; static DWORD drive_mask; static BOOL init_done = FALSE; @@ -257,17 +250,17 @@ static DWORD get_drive_map(void) DWORD type, size, data, mask = 0; HKEY hkey; - if (!RegOpenKeyW( HKEY_LOCAL_MACHINE, policiesW, &hkey )) + if (!RegOpenKeyW( HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer", &hkey )) { size = sizeof(data); - if (!RegQueryValueExW( hkey, nodrivesW, NULL, &type, (LPBYTE)&data, &size ) && type == REG_DWORD) + if (!RegQueryValueExW( hkey, L"NoDrives", NULL, &type, (LPBYTE)&data, &size ) && type == REG_DWORD) mask |= data; RegCloseKey( hkey ); } - if (!RegOpenKeyW( HKEY_CURRENT_USER, policiesW, &hkey )) + if (!RegOpenKeyW( HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer", &hkey )) { size = sizeof(data); - if (!RegQueryValueExW( hkey, nodrivesW, NULL, &type, (LPBYTE)&data, &size ) && type == REG_DWORD) + if (!RegQueryValueExW( hkey, L"NoDrives", NULL, &type, (LPBYTE)&data, &size ) && type == REG_DWORD) mask |= data; RegCloseKey( hkey ); } @@ -281,12 +274,6 @@ static DWORD get_drive_map(void) /************************************************************************** * CreateMyCompEnumList() */ -static const WCHAR MyComputer_NameSpaceW[] = { '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','\\','M','y','C','o','m','p','u','t','e','r','\\','N','a','m', - 'e','s','p','a','c','e','\0' }; - static BOOL CreateMyCompEnumList(IEnumIDListImpl *list, DWORD dwFlags) { BOOL ret = TRUE; @@ -296,7 +283,7 @@ static BOOL CreateMyCompEnumList(IEnumIDListImpl *list, DWORD dwFlags) /* enumerate the folders */ if (dwFlags & SHCONTF_FOLDERS) { - WCHAR wszDriveName[] = {'A', ':', '\\', '\0'}; + WCHAR wszDriveName[] = L"A:\\"; DWORD dwDrivemap = get_drive_map(); HKEY hkey; UINT i; @@ -312,7 +299,8 @@ static BOOL CreateMyCompEnumList(IEnumIDListImpl *list, DWORD dwFlags) TRACE("-- (%p)-> enumerate (mycomputer shell extensions)\n",list); for (i=0; i<2; i++) { if (ret && !RegOpenKeyExW(i == 0 ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, - MyComputer_NameSpaceW, 0, KEY_READ, &hkey)) + L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\MyComputer\\Namespace", + 0, KEY_READ, &hkey)) { WCHAR iid[50]; int i=0; @@ -613,13 +601,6 @@ static HRESULT WINAPI ISF_MyComputer_fnGetDisplayNameOf (IShellFolder2 *iface, { if ((GET_SHGDN_FOR (dwFlags) & (SHGDN_FORPARSING | SHGDN_FORADDRESSBAR)) == SHGDN_FORPARSING) { - static const WCHAR clsidW[] = - { 'C','L','S','I','D','\\',0 }; - static const WCHAR shellfolderW[] = - { '\\','s','h','e','l','l','f','o','l','d','e','r',0 }; - static const WCHAR wantsForParsingW[] = - { 'W','a','n','t','s','F','o','r','P','a','r','s','i','n', - 'g',0 }; BOOL bWantsForParsing = FALSE; WCHAR szRegPath[100]; LONG r; @@ -635,11 +616,10 @@ static HRESULT WINAPI ISF_MyComputer_fnGetDisplayNameOf (IShellFolder2 *iface, * Get the "WantsFORPARSING" flag from the registry */ - lstrcpyW (szRegPath, clsidW); + lstrcpyW (szRegPath, L"CLSID\\"); SHELL32_GUIDToStringW (clsid, &szRegPath[6]); - lstrcatW (szRegPath, shellfolderW); - r = SHGetValueW (HKEY_CLASSES_ROOT, szRegPath, - wantsForParsingW, NULL, NULL, NULL); + lstrcatW (szRegPath, L"\\shellfolder"); + r = SHGetValueW (HKEY_CLASSES_ROOT, szRegPath, L"WantsForParsing", NULL, NULL, NULL); if (r == ERROR_SUCCESS) bWantsForParsing = TRUE; @@ -690,15 +670,13 @@ static HRESULT WINAPI ISF_MyComputer_fnGetDisplayNameOf (IShellFolder2 *iface, /* long view "lw_name (C:)" */ if (!(dwFlags & SHGDN_FORPARSING)) { - static const WCHAR wszOpenBracket[] = {' ','(',0}; - static const WCHAR wszCloseBracket[] = {')',0}; WCHAR wszDrive[32 /* label */ + 6 /* ' (C:)'\0 */] = {0}; GetVolumeInformationW (pszPath, wszDrive, ARRAY_SIZE(wszDrive) - 5, NULL, NULL, NULL, NULL, 0); - lstrcatW (wszDrive, wszOpenBracket); + lstrcatW (wszDrive, L" ("); lstrcpynW (wszDrive + lstrlenW(wszDrive), pszPath, 3); - lstrcatW (wszDrive, wszCloseBracket); + lstrcatW (wszDrive, L")"); lstrcpyW (pszPath, wszDrive); } } diff --git a/dlls/shell32/shfldr_netplaces.c b/dlls/shell32/shfldr_netplaces.c index 460fa4745c9..8d98ae76e16 100644 --- a/dlls/shell32/shfldr_netplaces.c +++ b/dlls/shell32/shfldr_netplaces.c @@ -177,13 +177,11 @@ static HRESULT WINAPI ISF_NetworkPlaces_fnParseDisplayName (IShellFolder2 * ifac HWND hwndOwner, LPBC pbcReserved, LPOLESTR lpszDisplayName, DWORD * pchEaten, LPITEMIDLIST * ppidl, DWORD * pdwAttributes) { - static const WCHAR wszEntireNetwork[] = {'E','n','t','i','r','e','N','e','t','w','o','r','k'}; /* not nul-terminated */ IGenericSFImpl *This = impl_from_IShellFolder2(iface); HRESULT hr = E_INVALIDARG; LPCWSTR szNext = NULL; WCHAR szElement[MAX_PATH]; LPITEMIDLIST pidlTemp = NULL; - int len; TRACE ("(%p)->(HWND=%p,%p,%p=%s,%p,pidl=%p,%p)\n", This, hwndOwner, pbcReserved, lpszDisplayName, debugstr_w (lpszDisplayName), @@ -192,8 +190,7 @@ static HRESULT WINAPI ISF_NetworkPlaces_fnParseDisplayName (IShellFolder2 * ifac *ppidl = NULL; szNext = GetNextElementW (lpszDisplayName, szElement, MAX_PATH); - len = lstrlenW(szElement); - if (len == ARRAY_SIZE(wszEntireNetwork) && !wcsnicmp(szElement, wszEntireNetwork, ARRAY_SIZE(wszEntireNetwork))) + if (!wcsicmp(szElement, L"EntireNetwork")) { pidlTemp = _ILCreateEntireNetwork(); if (pidlTemp) diff --git a/dlls/shell32/shlexec.c b/dlls/shell32/shlexec.c index ba393ad7794..c385c26e1e6 100644 --- a/dlls/shell32/shlexec.c +++ b/dlls/shell32/shlexec.c @@ -44,13 +44,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(exec); -static const WCHAR wszOpen[] = {'o','p','e','n',0}; -static const WCHAR wszExe[] = {'.','e','x','e',0}; -static const WCHAR wszILPtr[] = {':','%','p',0}; -static const WCHAR wszShell[] = {'\\','s','h','e','l','l','\\',0}; -static const WCHAR wszFolder[] = {'F','o','l','d','e','r',0}; -static const WCHAR wszEmpty[] = {0}; - #define SEE_MASK_CLASSALL (SEE_MASK_CLASSNAME | SEE_MASK_CLASSKEY) typedef UINT_PTR (*SHELL_ExecuteW32)(const WCHAR *lpCmd, WCHAR *env, BOOL shWait, @@ -152,7 +145,7 @@ static BOOL SHELL_ArgifyW(WCHAR* out, int len, const WCHAR* fmt, const WCHAR* lp if (!done || (*fmt == '1')) { /*FIXME Is the call to SearchPathW() really needed? We already have separated out the parameter string in args. */ - if (SearchPathW(NULL, lpFile, wszExe, ARRAY_SIZE(xlpFile), xlpFile, NULL)) + if (SearchPathW(NULL, lpFile, L".exe", ARRAY_SIZE(xlpFile), xlpFile, NULL)) cmd = xlpFile; else cmd = lpFile; @@ -195,7 +188,7 @@ static BOOL SHELL_ArgifyW(WCHAR* out, int len, const WCHAR* fmt, const WCHAR* lp LPVOID pv; HGLOBAL hmem = SHAllocShared(pidl, ILGetSize(pidl), 0); pv = SHLockShared(hmem, 0); - chars = swprintf(buf, ARRAY_SIZE(buf), wszILPtr, pv); + chars = swprintf(buf, ARRAY_SIZE(buf), L":%p", pv); if (chars >= ARRAY_SIZE(buf)) ERR("pidl format buffer too small!\n"); used += chars; @@ -373,7 +366,6 @@ static UINT_PTR SHELL_ExecuteW(const WCHAR *lpCmd, WCHAR *env, BOOL shWait, */ static void *SHELL_BuildEnvW( const WCHAR *path ) { - static const WCHAR wPath[] = {'P','A','T','H','=',0}; WCHAR *strings, *new_env; WCHAR *p, *p2; int total = lstrlenW(path) + 1; @@ -384,7 +376,7 @@ static void *SHELL_BuildEnvW( const WCHAR *path ) while (*p) { int len = lstrlenW(p) + 1; - if (!wcsnicmp( p, wPath, 5 )) got_path = TRUE; + if (!wcsnicmp( p, L"PATH=", 5 )) got_path = TRUE; total += len; p += len; } @@ -402,7 +394,7 @@ static void *SHELL_BuildEnvW( const WCHAR *path ) { int len = lstrlenW(p) + 1; memcpy( p2, p, len * sizeof(WCHAR) ); - if (!wcsnicmp( p, wPath, 5 )) + if (!wcsnicmp( p, L"PATH=", 5 )) { p2[len - 1] = ';'; lstrcpyW( p2 + len, path ); @@ -413,7 +405,7 @@ static void *SHELL_BuildEnvW( const WCHAR *path ) } if (!got_path) { - lstrcpyW( p2, wPath ); + lstrcpyW( p2, L"PATH=" ); lstrcatW( p2, path ); p2 += lstrlenW(p2) + 1; } @@ -433,9 +425,6 @@ static void *SHELL_BuildEnvW( const WCHAR *path ) */ static BOOL SHELL_TryAppPathW( LPCWSTR szName, LPWSTR lpResult, WCHAR **env) { - static const WCHAR wszKeyAppPaths[] = {'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','\\','A','p','p',' ','P','a','t','h','s','\\',0}; - static const WCHAR wPath[] = {'P','a','t','h',0}; HKEY hkApp = 0; WCHAR buffer[1024]; LONG len; @@ -443,7 +432,7 @@ static BOOL SHELL_TryAppPathW( LPCWSTR szName, LPWSTR lpResult, WCHAR **env) BOOL found = FALSE; if (env) *env = NULL; - lstrcpyW(buffer, wszKeyAppPaths); + lstrcpyW(buffer, L"Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\"); lstrcatW(buffer, szName); res = RegOpenKeyExW(HKEY_LOCAL_MACHINE, buffer, 0, KEY_READ, &hkApp); if (res) goto end; @@ -456,7 +445,7 @@ static BOOL SHELL_TryAppPathW( LPCWSTR szName, LPWSTR lpResult, WCHAR **env) if (env) { DWORD count = sizeof(buffer); - if (!RegQueryValueExW(hkApp, wPath, NULL, NULL, (LPBYTE)buffer, &count) && buffer[0]) + if (!RegQueryValueExW(hkApp, L"Path", NULL, NULL, (LPBYTE)buffer, &count) && buffer[0]) *env = SHELL_BuildEnvW( buffer ); } @@ -485,7 +474,6 @@ end: */ static UINT SHELL_FindExecutableByVerb(LPCWSTR lpVerb, LPWSTR key, LPWSTR classname, LPWSTR command, LONG commandlen) { - static const WCHAR wCommand[] = {'\\','c','o','m','m','a','n','d',0}; HKEY hkeyClass; WCHAR verb[MAX_PATH]; @@ -496,9 +484,9 @@ static UINT SHELL_FindExecutableByVerb(LPCWSTR lpVerb, LPWSTR key, LPWSTR classn RegCloseKey(hkeyClass); /* Looking for ...buffer\shell\\command */ - lstrcatW(classname, wszShell); + lstrcatW(classname, L"\\shell\\"); lstrcatW(classname, verb); - lstrcatW(classname, wCommand); + lstrcatW(classname, L"\\command"); if (RegQueryValueW(HKEY_CLASSES_ROOT, classname, command, &commandlen) == ERROR_SUCCESS) @@ -509,7 +497,6 @@ static UINT SHELL_FindExecutableByVerb(LPCWSTR lpVerb, LPWSTR key, LPWSTR classn LPWSTR tmp; WCHAR param[256]; LONG paramlen = sizeof(param); - static const WCHAR wSpace[] = {' ',0}; /* FIXME: it seems all Windows version don't behave the same here. * the doc states that this ddeexec information can be found after @@ -518,14 +505,14 @@ static UINT SHELL_FindExecutableByVerb(LPCWSTR lpVerb, LPWSTR key, LPWSTR classn */ /* Get the parameters needed by the application from the associated ddeexec key */ - tmp = wcsstr(classname, wCommand); + tmp = wcsstr(classname, L"\\command"); tmp[0] = '\0'; lstrcatW(classname, wDdeexec); if (RegQueryValueW(HKEY_CLASSES_ROOT, classname, param, ¶mlen) == ERROR_SUCCESS) { paramlen /= sizeof(WCHAR); - lstrcatW(command, wSpace); + lstrcatW(command, L" "); lstrcatW(command, param); commandlen += paramlen; } @@ -556,9 +543,6 @@ static UINT SHELL_FindExecutableByVerb(LPCWSTR lpVerb, LPWSTR key, LPWSTR classn static UINT SHELL_FindExecutable(LPCWSTR lpPath, LPCWSTR lpFile, LPCWSTR lpVerb, LPWSTR lpResult, int resultLen, LPWSTR key, WCHAR **env, LPITEMIDLIST pidl, LPCWSTR args) { - static const WCHAR wWindows[] = {'w','i','n','d','o','w','s',0}; - static const WCHAR wPrograms[] = {'p','r','o','g','r','a','m','s',0}; - static const WCHAR wExtensions[] = {'e','x','e',' ','p','i','f',' ','b','a','t',' ','c','m','d',' ','c','o','m',0}; WCHAR *extension = NULL; /* pointer to file extension */ WCHAR classname[256]; /* registry name for this file type */ LONG classnamelen = sizeof(classname); /* length of above */ @@ -592,13 +576,13 @@ static UINT SHELL_FindExecutable(LPCWSTR lpPath, LPCWSTR lpFile, LPCWSTR lpVerb, return 33; } - if (SearchPathW(lpPath, lpFile, wszExe, ARRAY_SIZE(xlpFile), xlpFile, NULL)) + if (SearchPathW(lpPath, lpFile, L".exe", ARRAY_SIZE(xlpFile), xlpFile, NULL)) { TRACE("SearchPathW returned non-zero\n"); lpFile = xlpFile; /* The file was found in the application-supplied default directory (or the system search path) */ } - else if (lpPath && SearchPathW(NULL, lpFile, wszExe, ARRAY_SIZE(xlpFile), xlpFile, NULL)) + else if (lpPath && SearchPathW(NULL, lpFile, L".exe", ARRAY_SIZE(xlpFile), xlpFile, NULL)) { TRACE("SearchPathW returned non-zero\n"); lpFile = xlpFile; @@ -608,7 +592,7 @@ static UINT SHELL_FindExecutable(LPCWSTR lpPath, LPCWSTR lpFile, LPCWSTR lpVerb, attribs = GetFileAttributesW(lpFile); if (attribs!=INVALID_FILE_ATTRIBUTES && (attribs&FILE_ATTRIBUTE_DIRECTORY)) { - lstrcpyW(classname, wszFolder); + lstrcpyW(classname, L"Folder"); } else { @@ -641,7 +625,7 @@ static UINT SHELL_FindExecutable(LPCWSTR lpPath, LPCWSTR lpFile, LPCWSTR lpVerb, /* See if it's a program - if GetProfileString fails, we skip this * section. Actually, if GetProfileString fails, we've probably * got a lot more to worry about than running a program... */ - if (GetProfileStringW(wWindows, wPrograms, wExtensions, wBuffer, ARRAY_SIZE(wBuffer)) > 0) + if (GetProfileStringW(L"windows", L"programs", L"exe pif bat cmd com", wBuffer, ARRAY_SIZE(wBuffer)) > 0) { CharLowerW(wBuffer); tok = wBuffer; @@ -719,11 +703,9 @@ static UINT SHELL_FindExecutable(LPCWSTR lpPath, LPCWSTR lpFile, LPCWSTR lpVerb, } else /* Check win.ini */ { - static const WCHAR wExtensions[] = {'e','x','t','e','n','s','i','o','n','s',0}; - /* Toss the leading dot */ extension++; - if (GetProfileStringW(wExtensions, extension, wszEmpty, command, ARRAY_SIZE(command)) > 0) + if (GetProfileStringW(L"extensions", extension, L"", command, ARRAY_SIZE(command)) > 0) { if (*command) { @@ -776,8 +758,6 @@ static unsigned dde_connect(const WCHAR* key, const WCHAR* start, WCHAR* ddeexec LPCWSTR szCommandline, LPITEMIDLIST pidl, SHELL_ExecuteW32 execfunc, const SHELLEXECUTEINFOW *psei, LPSHELLEXECUTEINFOW psei_out) { - static const WCHAR wApplication[] = {'\\','a','p','p','l','i','c','a','t','i','o','n',0}; - static const WCHAR wTopic[] = {'\\','t','o','p','i','c',0}; WCHAR regkey[256]; WCHAR * endkey = regkey + lstrlenW(key); WCHAR app[256], topic[256], ifexec[256], static_res[256]; @@ -801,18 +781,16 @@ static unsigned dde_connect(const WCHAR* key, const WCHAR* start, WCHAR* ddeexec } lstrcpyW(regkey, key); endkeyLen = ARRAY_SIZE(regkey) - (endkey - regkey); - if (lstrlenW(wApplication) + 1 > endkeyLen) + if (lstrlenW(L"\\application") + 1 > endkeyLen) { - FIXME("endkey %s overruns buffer\n", debugstr_w(wApplication)); + FIXME("endkey overruns buffer\n"); return 2; } - lstrcpyW(endkey, wApplication); + lstrcpyW(endkey, L"\\application"); applen = sizeof(app); if (RegQueryValueW(HKEY_CLASSES_ROOT, regkey, app, &applen) != ERROR_SUCCESS) { WCHAR command[1024], fullpath[MAX_PATH]; - static const WCHAR wSo[] = { '.','s','o',0 }; - int sizeSo = ARRAY_SIZE(wSo); LPWSTR ptr = NULL; DWORD ret = 0; @@ -828,7 +806,7 @@ static unsigned dde_connect(const WCHAR* key, const WCHAR* start, WCHAR* ddeexec lstrcpyW(command, start+1); if ((ptr = wcschr(command, '"'))) *ptr = 0; - ret = SearchPathW(NULL, command, wszExe, ARRAY_SIZE(fullpath), fullpath, &ptr); + ret = SearchPathW(NULL, command, L".exe", ARRAY_SIZE(fullpath), fullpath, &ptr); } else { @@ -839,11 +817,11 @@ static unsigned dde_connect(const WCHAR* key, const WCHAR* start, WCHAR* ddeexec int idx = space-start; memcpy(command, start, idx*sizeof(WCHAR)); command[idx] = '\0'; - if ((ret = SearchPathW(NULL, command, wszExe, ARRAY_SIZE(fullpath), fullpath, &ptr))) + if ((ret = SearchPathW(NULL, command, L".exe", ARRAY_SIZE(fullpath), fullpath, &ptr))) break; } if (!ret) - ret = SearchPathW(NULL, start, wszExe, ARRAY_SIZE(fullpath), fullpath, &ptr); + ret = SearchPathW(NULL, start, L".exe", ARRAY_SIZE(fullpath), fullpath, &ptr); } if (!ret) @@ -859,9 +837,8 @@ static unsigned dde_connect(const WCHAR* key, const WCHAR* start, WCHAR* ddeexec lstrcpyW(app, ptr); /* Remove extensions (including .so) */ - ptr = app + lstrlenW(app) - (sizeSo-1); - if (lstrlenW(app) >= sizeSo && - !wcscmp(ptr, wSo)) + ptr = app + lstrlenW(app) - 3; + if (ptr > app && !wcscmp(ptr, L".so")) *ptr = 0; ptr = wcsrchr(app, '.'); @@ -869,18 +846,15 @@ static unsigned dde_connect(const WCHAR* key, const WCHAR* start, WCHAR* ddeexec *ptr = 0; } - if (lstrlenW(wTopic) + 1 > endkeyLen) + if (lstrlenW(L"\\topic") + 1 > endkeyLen) { - FIXME("endkey %s overruns buffer\n", debugstr_w(wTopic)); + FIXME("endkey overruns buffer\n"); return 2; } - lstrcpyW(endkey, wTopic); + lstrcpyW(endkey, L"\\topic"); topiclen = sizeof(topic); if (RegQueryValueW(HKEY_CLASSES_ROOT, regkey, topic, &topiclen) != ERROR_SUCCESS) - { - static const WCHAR wSystem[] = {'S','y','s','t','e','m',0}; - lstrcpyW(topic, wSystem); - } + lstrcpyW(topic, L"System"); if (unicode) { @@ -900,7 +874,6 @@ static unsigned dde_connect(const WCHAR* key, const WCHAR* start, WCHAR* ddeexec exec = ddeexec; if (!hConv) { - static const WCHAR wIfexec[] = {'\\','i','f','e','x','e','c',0}; TRACE("Launching %s\n", debugstr_w(start)); ret = execfunc(start, env, TRUE, psei, psei_out); if (ret <= 32) @@ -916,12 +889,12 @@ static unsigned dde_connect(const WCHAR* key, const WCHAR* start, WCHAR* ddeexec SetLastError(ERROR_DDE_FAIL); return 30; /* whatever */ } - if (lstrlenW(wIfexec) + 1 > endkeyLen) + if (lstrlenW(L"\\ifexec") + 1 > endkeyLen) { - FIXME("endkey %s overruns buffer\n", debugstr_w(wIfexec)); + FIXME("endkey overruns buffer\n"); return 2; } - lstrcpyW(endkey, wIfexec); + lstrcpyW(endkey, L"\\ifexec"); ifexeclen = sizeof(ifexec); if (RegQueryValueW(HKEY_CLASSES_ROOT, regkey, ifexec, &ifexeclen) == ERROR_SUCCESS) { @@ -978,8 +951,6 @@ static UINT_PTR execute_from_key(LPCWSTR key, LPCWSTR lpFile, WCHAR *env, LPCWST SHELL_ExecuteW32 execfunc, LPSHELLEXECUTEINFOW psei, LPSHELLEXECUTEINFOW psei_out) { - static const WCHAR wCommand[] = {'c','o','m','m','a','n','d',0}; - static const WCHAR wDdeexec[] = {'d','d','e','e','x','e','c',0}; WCHAR cmd[256], param[1024], ddeexec[256]; LONG cmdlen = sizeof(cmd), ddeexeclen = sizeof(ddeexec); UINT_PTR retval = SE_ERR_NOASSOC; @@ -1009,9 +980,9 @@ static UINT_PTR execute_from_key(LPCWSTR key, LPCWSTR lpFile, WCHAR *env, LPCWST /* Get the parameters needed by the application from the associated ddeexec key */ - tmp = wcsstr(key, wCommand); + tmp = wcsstr(key, L"command"); assert(tmp); - lstrcpyW(tmp, wDdeexec); + lstrcpyW(tmp, L"ddeexec"); if (RegQueryValueW(HKEY_CLASSES_ROOT, key, ddeexec, &ddeexeclen) == ERROR_SUCCESS) { @@ -1094,7 +1065,7 @@ HINSTANCE WINAPI FindExecutableW(LPCWSTR lpFile, LPCWSTR lpDirectory, LPWSTR lpR SetCurrentDirectoryW(lpDirectory); } - retval = SHELL_FindExecutable(lpDirectory, lpFile, wszOpen, res, MAX_PATH, NULL, NULL, NULL, NULL); + retval = SHELL_FindExecutable(lpDirectory, lpFile, L"open", res, MAX_PATH, NULL, NULL, NULL, NULL); if (retval > 32) lstrcpyW(lpResult, res); @@ -1319,8 +1290,6 @@ end: */ static LONG ShellExecute_FromContextMenu( LPSHELLEXECUTEINFOW sei ) { - static const WCHAR szcm[] = { 's','h','e','l','l','e','x','\\', - 'C','o','n','t','e','x','t','M','e','n','u','H','a','n','d','l','e','r','s',0 }; HKEY hkey, hkeycm = 0; WCHAR szguid[39]; HRESULT hr; @@ -1334,7 +1303,7 @@ static LONG ShellExecute_FromContextMenu( LPSHELLEXECUTEINFOW sei ) if ( !hkey ) return ERROR_FUNCTION_FAILED; - r = RegOpenKeyW( hkey, szcm, &hkeycm ); + r = RegOpenKeyW( hkey, L"shellex\\ContextMenuHandlers", &hkeycm ); if ( r == ERROR_SUCCESS ) { i = 0; @@ -1365,8 +1334,6 @@ static UINT_PTR SHELL_quote_and_execute( LPCWSTR wcmd, LPCWSTR wszParameters, LP static UINT_PTR SHELL_execute_class( LPCWSTR wszApplicationName, LPSHELLEXECUTEINFOW psei, LPSHELLEXECUTEINFOW psei_out, SHELL_ExecuteW32 execfunc ) { - static const WCHAR wQuote[] = {'"',0}; - static const WCHAR wSpace[] = {' ',0}; WCHAR execCmd[1024], classname[1024]; /* launch a document by fileclass like 'WordPad.Document.1' */ /* the Commandline contains 'c:\Path\wordpad.exe "%1"' */ @@ -1392,12 +1359,12 @@ static UINT_PTR SHELL_execute_class( LPCWSTR wszApplicationName, LPSHELLEXECUTEI done = SHELL_ArgifyW(wcmd, ARRAY_SIZE(wcmd), execCmd, wszApplicationName, psei->lpIDList, NULL, &resultLen); if (!done && wszApplicationName[0]) { - lstrcatW(wcmd, wSpace); + lstrcatW(wcmd, L" "); if (*wszApplicationName != '"') { - lstrcatW(wcmd, wQuote); + lstrcatW(wcmd, L"\""); lstrcatW(wcmd, wszApplicationName); - lstrcatW(wcmd, wQuote); + lstrcatW(wcmd, L"\""); } else lstrcatW(wcmd, wszApplicationName); @@ -1413,7 +1380,7 @@ static UINT_PTR SHELL_execute_class( LPCWSTR wszApplicationName, LPSHELLEXECUTEI TRACE("SHELL_FindExecutableByVerb returned %u (%s, %s)\n", (unsigned int)rslt, debugstr_w(classname), debugstr_w(execCmd)); if (33 > rslt) return rslt; - rslt = SHELL_quote_and_execute( execCmd, wszEmpty, classname, + rslt = SHELL_quote_and_execute( execCmd, L"", classname, wszApplicationName, NULL, psei, psei_out, execfunc ); return rslt; @@ -1421,7 +1388,6 @@ static UINT_PTR SHELL_execute_class( LPCWSTR wszApplicationName, LPSHELLEXECUTEI static void SHELL_translate_idlist( LPSHELLEXECUTEINFOW sei, LPWSTR wszParameters, DWORD parametersLen, LPWSTR wszApplicationName, DWORD dwApplicationNameLen ) { - static const WCHAR wExplorer[] = {'e','x','p','l','o','r','e','r','.','e','x','e',0}; WCHAR buffer[MAX_PATH]; /* last chance to translate IDList: now also allow CLSID paths */ @@ -1432,10 +1398,10 @@ static void SHELL_translate_idlist( LPSHELLEXECUTEINFOW sei, LPWSTR wszParameter ERR("parameters len exceeds buffer size (%i > %i), truncating\n", lstrlenW(buffer) + 1, parametersLen); lstrcpynW(wszParameters, buffer, parametersLen); - if (lstrlenW(wExplorer) > dwApplicationNameLen) - ERR("application len exceeds buffer size (%i > %i), truncating\n", - lstrlenW(wExplorer) + 1, dwApplicationNameLen); - lstrcpynW(wszApplicationName, wExplorer, dwApplicationNameLen); + if (lstrlenW(L"explorer.exe") > dwApplicationNameLen) + ERR("application len exceeds buffer size (%i), truncating\n", + dwApplicationNameLen); + lstrcpynW(wszApplicationName, L"explorer.exe", dwApplicationNameLen); sei->fMask &= ~SEE_MASK_INVOKEIDLIST; } else { @@ -1448,7 +1414,7 @@ static void SHELL_translate_idlist( LPSHELLEXECUTEINFOW sei, LPWSTR wszParameter attribs = GetFileAttributesW(buffer); if (attribs != INVALID_FILE_ATTRIBUTES && (attribs & FILE_ATTRIBUTE_DIRECTORY) && - HCR_GetExecuteCommandW(0, wszFolder, + HCR_GetExecuteCommandW(0, L"Folder", sei->lpVerb, buffer, sizeof(buffer))) { SHELL_ArgifyW(wszApplicationName, dwApplicationNameLen, @@ -1463,8 +1429,6 @@ static void SHELL_translate_idlist( LPSHELLEXECUTEINFOW sei, LPWSTR wszParameter static UINT_PTR SHELL_quote_and_execute( LPCWSTR wcmd, LPCWSTR wszParameters, LPCWSTR wszKeyname, LPCWSTR wszApplicationName, LPWSTR env, LPSHELLEXECUTEINFOW psei, LPSHELLEXECUTEINFOW psei_out, SHELL_ExecuteW32 execfunc ) { - static const WCHAR wQuote[] = {'"',0}; - static const WCHAR wSpace[] = {' ',0}; UINT_PTR retval; DWORD len; WCHAR *wszQuotedCmd; @@ -1480,11 +1444,11 @@ static UINT_PTR SHELL_quote_and_execute( LPCWSTR wcmd, LPCWSTR wszParameters, LP /* Must quote to handle case where cmd contains spaces, * else security hole if malicious user creates executable file "C:\\Program" */ - lstrcpyW(wszQuotedCmd, wQuote); + lstrcpyW(wszQuotedCmd, L"\""); lstrcatW(wszQuotedCmd, wcmd); - lstrcatW(wszQuotedCmd, wQuote); + lstrcatW(wszQuotedCmd, L"\""); if (wszParameters[0]) { - lstrcatW(wszQuotedCmd, wSpace); + lstrcatW(wszQuotedCmd, L" "); lstrcatW(wszQuotedCmd, wszParameters); } TRACE("%s/%s => %s/%s\n", debugstr_w(wszApplicationName), debugstr_w(psei->lpVerb), debugstr_w(wszQuotedCmd), debugstr_w(wszKeyname)); @@ -1498,8 +1462,6 @@ static UINT_PTR SHELL_quote_and_execute( LPCWSTR wcmd, LPCWSTR wszParameters, LP static UINT_PTR SHELL_execute_url( LPCWSTR lpFile, LPCWSTR wcmd, LPSHELLEXECUTEINFOW psei, LPSHELLEXECUTEINFOW psei_out, SHELL_ExecuteW32 execfunc ) { - static const WCHAR wShell[] = {'\\','s','h','e','l','l','\\',0}; - static const WCHAR wCommand[] = {'\\','c','o','m','m','a','n','d',0}; UINT_PTR retval; WCHAR *lpstrProtocol; LPCWSTR lpstrRes; @@ -1514,17 +1476,17 @@ static UINT_PTR SHELL_execute_url( LPCWSTR lpFile, LPCWSTR wcmd, LPSHELLEXECUTEI TRACE("Got URL: %s\n", debugstr_w(lpFile)); /* Looking for ...\shell\\command */ - len = iSize + lstrlenW(wShell) + lstrlenW(wCommand) + 1; + len = iSize + lstrlenW(L"\\shell\\") + lstrlenW(L"\\command") + 1; if (psei->lpVerb && *psei->lpVerb) len += lstrlenW(psei->lpVerb); else - len += lstrlenW(wszOpen); + len += lstrlenW(L"open"); lpstrProtocol = heap_alloc(len * sizeof(WCHAR)); memcpy(lpstrProtocol, lpFile, iSize*sizeof(WCHAR)); lpstrProtocol[iSize] = '\0'; - lstrcatW(lpstrProtocol, wShell); - lstrcatW(lpstrProtocol, psei->lpVerb && *psei->lpVerb ? psei->lpVerb: wszOpen); - lstrcatW(lpstrProtocol, wCommand); + lstrcatW(lpstrProtocol, L"\\shell\\"); + lstrcatW(lpstrProtocol, psei->lpVerb && *psei->lpVerb ? psei->lpVerb: L"open"); + lstrcatW(lpstrProtocol, L"\\command"); retval = execute_from_key(lpstrProtocol, lpFile, NULL, psei->lpParameters, wcmd, execfunc, psei, psei_out); @@ -1570,8 +1532,6 @@ static WCHAR *expand_environment( const WCHAR *str ) */ static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc ) { - static const WCHAR wWww[] = {'w','w','w',0}; - static const WCHAR wHttp[] = {'h','t','t','p',':','/','/',0}; static const DWORD unsupportedFlags = SEE_MASK_INVOKEIDLIST | SEE_MASK_ICON | SEE_MASK_HOTKEY | SEE_MASK_CONNECTNETDRV | SEE_MASK_FLAG_DDEWAIT | @@ -1805,7 +1765,7 @@ static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc ) }; PathFindOnPathW(wcmd, searchPath); } - retval = SHELL_quote_and_execute( wcmd, wszParameters, wszEmpty, + retval = SHELL_quote_and_execute( wcmd, wszParameters, L"", wszApplicationName, NULL, &sei_tmp, sei, execfunc ); if (retval > 32) { @@ -1831,21 +1791,19 @@ static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc ) } else if (PathIsDirectoryW(lpFile)) { - static const WCHAR wExplorer[] = {'e','x','p','l','o','r','e','r',0}; - static const WCHAR wQuote[] = {'"',0}; WCHAR wExec[MAX_PATH]; WCHAR * lpQuotedFile = heap_alloc( sizeof(WCHAR) * (lstrlenW(lpFile) + 3) ); if (lpQuotedFile) { - retval = SHELL_FindExecutable( sei_tmp.lpDirectory, wExplorer, - wszOpen, wExec, MAX_PATH, + retval = SHELL_FindExecutable( sei_tmp.lpDirectory, L"explorer", + L"open", wExec, MAX_PATH, NULL, &env, NULL, NULL ); if (retval > 32) { - lstrcpyW(lpQuotedFile, wQuote); + lstrcpyW(lpQuotedFile, L"\""); lstrcatW(lpQuotedFile, lpFile); - lstrcatW(lpQuotedFile, wQuote); + lstrcatW(lpQuotedFile, L"\""); retval = SHELL_quote_and_execute( wExec, lpQuotedFile, wszKeyname, wszApplicationName, env, @@ -1862,11 +1820,11 @@ static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc ) retval = SHELL_execute_url( lpFile, wcmd, &sei_tmp, sei, execfunc ); } /* Check if file specified is in the form www.??????.*** */ - else if (!wcsnicmp(lpFile, wWww, 3)) + else if (!wcsnicmp(lpFile, L"www", 3)) { /* if so, prefix lpFile with http:// and call ShellExecute */ WCHAR lpstrTmpFile[256]; - lstrcpyW(lpstrTmpFile, wHttp); + lstrcpyW(lpstrTmpFile, L"http://"); lstrcatW(lpstrTmpFile, lpFile); retval = (UINT_PTR)ShellExecuteW(sei_tmp.hwnd, sei_tmp.lpVerb, lpstrTmpFile, NULL, NULL, 0); } diff --git a/dlls/shell32/shlfileop.c b/dlls/shell32/shlfileop.c index e07b0daec53..50bbdd37261 100644 --- a/dlls/shell32/shlfileop.c +++ b/dlls/shell32/shlfileop.c @@ -56,9 +56,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(shell); #define DE_SAMEFILE 0x71 #define DE_DESTSAMETREE 0x7D -static const WCHAR wWildcardFile[] = {'*',0}; -static const WCHAR wWildcardChars[] = {'*','?',0}; - static DWORD SHNotifyCreateDirectoryA(LPCSTR path, LPSECURITY_ATTRIBUTES sec); static DWORD SHNotifyCreateDirectoryW(LPCWSTR path, LPSECURITY_ATTRIBUTES sec); static DWORD SHNotifyRemoveDirectoryA(LPCSTR path); @@ -79,8 +76,6 @@ typedef struct /* Confirm dialogs with an optional "Yes To All" as used in file operations confirmations */ -static const WCHAR CONFIRM_MSG_PROP[] = {'W','I','N','E','_','C','O','N','F','I','R','M',0}; - struct confirm_msg_info { LPWSTR lpszText; @@ -128,7 +123,7 @@ static INT_PTR ConfirmMsgBox_Paint(HWND hDlg) /* this will remap the rect to dialog coords */ MapWindowPoints(GetDlgItem(hDlg, IDD_MESSAGE), hDlg, (LPPOINT)&r, 2); hOldFont = SelectObject(hdc, (HFONT)SendDlgItemMessageW(hDlg, IDD_MESSAGE, WM_GETFONT, 0, 0)); - DrawTextW(hdc, GetPropW(hDlg, CONFIRM_MSG_PROP), -1, &r, DT_NOPREFIX | DT_PATH_ELLIPSIS | DT_WORDBREAK); + DrawTextW(hdc, GetPropW(hDlg, L"WINE_CONFIRM"), -1, &r, DT_NOPREFIX | DT_PATH_ELLIPSIS | DT_WORDBREAK); SelectObject(hdc, hOldFont); EndPaint(hDlg, &ps); return TRUE; @@ -145,7 +140,7 @@ static INT_PTR ConfirmMsgBox_Init(HWND hDlg, LPARAM lParam) SetWindowTextW(hDlg, info->lpszCaption); ShowWindow(GetDlgItem(hDlg, IDD_MESSAGE), SW_HIDE); - SetPropW(hDlg, CONFIRM_MSG_PROP, info->lpszText); + SetPropW(hDlg, L"WINE_CONFIRM", info->lpszText); SendDlgItemMessageW(hDlg, IDD_ICON, STM_SETICON, (WPARAM)info->hIcon, 0); /* compute the text height and resize the dialog */ @@ -194,14 +189,13 @@ static INT_PTR CALLBACK ConfirmMsgBoxProc(HWND hDlg, UINT uMsg, WPARAM wParam, L static int SHELL_ConfirmMsgBox(HWND hWnd, LPWSTR lpszText, LPWSTR lpszCaption, HICON hIcon, BOOL bYesToAll) { - static const WCHAR wszTemplate[] = {'S','H','E','L','L','_','Y','E','S','T','O','A','L','L','_','M','S','G','B','O','X',0}; struct confirm_msg_info info; info.lpszText = lpszText; info.lpszCaption = lpszCaption; info.hIcon = hIcon; info.bYesToAll = bYesToAll; - return DialogBoxParamW(shell32_hInstance, wszTemplate, hWnd, ConfirmMsgBoxProc, (LPARAM)&info); + return DialogBoxParamW(shell32_hInstance, L"SHELL_YESTOALL_MSGBOX", hWnd, ConfirmMsgBoxProc, (LPARAM)&info); } /* confirmation dialogs content */ @@ -351,7 +345,7 @@ static DWORD SHELL_DeleteDirectoryW(HWND hwnd, LPCWSTR pszDir, BOOL bShowUI) WIN32_FIND_DATAW wfd; WCHAR szTemp[MAX_PATH]; - PathCombineW(szTemp, pszDir, wWildcardFile); + PathCombineW(szTemp, pszDir, L"*"); hFind = FindFirstFileW(szTemp, &wfd); if (hFind != INVALID_HANDLE_VALUE) { @@ -793,7 +787,7 @@ int WINAPI SHCreateDirectoryExW(HWND hWnd, LPCWSTR path, LPSECURITY_ATTRIBUTES s static DWORD SHFindAttrW(LPCWSTR pName, BOOL fileOnly) { WIN32_FIND_DATAW wfd; - BOOL b_FileMask = fileOnly && (NULL != StrPBrkW(pName, wWildcardChars)); + BOOL b_FileMask = fileOnly && (NULL != StrPBrkW(pName, L"*?")); DWORD dwAttr = INVALID_FILE_ATTRIBUTES; HANDLE hFind = FindFirstFileW(pName, &wfd); @@ -1049,7 +1043,7 @@ static HRESULT parse_file_list(FILE_LIST *flList, LPCWSTR szFiles) for (p = szCurFile; *p; p++) if (*p == '/') *p = '\\'; /* parse wildcard files if they are in the filename */ - if (StrPBrkW(szCurFile, wWildcardChars)) + if (StrPBrkW(szCurFile, L"*?")) { parse_wildcard_files(flList, szCurFile, &i); flList->bAnyFromWildcard = TRUE; @@ -1097,8 +1091,6 @@ static void copy_dir_to_dir(FILE_OPERATION *op, const FILE_ENTRY *feFrom, LPCWST WCHAR szFrom[MAX_PATH], szTo[MAX_PATH]; SHFILEOPSTRUCTW fileOp; - static const WCHAR wildCardFiles[] = {'*','.','*',0}; - if (IsDotDir(feFrom->szFilename)) return; @@ -1120,7 +1112,7 @@ static void copy_dir_to_dir(FILE_OPERATION *op, const FILE_ENTRY *feFrom, LPCWST szTo[lstrlenW(szTo) + 1] = '\0'; SHNotifyCreateDirectoryW(szTo, NULL); - PathCombineW(szFrom, feFrom->szFullPath, wildCardFiles); + PathCombineW(szFrom, feFrom->szFullPath, L"*.*"); szFrom[lstrlenW(szFrom) + 1] = '\0'; fileOp = *op->req; @@ -1313,10 +1305,9 @@ static BOOL confirm_delete_list(HWND hWnd, DWORD fFlags, BOOL fTrash, const FILE { if (flFrom->dwNumFiles > 1) { - static const WCHAR format[] = {'%','d',0}; - WCHAR tmp[8]; + WCHAR tmp[12]; - wnsprintfW(tmp, ARRAY_SIZE(tmp), format, flFrom->dwNumFiles); + swprintf(tmp, ARRAY_SIZE(tmp), L"%d", flFrom->dwNumFiles); return SHELL_ConfirmDialogW(hWnd, (fTrash?ASK_TRASH_MULTIPLE_ITEM:ASK_DELETE_MULTIPLE_ITEM), tmp, NULL); } else diff --git a/dlls/shell32/shlfolder.c b/dlls/shell32/shlfolder.c index 91d283fd93f..ce7fc072fa3 100644 --- a/dlls/shell32/shlfolder.c +++ b/dlls/shell32/shlfolder.c @@ -48,9 +48,6 @@ WINE_DEFAULT_DEBUG_CHANNEL (shell); -static const WCHAR wszDotShellClassInfo[] = { - '.','S','h','e','l','l','C','l','a','s','s','I','n','f','o',0}; - /*************************************************************************** * SHELL32_GetCustomFolderAttribute (internal function) * @@ -72,14 +69,9 @@ static inline BOOL SHELL32_GetCustomFolderAttributeFromPath( LPWSTR pwszFolderPath, LPCWSTR pwszHeading, LPCWSTR pwszAttribute, LPWSTR pwszValue, DWORD cchValue) { - static const WCHAR wszDesktopIni[] = - {'d','e','s','k','t','o','p','.','i','n','i',0}; - static const WCHAR wszDefault[] = {0}; - PathAddBackslashW(pwszFolderPath); - PathAppendW(pwszFolderPath, wszDesktopIni); - return GetPrivateProfileStringW(pwszHeading, pwszAttribute, wszDefault, - pwszValue, cchValue, pwszFolderPath); + PathAppendW(pwszFolderPath, L"desktop.ini"); + return GetPrivateProfileStringW(pwszHeading, pwszAttribute, L"", pwszValue, cchValue, pwszFolderPath); } BOOL SHELL32_GetCustomFolderAttribute( @@ -283,7 +275,6 @@ HRESULT SHELL32_BindToChild (LPCITEMIDLIST pidlRoot, const CLSID *clsidChild, } else { /* file system folder */ CLSID clsidFolder = *clsidChild; - static const WCHAR wszCLSID[] = {'C','L','S','I','D',0}; WCHAR wszCLSIDValue[CHARS_IN_GUID], wszFolderPath[MAX_PATH], *pwszPathTail = wszFolderPath; /* see if folder CLSID should be overridden by desktop.ini file */ @@ -295,7 +286,7 @@ HRESULT SHELL32_BindToChild (LPCITEMIDLIST pidlRoot, const CLSID *clsidChild, _ILSimpleGetTextW(pidlChild,pwszPathTail,MAX_PATH - (int)(pwszPathTail - wszFolderPath)); if (SHELL32_GetCustomFolderAttributeFromPath (wszFolderPath, - wszDotShellClassInfo, wszCLSID, wszCLSIDValue, CHARS_IN_GUID)) + L".ShellClassInfo", L"CLSID", wszCLSIDValue, CHARS_IN_GUID)) CLSIDFromString (wszCLSIDValue, &clsidFolder); hr = SHELL32_CoCreateInitSF (pidlRoot, pathRoot, pidlChild, @@ -635,8 +626,6 @@ HRESULT WINAPI SHOpenFolderAndSelectItems( PCIDLIST_ABSOLUTE pidlFolder, UINT ci */ HRESULT WINAPI SHGetSetFolderCustomSettings( LPSHFOLDERCUSTOMSETTINGS fcs, PCWSTR path, DWORD flag ) { - static const WCHAR iconresourceW[] = {'I','c','o','n','R','e','s','o','u','r','c','e',0}; - static const WCHAR desktop_iniW[] = {'D','e','s','k','t','o','p','.','i','n','i',0}; WCHAR bufferW[MAX_PATH]; HRESULT hr; @@ -652,9 +641,9 @@ HRESULT WINAPI SHGetSetFolderCustomSettings( LPSHFOLDERCUSTOMSETTINGS fcs, PCWST { lstrcpyW(bufferW, path); PathAddBackslashW(bufferW); - lstrcatW(bufferW, desktop_iniW); + lstrcatW(bufferW, L"desktop.ini"); - if (WritePrivateProfileStringW(wszDotShellClassInfo, iconresourceW, fcs->pszIconFile, bufferW)) + if (WritePrivateProfileStringW(L".ShellClassInfo", L"IconResource", fcs->pszIconFile, bufferW)) { TRACE("Wrote an iconresource entry %s into %s\n", debugstr_w(fcs->pszIconFile), debugstr_w(bufferW)); hr = S_OK; diff --git a/dlls/shell32/shlfsbind.c b/dlls/shell32/shlfsbind.c index 20158232ef7..4f1e56622b0 100644 --- a/dlls/shell32/shlfsbind.c +++ b/dlls/shell32/shlfsbind.c @@ -151,8 +151,6 @@ HRESULT WINAPI IFileSystemBindData_Constructor(const WIN32_FIND_DATAW *find_data ret = CreateBindCtx(0, ppV); if (SUCCEEDED(ret)) { - static const WCHAR nameW[] = { - 'F','i','l','e',' ','S','y','s','t','e','m',' ','B','i','n','d',' ','D','a','t','a',0}; BIND_OPTS bindOpts; bindOpts.cbStruct = sizeof(BIND_OPTS); @@ -160,7 +158,7 @@ HRESULT WINAPI IFileSystemBindData_Constructor(const WIN32_FIND_DATAW *find_data bindOpts.grfMode = STGM_CREATE; bindOpts.dwTickCountDeadline = 0; IBindCtx_SetBindOptions(*ppV, &bindOpts); - IBindCtx_RegisterObjectParam(*ppV, (WCHAR*)nameW, (IUnknown*)&This->IFileSystemBindData_iface); + IBindCtx_RegisterObjectParam(*ppV, (WCHAR*)L"File System Bind Data", (IUnknown*)&This->IFileSystemBindData_iface); IFileSystemBindData_Release(&This->IFileSystemBindData_iface); } diff --git a/dlls/shell32/shlmenu.c b/dlls/shell32/shlmenu.c index 393d496d574..e4afe3dcfdc 100644 --- a/dlls/shell32/shlmenu.c +++ b/dlls/shell32/shlmenu.c @@ -236,8 +236,7 @@ static int FM_InitMenuPopup(HMENU hmenu, LPCITEMIDLIST pAlternatePidl) if ( GetMenuItemCount (hmenu) == 0 ) { - static const WCHAR szEmpty[] = { '(','e','m','p','t','y',')',0 }; - FileMenu_AppendItemW (hmenu, szEmpty, uID, FM_BLANK_ICON, 0, FM_DEFAULT_HEIGHT); + FileMenu_AppendItemW (hmenu, L"(empty)", uID, FM_BLANK_ICON, 0, FM_DEFAULT_HEIGHT); NumberOfItems++; } diff --git a/dlls/shell32/shlview.c b/dlls/shell32/shlview.c index b9528cea1bd..a2afc72b7a9 100644 --- a/dlls/shell32/shlview.c +++ b/dlls/shell32/shlview.c @@ -66,8 +66,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(shell); -static const WCHAR SV_CLASS_NAME[] = {'S','H','E','L','L','D','L','L','_','D','e','f','V','i','e','w',0}; - typedef struct { BOOL bIsAscending; INT nHeaderID; @@ -670,7 +668,6 @@ static HRESULT ShellView_FillList(IShellViewImpl *This) static LRESULT ShellView_OnCreate(IShellViewImpl *This) { IShellView3 *iface = &This->IShellView3_iface; - static const WCHAR accel_nameW[] = {'s','h','v','_','a','c','c','e','l',0}; IPersistFolder2 *ppf2; IDropTarget* pdt; HRESULT hr; @@ -723,7 +720,7 @@ static LRESULT ShellView_OnCreate(IShellViewImpl *This) IPersistFolder2_Release(ppf2); } - This->hAccel = LoadAcceleratorsW(shell32_hInstance, accel_nameW); + This->hAccel = LoadAcceleratorsW(shell32_hInstance, L"shv_accel"); return S_OK; } @@ -780,7 +777,6 @@ static void ShellView_MergeFileMenu(IShellViewImpl *This, HMENU hSubMenu) { if (hSubMenu) { - static const WCHAR dummyW[] = {'d','u','m','m','y','4','5',0}; MENUITEMINFOW mii; /* insert This item at the beginning of the menu */ @@ -793,7 +789,7 @@ static void ShellView_MergeFileMenu(IShellViewImpl *This, HMENU hSubMenu) mii.cbSize = sizeof(mii); mii.fMask = MIIM_ID | MIIM_TYPE | MIIM_STATE; - mii.dwTypeData = (LPWSTR)dummyW; + mii.dwTypeData = (LPWSTR)L"dummy45"; mii.fState = MFS_ENABLED; mii.wID = IDM_MYFILEITEM; mii.fType = MFT_STRING; @@ -812,8 +808,6 @@ static void ShellView_MergeViewMenu(IShellViewImpl *This, HMENU hSubMenu) /* add a separator at the correct position in the menu */ if (hSubMenu) { - static const WCHAR menuW[] = {'M','E','N','U','_','0','0','1',0}; - static const WCHAR viewW[] = {'V','i','e','w',0}; MENUITEMINFOW mii; memset(&mii, 0, sizeof(mii)); @@ -826,8 +820,8 @@ static void ShellView_MergeViewMenu(IShellViewImpl *This, HMENU hSubMenu) mii.cbSize = sizeof(mii); mii.fMask = MIIM_SUBMENU | MIIM_TYPE | MIIM_DATA; mii.fType = MFT_STRING; - mii.dwTypeData = (LPWSTR)viewW; - mii.hSubMenu = LoadMenuW(shell32_hInstance, menuW); + mii.dwTypeData = (LPWSTR)L"View"; + mii.hSubMenu = LoadMenuW(shell32_hInstance, L"MENU_001"); InsertMenuItemW(hSubMenu, FCIDM_MENU_VIEW_SEP_OPTIONS, FALSE, &mii); } } @@ -1140,8 +1134,6 @@ static LRESULT ShellView_OnActivate(IShellViewImpl *This, UINT uState) if (This->hMenu) { - static const WCHAR dummyW[] = {'d','u','m','m','y',' ','3','1',0}; - IShellBrowser_InsertMenusSB(This->pShellBrowser, This->hMenu, &omw); TRACE("-- after fnInsertMenusSB\n"); @@ -1155,7 +1147,7 @@ static LRESULT ShellView_OnActivate(IShellViewImpl *This, UINT uState) mii.hbmpUnchecked = NULL; mii.dwItemData = 0; /* build the top level menu get the menu item's text */ - mii.dwTypeData = (LPWSTR)dummyW; + mii.dwTypeData = (LPWSTR)L"dummy 31"; mii.cch = 0; mii.hbmpItem = NULL; @@ -2111,7 +2103,7 @@ static HRESULT WINAPI IShellView3_fnCreateViewWindow3(IShellView3 *iface, IShell TRACE("-- CommDlgBrowser %p\n", This->pCommDlgBrowser); /* If our window class has not been registered, then do so */ - if (!GetClassInfoW(shell32_hInstance, SV_CLASS_NAME, &wc)) + if (!GetClassInfoW(shell32_hInstance, L"SHELLDLL_DefView", &wc)) { wc.style = CS_HREDRAW | CS_VREDRAW; wc.lpfnWndProc = ShellView_WndProc; @@ -2122,12 +2114,12 @@ static HRESULT WINAPI IShellView3_fnCreateViewWindow3(IShellView3 *iface, IShell wc.hCursor = LoadCursorW(0, (LPWSTR)IDC_ARROW); wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); wc.lpszMenuName = NULL; - wc.lpszClassName = SV_CLASS_NAME; + wc.lpszClassName = L"SHELLDLL_DefView"; if (!RegisterClassW(&wc)) return E_FAIL; } - wnd = CreateWindowExW(0, SV_CLASS_NAME, NULL, WS_CHILD | WS_TABSTOP, + wnd = CreateWindowExW(0, L"SHELLDLL_DefView", NULL, WS_CHILD | WS_TABSTOP, rect->left, rect->top, rect->right - rect->left, rect->bottom - rect->top, diff --git a/dlls/shell32/shlview_cmenu.c b/dlls/shell32/shlview_cmenu.c index 6290cd0f9c8..6c05904bb91 100644 --- a/dlls/shell32/shlview_cmenu.c +++ b/dlls/shell32/shlview_cmenu.c @@ -360,15 +360,6 @@ static BOOL format_date(FILETIME *time, WCHAR *buffer, DWORD size) static BOOL get_program_description(WCHAR *path, WCHAR *buffer, DWORD size) { - static const WCHAR translationW[] = { - '\\','V','a','r','F','i','l','e','I','n','f','o', - '\\','T','r','a','n','s','l','a','t','i','o','n',0 - }; - static const WCHAR fileDescFmtW[] = { - '\\','S','t','r','i','n','g','F','i','l','e','I','n','f','o', - '\\','%','0','4','x','%','0','4','x', - '\\','F','i','l','e','D','e','s','c','r','i','p','t','i','o','n',0 - }; WCHAR fileDescW[41], *desc; DWORD versize, *lang; UINT dlen, llen, i; @@ -384,12 +375,13 @@ static BOOL get_program_description(WCHAR *path, WCHAR *buffer, DWORD size) if (!GetFileVersionInfoW(path, 0, versize, data)) goto out; - if (!VerQueryValueW(data, translationW, (LPVOID *)&lang, &llen)) + if (!VerQueryValueW(data, L"\\VarFileInfo\\Translation", (LPVOID *)&lang, &llen)) goto out; for (i = 0; i < llen / sizeof(DWORD); i++) { - swprintf(fileDescW, ARRAY_SIZE(fileDescW), fileDescFmtW, LOWORD(lang[i]), HIWORD(lang[i])); + swprintf(fileDescW, ARRAY_SIZE(fileDescW), L"\\StringFileInfo\\%04x%04x\\FileDescription", + LOWORD(lang[i]), HIWORD(lang[i])); if (VerQueryValueW(data, fileDescW, (LPVOID *)&desc, &dlen)) { if (dlen > size - 1) dlen = size - 1; @@ -448,9 +440,7 @@ static void init_file_properties_dlg(HWND hwndDlg, struct file_properties_info * if (exinfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { - static const WCHAR unknownW[] = {'(','u','n','k','n','o','w','n',')',0}; - SetDlgItemTextW(hwndDlg, IDC_FPROP_SIZE, unknownW); - + SetDlgItemTextW(hwndDlg, IDC_FPROP_SIZE, L"(unknown)"); /* TODO: Implement counting for directories */ return; } @@ -541,9 +531,8 @@ static INT_PTR CALLBACK file_properties_proc(HWND hwndDlg, UINT uMsg, WPARAM wPa wcscmp(props->filename, newname) && lstrlenW(props->dir) + lstrlenW(newname) + 2 < ARRAY_SIZE(newpath)) { - static const WCHAR slash[] = {'\\', 0}; lstrcpyW(newpath, props->dir); - lstrcatW(newpath, slash); + lstrcatW(newpath, L"\\"); lstrcatW(newpath, newname); if (!MoveFileW(props->path, newpath)) @@ -653,8 +642,6 @@ error: static void DoOpenProperties(ContextMenu *This, HWND hwnd) { - static const WCHAR wszFolder[] = {'F','o','l','d','e','r', 0}; - static const WCHAR wszFiletypeAll[] = {'*',0}; LPSHELLFOLDER lpDesktopSF; LPSHELLFOLDER lpSF; LPDATAOBJECT lpDo; @@ -695,14 +682,13 @@ static void DoOpenProperties(ContextMenu *This, HWND hwnd) } else if (_ILIsFolder(This->apidl[0])) { - lstrcpynW(wszFiletype, wszFolder, 64); + lstrcpynW(wszFiletype, L"Folder", 64); } else if (_ILIsSpecialFolder(This->apidl[0])) { LPGUID folderGUID; - static const WCHAR wszclsid[] = {'C','L','S','I','D','\\', 0}; folderGUID = _ILGetGUIDPointer(This->apidl[0]); - lstrcpyW(wszFiletype, wszclsid); + lstrcpyW(wszFiletype, L"CLSID\\"); StringFromGUID2(folderGUID, &wszFiletype[6], MAX_PATH - 6); } else @@ -738,7 +724,7 @@ static void DoOpenProperties(ContextMenu *This, HWND hwnd) SHAddFromPropSheetExtArray(hpsxa, Properties_AddPropSheetCallback, (LPARAM)&psh); SHDestroyPropSheetExtArray(hpsxa); } - hpsxa = SHCreatePropSheetExtArrayEx(HKEY_CLASSES_ROOT, wszFiletypeAll, MAX_PROP_PAGES - psh.nPages, lpDo); + hpsxa = SHCreatePropSheetExtArrayEx(HKEY_CLASSES_ROOT, L"*", MAX_PROP_PAGES - psh.nPages, lpDo); if (hpsxa != NULL) { SHAddFromPropSheetExtArray(hpsxa, Properties_AddPropSheetCallback, (LPARAM)&psh); @@ -845,14 +831,6 @@ static HRESULT WINAPI ItemMenu_InvokeCommand( static HRESULT WINAPI ItemMenu_GetCommandString(IContextMenu3 *iface, UINT_PTR cmdid, UINT flags, UINT *reserved, LPSTR name, UINT maxlen) { - static const WCHAR openW[] = {'o','p','e','n',0}; - static const WCHAR exploreW[] = {'e','x','p','l','o','r','e',0}; - static const WCHAR cutW[] = {'c','u','t',0}; - static const WCHAR copyW[] = {'c','o','p','y',0}; - static const WCHAR linkW[] = {'l','i','n','k',0}; - static const WCHAR deleteW[] = {'d','e','l','e','t','e',0}; - static const WCHAR propertiesW[] = {'p','r','o','p','e','r','t','i','e','s',0}; - static const WCHAR renameW[] = {'r','e','n','a','m','e',0}; ContextMenu *This = impl_from_IContextMenu3(iface); const WCHAR *cmdW = NULL; HRESULT hr = S_OK; @@ -871,28 +849,28 @@ static HRESULT WINAPI ItemMenu_GetCommandString(IContextMenu3 *iface, UINT_PTR c switch (cmdid + FCIDM_BASE) { case FCIDM_SHVIEW_OPEN: - cmdW = openW; + cmdW = L"open"; break; case FCIDM_SHVIEW_EXPLORE: - cmdW = exploreW; + cmdW = L"explore"; break; case FCIDM_SHVIEW_CUT: - cmdW = cutW; + cmdW = L"cut"; break; case FCIDM_SHVIEW_COPY: - cmdW = copyW; + cmdW = L"copy"; break; case FCIDM_SHVIEW_CREATELINK: - cmdW = linkW; + cmdW = L"link"; break; case FCIDM_SHVIEW_DELETE: - cmdW = deleteW; + cmdW = L"delete"; break; case FCIDM_SHVIEW_PROPERTIES: - cmdW = propertiesW; + cmdW = L"properties"; break; case FCIDM_SHVIEW_RENAME: - cmdW = renameW; + cmdW = L"rename"; break; } @@ -1385,8 +1363,6 @@ static HRESULT WINAPI BackgroundMenu_GetCommandString( LPSTR lpszName, UINT uMaxNameLen) { - static const WCHAR pasteW[] = {'p','a','s','t','e',0}; - static const WCHAR propertiesW[] = {'p','r','o','p','e','r','t','i','e','s',0}; ContextMenu *This = impl_from_IContextMenu3(iface); const WCHAR *cmdW = NULL; HRESULT hr = E_FAIL; @@ -1405,10 +1381,10 @@ static HRESULT WINAPI BackgroundMenu_GetCommandString( switch (idCommand + FCIDM_BASE) { case FCIDM_SHVIEW_INSERT: - cmdW = pasteW; + cmdW = L"paste"; break; case FCIDM_SHVIEW_PROPERTIES: - cmdW = propertiesW; + cmdW = L"properties"; break; } diff --git a/dlls/shell32/shpolicy.c b/dlls/shell32/shpolicy.c index a05c7e96fd8..21bb49c80cf 100644 --- a/dlls/shell32/shpolicy.c +++ b/dlls/shell32/shpolicy.c @@ -55,15 +55,6 @@ typedef struct tagPOLICYDAT DWORD cache; /* cached value or 0xffffffff for invalid */ } POLICYDATA, *LPPOLICYDATA; -/* registry strings */ -static const CHAR strRegistryPolicyA[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Policies"; -static const WCHAR strRegistryPolicyW[] = {'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', - '\\','P','o','l','i','c','i','e','s',0}; -static const CHAR strPolicyA[] = "Policy"; -static const WCHAR strPolicyW[] = {'P','o','l','i','c','y',0}; - /* application strings */ static const char strExplorer[] = {"Explorer"}; @@ -853,8 +844,7 @@ DWORD WINAPI SHRestricted (RESTRICTIONS policy) return p->cache; } - lstrcpyA(regstr, strRegistryPolicyA); - lstrcatA(regstr, "\\"); + lstrcpyA(regstr, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\"); lstrcatA(regstr, p->appstr); /* return 0 and don't set the cache if any registry errors occur */ @@ -898,15 +888,15 @@ BOOL WINAPI SHInitRestricted(LPCVOID unused, LPCVOID inpRegKey) { if (SHELL_OsIsUnicode()) { - if (lstrcmpiW(inpRegKey, strRegistryPolicyW) && - lstrcmpiW(inpRegKey, strPolicyW)) + if (lstrcmpiW(inpRegKey, L"Software\\Microsoft\\Windows\\CurrentVersion\\Policies") && + lstrcmpiW(inpRegKey, L"Policy")) /* doesn't match, fail */ return FALSE; } else { - if (lstrcmpiA(inpRegKey, strRegistryPolicyA) && - lstrcmpiA(inpRegKey, strPolicyA)) + if (lstrcmpiA(inpRegKey, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies") && + lstrcmpiA(inpRegKey, "Policy")) /* doesn't match, fail */ return FALSE; } diff --git a/dlls/shell32/systray.c b/dlls/shell32/systray.c index f748cbaef9f..9064e6e7365 100644 --- a/dlls/shell32/systray.c +++ b/dlls/shell32/systray.c @@ -37,8 +37,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(systray); -static const WCHAR classname[] = /* Shell_TrayWnd */ {'S','h','e','l','l','_','T','r','a','y','W','n','d','\0'}; - struct notify_data /* platform-independent format for NOTIFYICONDATA */ { LONG hWnd; @@ -149,7 +147,7 @@ BOOL WINAPI Shell_NotifyIconW(DWORD dwMessage, PNOTIFYICONDATAW nid) return Shell_NotifyIconW(dwMessage, &newNid); } - tray = FindWindowExW(0, NULL, classname, NULL); + tray = FindWindowExW(0, NULL, L"Shell_TrayWnd", NULL); if (!tray) return FALSE; cds.dwData = dwMessage;