From 2ada141a039ba7f0cd70c6f48b3b7cd5b9565bee Mon Sep 17 00:00:00 2001 From: Johannes Anderwald Date: Mon, 17 Oct 2011 14:42:47 +0000 Subject: [PATCH] [SHELL32] - Remove unused code - Display file extension based on Edijus patch See issue #6310 for more details. svn path=/trunk/; revision=54177 --- reactos/dll/win32/shell32/fprop.cpp | 9 ++ reactos/dll/win32/shell32/shellpath.cpp | 191 ------------------------ 2 files changed, 9 insertions(+), 191 deletions(-) diff --git a/reactos/dll/win32/shell32/fprop.cpp b/reactos/dll/win32/shell32/fprop.cpp index 26b2871c93c..f0e6f743ad3 100644 --- a/reactos/dll/win32/shell32/fprop.cpp +++ b/reactos/dll/win32/shell32/fprop.cpp @@ -246,6 +246,15 @@ SH_FileGeneralSetFileType(HWND hwndDlg, WCHAR *filext) /* file extension type */ value[MAX_PATH - 1] = L'\0'; + lvalue = wcslen(value); + lname = wcslen(filext); + if (MAX_PATH - lvalue - lname - 3 > 0) + { + wcscat(value, L" ("); + wcscat(value, filext); + wcscat(value, L")"); + } + SendMessageW(hDlgCtrl, WM_SETTEXT, (WPARAM)NULL, (LPARAM)value); return TRUE; diff --git a/reactos/dll/win32/shell32/shellpath.cpp b/reactos/dll/win32/shell32/shellpath.cpp index 26ec5ec37c4..bf2ce13d3c4 100644 --- a/reactos/dll/win32/shell32/shellpath.cpp +++ b/reactos/dll/win32/shell32/shellpath.cpp @@ -1662,189 +1662,6 @@ static HRESULT _SHRegisterCommonShellFolders(void) return hr; } -/****************************************************************************** - * _SHAppendToUnixPath [Internal] - * - * Helper function for _SHCreateSymbolicLinks. Appends pwszSubPath (or the - * corresponding resource, if IS_INTRESOURCE) to the unix base path 'szBasePath' - * and replaces backslashes with slashes. - * - * PARAMS - * szBasePath [IO] The unix base path, which will be appended to (CP_UNXICP). - * pwszSubPath [I] Sub-path or resource id (use MAKEINTRESOURCEW). - * - * RETURNS - * Success: TRUE, - * Failure: FALSE - */ -static BOOL __inline _SHAppendToUnixPath(char *szBasePath, LPCWSTR pwszSubPath) { - WCHAR wszSubPath[MAX_PATH]; - int cLen = strlen(szBasePath); - char *pBackslash; - - if (IS_INTRESOURCE(pwszSubPath)) { - if (!LoadStringW(shell32_hInstance, LOWORD(pwszSubPath), wszSubPath, MAX_PATH)) { - /* Fall back to hard coded defaults. */ - switch (LOWORD(pwszSubPath)) { - case IDS_PERSONAL: - wcscpy(wszSubPath, PersonalW); - break; - case IDS_MYMUSIC: - wcscpy(wszSubPath, My_MusicW); - break; - case IDS_MYPICTURES: - wcscpy(wszSubPath, My_PicturesW); - break; - case IDS_MYVIDEO: - wcscpy(wszSubPath, My_VideoW); - break; - default: - ERR("LoadString(%d) failed!\n", LOWORD(pwszSubPath)); - return FALSE; - } - } - } else { - wcscpy(wszSubPath, pwszSubPath); - } - - if (szBasePath[cLen-1] != '/') szBasePath[cLen++] = '/'; - - if (!WideCharToMultiByte(CP_ACP, 0, wszSubPath, -1, szBasePath + cLen, - FILENAME_MAX - cLen, NULL, NULL)) - { - return FALSE; - } - - pBackslash = szBasePath + cLen; - while ((pBackslash = strchr(pBackslash, '\\'))) *pBackslash = '/'; - - return TRUE; -} -#if 0 -/****************************************************************************** - * _SHCreateSymbolicLinks [Internal] - * - * Sets up symbol links for various shell folders to point into the users home - * directory. We do an educated guess about what the user would probably want: - * - If there is a 'My Documents' directory in $HOME, the user probably wants - * wine's 'My Documents' to point there. Furthermore, we imply that the user - * is a Windows lover and has no problem with wine creating 'My Pictures', - * 'My Music' and 'My Video' subfolders under '$HOME/My Documents', if those - * do not already exits. We put appropriate symbolic links in place for those, - * too. - * - If there is no 'My Documents' directory in $HOME, we let 'My Documents' - * point directly to $HOME. We assume the user to be a unix hacker who does not - * want wine to create anything anywhere besides the .wine directory. So, if - * there already is a 'My Music' directory in $HOME, we symlink the 'My Music' - * shell folder to it. But if not, we symlink it to $HOME directly. The same - * holds fo 'My Pictures' and 'My Video'. - * - The Desktop shell folder is symlinked to '$HOME/Desktop', if that does - * exists and left alone if not. - * ('My Music',... above in fact means LoadString(IDS_MYMUSIC)) - */ -static void _SHCreateSymbolicLinks(void) -{ - UINT aidsMyStuff[] = { IDS_MYPICTURES, IDS_MYVIDEO, IDS_MYMUSIC }, i; - int acsidlMyStuff[] = { CSIDL_MYPICTURES, CSIDL_MYVIDEO, CSIDL_MYMUSIC }; - WCHAR wszTempPath[MAX_PATH]; - char szPersonalTarget[FILENAME_MAX], *pszPersonal; - char szMyStuffTarget[FILENAME_MAX], *pszMyStuff; - char szDesktopTarget[FILENAME_MAX], *pszDesktop; - struct stat statFolder; - const char *pszHome; - HRESULT hr; - - /* Create all necessary profile sub-dirs up to 'My Documents' and get the unix path. */ - hr = SHGetFolderPathW(NULL, CSIDL_PERSONAL|CSIDL_FLAG_CREATE, NULL, - SHGFP_TYPE_DEFAULT, wszTempPath); - if (FAILED(hr)) return; - pszPersonal = wine_get_unix_file_name(wszTempPath); - if (!pszPersonal) return; - - pszHome = getenv("HOME"); - if (pszHome && !stat(pszHome, &statFolder) && S_ISDIR(statFolder.st_mode)) { - strcpy(szPersonalTarget, pszHome); - if (_SHAppendToUnixPath(szPersonalTarget, MAKEINTRESOURCEW(IDS_PERSONAL)) && - !stat(szPersonalTarget, &statFolder) && S_ISDIR(statFolder.st_mode)) - { - /* '$HOME/My Documents' exists. Create 'My Pictures', 'My Videos' and - * 'My Music' subfolders or fail silently if they already exist. */ - for (i = 0; i < sizeof(aidsMyStuff)/sizeof(aidsMyStuff[0]); i++) { - strcpy(szMyStuffTarget, szPersonalTarget); - if (_SHAppendToUnixPath(szMyStuffTarget, MAKEINTRESOURCEW(aidsMyStuff[i]))) - mkdir(szMyStuffTarget); - } - } - else - { - /* '$HOME/My Documents' doesn't exists, but '$HOME' does. */ - strcpy(szPersonalTarget, pszHome); - } - - /* Replace 'My Documents' directory with a symlink of fail silently if not empty. */ - rmdir(pszPersonal); - symlink(szPersonalTarget, pszPersonal); - } - else - { - /* '$HOME' doesn't exist. Create 'My Pictures', 'My Videos' and 'My Music' subdirs - * in '%USERPROFILE%\\My Documents' or fail silently if they already exist. */ - strcpy(szPersonalTarget, pszPersonal); - for (i = 0; i < sizeof(aidsMyStuff)/sizeof(aidsMyStuff[0]); i++) { - strcpy(szMyStuffTarget, szPersonalTarget); - if (_SHAppendToUnixPath(szMyStuffTarget, MAKEINTRESOURCEW(aidsMyStuff[i]))) - mkdir(szMyStuffTarget); - } - } - - /* Create symbolic links for 'My Pictures', 'My Video' and 'My Music'. */ - for (i=0; i < sizeof(aidsMyStuff)/sizeof(aidsMyStuff[0]); i++) { - /* Create the current 'My Whatever' folder and get it's unix path. */ - hr = SHGetFolderPathW(NULL, acsidlMyStuff[i]|CSIDL_FLAG_CREATE, NULL, - SHGFP_TYPE_DEFAULT, wszTempPath); - if (FAILED(hr)) continue; - pszMyStuff = wine_get_unix_file_name(wszTempPath); - if (!pszMyStuff) continue; - - strcpy(szMyStuffTarget, szPersonalTarget); - if (_SHAppendToUnixPath(szMyStuffTarget, MAKEINTRESOURCEW(aidsMyStuff[i])) && - !stat(szMyStuffTarget, &statFolder) && S_ISDIR(statFolder.st_mode)) - { - /* If there's a 'My Whatever' directory where 'My Documents' links to, link to it. */ - rmdir(pszMyStuff); - symlink(szMyStuffTarget, pszMyStuff); - } - else - { - /* Else link to where 'My Documents' itself links to. */ - rmdir(pszMyStuff); - symlink(szPersonalTarget, pszMyStuff); - } - HeapFree(GetProcessHeap(), 0, pszMyStuff); - } - - /* Last but not least, the Desktop folder */ - if (pszHome) - strcpy(szDesktopTarget, pszHome); - else - strcpy(szDesktopTarget, pszPersonal); - HeapFree(GetProcessHeap(), 0, pszPersonal); - - if (_SHAppendToUnixPath(szDesktopTarget, DesktopW) && - !stat(szDesktopTarget, &statFolder) && S_ISDIR(statFolder.st_mode)) - { - hr = SHGetFolderPathW(NULL, CSIDL_DESKTOPDIRECTORY|CSIDL_FLAG_CREATE, NULL, - SHGFP_TYPE_DEFAULT, wszTempPath); - if (SUCCEEDED(hr) && (pszDesktop = wine_get_unix_file_name(wszTempPath))) - { - rmdir(pszDesktop); - symlink(szDesktopTarget, pszDesktop); - HeapFree(GetProcessHeap(), 0, pszDesktop); - } - } -} -#endif - /* Register the default values in the registry, as some apps seem to depend * on their presence. The set registered was taken from Windows XP. */ @@ -1852,14 +1669,6 @@ EXTERN_C HRESULT SHELL_RegisterShellFolders(void) { HRESULT hr; - /* Set up '$HOME' targeted symlinks for 'My Documents', 'My Pictures', - * 'My Video', 'My Music' and 'Desktop' in advance, so that the - * _SHRegister*ShellFolders() functions will find everything nice and clean - * and thus will not attempt to create them in the profile directory. */ -#if 0 - _SHCreateSymbolicLinks(); -#endif - hr = _SHRegisterUserShellFolders(TRUE); if (SUCCEEDED(hr)) hr = _SHRegisterUserShellFolders(FALSE);