Author: janderwald Date: Sun Jul 27 17:58:19 2008 New Revision: 34867
URL: http://svn.reactos.org/svn/reactos?rev=34867&view=rev Log: - implement changing drive volume name - display default volume label "local disk" if there is no title - verify that provided clsid is valid - display drive property dialog - note: changing volume label currently leads to a crash
Modified: trunk/reactos/dll/win32/shell32/drive.c trunk/reactos/dll/win32/shell32/fprop.c
Modified: trunk/reactos/dll/win32/shell32/drive.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/drive.c?r... ============================================================================== --- trunk/reactos/dll/win32/shell32/drive.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/drive.c [iso-8859-1] Sun Jul 27 17:58:19 2008 @@ -229,12 +229,13 @@ ) { LPPROPSHEETPAGEW ppsp; - LPDRAWITEMSTRUCT drawItem; + LPDRAWITEMSTRUCT drawItem; STARTUPINFOW si; PROCESS_INFORMATION pi; WCHAR * lpstr; WCHAR szPath[MAX_PATH]; UINT length; + LPPSHNOTIFY lppsn;
switch(uMsg) { @@ -246,11 +247,11 @@ SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)lpstr); InitializeGeneralDriveDialog(hwndDlg, lpstr); return TRUE; - case WM_DRAWITEM: - drawItem = (LPDRAWITEMSTRUCT)lParam; - if (drawItem->CtlID >= 14013 && drawItem->CtlID <= 14015) + case WM_DRAWITEM: + drawItem = (LPDRAWITEMSTRUCT)lParam; + if (drawItem->CtlID >= 14013 && drawItem->CtlID <= 14015) { - PaintStaticControls(hwndDlg, drawItem); + PaintStaticControls(hwndDlg, drawItem); return TRUE; } break; @@ -272,7 +273,32 @@ CloseHandle(pi.hProcess); CloseHandle(pi.hThread); } + break; } + case WM_NOTIFY: + lppsn = (LPPSHNOTIFY) lParam; + if (LOWORD(wParam) == 14001) + { + if (HIWORD(wParam) == EN_CHANGE) + { + PropSheet_Changed(GetParent(hwndDlg), hwndDlg); + } + break; + } + if (lppsn->hdr.code == PSN_APPLY) + { + lpstr = (LPWSTR)GetWindowLong(hwndDlg, DWLP_USER); + if (lpstr && SendDlgItemMessageW(hwndDlg, 14001, WM_GETTEXT, sizeof(szPath)/sizeof(WCHAR), (LPARAM)szPath)) + { + szPath[(sizeof(szPath)/sizeof(WCHAR))-1] = L'\0'; + SetVolumeLabelW(lpstr, szPath); + } + SetWindowLong( hwndDlg, DWL_MSGRESULT, PSNRET_NOERROR ); + return TRUE; + } + break; + + default: break; }
@@ -409,6 +435,8 @@ PROPSHEETHEADERW psh; BOOL ret; UINT i; + WCHAR szName[MAX_PATH]; + DWORD dwMaxComponent, dwFileSysFlags;
ZeroMemory(&psh, sizeof(PROPSHEETHEADERW)); psh.dwSize = sizeof(PROPSHEETHEADERW); @@ -417,6 +445,30 @@ psh.nStartPage = 0; psh.phpage = hpsp;
+ + if (GetVolumeInformationW(drive, szName, sizeof(szName)/sizeof(WCHAR), NULL, &dwMaxComponent, + &dwFileSysFlags, NULL, 0)) + { + psh.pszCaption = szName; + psh.dwFlags |= PSH_PROPTITLE; + if (!wcslen(szName)) + { + /* FIXME + * check if disk is a really a local hdd + */ + i = LoadStringW(shell32_hInstance, IDS_DRIVE_FIXED, szName, sizeof(szName)/sizeof(WCHAR)); + if (i > 0 && i < (sizeof(szName)/sizeof(WCHAR)) + 6) + { + szName[i] = L' '; + szName[i+1] = L'('; + wcscpy(&szName[i+2], drive); + szName[i+4] = L')'; + szName[i+5] = L'\0'; + } + } + } + + for (i = 0; i < DRIVE_PROPERTY_PAGES; i++) { HPROPSHEETPAGE hprop = SH_CreatePropertySheetPage(PropPages[i].resname, PropPages[i].dlgproc, (LPARAM)drive, NULL);
Modified: trunk/reactos/dll/win32/shell32/fprop.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/fprop.c?r... ============================================================================== --- trunk/reactos/dll/win32/shell32/fprop.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/fprop.c [iso-8859-1] Sun Jul 27 17:58:19 2008 @@ -674,6 +674,7 @@ UINT Length; DWORD dwName; int Pages; + CLSID clsid;
pOffset = wcsrchr(wFileName, L'.'); if (!pOffset) @@ -681,8 +682,16 @@ Length = wcslen(szName); if (Length >=94) return 0; - wcscpy(szName, L"CLSID\"); - wcscpy(&szName[6], wFileName); + + if (CLSIDFromString(wFileName, &clsid) == NOERROR) + { + wcscpy(szName, L"CLSID\"); + wcscpy(&szName[6], wFileName); + } + else + { + wcscpy(szName, wFileName); + } } else { @@ -767,12 +776,17 @@ strcpyW(wFileName, lpf); }
- if (PathIsDirectoryW(wFileName) || strlenW(wFileName) == 3) - { - FIXME("directory / drive resources are missing\n"); - return FALSE; - } - + if (PathIsDirectoryW(wFileName)) + { + FIXME("directory resources are missing\n"); + return FALSE; + } + + if (wcslen(wFileName) == 3) + { + return SH_ShowDriveProperties(wFileName); + } + wcscpy(szTemp, wFileName); pFileName = wcsrchr(szTemp, '\'); if (pFileName)