Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygendrive.cpp
Go to the documentation of this file.
00001 /* 00002 * Shell Library Functions 00003 * 00004 * Copyright 2005 Johannes Anderwald 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2.1 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with this library; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00019 */ 00020 00021 #include <precomp.h> 00022 using namespace std; 00023 00024 #define MAX_PROPERTY_SHEET_PAGE 32 00025 00026 WINE_DEFAULT_DEBUG_CHANNEL(shell); 00027 00028 typedef struct 00029 { 00030 WCHAR Drive; 00031 UINT Options; 00032 UINT Result; 00033 } FORMAT_DRIVE_CONTEXT, *PFORMAT_DRIVE_CONTEXT; 00034 00035 EXTERN_C HPSXA WINAPI SHCreatePropSheetExtArrayEx(HKEY hKey, LPCWSTR pszSubKey, UINT max_iface, IDataObject *pDataObj); 00036 HPROPSHEETPAGE SH_CreatePropertySheetPage(LPCSTR resname, DLGPROC dlgproc, LPARAM lParam, LPWSTR szTitle); 00037 00038 static BOOL 00039 GetDefaultClusterSize(LPWSTR szFs, PDWORD pClusterSize, PULARGE_INTEGER TotalNumberOfBytes) 00040 { 00041 DWORD ClusterSize; 00042 00043 if (!wcsicmp(szFs, L"FAT16") || 00044 !wcsicmp(szFs, L"FAT")) //REACTOS HACK 00045 { 00046 if (TotalNumberOfBytes->QuadPart <= (16 * 1024 * 1024)) 00047 ClusterSize = 2048; 00048 else if (TotalNumberOfBytes->QuadPart <= (32 * 1024 * 1024)) 00049 ClusterSize = 512; 00050 else if (TotalNumberOfBytes->QuadPart <= (64 * 1024 * 1024)) 00051 ClusterSize = 1024; 00052 else if (TotalNumberOfBytes->QuadPart <= (128 * 1024 * 1024)) 00053 ClusterSize = 2048; 00054 else if (TotalNumberOfBytes->QuadPart <= (256 * 1024 * 1024)) 00055 ClusterSize = 4096; 00056 else if (TotalNumberOfBytes->QuadPart <= (512 * 1024 * 1024)) 00057 ClusterSize = 8192; 00058 else if (TotalNumberOfBytes->QuadPart <= (1024 * 1024 * 1024)) 00059 ClusterSize = 16384; 00060 else if (TotalNumberOfBytes->QuadPart <= (2048LL * 1024LL * 1024LL)) 00061 ClusterSize = 32768; 00062 else if (TotalNumberOfBytes->QuadPart <= (4096LL * 1024LL * 1024LL)) 00063 ClusterSize = 8192; 00064 else 00065 return FALSE; 00066 } 00067 else if (!wcsicmp(szFs, L"FAT32")) 00068 { 00069 if (TotalNumberOfBytes->QuadPart <= (64 * 1024 * 1024)) 00070 ClusterSize = 512; 00071 else if (TotalNumberOfBytes->QuadPart <= (128 * 1024 * 1024)) 00072 ClusterSize = 1024; 00073 else if (TotalNumberOfBytes->QuadPart <= (256 * 1024 * 1024)) 00074 ClusterSize = 2048; 00075 else if (TotalNumberOfBytes->QuadPart <= (8192LL * 1024LL * 1024LL)) 00076 ClusterSize = 2048; 00077 else if (TotalNumberOfBytes->QuadPart <= (16384LL * 1024LL * 1024LL)) 00078 ClusterSize = 8192; 00079 else if (TotalNumberOfBytes->QuadPart <= (32768LL * 1024LL * 1024LL)) 00080 ClusterSize = 16384; 00081 else 00082 return FALSE; 00083 } 00084 else if (!wcsicmp(szFs, L"NTFS")) 00085 { 00086 if (TotalNumberOfBytes->QuadPart <= (512 * 1024 * 1024)) 00087 ClusterSize = 512; 00088 else if (TotalNumberOfBytes->QuadPart <= (1024 * 1024 * 1024)) 00089 ClusterSize = 1024; 00090 else if (TotalNumberOfBytes->QuadPart <= (2048LL * 1024LL * 1024LL)) 00091 ClusterSize = 2048; 00092 else 00093 ClusterSize = 2048; 00094 } 00095 else 00096 return FALSE; 00097 00098 *pClusterSize = ClusterSize; 00099 return TRUE; 00100 } 00101 00102 static BOOL CALLBACK 00103 AddPropSheetPageCallback(HPROPSHEETPAGE hPage, LPARAM lParam) 00104 { 00105 PROPSHEETHEADER *ppsh = (PROPSHEETHEADER *)lParam; 00106 if (ppsh->nPages < MAX_PROPERTY_SHEET_PAGE) 00107 { 00108 ppsh->phpage[ppsh->nPages++] = hPage; 00109 return TRUE; 00110 } 00111 return FALSE; 00112 } 00113 00114 typedef struct _DRIVE_PROP_PAGE 00115 { 00116 LPCSTR resname; 00117 DLGPROC dlgproc; 00118 UINT DriveType; 00119 } DRIVE_PROP_PAGE; 00120 00121 BOOL 00122 SH_ShowDriveProperties(WCHAR *pwszDrive, LPCITEMIDLIST pidlFolder, LPCITEMIDLIST *apidl) 00123 { 00124 HPSXA hpsx = NULL; 00125 HPROPSHEETPAGE hpsp[MAX_PROPERTY_SHEET_PAGE]; 00126 PROPSHEETHEADERW psh; 00127 CComObject<CDrvDefExt> *pDrvDefExt = NULL; 00128 00129 ZeroMemory(&psh, sizeof(PROPSHEETHEADERW)); 00130 psh.dwSize = sizeof(PROPSHEETHEADERW); 00131 psh.dwFlags = 0; // FIXME: make it modeless 00132 psh.hwndParent = NULL; 00133 psh.nStartPage = 0; 00134 psh.phpage = hpsp; 00135 00136 WCHAR wszName[256]; 00137 if (GetVolumeInformationW(pwszDrive, wszName, sizeof(wszName) / sizeof(WCHAR), NULL, NULL, NULL, NULL, 0)) 00138 { 00139 psh.pszCaption = wszName; 00140 psh.dwFlags |= PSH_PROPTITLE; 00141 if (wszName[0] == UNICODE_NULL) 00142 { 00143 /* FIXME: check if disk is a really a local hdd */ 00144 UINT i = LoadStringW(shell32_hInstance, IDS_DRIVE_FIXED, wszName, sizeof(wszName) / sizeof(WCHAR) - 6); 00145 StringCchPrintf(wszName + i, sizeof(wszName) / sizeof(WCHAR) - i, L" (%s)", pwszDrive); 00146 } 00147 } 00148 00149 CComPtr<IDataObject> pDataObj; 00150 HRESULT hr = SHCreateDataObject(pidlFolder, 1, apidl, NULL, IID_IDataObject, (LPVOID *)&pDataObj); 00151 00152 if (SUCCEEDED(hr)) 00153 { 00154 hr = CComObject<CDrvDefExt>::CreateInstance(&pDrvDefExt); 00155 if (SUCCEEDED(hr)) 00156 { 00157 pDrvDefExt->AddRef(); // CreateInstance returns object with 0 ref count 00158 hr = pDrvDefExt->Initialize(pidlFolder, pDataObj, NULL); 00159 if (SUCCEEDED(hr)) 00160 { 00161 hr = pDrvDefExt->AddPages(AddPropSheetPageCallback, (LPARAM)&psh); 00162 if (FAILED(hr)) 00163 ERR("AddPages failed\n"); 00164 } else 00165 ERR("Initialize failed\n"); 00166 } 00167 00168 hpsx = SHCreatePropSheetExtArrayEx(HKEY_CLASSES_ROOT, L"Drive", MAX_PROPERTY_SHEET_PAGE, pDataObj); 00169 if (hpsx) 00170 SHAddFromPropSheetExtArray(hpsx, (LPFNADDPROPSHEETPAGE)AddPropSheetPageCallback, (LPARAM)&psh); 00171 } 00172 00173 HWND hwnd = (HWND)PropertySheetW(&psh); 00174 00175 if (hpsx) 00176 SHDestroyPropSheetExtArray(hpsx); 00177 if (pDrvDefExt) 00178 pDrvDefExt->Release(); 00179 00180 if (!hwnd) 00181 return FALSE; 00182 return TRUE; 00183 } 00184 00185 static VOID 00186 InsertDefaultClusterSizeForFs(HWND hwndDlg, PFORMAT_DRIVE_CONTEXT pContext) 00187 { 00188 WCHAR wszBuf[100] = {0}; 00189 WCHAR szDrive[] = L"C:\\"; 00190 INT iSelIndex; 00191 ULARGE_INTEGER FreeBytesAvailableUser, TotalNumberOfBytes; 00192 DWORD ClusterSize; 00193 LRESULT lIndex; 00194 HWND hDlgCtrl; 00195 00196 hDlgCtrl = GetDlgItem(hwndDlg, 28677); 00197 iSelIndex = SendMessage(hDlgCtrl, CB_GETCURSEL, 0, 0); 00198 if (iSelIndex == CB_ERR) 00199 return; 00200 00201 if (SendMessageW(hDlgCtrl, CB_GETLBTEXT, iSelIndex, (LPARAM)wszBuf) == CB_ERR) 00202 return; 00203 00204 szDrive[0] = pContext->Drive + 'A'; 00205 00206 if (!GetDiskFreeSpaceExW(szDrive, &FreeBytesAvailableUser, &TotalNumberOfBytes, NULL)) 00207 return; 00208 00209 if (!wcsicmp(wszBuf, L"FAT16") || 00210 !wcsicmp(wszBuf, L"FAT")) //REACTOS HACK 00211 { 00212 if (!GetDefaultClusterSize(wszBuf, &ClusterSize, &TotalNumberOfBytes)) 00213 { 00214 TRACE("FAT16 is not supported on hdd larger than 4G current %lu\n", TotalNumberOfBytes.QuadPart); 00215 SendMessageW(hDlgCtrl, CB_DELETESTRING, iSelIndex, 0); 00216 return; 00217 } 00218 00219 if (LoadStringW(shell32_hInstance, IDS_DEFAULT_CLUSTER_SIZE, wszBuf, sizeof(wszBuf) / sizeof(WCHAR))) 00220 { 00221 hDlgCtrl = GetDlgItem(hwndDlg, 28680); 00222 SendMessageW(hDlgCtrl, CB_RESETCONTENT, 0, 0); 00223 lIndex = SendMessageW(hDlgCtrl, CB_ADDSTRING, 0, (LPARAM)wszBuf); 00224 if (lIndex != CB_ERR) 00225 SendMessageW(hDlgCtrl, CB_SETITEMDATA, lIndex, (LPARAM)ClusterSize); 00226 SendMessageW(hDlgCtrl, CB_SETCURSEL, 0, 0); 00227 } 00228 } 00229 else if (!wcsicmp(wszBuf, L"FAT32")) 00230 { 00231 if (!GetDefaultClusterSize(wszBuf, &ClusterSize, &TotalNumberOfBytes)) 00232 { 00233 TRACE("FAT32 is not supported on hdd larger than 32G current %lu\n", TotalNumberOfBytes.QuadPart); 00234 SendMessageW(hDlgCtrl, CB_DELETESTRING, iSelIndex, 0); 00235 return; 00236 } 00237 00238 if (LoadStringW(shell32_hInstance, IDS_DEFAULT_CLUSTER_SIZE, wszBuf, sizeof(wszBuf) / sizeof(WCHAR))) 00239 { 00240 hDlgCtrl = GetDlgItem(hwndDlg, 28680); 00241 SendMessageW(hDlgCtrl, CB_RESETCONTENT, 0, 0); 00242 lIndex = SendMessageW(hDlgCtrl, CB_ADDSTRING, 0, (LPARAM)wszBuf); 00243 if (lIndex != CB_ERR) 00244 SendMessageW(hDlgCtrl, CB_SETITEMDATA, lIndex, (LPARAM)ClusterSize); 00245 SendMessageW(hDlgCtrl, CB_SETCURSEL, 0, 0); 00246 } 00247 } 00248 else if (!wcsicmp(wszBuf, L"NTFS")) 00249 { 00250 if (!GetDefaultClusterSize(wszBuf, &ClusterSize, &TotalNumberOfBytes)) 00251 { 00252 TRACE("NTFS is not supported on hdd larger than 2TB current %lu\n", TotalNumberOfBytes.QuadPart); 00253 SendMessageW(hDlgCtrl, CB_DELETESTRING, iSelIndex, 0); 00254 return; 00255 } 00256 00257 hDlgCtrl = GetDlgItem(hwndDlg, 28680); 00258 if (LoadStringW(shell32_hInstance, IDS_DEFAULT_CLUSTER_SIZE, wszBuf, sizeof(wszBuf) / sizeof(WCHAR))) 00259 { 00260 SendMessageW(hDlgCtrl, CB_RESETCONTENT, 0, 0); 00261 lIndex = SendMessageW(hDlgCtrl, CB_ADDSTRING, 0, (LPARAM)wszBuf); 00262 if (lIndex != CB_ERR) 00263 SendMessageW(hDlgCtrl, CB_SETITEMDATA, lIndex, (LPARAM)ClusterSize); 00264 SendMessageW(hDlgCtrl, CB_SETCURSEL, 0, 0); 00265 } 00266 ClusterSize = 512; 00267 for (lIndex = 0; lIndex < 4; lIndex++) 00268 { 00269 TotalNumberOfBytes.QuadPart = ClusterSize; 00270 if (StrFormatByteSizeW(TotalNumberOfBytes.QuadPart, wszBuf, sizeof(wszBuf) / sizeof(WCHAR))) 00271 { 00272 lIndex = SendMessageW(hDlgCtrl, CB_ADDSTRING, 0, (LPARAM)wszBuf); 00273 if (lIndex != CB_ERR) 00274 SendMessageW(hDlgCtrl, CB_SETITEMDATA, lIndex, (LPARAM)ClusterSize); 00275 } 00276 ClusterSize *= 2; 00277 } 00278 } 00279 else 00280 { 00281 FIXME("unknown fs\n"); 00282 SendDlgItemMessageW(hwndDlg, 28680, CB_RESETCONTENT, iSelIndex, 0); 00283 return; 00284 } 00285 } 00286 00287 static VOID 00288 InitializeFormatDriveDlg(HWND hwndDlg, PFORMAT_DRIVE_CONTEXT pContext) 00289 { 00290 WCHAR szText[120]; 00291 WCHAR szDrive[] = L"C:\\"; 00292 WCHAR szFs[30] = L""; 00293 INT cchText; 00294 ULARGE_INTEGER FreeBytesAvailableUser, TotalNumberOfBytes; 00295 DWORD dwIndex, dwDefault; 00296 UCHAR uMinor, uMajor; 00297 BOOLEAN Latest; 00298 HWND hwndFileSystems; 00299 00300 cchText = GetWindowTextW(hwndDlg, szText, sizeof(szText) / sizeof(WCHAR) - 1); 00301 if (cchText < 0) 00302 cchText = 0; 00303 szText[cchText++] = L' '; 00304 szDrive[0] = pContext->Drive + L'A'; 00305 if (GetVolumeInformationW(szDrive, &szText[cchText], (sizeof(szText) / sizeof(WCHAR)) - cchText, NULL, NULL, NULL, szFs, sizeof(szFs) / sizeof(WCHAR))) 00306 { 00307 if (szText[cchText] == UNICODE_NULL) 00308 { 00309 /* load default volume label */ 00310 cchText += LoadStringW(shell32_hInstance, IDS_DRIVE_FIXED, &szText[cchText], (sizeof(szText) / sizeof(WCHAR)) - cchText); 00311 } 00312 else 00313 { 00314 /* set volume label */ 00315 SetDlgItemTextW(hwndDlg, 28679, &szText[cchText]); 00316 cchText += wcslen(&szText[cchText]); 00317 } 00318 } 00319 00320 StringCchPrintfW(szText + cchText, _countof(szText) - cchText, L" (%c)", szDrive[0]); 00321 00322 /* set window text */ 00323 SetWindowTextW(hwndDlg, szText); 00324 00325 if (GetDiskFreeSpaceExW(szDrive, &FreeBytesAvailableUser, &TotalNumberOfBytes, NULL)) 00326 { 00327 if (StrFormatByteSizeW(TotalNumberOfBytes.QuadPart, szText, sizeof(szText) / sizeof(WCHAR))) 00328 { 00329 /* add drive capacity */ 00330 SendDlgItemMessageW(hwndDlg, 28673, CB_ADDSTRING, 0, (LPARAM)szText); 00331 SendDlgItemMessageW(hwndDlg, 28673, CB_SETCURSEL, 0, (LPARAM)0); 00332 } 00333 } 00334 00335 if (pContext->Options & SHFMT_OPT_FULL) 00336 { 00337 /* check quick format button */ 00338 SendDlgItemMessageW(hwndDlg, 28674, BM_SETCHECK, BST_CHECKED, 0); 00339 } 00340 00341 /* enumerate all available filesystems */ 00342 dwIndex = 0; 00343 dwDefault = 0; 00344 hwndFileSystems = GetDlgItem(hwndDlg, 28677); 00345 00346 while(QueryAvailableFileSystemFormat(dwIndex, szText, &uMajor, &uMinor, &Latest)) 00347 { 00348 if (!wcsicmp(szText, szFs)) 00349 dwDefault = dwIndex; 00350 00351 SendMessageW(hwndFileSystems, CB_ADDSTRING, 0, (LPARAM)szText); 00352 dwIndex++; 00353 } 00354 00355 if (!dwIndex) 00356 { 00357 ERR("no filesystem providers\n"); 00358 return; 00359 } 00360 00361 /* select default filesys */ 00362 SendMessageW(hwndFileSystems, CB_SETCURSEL, dwDefault, 0); 00363 /* setup cluster combo */ 00364 InsertDefaultClusterSizeForFs(hwndDlg, pContext); 00365 /* hide progress control */ 00366 ShowWindow(GetDlgItem(hwndDlg, 28678), SW_HIDE); 00367 } 00368 00369 static HWND FormatDrvDialog = NULL; 00370 static BOOLEAN bSuccess = FALSE; 00371 00372 static BOOLEAN NTAPI 00373 FormatExCB( 00374 IN CALLBACKCOMMAND Command, 00375 IN ULONG SubAction, 00376 IN PVOID ActionInfo) 00377 { 00378 PDWORD Progress; 00379 PBOOLEAN pSuccess; 00380 switch(Command) 00381 { 00382 case PROGRESS: 00383 Progress = (PDWORD)ActionInfo; 00384 SendDlgItemMessageW(FormatDrvDialog, 28678, PBM_SETPOS, (WPARAM)*Progress, 0); 00385 break; 00386 case DONE: 00387 pSuccess = (PBOOLEAN)ActionInfo; 00388 bSuccess = (*pSuccess); 00389 break; 00390 00391 case VOLUMEINUSE: 00392 case INSUFFICIENTRIGHTS: 00393 case FSNOTSUPPORTED: 00394 case CLUSTERSIZETOOSMALL: 00395 bSuccess = FALSE; 00396 FIXME("\n"); 00397 break; 00398 00399 default: 00400 break; 00401 } 00402 00403 return TRUE; 00404 } 00405 00406 VOID 00407 FormatDrive(HWND hwndDlg, PFORMAT_DRIVE_CONTEXT pContext) 00408 { 00409 WCHAR szDrive[4] = { L'C', ':', '\\', 0 }; 00410 WCHAR szFileSys[40] = {0}; 00411 WCHAR szLabel[40] = {0}; 00412 INT iSelIndex; 00413 UINT Length; 00414 HWND hDlgCtrl; 00415 BOOL QuickFormat; 00416 DWORD ClusterSize; 00417 00418 /* set volume path */ 00419 szDrive[0] = pContext->Drive; 00420 00421 /* get filesystem */ 00422 hDlgCtrl = GetDlgItem(hwndDlg, 28677); 00423 iSelIndex = SendMessageW(hDlgCtrl, CB_GETCURSEL, 0, 0); 00424 if (iSelIndex == CB_ERR) 00425 { 00426 FIXME("\n"); 00427 return; 00428 } 00429 Length = SendMessageW(hDlgCtrl, CB_GETLBTEXTLEN, iSelIndex, 0); 00430 if ((int)Length == CB_ERR || Length + 1 > sizeof(szFileSys) / sizeof(WCHAR)) 00431 { 00432 FIXME("\n"); 00433 return; 00434 } 00435 00436 /* retrieve the file system */ 00437 SendMessageW(hDlgCtrl, CB_GETLBTEXT, iSelIndex, (LPARAM)szFileSys); 00438 szFileSys[(sizeof(szFileSys)/sizeof(WCHAR))-1] = L'\0'; 00439 00440 /* retrieve the volume label */ 00441 hDlgCtrl = GetWindow(hwndDlg, 28679); 00442 Length = SendMessageW(hDlgCtrl, WM_GETTEXTLENGTH, 0, 0); 00443 if (Length + 1 > sizeof(szLabel) / sizeof(WCHAR)) 00444 { 00445 FIXME("\n"); 00446 return; 00447 } 00448 SendMessageW(hDlgCtrl, WM_GETTEXT, sizeof(szLabel) / sizeof(WCHAR), (LPARAM)szLabel); 00449 szLabel[(sizeof(szLabel)/sizeof(WCHAR))-1] = L'\0'; 00450 00451 /* check for quickformat */ 00452 if (SendDlgItemMessageW(hwndDlg, 28674, BM_GETCHECK, 0, 0) == BST_CHECKED) 00453 QuickFormat = TRUE; 00454 else 00455 QuickFormat = FALSE; 00456 00457 /* get the cluster size */ 00458 hDlgCtrl = GetDlgItem(hwndDlg, 28680); 00459 iSelIndex = SendMessageW(hDlgCtrl, CB_GETCURSEL, 0, 0); 00460 if (iSelIndex == CB_ERR) 00461 { 00462 FIXME("\n"); 00463 return; 00464 } 00465 ClusterSize = SendMessageW(hDlgCtrl, CB_GETITEMDATA, iSelIndex, 0); 00466 if ((int)ClusterSize == CB_ERR) 00467 { 00468 FIXME("\n"); 00469 return; 00470 } 00471 00472 hDlgCtrl = GetDlgItem(hwndDlg, 28680); 00473 ShowWindow(hDlgCtrl, SW_SHOW); 00474 SendMessageW(hDlgCtrl, PBM_SETRANGE, 0, MAKELPARAM(0, 100)); 00475 bSuccess = FALSE; 00476 00477 /* FIXME 00478 * will cause display problems 00479 * when performing more than one format 00480 */ 00481 FormatDrvDialog = hwndDlg; 00482 00483 FormatEx(szDrive, 00484 FMIFS_HARDDISK, /* FIXME */ 00485 szFileSys, 00486 szLabel, 00487 QuickFormat, 00488 ClusterSize, 00489 FormatExCB); 00490 00491 ShowWindow(hDlgCtrl, SW_HIDE); 00492 FormatDrvDialog = NULL; 00493 if (!bSuccess) 00494 { 00495 pContext->Result = SHFMT_ERROR; 00496 } 00497 else if (QuickFormat) 00498 { 00499 pContext->Result = SHFMT_OPT_FULL; 00500 } 00501 else 00502 { 00503 pContext->Result = FALSE; 00504 } 00505 } 00506 00507 static INT_PTR CALLBACK 00508 FormatDriveDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) 00509 { 00510 PFORMAT_DRIVE_CONTEXT pContext; 00511 00512 switch(uMsg) 00513 { 00514 case WM_INITDIALOG: 00515 InitializeFormatDriveDlg(hwndDlg, (PFORMAT_DRIVE_CONTEXT)lParam); 00516 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)lParam); 00517 return TRUE; 00518 case WM_COMMAND: 00519 switch(LOWORD(wParam)) 00520 { 00521 case IDOK: 00522 pContext = (PFORMAT_DRIVE_CONTEXT)GetWindowLongPtr(hwndDlg, DWLP_USER); 00523 FormatDrive(hwndDlg, pContext); 00524 break; 00525 case IDCANCEL: 00526 pContext = (PFORMAT_DRIVE_CONTEXT)GetWindowLongPtr(hwndDlg, DWLP_USER); 00527 EndDialog(hwndDlg, pContext->Result); 00528 break; 00529 case 28677: // filesystem combo 00530 if (HIWORD(wParam) == CBN_SELENDOK) 00531 { 00532 pContext = (PFORMAT_DRIVE_CONTEXT)GetWindowLongPtr(hwndDlg, DWLP_USER); 00533 InsertDefaultClusterSizeForFs(hwndDlg, pContext); 00534 } 00535 break; 00536 } 00537 } 00538 return FALSE; 00539 } 00540 00541 /************************************************************************* 00542 * SHFormatDrive (SHELL32.@) 00543 */ 00544 00545 DWORD 00546 WINAPI 00547 SHFormatDrive(HWND hwnd, UINT drive, UINT fmtID, UINT options) 00548 { 00549 FORMAT_DRIVE_CONTEXT Context; 00550 int result; 00551 00552 TRACE("%p, 0x%08x, 0x%08x, 0x%08x - stub\n", hwnd, drive, fmtID, options); 00553 00554 Context.Drive = drive; 00555 Context.Options = options; 00556 00557 result = DialogBoxParamW(shell32_hInstance, MAKEINTRESOURCEW(IDD_FORMAT_DRIVE), hwnd, FormatDriveDlg, (LPARAM)&Context); 00558 00559 return result; 00560 } 00561 00562 Generated on Sun May 27 2012 04:26:17 for ReactOS by
1.7.6.1
|