From 759e9f55eed6061bfd5a1a31edc84e130a945643 Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Sat, 17 Oct 2015 23:01:19 +0000 Subject: [PATCH] [SHELL32] Enable formatting a Ext volume from GUI. Patch by Peter Hater svn path=/trunk/; revision=69579 --- reactos/boot/bootdata/hivesft.inf | 1 + reactos/dll/win32/shell32/dialogs/drive.cpp | 28 +++++++++++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/reactos/boot/bootdata/hivesft.inf b/reactos/boot/bootdata/hivesft.inf index f3827877883..be6dc79edc5 100644 --- a/reactos/boot/bootdata/hivesft.inf +++ b/reactos/boot/bootdata/hivesft.inf @@ -1094,6 +1094,7 @@ HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\Tonga Standard Tim HKLM,"SOFTWARE\ReactOS\ReactOS\CurrentVersion\IFS","FAT",0x00000000,"ufat.dll" HKLM,"SOFTWARE\ReactOS\ReactOS\CurrentVersion\IFS","FAT32",0x00000000,"ufat.dll" HKLM,"SOFTWARE\ReactOS\ReactOS\CurrentVersion\IFS","FATX",0x00000000,"ufatx.dll" +HKLM,"SOFTWARE\ReactOS\ReactOS\CurrentVersion\IFS","EXT2",0x00000000,"uext2.dll" ; Winlogon settings HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon","ConsoleShell",0x00020000,"%SystemRoot%\system32\cmd.exe" diff --git a/reactos/dll/win32/shell32/dialogs/drive.cpp b/reactos/dll/win32/shell32/dialogs/drive.cpp index 36c4f66ef57..692bea9770a 100644 --- a/reactos/dll/win32/shell32/dialogs/drive.cpp +++ b/reactos/dll/win32/shell32/dialogs/drive.cpp @@ -91,6 +91,11 @@ GetDefaultClusterSize(LPWSTR szFs, PDWORD pClusterSize, PULARGE_INTEGER TotalNum else ClusterSize = 2048; } + else if (!wcsicmp(szFs, L"EXT2")) + { + // auto block size calculation + ClusterSize = 0; + } else return FALSE; @@ -200,7 +205,7 @@ InsertDefaultClusterSizeForFs(HWND hwndDlg, PFORMAT_DRIVE_CONTEXT pContext) if (SendMessageW(hDlgCtrl, CB_GETLBTEXT, iSelIndex, (LPARAM)wszBuf) == CB_ERR) return; - szDrive[0] = pContext->Drive + 'A'; + szDrive[0] = pContext->Drive + L'A'; if (!GetDiskFreeSpaceExW(szDrive, &FreeBytesAvailableUser, &TotalNumberOfBytes, NULL)) return; @@ -275,6 +280,25 @@ InsertDefaultClusterSizeForFs(HWND hwndDlg, PFORMAT_DRIVE_CONTEXT pContext) ClusterSize *= 2; } } + else if (!wcsicmp(wszBuf, L"EXT2")) + { + if (!GetDefaultClusterSize(wszBuf, &ClusterSize, &TotalNumberOfBytes)) + { + TRACE("EXT2 is not supported on hdd larger than 32T current %lu\n", TotalNumberOfBytes.QuadPart); + SendMessageW(hDlgCtrl, CB_DELETESTRING, iSelIndex, 0); + return; + } + + if (LoadStringW(shell32_hInstance, IDS_DEFAULT_CLUSTER_SIZE, wszBuf, _countof(wszBuf))) + { + hDlgCtrl = GetDlgItem(hwndDlg, 28680); + SendMessageW(hDlgCtrl, CB_RESETCONTENT, 0, 0); + lIndex = SendMessageW(hDlgCtrl, CB_ADDSTRING, 0, (LPARAM)wszBuf); + if (lIndex != CB_ERR) + SendMessageW(hDlgCtrl, CB_SETITEMDATA, lIndex, (LPARAM)ClusterSize); + SendMessageW(hDlgCtrl, CB_SETCURSEL, 0, 0); + } + } else { FIXME("unknown fs\n"); @@ -415,7 +439,7 @@ FormatDrive(HWND hwndDlg, PFORMAT_DRIVE_CONTEXT pContext) DWORD ClusterSize; /* set volume path */ - szDrive[0] = pContext->Drive; + szDrive[0] = pContext->Drive + L'A'; /* get filesystem */ hDlgCtrl = GetDlgItem(hwndDlg, 28677);