https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9536f44c81776636a033d5...
commit 9536f44c81776636a033d5e875e7e0b2dc7e7cbb Author: George Bișoc george.bisoc@reactos.org AuthorDate: Tue Mar 2 19:37:31 2021 +0100 Commit: GitHub noreply@github.com CommitDate: Tue Mar 2 19:37:31 2021 +0100
[SHELL32] Determine if the FS is of type FATX (#3398)
FATX is listed as a filesystem for format within the list but it's classed out from current proposed filesystems, thus spamming the debug output and not allowing to actually format a storage drive with this FS. CORE-17272 --- dll/win32/shell32/dialogs/drive.cpp | 43 +++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+)
diff --git a/dll/win32/shell32/dialogs/drive.cpp b/dll/win32/shell32/dialogs/drive.cpp index 126dc0da211..6c6b0f39590 100644 --- a/dll/win32/shell32/dialogs/drive.cpp +++ b/dll/win32/shell32/dialogs/drive.cpp @@ -81,6 +81,27 @@ GetDefaultClusterSize(LPWSTR szFs, PDWORD pClusterSize, PULARGE_INTEGER TotalNum else return FALSE; } + else if (!wcsicmp(szFs, L"FATX")) + { + if (TotalNumberOfBytes->QuadPart <= (16 * 1024 * 1024)) + ClusterSize = 2048; + else if (TotalNumberOfBytes->QuadPart <= (32 * 1024 * 1024)) + ClusterSize = 512; + else if (TotalNumberOfBytes->QuadPart <= (64 * 1024 * 1024)) + ClusterSize = 1024; + else if (TotalNumberOfBytes->QuadPart <= (128 * 1024 * 1024)) + ClusterSize = 2048; + else if (TotalNumberOfBytes->QuadPart <= (256 * 1024 * 1024)) + ClusterSize = 4096; + else if (TotalNumberOfBytes->QuadPart <= (8192LL * 1024LL * 1024LL)) + ClusterSize = 2048; + else if (TotalNumberOfBytes->QuadPart <= (16384LL * 1024LL * 1024LL)) + ClusterSize = 8192; + else if (TotalNumberOfBytes->QuadPart <= (32768LL * 1024LL * 1024LL)) + ClusterSize = 16384; + else + return FALSE; + } else if (!wcsicmp(szFs, L"NTFS")) { if (TotalNumberOfBytes->QuadPart <= (512 * 1024 * 1024)) @@ -252,6 +273,28 @@ InsertDefaultClusterSizeForFs(HWND hwndDlg, PFORMAT_DRIVE_CONTEXT pContext) SendMessageW(GetDlgItem(hwndDlg, 28675), BM_SETCHECK, BST_UNCHECKED, 0); EnableWindow(GetDlgItem(hwndDlg, 28675), FALSE); } + else if (!wcsicmp(wszBuf, L"FATX")) + { + if (!GetDefaultClusterSize(wszBuf, &ClusterSize, &TotalNumberOfBytes)) + { + TRACE("FATX supports drives smaller than 1G (FATX16) and up to 32G (FATX32), current size -> %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); + } + + SendMessageW(GetDlgItem(hwndDlg, 28675), BM_SETCHECK, BST_UNCHECKED, 0); + EnableWindow(GetDlgItem(hwndDlg, 28675), FALSE); + } else if (!wcsicmp(wszBuf, L"NTFS")) { if (!GetDefaultClusterSize(wszBuf, &ClusterSize, &TotalNumberOfBytes))