ReactOS 0.4.17-dev-650-gd0e71de
drivepage.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS GUI first stage setup application
3 * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4 * PURPOSE: Disk partitions/Volumes page
5 * COPYRIGHT: Copyright 2008-2010 Matthias Kupfer <mkupfer@reactos.org>
6 * Copyright 2008-2009 Dmitry Chapyshev <dmitry@reactos.org>
7 * Copyright 2018-2026 Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
8 */
9
10#include "reactos.h"
11#include <shlwapi.h>
12
13#include <math.h> // For pow()
14
15// #include <ntdddisk.h>
16#include <ntddstor.h>
17#include <ntddscsi.h>
18
19#include "resource.h"
20
21#define NDEBUG
22#include <debug.h>
23
24/* GLOBALS ******************************************************************/
25
26#define IDS_LIST_COLUMN_FIRST IDS_PARTITION_NAME
27#define IDS_LIST_COLUMN_LAST IDS_PARTITION_STATUS
28
29#define MAX_LIST_COLUMNS (IDS_LIST_COLUMN_LAST - IDS_LIST_COLUMN_FIRST + 1)
31static const INT column_widths[MAX_LIST_COLUMNS] = {200, 90, 60, 60};
33
34/* FUNCTIONS ****************************************************************/
35
41static BOOL
43 _Inout_ PWSTR pszSanitized)
44{
45 PWCHAR pch1, pch2;
46 BOOL bSanitized = FALSE;
47
48 for (pch1 = pch2 = pszSanitized; *pch1; ++pch1)
49 {
50 /* Skip any invalid character found */
52 {
53 bSanitized = TRUE;
54 continue;
55 }
56
57 /* Copy over the valid ones */
58 *pch2 = *pch1;
59 ++pch2;
60 }
61 *pch2 = 0;
62
63 return bSanitized;
64}
65
70static BOOL
73{
74 HGLOBAL hData;
75 LPWSTR pszText, pszSanitized;
76 BOOL bSanitized;
77
78 /* Protect read-only edit control from modification */
80 return FALSE;
81
82 if (!OpenClipboard(hWnd))
83 return FALSE;
84
86 pszText = GlobalLock(hData);
87 if (!pszText)
88 {
90 return FALSE;
91 }
92
93 pszSanitized = _wcsdup(pszText);
94 GlobalUnlock(hData);
95 bSanitized = (pszSanitized && DoSanitizeText(pszSanitized));
96 if (bSanitized)
97 {
98 /* Update clipboard text */
99 SIZE_T cbData = (wcslen(pszSanitized) + 1) * sizeof(WCHAR);
101 pszText = GlobalLock(hData);
102 if (pszText)
103 {
104 CopyMemory(pszText, pszSanitized, cbData);
105 GlobalUnlock(hData);
107 }
108 }
109 free(pszSanitized);
110
112 return bSanitized;
113}
114
115static VOID
118{
119 EDITBALLOONTIP balloon;
120 WCHAR szTitle[512];
121 WCHAR szText[512];
122
123 /* Load the resources */
126
127 /* Show a warning balloon */
128 balloon.cbStruct = sizeof(balloon);
129 balloon.pszTitle = szTitle;
130 balloon.pszText = szText;
131#if (_WIN32_WINNT < _WIN32_WINNT_VISTA)
132 balloon.ttiIcon = TTI_ERROR;
133#else
134 balloon.ttiIcon = TTI_ERROR_LARGE;
135#endif
136
138 Edit_ShowBalloonTip(hEdit, &balloon);
139
140 // NOTE: There is no need to hide it when other keys are pressed;
141 // the EDIT control will deal with that itself.
142}
143
149static LRESULT
152 _In_ HWND hWnd,
153 _In_ UINT uMsg,
156{
158
159 switch (uMsg)
160 {
161 case WM_UNICHAR:
162 if (wParam == UNICODE_NOCHAR)
163 return TRUE;
165
166 case WM_IME_CHAR:
167 case WM_CHAR:
168 {
169 WCHAR wch = (WCHAR)wParam;
170
171 /* Let the EDIT control deal with Control characters.
172 * It won't emit them as raw data in the text. */
173 if (wParam < ' ')
174 break;
175
176 /* Ignore Ctrl-Backspace */
177 if (wParam == '\x7F')
178 return 0;
179
180 /* Protect read-only edit control from modification */
182 break;
183
184 if (uMsg == WM_IME_CHAR)
185 {
186 if (!IsWindowUnicode(hWnd) && HIBYTE(wch) != 0)
187 {
188 CHAR data[] = {HIBYTE(wch), LOBYTE(wch)};
189 MultiByteToWideChar(CP_ACP, 0, data, 2, &wch, 1);
190 }
191 }
192
193 /* Show an error and ignore input character if it's invalid */
195 {
197 return 0;
198 }
199 break;
200 }
201
202 case WM_PASTE:
203 /* Verify the text being pasted; if it was sanitized, show an error */
206 break;
207 }
208
209 return CallWindowProcW(orgEditProc, hWnd, uMsg, wParam, lParam);
210}
211
212static INT_PTR
215 _In_ HWND hDlg,
216 _In_ UINT uMsg,
219{
220 PSETUPDATA pSetupData;
221
222 /* Retrieve pointer to the global setup data */
223 pSetupData = (PSETUPDATA)GetWindowLongPtrW(hDlg, GWLP_USERDATA);
224
225 switch (uMsg)
226 {
227 case WM_INITDIALOG:
228 {
229 HWND hEdit;
230 WNDPROC orgEditProc;
231 BOOL bIsBIOS;
232 UINT uID;
233 INT iItem, iCurrent = CB_ERR, iDefault = 0;
234 WCHAR szText[50];
235
236 /* Save pointer to the global setup data */
237 pSetupData = (PSETUPDATA)lParam;
238 SetWindowLongPtrW(hDlg, GWLP_USERDATA, (LONG_PTR)pSetupData);
239
240 /* Subclass the install-dir edit control */
241 hEdit = GetDlgItem(hDlg, IDC_PATH);
245
246 /* Set the current installation directory */
247 SetWindowTextW(hEdit, pSetupData->USetupData.InstallationDirectory);
248
249
250 /* Initialize the list of available bootloader locations */
251 bIsBIOS = ((pSetupData->USetupData.ArchType == ARCH_PcAT) ||
252 (pSetupData->USetupData.ArchType == ARCH_NEC98x86));
254 {
255 if ( ( bIsBIOS && (uID == IDS_BOOTLOADER_SYSTEM)) ||
256 (!bIsBIOS && (uID == IDS_BOOTLOADER_MBRVBR || uID == IDS_BOOTLOADER_VBRONLY)) )
257 {
258 continue; // Skip this choice.
259 }
260
261 LoadStringW(pSetupData->hInstance, uID, szText, ARRAYSIZE(szText));
262 iItem = SendDlgItemMessageW(hDlg, IDC_INSTFREELDR, CB_ADDSTRING, 0, (LPARAM)szText);
263 if (iItem != CB_ERR && iItem != CB_ERRSPACE)
264 {
265 UINT uBldrLoc = uID - IDS_BOOTLOADER_NOINST
266 - (bIsBIOS && (uID >= IDS_BOOTLOADER_SYSTEM) ? 1 : 0);
267 SendDlgItemMessageW(hDlg, IDC_INSTFREELDR, CB_SETITEMDATA, iItem, uBldrLoc);
268
269 /* Find the index of the current and default locations */
270 if (uBldrLoc == pSetupData->USetupData.BootLoaderLocation)
271 iCurrent = iItem;
273 iDefault = iItem;
274 }
275 }
276 /* Select the current location or fall back to the default one */
277 if (iCurrent == CB_ERR)
278 iCurrent = iDefault;
280
281 return TRUE;
282 }
283
284 case WM_DESTROY:
285 {
286 /* Unsubclass the edit control */
287 HWND hEdit = GetDlgItem(hDlg, IDC_PATH);
289 if (orgEditProc) SetWindowLongPtrW(hEdit, GWLP_WNDPROC, (LONG_PTR)orgEditProc);
290 break;
291 }
292
293 case WM_COMMAND:
294 {
295 if (HIWORD(wParam) == BN_CLICKED) switch (LOWORD(wParam))
296 {
297 case IDOK:
298 {
299 HWND hEdit;
300 BOOL bIsValid;
301 WCHAR InstallDir[MAX_PATH];
302 INT iItem;
303 UINT uBldrLoc = CB_ERR;
304
305 /*
306 * Retrieve the installation path and verify its validity.
307 * Check for the validity of the installation directory and
308 * pop up an error if this is not the case.
309 */
310 hEdit = GetDlgItem(hDlg, IDC_PATH);
311 bIsValid = (GetWindowTextLengthW(hEdit) < _countof(InstallDir)); // && IsValidInstallDirectory(InstallDir);
312 GetWindowTextW(hEdit, InstallDir, _countof(InstallDir));
313 bIsValid = bIsValid && IsValidInstallDirectory(InstallDir);
314
315 if (!bIsValid)
316 {
317 // ERROR_DIRECTORY_NAME
318 DisplayError(hDlg,
321 break; // Go back to the dialog.
322 }
323
326 InstallDir);
327
328 /* Retrieve the bootloader location */
330 if (iItem != CB_ERR)
331 uBldrLoc = SendDlgItemMessageW(hDlg, IDC_INSTFREELDR, CB_GETITEMDATA, iItem, 0);
332 if (uBldrLoc == CB_ERR) // Default location: System partition / MBR & VBR
334 uBldrLoc = min(max(uBldrLoc, 0), 3);
335 pSetupData->USetupData.BootLoaderLocation = uBldrLoc;
336
338 }
339 case IDCANCEL:
340 EndDialog(hDlg, LOWORD(wParam));
341 return TRUE;
342 }
343 break;
344 }
345 }
346
347 return FALSE;
348}
349
350
356typedef struct _PARTITEM
357{
358 PPARTENTRY PartEntry; //< Disk region this structure is associated to.
359 PVOLENTRY Volume; //< Associated file system volume if any, or NULL.
360 PVOL_CREATE_INFO VolCreate; //< Volume create information (allocated).
362
367typedef struct _PARTCREATE_CTX
368{
369 PPARTITEM PartItem; //< Partition item info stored in the TreeList.
370 ULONG MaxSizeMB; //< Maximum possible partition size in MB.
371 ULONG PartSizeMB; //< Selected partition size in MB.
372 BOOLEAN MBRExtPart; //< Whether to create an MBR extended partition.
373 BOOLEAN ForceFormat :1; //< Whether to force formatting ('Do not format' option hidden).
374 BOOLEAN AutoFormat :1; //< Whether to auto-format (Format dialog stays hidden).
376
377static INT_PTR
380 _In_ PPARTCREATE_CTX PartCreateCtx,
381 _In_ HWND hDlg,
382 _In_ UINT uMsg,
385{
386 switch (uMsg)
387 {
388 case WM_INITDIALOG:
389 {
390 ULONG Index = 0;
391 INT iItem;
393 PCWSTR DefaultFs;
395 PVOL_CREATE_INFO VolCreate;
396
397 /* List the well-known file systems. We use the same strings
398 * for the displayed FS names and their actual ones. */
400 {
402 if (iItem != CB_ERR && iItem != CB_ERRSPACE)
404 }
405
406 /* Add the 'Do not format' entry if needed */
407 if (!PartCreateCtx->ForceFormat)
408 {
409 WCHAR szText[50];
410
412 iItem = SendDlgItemMessageW(hDlg, IDC_FSTYPE, CB_INSERTSTRING, 0, (LPARAM)szText);
413 if (iItem != CB_ERR && iItem != CB_ERRSPACE)
415 }
416
418 {
419 /* In unattended mode, preselect the file system */
421 {
422 /* 1 is for BtrFS */
423 case 1:
424 DefaultFs = L"BTRFS";
425 break;
426
427 /* If we don't understand input, default to FAT */
428 default:
429 DefaultFs = L"FAT";
430 break;
431 }
432 }
433 else
434 {
435 /* By default select the "FAT" file system */
436 DefaultFs = L"FAT";
437 }
438
439 /* Retrieve the selected volume and create information */
440 ASSERT(PartCreateCtx->PartItem->Volume == PartCreateCtx->PartItem->PartEntry->Volume);
441 Volume = PartCreateCtx->PartItem->PartEntry->Volume;
442 VolCreate = PartCreateCtx->PartItem->VolCreate;
443
444 /* Select the existing file system in the list if any,
445 * otherwise use the "DefaultFs" */
446 if (VolCreate && *VolCreate->FileSystemName)
447 FileSystem = VolCreate->FileSystemName;
448 else if (!SetupData.bUnattend && Volume && *Volume->Info.FileSystem)
449 FileSystem = Volume->Info.FileSystem;
450 else
451 FileSystem = DefaultFs;
452
454 if (iItem == CB_ERR)
455 iItem = 0;
457
458 /* Check the quick-format option by default as it speeds up formatting */
459 if (!VolCreate || VolCreate->QuickFormat)
461 else
463
464 return TRUE;
465 }
466
467 case WM_COMMAND:
468 {
469 //
470 // NOTE:
471 // - CBN_SELCHANGE sent everytime a combobox list item is selected,
472 // *even if* the list is opened.
473 // - CBN_SELENDOK sent only when user finished to select an item
474 // by clicking on it (if the list is opened), or selection changed
475 // (when the list is closed but selection is done with arrow keys).
476 //
477 if ((HIWORD(wParam) == CBN_SELCHANGE /*|| HIWORD(wParam) == CBN_SELENDOK*/) &&
479 {
480 // HWND hWndList = GetDlgItem(hDlg, IDC_FSTYPE);
482 INT iItem;
483
484 /* Retrieve the selected file system. Use the
485 * item data instead of the displayed string. */
486 iItem = SendDlgItemMessageW(hDlg, IDC_FSTYPE, CB_GETCURSEL, 0, 0);
487 if (iItem == CB_ERR)
488 iItem = 0; // Default entry
490 if (FileSystem == (PCWSTR)CB_ERR)
491 FileSystem = NULL; // Default data
492
493 /* Enable or disable formatting options,
494 * depending on whether we need to format */
496 return TRUE;
497 }
498
499 if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDOK)
500 {
501 PPARTITEM PartItem = PartCreateCtx->PartItem;
502 PVOL_CREATE_INFO VolCreate;
504 INT iItem;
505
506 /*
507 * Retrieve the formatting options
508 */
509
510 /* Retrieve the selected file system. Use the
511 * item data instead of the displayed string. */
512 iItem = SendDlgItemMessageW(hDlg, IDC_FSTYPE, CB_GETCURSEL, 0, 0);
513 if (iItem == CB_ERR)
514 iItem = 0; // Default entry
516 if (FileSystem == (PCWSTR)CB_ERR)
517 FileSystem = NULL; // Default data
518
519 VolCreate = PartItem->VolCreate;
520
521 /* Check if we need to format */
522 if (!FileSystem || !*FileSystem)
523 {
524 /* We don't format. If there is an existing
525 * volume-create structure, free it. */
526 if (VolCreate)
527 LocalFree(VolCreate);
528 PartItem->VolCreate = NULL;
529
530 /* And return */
531 return TRUE;
532 }
533
534 /* We will format: allocate and initialize
535 * a volume-create structure if needed */
536 if (!VolCreate)
537 VolCreate = LocalAlloc(LPTR, sizeof(*VolCreate));
538 if (!VolCreate)
539 {
540 DPRINT1("Failed to allocate volume-create structure\n");
541 return TRUE;
542 }
543
544 /* Cached input information that will be set to
545 * the FORMAT_VOLUME_INFO structure given to the
546 * 'FSVOLNOTIFY_STARTFORMAT' step */
547 // TODO: Think about which values could be defaulted...
549 _countof(VolCreate->FileSystemName),
550 FileSystem);
551 VolCreate->MediaFlag = FMIFS_HARDDISK;
552 VolCreate->Label = NULL;
553 VolCreate->QuickFormat =
555 VolCreate->ClusterSize = 0;
556
557 /* Set the volume associated to the new create information */
558 VolCreate->Volume = PartItem->Volume;
559
560 /* Associate the new, or update the volume create information */
561 PartItem->VolCreate = VolCreate;
562 return TRUE;
563 }
564 break;
565 }
566 }
567
568 return FALSE;
569}
570
571#define PM_FMTDLG_SHOWHIDE (WM_APP + 1)
572
573static INT_PTR
576 _In_ HWND hDlg,
577 _In_ UINT uMsg,
580{
581 PPARTCREATE_CTX PartCreateCtx;
582
583 /* Retrieve dialog context pointer */
584 PartCreateCtx = (PPARTCREATE_CTX)GetWindowLongPtrW(hDlg, GWLP_USERDATA);
585
586 switch (uMsg)
587 {
588 case WM_INITDIALOG:
589 {
590 /* Save dialog context pointer */
591 PartCreateCtx = (PPARTCREATE_CTX)lParam;
592 SetWindowLongPtrW(hDlg, GWLP_USERDATA, (LONG_PTR)PartCreateCtx);
593
594 /* We actually want to format, so set the flag */
595 PartCreateCtx->ForceFormat = TRUE;
596
597 /* In auto-format mode, hide the dialog and simulate press on OK.
598 * The file system is preselected by FormatDlgProcWorker(). */
599 if (PartCreateCtx->AutoFormat)
600 {
601 /* Win32 NOTE: No need to first invoke the helper dialog procedure,
602 * before posting our messages. The posted messages are dealt with
603 * *ONLY* after any messages potentially sent to ourselves by the
604 * helper dialog procedure. */
605 //INT_PTR ret = FormatDlgProcWorker(PartCreateCtx, hDlg, uMsg, wParam, lParam);
608 //return ret;
609 }
610 break;
611 }
612
614 ShowWindow(hDlg, wParam ? SW_SHOW : SW_HIDE);
615 break;
616
617 case WM_COMMAND:
618 {
619 if (HIWORD(wParam) == BN_CLICKED) switch (LOWORD(wParam))
620 {
621 case IDOK:
622 /* Retrieve the formatting options */
623 FormatDlgProcWorker(PartCreateCtx, hDlg, uMsg, wParam, lParam);
625 case IDCANCEL:
626 EndDialog(hDlg, LOWORD(wParam));
627 return TRUE;
628 }
629 break;
630 }
631 }
632
633 return FormatDlgProcWorker(PartCreateCtx, hDlg, uMsg, wParam, lParam);
634}
635
636static INT_PTR
639 _In_ HWND hDlg,
640 _In_ UINT uMsg,
643{
644 PPARTCREATE_CTX PartCreateCtx;
645
646 /* Retrieve dialog context pointer */
647 PartCreateCtx = (PPARTCREATE_CTX)GetWindowLongPtrW(hDlg, GWLP_USERDATA);
648
649 switch (uMsg)
650 {
651 case WM_INITDIALOG:
652 {
653 PPARTENTRY PartEntry;
654 PDISKENTRY DiskEntry;
655 ULONG MaxSizeMB;
656
657 /* Save dialog context pointer */
658 PartCreateCtx = (PPARTCREATE_CTX)lParam;
659 SetWindowLongPtrW(hDlg, GWLP_USERDATA, (LONG_PTR)PartCreateCtx);
660
661 /* Retrieve the selected partition */
662 PartEntry = PartCreateCtx->PartItem->PartEntry;
663 DiskEntry = PartEntry->DiskEntry;
664
665 /* Set the spinner to the maximum size in MB the partition can have */
666 MaxSizeMB = PartCreateCtx->MaxSizeMB;
669
670 /* Default to regular partition (non-extended on MBR disks) */
672
673 /* Also, disable and hide IDC_CHECK_MBREXTPART
674 * if space is logical or the disk is not MBR */
675 if ((DiskEntry->DiskStyle == PARTITION_STYLE_MBR) &&
676 !PartEntry->LogicalPartition)
677 {
680 }
681 else
682 {
685 }
686 break;
687 }
688
689 case WM_COMMAND:
690 {
691 if (HIWORD(wParam) == BN_CLICKED) switch (LOWORD(wParam))
692 {
694 {
695 /* Check for MBR-extended (container) partition */
696 // BST_UNCHECKED or BST_INDETERMINATE => FALSE
698 {
699 /* It is, disable formatting options */
703 }
704 else
705 {
706 /* It is not, re-enable formatting options */
710 }
711 return TRUE;
712 }
713
714 case IDOK:
715 {
716 /* Collect all the information and return it
717 * to the caller for creating the partition */
719 PartCreateCtx->PartSizeMB = min(max(PartCreateCtx->PartSizeMB, 1), PartCreateCtx->MaxSizeMB);
721
722 /* Retrieve the formatting options */
723 FormatDlgProcWorker(PartCreateCtx, hDlg, uMsg, wParam, lParam);
725 }
726 case IDCANCEL:
727 EndDialog(hDlg, LOWORD(wParam));
728 return TRUE;
729 }
730 break;
731 }
732 }
733
734 return FormatDlgProcWorker(PartCreateCtx, hDlg, uMsg, wParam, lParam);
735}
736
737
738BOOL
741 IN HWND hWndTreeList,
742 IN const UINT* pIDs,
743 IN const INT* pColsWidth,
744 IN const INT* pColsAlign,
745 IN UINT nNumOfColumns)
746{
747 UINT i;
748 TLCOLUMN tlC;
749 WCHAR szText[50];
750
751 /* Create the columns */
752 tlC.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
753 tlC.pszText = szText;
754
755 /* Load the column labels from the resource file */
756 for (i = 0; i < nNumOfColumns; i++)
757 {
758 tlC.iSubItem = i;
759 tlC.cx = pColsWidth[i];
760 tlC.fmt = pColsAlign[i];
761
762 LoadStringW(hInstance, pIDs[i], szText, ARRAYSIZE(szText));
763
764 if (TreeList_InsertColumn(hWndTreeList, i, &tlC) == -1)
765 return FALSE;
766 }
767
768 return TRUE;
769}
770
771
774 _In_ HWND hTreeList,
775 _In_opt_ HTLITEM hParent,
776 _In_opt_ HTLITEM hInsertAfter,
777 _In_ LPCWSTR lpText,
778 _In_ INT iImage,
779 _In_ INT iSelectedImage,
781{
782 TLINSERTSTRUCTW Insert;
783
784 ZeroMemory(&Insert, sizeof(Insert));
785
786 Insert.item.mask = TVIF_TEXT | TVIF_PARAM | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
787 Insert.hParent = hParent;
788 Insert.hInsertAfter = (hInsertAfter ? hInsertAfter : TVI_LAST);
789 Insert.item.pszText = (LPWSTR)lpText;
790 Insert.item.iImage = iImage;
791 Insert.item.iSelectedImage = iSelectedImage;
792 Insert.item.lParam = lParam;
793
794 // Insert.item.mask |= TVIF_STATE;
795 // Insert.item.stateMask = TVIS_OVERLAYMASK;
796 // Insert.item.state = INDEXTOOVERLAYMASK(1);
797
798 return TreeList_InsertItem(hTreeList, &Insert);
799}
800
801LPARAM
803 _In_ HWND hTreeList,
805{
806 TLITEMW tlItem;
807
808 tlItem.mask = TVIF_PARAM;
809 tlItem.hItem = hItem;
810 TreeList_GetItem(hTreeList, &tlItem);
811
812 return tlItem.lParam;
813}
814
815static
818 _In_ HWND hTreeList,
820{
821 HTLITEM hParentItem = TreeList_GetParent(hTreeList, hItem);
822 /* May or may not be a PPARTITEM: this is a PPARTITEM only when hParentItem != NULL */
823 PPARTITEM PartItem = (PPARTITEM)TreeListGetItemData(hTreeList, hItem);
824 if (!hParentItem || !PartItem)
825 return NULL;
826 return PartItem;
827}
828
829static
832 _In_ HWND hTreeList,
833 _Out_opt_ HTLITEM* phItem)
834{
835 PPARTITEM PartItem = NULL;
837 if (hItem)
838 {
839 PartItem = GetItemPartition(hTreeList, hItem);
840 if (PartItem && phItem)
841 *phItem = hItem;
842 }
843 return PartItem;
844}
845
846static
849 _In_ HWND hTreeList,
850 _In_opt_ PPARTENTRY PartEntry,
851 _Out_opt_ HTLITEM* phItem)
852{
853 PPARTITEM PartItem = NULL;
854
855 /* Enumerate every cached data in the TreeList, and for each, check
856 * whether its corresponding PPARTENTRY is the one we are looking for */
858 while ((hItem = TreeList_GetNextItem(hTreeList, hItem, TVGN_NEXTITEM)))
859 {
860 PartItem = GetItemPartition(hTreeList, hItem);
861 if (!PartItem)
862 continue;
863
864 /* Return the first valid partition item (if PartEntry == NULL),
865 * or the one that matches the given partition entry */
866 if (!PartEntry || (PartItem->PartEntry == PartEntry))
867 break; /* Found it */
868 /* Not yet found */
869 }
870 if (phItem)
871 *phItem = hItem;
872 return (hItem ? PartItem : NULL);
873}
874
877 _In_ HWND hTreeList,
879{
880 /* Enumerate every cached data in the TreeList, and for each, check
881 * whether its corresponding PPARTENTRY is the one we are looking for */
883 while ((hItem = TreeList_GetNextItem(hTreeList, hItem, TVGN_NEXTITEM)))
884 {
885 PPARTITEM PartItem = GetItemPartition(hTreeList, hItem);
886 if (!PartItem || !PartItem->VolCreate /* || !PartItem->Volume */)
887 continue;
888
889 if (PartItem->Volume == Volume)
890 {
891 /* Found it, return the associated volume-create structure */
892 return PartItem->VolCreate;
893 }
894 }
895 return NULL; /* Nothing was found */
896}
897
898
899VOID
901 IN PPARTENTRY PartEntry,
902 OUT PSTR strBuffer,
904{
905 if (PartEntry->PartitionType == PARTITION_ENTRY_UNUSED)
906 {
907 StringCchCopyA(strBuffer, cchBuffer,
908 "Unused" /* MUIGetString(STRING_FORMATUNUSED) */);
909 }
910 // else if (PartEntry == PartEntry->DiskEntry->ExtendedPartition)
911 else if (IsContainerPartition(PartEntry->PartitionType))
912 {
913 StringCchCopyA(strBuffer, cchBuffer,
914 "Extended Partition" /* MUIGetString(STRING_EXTENDED_PARTITION) */);
915 }
916 else
917 {
918 /* Do the table lookup */
919 PCSTR Description = LookupPartitionTypeString(PartEntry->DiskEntry->DiskStyle,
920 &PartEntry->PartitionType);
921 if (Description)
922 {
924 return;
925 }
926
927 /* We are here because the partition type is unknown */
928 if (cchBuffer > 0) *strBuffer = '\0';
929 }
930
931 if ((cchBuffer > 0) && (*strBuffer == '\0'))
932 {
933 StringCchPrintfA(strBuffer, cchBuffer,
934 // MUIGetString(STRING_PARTTYPE),
935 "Type 0x%02x",
936 PartEntry->PartitionType);
937 }
938}
939
940
941static VOID
945{
946 ULONGLONG DiskSize = *Size;
947
948 if (DiskSize >= 10 * GB) /* 10 GB */
949 {
950 DiskSize = RoundingDivide(DiskSize, GB);
951 *Unit = L"GB"; // MUIGetString(STRING_GB);
952 }
953 else
954 {
955 DiskSize = RoundingDivide(DiskSize, MB);
956 if (DiskSize == 0)
957 DiskSize = 1;
958 *Unit = L"MB"; // MUIGetString(STRING_MB);
959 }
960
961 *Size = DiskSize;
962}
963
964static VOID
968{
969 ULONGLONG PartSize = *Size;
970
971#if 0
972 if (PartSize >= 10 * GB) /* 10 GB */
973 {
974 PartSize = RoundingDivide(PartSize, GB);
975 *Unit = L"GB"; // MUIGetString(STRING_GB);
976 }
977 else
978#endif
979 if (PartSize >= 10 * MB) /* 10 MB */
980 {
981 PartSize = RoundingDivide(PartSize, MB);
982 *Unit = L"MB"; // MUIGetString(STRING_MB);
983 }
984 else
985 {
986 PartSize = RoundingDivide(PartSize, KB);
987 *Unit = L"KB"; // MUIGetString(STRING_KB);
988 }
989
990 *Size = PartSize;
991}
992
993static
997 _In_ HTLITEM htiParent,
998 _In_opt_ HTLITEM hInsertAfter,
999 _In_ PPARTENTRY PartEntry)
1000{
1001 PDISKENTRY DiskEntry = PartEntry->DiskEntry;
1002 PVOLINFO VolInfo = (PartEntry->Volume ? &PartEntry->Volume->Info : NULL);
1003 PPARTITEM PartItem;
1004 ULONGLONG PartSize;
1005 HTLITEM htiPart;
1006 CHAR PartTypeString[32];
1007 PCHAR PartType = PartTypeString;
1008 WCHAR LineBuffer[128];
1009
1010 /* Volume name */
1011 if (PartEntry->IsPartitioned == FALSE)
1012 {
1013 /* Unpartitioned space: Just display the description */
1014 StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
1015 // MUIGetString(STRING_UNPSPACE)
1016 L"Unpartitioned space");
1017 }
1018 else
1019//
1020// NOTE: This could be done with the next case.
1021//
1022 if ((DiskEntry->DiskStyle == PARTITION_STYLE_MBR) &&
1023 IsContainerPartition(PartEntry->PartitionType))
1024 {
1025 /* Extended partition container: Just display the partition's type */
1026 StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
1027 // MUIGetString(STRING_EXTENDED_PARTITION)
1028 L"Extended Partition");
1029 }
1030 else
1031 {
1032 /* Drive letter and partition number */
1033 StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
1034 // MUIGetString(STRING_HDDINFOUNK5),
1035 L"%s (%c%c)",
1036 (VolInfo && *VolInfo->VolumeLabel) ? VolInfo->VolumeLabel : L"Partition",
1037 !(VolInfo && VolInfo->DriveLetter) ? L'-' : VolInfo->DriveLetter,
1038 !(VolInfo && VolInfo->DriveLetter) ? L'-' : L':');
1039 }
1040
1041 /* Allocate and initialize a partition-info structure */
1042 PartItem = LocalAlloc(LPTR, sizeof(*PartItem));
1043 if (!PartItem)
1044 {
1045 DPRINT1("Failed to allocate partition-info structure\n");
1046 // return NULL;
1047 // We'll store a NULL pointer?!
1048 }
1049
1050 PartItem->PartEntry = PartEntry;
1051 PartItem->Volume = PartEntry->Volume;
1052
1053 htiPart = TreeListAddItem(hWndList, htiParent, hInsertAfter,
1054 LineBuffer, 1, 1,
1055 (LPARAM)PartItem);
1056
1057 *LineBuffer = 0;
1058 if (PartEntry->IsPartitioned)
1059 {
1060 PartTypeString[0] = '\0';
1061
1062 /*
1063 * If the volume's file system is recognized, display the volume label
1064 * (if any) and the file system name. Otherwise, display the partition
1065 * type if it's not a new partition.
1066 */
1067 if (VolInfo && *VolInfo->FileSystem &&
1068 _wcsicmp(VolInfo->FileSystem, L"RAW") != 0)
1069 {
1070 // TODO: Group this part together with the similar one
1071 // from below once the strings are in the same encoding...
1072 if (PartEntry->New)
1073 {
1074 StringCchPrintfA(PartTypeString,
1075 ARRAYSIZE(PartTypeString),
1076 "New (%S)",
1077 VolInfo->FileSystem);
1078 }
1079 else
1080 {
1081 StringCchPrintfA(PartTypeString,
1082 ARRAYSIZE(PartTypeString),
1083 "%S",
1084 VolInfo->FileSystem);
1085 }
1086 PartType = PartTypeString;
1087 }
1088 else
1089 /* Determine partition type */
1090 if (PartEntry->New)
1091 {
1092 /* Use this description if the partition is new and not planned for formatting */
1093 PartType = "New (Unformatted)"; // MUIGetString(STRING_UNFORMATTED);
1094 }
1095 else
1096 {
1097 /* If the partition is not new but its file system is not recognized
1098 * (or is not formatted), use the partition type description. */
1099 GetPartitionTypeString(PartEntry,
1100 PartTypeString,
1101 ARRAYSIZE(PartTypeString));
1102 PartType = PartTypeString;
1103 }
1104#if 0
1105 if (!PartType || !*PartType)
1106 {
1108 }
1109#endif
1110
1111 StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
1112 L"%S",
1113 PartType);
1114 }
1115 TreeList_SetItemText(hWndList, htiPart, 1, LineBuffer);
1116
1117 /* Format the partition size */
1118 PartSize = GetPartEntrySizeInBytes(PartEntry);
1119 if (!StrFormatByteSizeW(PartSize, LineBuffer, ARRAYSIZE(LineBuffer)))
1120 {
1121 /* We failed for whatever reason, do the hardcoded way */
1122 PCWSTR Unit;
1123 PrettifySize2(&PartSize, &Unit);
1124 StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
1125 L"%6I64u %s",
1126 PartSize, Unit);
1127 }
1128 TreeList_SetItemText(hWndList, htiPart, 2, LineBuffer);
1129
1130 /* Volume status */
1131 *LineBuffer = 0;
1132 if (PartEntry->IsPartitioned)
1133 {
1134 StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
1135 // MUIGetString(STRING_HDDINFOUNK5),
1136 PartEntry->BootIndicator ? L"Active" : L"");
1137 }
1138 TreeList_SetItemText(hWndList, htiPart, 3, LineBuffer);
1139
1140
1141 /* If this is the single extended partition of an MBR disk,
1142 * recursively display its logical partitions */
1143 if (PartEntry == DiskEntry->ExtendedPartition)
1144 {
1145 PLIST_ENTRY LogicalEntry;
1146
1147 for (LogicalEntry = DiskEntry->LogicalPartListHead.Flink;
1148 LogicalEntry != &DiskEntry->LogicalPartListHead;
1149 LogicalEntry = LogicalEntry->Flink)
1150 {
1151 PPARTENTRY LogicalPartEntry = CONTAINING_RECORD(LogicalEntry, PARTENTRY, ListEntry);
1152 PrintPartitionData(hWndList, htiPart, NULL, LogicalPartEntry);
1153 }
1154
1155 /* Expand the extended partition node */
1157 }
1158
1159 return htiPart;
1160}
1161
1166static
1167VOID
1170 _In_ TLITEMW* ptlItem)
1171{
1172 /* Code below is equivalent to: PartItem = GetItemPartition(hWndList, ptlItem->hItem);
1173 * except that we already have the data structure in ptlItem->lParam, so there is
1174 * no need to call extra helpers as GetItemPartition() does. */
1175 HTLITEM hParentItem = TreeList_GetParent(hWndList, ptlItem->hItem);
1176 /* May or may not be a PPARTITEM: this is a PPARTITEM only when hParentItem != NULL */
1177 PPARTITEM PartItem = (PPARTITEM)ptlItem->lParam;
1178 if (!hParentItem || !PartItem)
1179 return;
1180
1181 if (PartItem->VolCreate)
1182 LocalFree(PartItem->VolCreate);
1183 LocalFree(PartItem);
1184}
1185
1186static
1187VOID
1190 _In_opt_ HTLITEM hInsertAfter,
1191 _In_ PDISKENTRY DiskEntry)
1192{
1193 BOOL Success;
1194 HANDLE hDevice;
1195 PCHAR DiskName = NULL;
1196 ULONG Length = 0;
1197 PLIST_ENTRY PrimaryEntry;
1198 ULONGLONG DiskSize;
1199 HTLITEM htiDisk;
1200 WCHAR LineBuffer[128];
1201 UCHAR outBuf[512];
1202
1203 StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
1204 // L"\\Device\\Harddisk%lu\\Partition%lu",
1205 L"\\\\.\\PhysicalDrive%lu",
1206 DiskEntry->DiskNumber);
1207
1208 hDevice = CreateFileW(
1209 LineBuffer, // device interface name
1210 GENERIC_READ /*| GENERIC_WRITE*/, // dwDesiredAccess
1211 FILE_SHARE_READ | FILE_SHARE_WRITE, // dwShareMode
1212 NULL, // lpSecurityAttributes
1213 OPEN_EXISTING, // dwCreationDistribution
1214 0, // dwFlagsAndAttributes
1215 NULL // hTemplateFile
1216 );
1217 if (hDevice != INVALID_HANDLE_VALUE)
1218 {
1220
1221 Query.PropertyId = StorageDeviceProperty;
1222 Query.QueryType = PropertyStandardQuery;
1223
1224 Success = DeviceIoControl(hDevice,
1226 &Query,
1227 sizeof(Query),
1228 &outBuf,
1229 sizeof(outBuf),
1230 &Length,
1231 NULL);
1232 if (Success)
1233 {
1235 if (devDesc->ProductIdOffset)
1236 {
1237 DiskName = (PCHAR)&outBuf[devDesc->ProductIdOffset];
1238 Length -= devDesc->ProductIdOffset;
1239 DiskName[min(Length, strlen(DiskName))] = 0;
1240 // ( i = devDesc->ProductIdOffset; p[i] != 0 && i < Length; i++ )
1241 }
1242 }
1243
1244 CloseHandle(hDevice);
1245 }
1246
1247 if (DiskName && *DiskName)
1248 {
1249 if (DiskEntry->DriverName.Length > 0)
1250 {
1251 StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
1252 // MUIGetString(STRING_HDDINFO_1),
1253 L"Harddisk %lu (%S) (Port=%hu, Bus=%hu, Id=%hu) on %wZ",
1254 DiskEntry->DiskNumber,
1255 DiskName,
1256 DiskEntry->Port,
1257 DiskEntry->Bus,
1258 DiskEntry->Id,
1259 &DiskEntry->DriverName);
1260 }
1261 else
1262 {
1263 StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
1264 // MUIGetString(STRING_HDDINFO_2),
1265 L"Harddisk %lu (%S) (Port=%hu, Bus=%hu, Id=%hu)",
1266 DiskEntry->DiskNumber,
1267 DiskName,
1268 DiskEntry->Port,
1269 DiskEntry->Bus,
1270 DiskEntry->Id);
1271 }
1272 }
1273 else
1274 {
1275 if (DiskEntry->DriverName.Length > 0)
1276 {
1277 StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
1278 // MUIGetString(STRING_HDDINFO_1),
1279 L"Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu) on %wZ",
1280 DiskEntry->DiskNumber,
1281 DiskEntry->Port,
1282 DiskEntry->Bus,
1283 DiskEntry->Id,
1284 &DiskEntry->DriverName);
1285 }
1286 else
1287 {
1288 StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
1289 // MUIGetString(STRING_HDDINFO_2),
1290 L"Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu)",
1291 DiskEntry->DiskNumber,
1292 DiskEntry->Port,
1293 DiskEntry->Bus,
1294 DiskEntry->Id);
1295 }
1296 }
1297
1298 htiDisk = TreeListAddItem(hWndList, NULL, hInsertAfter,
1299 LineBuffer, 0, 0,
1300 (LPARAM)DiskEntry);
1301
1302 /* Disk type: MBR, GPT or RAW (Uninitialized) */
1303 TreeList_SetItemText(hWndList, htiDisk, 1,
1304 DiskEntry->DiskStyle == PARTITION_STYLE_MBR ? L"MBR" :
1305 DiskEntry->DiskStyle == PARTITION_STYLE_GPT ? L"GPT" :
1306 L"RAW");
1307
1308 /* Format the disk size */
1309 DiskSize = GetDiskSizeInBytes(DiskEntry);
1310 if (!StrFormatByteSizeW(DiskSize, LineBuffer, ARRAYSIZE(LineBuffer)))
1311 {
1312 /* We failed for whatever reason, do the hardcoded way */
1313 PCWSTR Unit;
1314 PrettifySize1(&DiskSize, &Unit);
1315 StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
1316 L"%6I64u %s",
1317 DiskSize, Unit);
1318 }
1319 TreeList_SetItemText(hWndList, htiDisk, 2, LineBuffer);
1320
1321 /* Print partition lines */
1322 for (PrimaryEntry = DiskEntry->PrimaryPartListHead.Flink;
1323 PrimaryEntry != &DiskEntry->PrimaryPartListHead;
1324 PrimaryEntry = PrimaryEntry->Flink)
1325 {
1326 /* If this is an extended partition, recursively print the logical partitions */
1327 PPARTENTRY PartEntry = CONTAINING_RECORD(PrimaryEntry, PARTENTRY, ListEntry);
1328 PrintPartitionData(hWndList, htiDisk, NULL, PartEntry);
1329 }
1330
1331 /* Expand the disk node */
1333}
1334
1335static VOID
1339{
1340 const DWORD dwStyle = TVS_HASBUTTONS | /*TVS_HASLINES | TVS_LINESATROOT |*/ TVS_SHOWSELALWAYS | TVS_FULLROWSELECT;
1341 const DWORD dwExStyle = TVS_EX_FULLROWMARK /* | TVS_EX_FULLROWITEMS*/;
1342 HIMAGELIST hSmall;
1343
1344 /* Set the TreeList styles and fixup the item selection color */
1346 // TreeList_SetStyleEx(hWndList, dwStyle, dwStyle);
1349
1350 /* Initialize its columns */
1352 hWndList,
1353 column_ids,
1357
1358 /* Create the ImageList */
1361 ILC_COLOR32 | ILC_MASK, // ILC_COLOR24
1362 1, 1);
1363
1364 /* Add event type icons to the ImageList */
1367
1368 /* Assign the ImageList to the List View */
1370}
1371
1372static VOID
1376{
1378
1379 /* Clear the list first */
1381
1382 /* Insert all the detected disks and partitions */
1383 for (Entry = List->DiskListHead.Flink;
1384 Entry != &List->DiskListHead;
1385 Entry = Entry->Flink)
1386 {
1387 /* Print disk entry */
1388 PDISKENTRY DiskEntry = CONTAINING_RECORD(Entry, DISKENTRY, ListEntry);
1389 PrintDiskData(hWndList, NULL, DiskEntry);
1390 }
1391
1392 /* Select the first usable partition/empty space */
1393 {
1394 HTLITEM hItem;
1396 hItem = (HTLITEM)1; // If none, select the first item, whatever it is.
1398 }
1399}
1400
1401static VOID
1404{
1405 HIMAGELIST hSmall;
1406
1407 /* Cleanup all the items. Their cached data will be automatically deleted
1408 * on response to the TVN_DELETEITEM notification sent by the TreeList
1409 * by DeleteTreeItem() */
1411
1412 /* And cleanup the imagelist */
1415 ImageList_Destroy(hSmall);
1416}
1417
1418
1424static BOOLEAN
1426 _In_ HWND hList,
1428 _Inout_ HTLITEM* phItem,
1429 _Inout_opt_ PPARTITEM* pPartItem,
1430 _In_opt_ ULONGLONG SizeBytes,
1432{
1433 PPARTITEM PartItem;
1434 PPARTENTRY PartEntry;
1435 HTLITEM hParentItem;
1436 HTLITEM hInsertAfter;
1437 PPARTENTRY NextPart;
1439
1440 PartItem = (pPartItem ? *pPartItem : GetItemPartition(hList, *phItem));
1441 if (!PartItem)
1442 {
1443 /* We must have a disk region... */
1444 ASSERT(FALSE);
1445 return FALSE;
1446 }
1447 PartEntry = PartItem->PartEntry;
1448#if 0
1449 if (PartEntry->IsPartitioned)
1450 {
1451 /* Don't create a partition when one already exists */
1452 ASSERT(FALSE);
1453 return FALSE;
1454 }
1455 ASSERT(!PartEntry->Volume);
1456#endif
1457
1459 PartEntry,
1460 SizeBytes,
1462 if (!Success)
1463 return Success;
1464
1465 /* Retrieve the parent item (disk or MBR extended partition) */
1466 hParentItem = TreeList_GetParent(hList, *phItem);
1467 hInsertAfter = TreeList_GetPrevSibling(hList, *phItem);
1468 if (!hInsertAfter)
1469 hInsertAfter = TVI_FIRST;
1470
1471 /*
1472 * The current entry has been recreated and maybe split
1473 * in two: new partition and remaining unused space.
1474 * Thus, recreate the current entry.
1475 *
1476 * NOTE: Since we create a partition we don't care
1477 * about its previous PartItem, so it can be deleted.
1478 */
1479 {
1480 /* Cache out the original item's volume create info */
1481 PVOL_CREATE_INFO VolCreate = PartItem->VolCreate;
1482 PartItem->VolCreate = NULL;
1483
1484 /* Remove the current item */
1485 TreeList_DeleteItem(hList, *phItem);
1486
1487 /* Recreate the entry */
1488 *phItem = PrintPartitionData(hList, hParentItem, hInsertAfter, PartEntry);
1489
1490 /* Retrieve the new PartItem and restore the volume create
1491 * information associated to the newly-created partition */
1492 PartItem = GetItemPartition(hList, *phItem);
1493 ASSERT(PartItem);
1494
1495 /* Update the volume associated to the create information */
1496 if (VolCreate)
1497 VolCreate->Volume = PartItem->Volume;
1498
1499 /* Restore the volume create information */
1500 PartItem->VolCreate = VolCreate;
1501
1502 if (pPartItem)
1503 *pPartItem = PartItem;
1504 }
1505
1506 /* Add also the following unused space, if any */
1507 // NextPart = GetAdjDiskRegion(NULL, PartEntry, ENUM_REGION_NEXT);
1508 NextPart = GetAdjUnpartitionedEntry(PartEntry, TRUE);
1509 if (NextPart /*&& !NextPart->IsPartitioned*/)
1510 PrintPartitionData(hList, hParentItem, *phItem, NextPart);
1511
1512 /* Select the created partition */
1513 TreeList_SelectItem(hList, *phItem);
1514
1515 return TRUE;
1516}
1517
1523static BOOLEAN
1525 _In_ HWND hList,
1527 _Inout_ HTLITEM* phItem,
1528 _In_ PPARTITEM PartItem)
1529{
1530 PPARTENTRY PartEntry = PartItem->PartEntry;
1531 PPARTENTRY PrevPart, NextPart;
1532 BOOLEAN PrevIsPartitioned, NextIsPartitioned;
1534
1535 HTLITEM hParentItem;
1536 HTLITEM hInsertAfter;
1537 HTLITEM hAdjItem;
1538 PPARTITEM AdjPartItem;
1539
1540#if 0
1541 if (!PartEntry->IsPartitioned)
1542 {
1543 /* Don't delete an unpartitioned disk region */
1544 ASSERT(FALSE);
1545 return FALSE;
1546 }
1547#endif
1548
1549 /*
1550 * Determine the nature of the previous and next disk regions,
1551 * in order to know what to do on the corresponding tree items
1552 * after the selected partition has been deleted.
1553 *
1554 * NOTE: Don't reference these pointers after DeletePartition(),
1555 * since these disk regions might have been coalesced/reallocated.
1556 * However we can check whether they were NULL or not.
1557 */
1558 // PrevPart = GetAdjDiskRegion(NULL, PartEntry, ENUM_REGION_PREV);
1559 // NextPart = GetAdjDiskRegion(NULL, PartEntry, ENUM_REGION_NEXT);
1560 PrevPart = GetAdjUnpartitionedEntry(PartEntry, FALSE);
1561 NextPart = GetAdjUnpartitionedEntry(PartEntry, TRUE);
1562
1563 PrevIsPartitioned = (PrevPart && PrevPart->IsPartitioned);
1564 NextIsPartitioned = (NextPart && NextPart->IsPartitioned);
1565
1566 ASSERT(PartEntry->IsPartitioned); // The current partition must be partitioned.
1568 PartEntry,
1569 &PartEntry);
1570 if (!Success)
1571 return Success;
1572
1573 /* Retrieve the parent item (disk or MBR extended partition) */
1574 hParentItem = TreeList_GetParent(hList, *phItem);
1575
1576 /* If previous sibling isn't partitioned, remove it */
1577 if (PrevPart && !PrevIsPartitioned)
1578 {
1579 hAdjItem = TreeList_GetPrevSibling(hList, *phItem);
1580 ASSERT(hAdjItem); // TODO: Investigate
1581 if (hAdjItem)
1582 {
1583 AdjPartItem = GetItemPartition(hList, hAdjItem);
1584 ASSERT(AdjPartItem && (AdjPartItem->PartEntry == PrevPart));
1585 AdjPartItem = NULL;
1586 TreeList_DeleteItem(hList, hAdjItem);
1587 }
1588 }
1589 /* If next sibling isn't partitioned, remove it */
1590 if (NextPart && !NextIsPartitioned)
1591 {
1592 hAdjItem = TreeList_GetNextSibling(hList, *phItem);
1593 ASSERT(hAdjItem); // TODO: Investigate
1594 if (hAdjItem)
1595 {
1596 AdjPartItem = GetItemPartition(hList, hAdjItem);
1597 ASSERT(AdjPartItem && (AdjPartItem->PartEntry == NextPart));
1598 AdjPartItem = NULL;
1599 TreeList_DeleteItem(hList, hAdjItem);
1600 }
1601 }
1602
1603 /* We are going to insert the updated entry after
1604 * either, the original previous sibling (if it is
1605 * partitioned), or the second-previous sibling
1606 * (if the first one was already removed, see above) */
1607 hInsertAfter = TreeList_GetPrevSibling(hList, *phItem);
1608 if (!hInsertAfter)
1609 hInsertAfter = TVI_FIRST;
1610
1611 /* Remove the current item */
1612 TreeList_DeleteItem(hList, *phItem);
1613
1614 /* Add back the "new" unpartitioned space */
1615 *phItem = PrintPartitionData(hList, hParentItem, hInsertAfter, PartEntry);
1616
1617 /* Select the unpartitioned space */
1618 TreeList_SelectItem(hList, *phItem);
1619
1620 return TRUE;
1621}
1622
1623
1624static BOOLEAN
1626 _In_ PSETUPDATA pSetupData,
1627 _In_ HWND hwndDlg,
1629{
1630 HWND hList;
1631 HTLITEM hItem;
1632 PPARTITEM PartItem;
1633 PPARTENTRY PartEntry;
1634
1635 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
1636 if (CurrentPartition)
1637 {
1639 if (hItem)
1641 }
1642 else
1643 {
1644 PartItem = GetSelectedPartition(hList, &hItem);
1645 }
1646 if (!PartItem)
1647 return FALSE; // Fail
1648 PartEntry = PartItem->PartEntry;
1649 ASSERT(PartEntry);
1650
1651 /*
1652 * Check whether the user wants to install ReactOS on a disk that
1653 * is not recognized by the computer's firmware and if so, display
1654 * a warning since such disks may not be bootable.
1655 */
1656 if (PartEntry->DiskEntry->MediaType == FixedMedia &&
1657 !PartEntry->DiskEntry->BiosFound)
1658 {
1659 INT nRet;
1660
1661 nRet = DisplayMessage(hwndDlg,
1663 L"Warning",
1664 L"The disk you have selected for installing ReactOS\n"
1665 L"is not visible by the firmware of your computer,\n"
1666 L"and so may not be bootable.\n"
1667 L"\nClick on OK to continue anyway."
1668 L"\nClick on CANCEL to go back to the partitions list.");
1669 if (nRet != IDOK)
1670 return FALSE; // Fail
1671 }
1672
1673 /* If this is an empty region, auto-create the partition if conditions are OK */
1674 if (!PartEntry->IsPartitioned)
1675 {
1676 ULONG Error;
1677
1678 Error = PartitionCreateChecks(PartEntry, 0ULL, 0);
1679 if (Error != NOT_AN_ERROR)
1680 {
1681 // MUIDisplayError(Error, Ir, POPUP_WAIT_ANY_KEY);
1683 L"Could not create a partition on the selected disk region.");
1684 return FALSE; // Fail
1685 }
1686
1687 /* Automatically create the partition on the whole empty space;
1688 * it will be formatted later with default parameters */
1689 if (!DoCreatePartition(hList, pSetupData->PartitionList,
1690 &hItem, &PartItem,
1691 0ULL, 0))
1692 {
1693 DisplayError(GetParent(hwndDlg),
1696 return FALSE; // Fail
1697 }
1698 /* Update PartEntry */
1699 PartEntry = PartItem->PartEntry;
1700 }
1701
1702 ASSERT(PartEntry->IsPartitioned);
1703 // ASSERT(PartEntry != PartEntry->DiskEntry->ExtendedPartition);
1705 ASSERT(PartEntry->Volume);
1706
1707#if 0 // TODO: Implement!
1708 if (!IsPartitionLargeEnough(PartEntry))
1709 {
1712 return FALSE; // Fail
1713 }
1714#endif
1715
1716 /* Force formatting only if the partition doesn't have a volume (may or may not be formatted) */
1717 if (PartEntry->Volume &&
1718 ((PartEntry->Volume->FormatState == Formatted) ||
1719 (PartItem->VolCreate && *PartItem->VolCreate->FileSystemName)) &&
1720 !(pSetupData->bUnattend && pSetupData->USetupData.FormatPartition))
1721 {
1722 /*NOTHING*/;
1723 }
1724 else /* Request formatting of the selected region if it's not already formatted */
1725 {
1726 INT_PTR ret;
1727 PARTCREATE_CTX PartCreateCtx = {0};
1728
1729 /* In unattended setup, try auto-formatting if required,
1730 * otherwise show the dialog to ask the user what to do */
1731 if (pSetupData->bUnattend && pSetupData->USetupData.FormatPartition)
1732 PartCreateCtx.AutoFormat = TRUE;
1733
1734 /* Show the formatting dialog. In unattended setup, auto-format with
1735 * "default" filesystem, or popup the dialog asking the user what to do. */
1736 PartCreateCtx.PartItem = PartItem;
1737 ret = DialogBoxParamW(pSetupData->hInstance,
1739 hwndDlg,
1741 (LPARAM)&PartCreateCtx);
1742
1743 /* If the user refuses to format the partition, fail */
1744 if (ret != IDOK)
1745 return FALSE;
1746
1747 /* The partition will be formatted */
1748 }
1749
1750 /* The install partition has been found */
1751 ASSERT((PartEntry->Volume && PartEntry->Volume->FormatState == Formatted) ||
1752 (PartItem->VolCreate && *PartItem->VolCreate->FileSystemName));
1753 InstallPartition = PartEntry;
1754 return TRUE;
1755}
1756
1757INT_PTR
1760 _In_ HWND hwndDlg,
1761 _In_ UINT uMsg,
1764{
1765 PSETUPDATA pSetupData;
1766 HWND hList;
1767
1768 /* Retrieve pointer to the global setup data */
1769 pSetupData = (PSETUPDATA)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
1770
1771 switch (uMsg)
1772 {
1773 case WM_INITDIALOG:
1774 {
1775 /* Save pointer to the global setup data */
1776 pSetupData = (PSETUPDATA)((LPPROPSHEETPAGEW)lParam)->lParam;
1777 SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (LONG_PTR)pSetupData);
1778
1779 /* Initially hide and disable all partitioning buttons */
1780 ShowDlgItem(hwndDlg, IDC_INITDISK, SW_HIDE);
1781 EnableDlgItem(hwndDlg, IDC_INITDISK, FALSE);
1788
1789 /* Initialize the partitions list */
1790 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
1792 InitPartitionList(pSetupData->hInstance, hList);
1793 DrawPartitionList(hList, pSetupData->PartitionList);
1794 break;
1795 }
1796
1797 case WM_DESTROY:
1798 {
1799 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
1803 return TRUE;
1804 }
1805
1806 case WM_COMMAND:
1807 {
1808 if (HIWORD(wParam) == BN_CLICKED) switch (LOWORD(wParam))
1809 {
1810 case IDC_PARTMOREOPTS:
1811 {
1812 DialogBoxParamW(pSetupData->hInstance,
1814 hwndDlg,
1816 (LPARAM)pSetupData);
1817 return TRUE;
1818 }
1819
1820 case IDC_INITDISK:
1821 {
1822 // TODO: Implement disk partitioning initialization
1823 return TRUE;
1824 }
1825
1826 case IDC_PARTCREATE:
1827 {
1828 HTLITEM hItem;
1829 PPARTITEM PartItem;
1830 PPARTENTRY PartEntry;
1831 ULONGLONG PartSize;
1832 ULONGLONG MaxPartSize;
1833 ULONG MaxSizeMB;
1834 INT_PTR ret;
1835 PARTCREATE_CTX PartCreateCtx = {0};
1836
1837 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
1838 PartItem = GetSelectedPartition(hList, &hItem);
1839 if (!PartItem)
1840 {
1841 /* If the button was clicked, an empty disk
1842 * region should have been selected first */
1843 ASSERT(FALSE);
1844 break;
1845 }
1846 PartEntry = PartItem->PartEntry;
1847 if (PartEntry->IsPartitioned)
1848 {
1849 /* Don't create a partition when one already exists */
1850 ASSERT(FALSE);
1851 break;
1852 }
1853 ASSERT(!PartEntry->Volume);
1854
1855 /* Get the partition info stored in the TreeList */
1856 PartCreateCtx.PartItem = PartItem;
1857
1858 /* Retrieve the maximum size in MB (rounded up) the partition can have */
1859 MaxPartSize = GetPartEntrySizeInBytes(PartEntry);
1860 MaxSizeMB = (ULONG)RoundingDivide(MaxPartSize, MB);
1861 PartCreateCtx.MaxSizeMB = MaxSizeMB;
1862
1863 /* Don't force formatting by default */
1864 PartCreateCtx.ForceFormat = FALSE;
1865
1866 /* Show the partitioning dialog */
1867 ret = DialogBoxParamW(pSetupData->hInstance,
1869 hwndDlg,
1871 (LPARAM)&PartCreateCtx);
1872 if (ret != IDOK)
1873 break;
1874
1875 /*
1876 * If the input size, given in MB, specifies the maximum partition
1877 * size, it may slightly under- or over-estimate the latter due to
1878 * rounding error. In this case, use all of the unpartitioned space.
1879 * Otherwise, directly convert the size to bytes.
1880 */
1881 PartSize = PartCreateCtx.PartSizeMB;
1882 if (PartSize == MaxSizeMB)
1883 PartSize = MaxPartSize;
1884 else // if (PartSize < MaxSizeMB)
1885 PartSize *= MB;
1886
1887 ASSERT(PartSize <= MaxPartSize);
1888
1889 if (!DoCreatePartition(hList, pSetupData->PartitionList,
1890 &hItem, &PartItem,
1891 PartSize,
1892 !PartCreateCtx.MBRExtPart
1893 ? 0 : PARTITION_EXTENDED))
1894 {
1895 DisplayError(GetParent(hwndDlg),
1898 }
1899 break;
1900 }
1901
1902 case IDC_PARTFORMAT:
1903 {
1904 PPARTITEM PartItem;
1905 PPARTENTRY PartEntry;
1906 INT_PTR ret;
1907 PARTCREATE_CTX PartCreateCtx = {0};
1908
1909 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
1910 PartItem = GetSelectedPartition(hList, NULL);
1911 if (!PartItem)
1912 {
1913 /* If the button was clicked, an empty disk
1914 * region should have been selected first */
1915 ASSERT(FALSE);
1916 break;
1917 }
1918 PartEntry = PartItem->PartEntry;
1919 if (!PartEntry->Volume)
1920 {
1921 /* Don't format an unformattable partition */
1922 ASSERT(FALSE);
1923 break;
1924 }
1925
1926 /* Show the formatting dialog */
1927 PartCreateCtx.PartItem = PartItem;
1928 ret = DialogBoxParamW(pSetupData->hInstance,
1930 hwndDlg,
1932 (LPARAM)&PartCreateCtx);
1934 break;
1935 }
1936
1937 case IDC_PARTDELETE:
1938 {
1939 HTLITEM hItem;
1940 PPARTITEM PartItem;
1941 PPARTENTRY PartEntry;
1942 UINT uIDWarnMsg;
1943
1944 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
1945 PartItem = GetSelectedPartition(hList, &hItem);
1946 if (!PartItem)
1947 {
1948 /* If the button was clicked, a partition
1949 * should have been selected first */
1950 ASSERT(FALSE);
1951 break;
1952 }
1953 PartEntry = PartItem->PartEntry;
1954 if (!PartEntry->IsPartitioned)
1955 {
1956 /* Don't delete an unpartitioned disk region */
1957 ASSERT(FALSE);
1958 break;
1959 }
1960
1961 /* Choose the correct warning message to display:
1962 * MBR-extended (container) vs. standard partition */
1963 if (PartEntry == PartEntry->DiskEntry->ExtendedPartition)
1965 else
1966 uIDWarnMsg = IDS_WARN_DELETE_PARTITION;
1967
1968 /* If the user really wants to delete the partition... */
1969 if (DisplayMessage(GetParent(hwndDlg),
1972 MAKEINTRESOURCEW(uIDWarnMsg)) == IDYES)
1973 {
1974 /* ... make it so! */
1975 if (!DoDeletePartition(hList, pSetupData->PartitionList,
1976 &hItem, PartItem))
1977 {
1979 L"Could not delete the selected partition.");
1980 }
1981 }
1982 break;
1983 }
1984 }
1985 break;
1986 }
1987
1988 case WM_NOTIFY:
1989 {
1990 LPNMHDR lpnm = (LPNMHDR)lParam;
1991
1992 if (lpnm->idFrom == IDC_PARTITION) switch (lpnm->code)
1993 {
1994 case NM_RETURN:
1995 {
1996 /* If the currently selected item is a partition (and so, if
1997 * the wizard "Next" button is enabled), pressing "Next" will
1998 * attempt to select an install partition and go to the next
1999 * page if successful. */
2000 HWND hWndParent = GetParent(hwndDlg);
2003 break;
2004 }
2005
2006 case TVN_KEYDOWN:
2007 {
2008 if (((LPTV_KEYDOWN_EX)lParam)->wVKey == VK_DELETE)
2009 {
2010 /* Send the delete command only if IDC_PARTDELETE is
2011 * enabled (i.e. the selected item IS a partition) */
2014 }
2015 break;
2016 }
2017 }
2018
2019 // On Vista+ we can use TVN_ITEMCHANGED instead, with NMTVITEMCHANGE* pointer
2020 if (lpnm->idFrom == IDC_PARTITION && lpnm->code == TVN_SELCHANGED)
2021 {
2023
2024 /* Check whether the item has been (de)selected */
2025#if 0 // When using NMTVITEMCHANGE
2026 if (!(pnmv->uChanged & TVIF_STATE) ||
2027 !((pnmv->uStateOld ^ pnmv->uStateNew) & TVIS_SELECTED))
2028 { break; }
2029#endif
2030 if (!((pnmv->itemOld.mask | pnmv->itemNew.mask) & TVIF_STATE) ||
2031 !((pnmv->itemOld.state ^ pnmv->itemNew.state) & TVIS_SELECTED))
2032 {
2033 break;
2034 }
2035
2036 if (pnmv->itemNew.state & TVIS_SELECTED)
2037 {
2038 HTLITEM hParentItem = TreeList_GetParent(lpnm->hwndFrom, pnmv->itemNew.hItem);
2039 /* May or may not be a PPARTENTRY: this is a PPARTENTRY only when hParentItem != NULL */
2040
2041 if (!hParentItem)
2042 {
2043 /* Hard disk */
2044 PDISKENTRY DiskEntry = (PDISKENTRY)pnmv->itemNew.lParam;
2045 ASSERT(DiskEntry);
2046
2047 /* Show the "Initialize" disk button and hide and disable the others */
2048 ShowDlgItem(hwndDlg, IDC_INITDISK, SW_SHOW);
2049
2050#if 0 // FIXME: Init disk not implemented yet!
2051 EnableDlgItem(hwndDlg, IDC_INITDISK,
2052 DiskEntry->DiskStyle == PARTITION_STYLE_RAW);
2053#else
2054 EnableDlgItem(hwndDlg, IDC_INITDISK, FALSE);
2055#endif
2056
2059
2062
2065
2066 /* Disable the "Next" button */
2067 goto DisableWizNext;
2068 }
2069 else
2070 {
2071 /* Partition or unpartitioned space */
2072 PPARTITEM PartItem = (PPARTITEM)pnmv->itemNew.lParam;
2073 PPARTENTRY PartEntry;
2074 BOOL CanBePartitioned;
2075 ASSERT(PartItem);
2076 PartEntry = PartItem->PartEntry;
2077 ASSERT(PartEntry);
2078
2079 /* Hide and disable the "Initialize" disk button */
2080 ShowDlgItem(hwndDlg, IDC_INITDISK, SW_HIDE);
2081 EnableDlgItem(hwndDlg, IDC_INITDISK, FALSE);
2082
2083 /* Check whether the selected disk region is not partitioned, and
2084 * can be partitioned according to the disk's partitioning scheme */
2085 CanBePartitioned = (!PartEntry->IsPartitioned &&
2086 (PartitionCreateChecks(PartEntry, 0ULL, 0) == NOT_AN_ERROR));
2087
2088 if (!PartEntry->IsPartitioned)
2089 {
2090 /* Show the "Create" partition button, but enable it
2091 * only if the selected disk region can be partitioned */
2093 EnableDlgItem(hwndDlg, IDC_PARTCREATE, CanBePartitioned);
2094
2095 /* Hide and disable the "Format" button */
2098 }
2099 else
2100 {
2101 /* Hide and disable the "Create" partition button */
2104
2105 /* Show the "Format" button, but enable it only
2106 * if a formattable volume is present */
2108 EnableDlgItem(hwndDlg, IDC_PARTFORMAT, !!PartEntry->Volume);
2109 }
2110
2111 /* Show the "Delete" partition button, but enable it
2112 * only if the disk region is partitioned */
2114 EnableDlgItem(hwndDlg, IDC_PARTDELETE, PartEntry->IsPartitioned);
2115
2116 /*
2117 * Enable the "Next" button if:
2118 *
2119 * 1. the selected disk region is partitioned:
2120 * it can either have a volume attached (and be either
2121 * formatted or ready to be formatted),
2122 * or it's not yet formatted (the installer will prompt
2123 * for formatting parameters).
2124 *
2125 * 2. Or, the selected disk region is not partitioned, but
2126 * can be partitioned according to the disk's partitioning
2127 * scheme (the installer will auto-partition the region
2128 * and prompt for formatting parameters).
2129 *
2130 * In all other cases, the "Next" button is disabled.
2131 */
2132
2133 // TODO: In the future: first test needs to be augmented with:
2134 // (... && PartEntry->Volume->IsSimpleVolume)
2135 if ((PartEntry->IsPartitioned && PartEntry->Volume) || CanBePartitioned)
2136 {
2137 // ASSERT(PartEntry != PartEntry->DiskEntry->ExtendedPartition);
2138 ASSERT(!IsContainerPartition(PartEntry->PartitionType));
2140 }
2141 else
2142 {
2143 goto DisableWizNext;
2144 }
2145 }
2146 }
2147 else
2148 {
2149DisableWizNext:
2150 /* Keep the "Next" button disabled. It will be enabled
2151 * only when the user selects a valid partition. */
2153 }
2154
2155 break;
2156 }
2157
2158 if (lpnm->idFrom == IDC_PARTITION && lpnm->code == TVN_DELETEITEM)
2159 {
2160 /* Deleting an item from the partition list */
2162 DeleteTreeItem(lpnm->hwndFrom, (TLITEMW*)&pnmv->itemOld);
2163 break;
2164 }
2165
2166 switch (lpnm->code)
2167 {
2168 case PSN_SETACTIVE:
2169 {
2170 /* Keep the "Next" button disabled. It will be enabled
2171 * only when the user selects a valid partition. */
2173
2174 /* In unattended mode, switch directly to the next page.
2175 * TODO: *UNLESS* there are inconsistencies in the data,
2176 * in which case we should stay on the page! */
2177 if (pSetupData->bUnattend) do
2178 {
2180
2181 /* If DestinationDiskNumber or DestinationPartitionNumber are invalid
2182 * (see below), don't select the partition and show the list instead */
2183 if (pSetupData->USetupData.DestinationDiskNumber == -1 ||
2184 pSetupData->USetupData.DestinationPartitionNumber == -1)
2185 {
2186 break;
2187 }
2188
2189 /* Determine the selected installation disk & partition */
2193
2194 /* Now reset DestinationDiskNumber and DestinationPartitionNumber
2195 * to *invalid* values, so that if the corresponding partition is
2196 * determined to be invalid by the code below or in CreateInstallPartition,
2197 * we don't reselect it when SelectPartitionPage() is called again */
2198 pSetupData->USetupData.DestinationDiskNumber = -1;
2199 pSetupData->USetupData.DestinationPartitionNumber = -1;
2200
2201 // FIXME: Here and in the AutoPartition case below, the CurrentPartition
2202 // may actually be unsuitable (MBR-extended, non-simple volume...).
2203 // More checks need to be made here!
2204 //
2205 // NOTE: We don't check for CurrentPartition->Volume in case
2206 // the partition doesn't contain a recognized volume/none exists.
2207 // We also don't check whether IsPartitioned is TRUE, because if
2208 // the partition is still empty space, we'll try to partition it.
2210 goto CreateInstallPartition;
2211
2212 if (pSetupData->USetupData.AutoPartition)
2213 {
2214 /* Use whatever selected partition (or the first one) in the list */
2215 PPARTITEM PartItem;
2216 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
2217 PartItem = GetSelectedPartition(hList, NULL);
2218 if (!PartItem)
2219 PartItem = FindPartitionItem(hList, NULL, NULL);
2220 if (PartItem)
2221 CurrentPartition = PartItem->PartEntry;
2222
2223 // TODO: Do more checks, and loop until we find a valid partition.
2224 goto CreateInstallPartition;
2225 }
2226 break;
2227
2228CreateInstallPartition:
2229 /* Select the install partition and if success,
2230 * proceed with the installation */
2231 if (SelectInstallPartition(pSetupData, hwndDlg, CurrentPartition))
2232 {
2233 SetWindowLongPtrW(hwndDlg, DWLP_MSGRESULT, -1);
2234 return TRUE;
2235 }
2236 /* Halt the installation and display the page */
2237 } while (0);
2238 break;
2239 }
2240
2242 {
2243 /* Reselect the currently selected item, so as to refresh the UI buttons */
2244 HTLITEM hItem;
2245 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
2247 if (hItem)
2248 {
2249 /* Don't use TreeList_SelectItem() directly. Instead,
2250 * deselect first the item before reselecting it, so as to
2251 * invalidate its cached state and have the TVN_SELCHANGED
2252 * notification sent. */
2253 TreeList_SetItemState(hList, hItem, 0, TVIS_SELECTED);
2254 TreeList_SetItemState(hList, hItem, TVIS_SELECTED, TVIS_SELECTED);
2255 }
2256
2257 /* Focus on the partition list */
2259 return TRUE;
2260 }
2261
2262 case PSN_QUERYCANCEL:
2263 {
2264 if (DisplayMessage(GetParent(hwndDlg),
2268 {
2269 /* Go to the Abort page */
2271 }
2272
2273 /* Do not close the wizard too soon */
2275 return TRUE;
2276 }
2277
2278 case PSN_WIZNEXT:
2279 {
2280 /* Select the install partition and if success, go to the next page */
2281 if (SelectInstallPartition(pSetupData, hwndDlg, NULL))
2282 break;
2283 /* Failed, stay on the page */
2284 SetWindowLongPtrW(hwndDlg, DWLP_MSGRESULT, -1);
2285 return TRUE;
2286 }
2287
2288 default:
2289 break;
2290 }
2291 break;
2292 }
2293
2294 default:
2295 break;
2296 }
2297
2298 return FALSE;
2299}
2300
2301/* EOF */
static HWND hWndList[5+1]
Definition: SetParent.c:10
unsigned char BOOLEAN
Definition: actypes.h:127
HWND hWnd
Definition: settings.c:17
#define CF_UNICODETEXT
Definition: constants.h:408
#define DPRINT1
Definition: precomp.h:8
BOOL Query(LPCTSTR *ServiceArgs, DWORD ArgCount, BOOL bExtended)
Definition: query.c:292
PCSTR NTAPI LookupPartitionTypeString(_In_ PARTITION_STYLE PartitionStyle, _In_ PVOID PartitionType)
Definition: partinfo.c:804
UI_CONTEXT UiContext
Definition: reactos.c:37
PPARTENTRY InstallPartition
Definition: reactos.c:27
INT __cdecl DisplayMessage(_In_opt_ HWND hWnd, _In_ UINT uType, _In_opt_ PCWSTR pszTitle, _In_opt_ PCWSTR pszFormatMessage,...)
Definition: reactos.c:244
SETUPDATA SetupData
Definition: reactos.c:24
#define ShowDlgItem(hDlg, nID, nCmdShow)
Definition: reactos.h:34
#define ID_WIZNEXT
Definition: reactos.h:47
struct _SETUPDATA * PSETUPDATA
#define IDC_CHECK_MBREXTPART
Definition: resource.h:88
#define IDS_BOOTLOADER_MBRVBR
Definition: resource.h:133
#define IDS_BOOTLOADER_SYSTEM
Definition: resource.h:132
#define IDC_FSTYPE
Definition: resource.h:90
#define IDI_PARTITION
Definition: resource.h:21
#define IDS_WARN_DELETE_PARTITION
Definition: resource.h:179
#define IDC_INITDISK
Definition: resource.h:51
#define IDD_ABORTPAGE
Definition: resource.h:78
#define IDC_FS_STATIC
Definition: resource.h:89
#define IDS_ERROR_INVALID_INSTALLDIR_CHAR
Definition: resource.h:168
#define IDC_PARTMOREOPTS
Definition: resource.h:56
#define IDS_ERROR_CREATE_PARTITION_TITLE
Definition: resource.h:175
#define IDC_CHECK_QUICKFMT
Definition: resource.h:91
#define IDC_PARTDELETE
Definition: resource.h:54
#define IDS_WARN_DELETE_PARTITION_TITLE
Definition: resource.h:178
#define IDS_ERROR_CREATE_PARTITION
Definition: resource.h:176
#define IDS_BOOTLOADER_VBRONLY
Definition: resource.h:134
#define IDC_PARTITION
Definition: resource.h:50
#define IDD_FORMAT
Definition: resource.h:93
#define IDC_PATH
Definition: resource.h:81
#define IDC_INSTFREELDR
Definition: resource.h:82
#define IDD_ADVINSTOPTS
Definition: resource.h:80
#define IDI_DISKDRIVE
Definition: resource.h:20
#define IDC_PARTFORMAT
Definition: resource.h:53
#define IDC_PARTCREATE
Definition: resource.h:52
#define IDS_ABORTSETUP2
Definition: resource.h:111
#define IDS_ERROR_DIRECTORY_NAME_TITLE
Definition: resource.h:171
#define IDC_UPDOWN_PARTSIZE
Definition: resource.h:86
#define IDS_ABORTSETUP
Definition: resource.h:110
#define IDD_PARTITION
Definition: resource.h:84
#define IDS_WARN_DELETE_MBR_EXTENDED_PARTITION
Definition: resource.h:180
#define IDS_ERROR_DIRECTORY_NAME
Definition: resource.h:172
#define IDS_ERROR_INVALID_INSTALLDIR_CHAR_TITLE
Definition: resource.h:167
#define IDS_BOOTLOADER_NOINST
Definition: resource.h:130
#define IDS_VOLUME_NOFORMAT
Definition: resource.h:118
BOOL Error
Definition: chkdsk.c:66
PWCHAR FileSystem
Definition: format.c:71
HINSTANCE hInstance
Definition: charmap.c:19
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define free
Definition: debug_ros.c:5
BOOL WINAPI DeviceIoControl(IN HANDLE hDevice, IN DWORD dwIoControlCode, IN LPVOID lpInBuffer OPTIONAL, IN DWORD nInBufferSize OPTIONAL, OUT LPVOID lpOutBuffer OPTIONAL, IN DWORD nOutBufferSize OPTIONAL, OUT LPDWORD lpBytesReturned OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: deviceio.c:136
PartType
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:941
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:814
#define CloseHandle
Definition: compat.h:739
#define CP_ACP
Definition: compat.h:109
#define OPEN_EXISTING
Definition: compat.h:775
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define GENERIC_READ
Definition: compat.h:135
#define MAX_PATH
Definition: compat.h:34
#define CreateFileW
Definition: compat.h:741
#define CALLBACK
Definition: compat.h:35
#define MultiByteToWideChar
Definition: compat.h:110
#define FILE_SHARE_READ
Definition: compat.h:136
static DWORD cchBuffer
Definition: fusion.c:85
_ACRTIMP int __cdecl _wcsicmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:164
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
Definition: wcs.c:2988
_ACRTIMP wchar_t *__cdecl _wcsdup(const wchar_t *) __WINE_DEALLOC(free) __WINE_MALLOC
Definition: wcs.c:86
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1597
LPWSTR WINAPI StrFormatByteSizeW(LONGLONG llBytes, LPWSTR lpszDest, UINT cchMax)
Definition: string.c:854
static VOID ShowErrorTip(_In_ HWND hEdit)
Definition: drivepage.c:116
static VOID InitPartitionList(_In_ HINSTANCE hInstance, _In_ HWND hWndList)
Definition: drivepage.c:1336
static PPARTITEM FindPartitionItem(_In_ HWND hTreeList, _In_opt_ PPARTENTRY PartEntry, _Out_opt_ HTLITEM *phItem)
Definition: drivepage.c:848
static const INT column_widths[MAX_LIST_COLUMNS]
Definition: drivepage.c:31
static BOOL DoSanitizeClipboard(_In_ HWND hWnd)
Sanitize in-place any text found in the clipboard.
Definition: drivepage.c:71
#define MAX_LIST_COLUMNS
Definition: drivepage.c:29
struct _PARTITEM * PPARTITEM
static BOOLEAN DoDeletePartition(_In_ HWND hList, _In_ PPARTLIST List, _Inout_ HTLITEM *phItem, _In_ PPARTITEM PartItem)
Delete the selected partition in the partition list, and update the partition list UI.
Definition: drivepage.c:1524
LPARAM TreeListGetItemData(_In_ HWND hTreeList, _In_ HTLITEM hItem)
Definition: drivepage.c:802
static const INT column_alignment[MAX_LIST_COLUMNS]
Definition: drivepage.c:32
PVOL_CREATE_INFO FindVolCreateInTreeByVolume(_In_ HWND hTreeList, _In_ PVOLENTRY Volume)
Definition: drivepage.c:876
INT_PTR CALLBACK DriveDlgProc(_In_ HWND hwndDlg, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam)
Definition: drivepage.c:1759
static INT_PTR CALLBACK PartitionDlgProc(_In_ HWND hDlg, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam)
Definition: drivepage.c:638
static VOID PrettifySize1(_Inout_ PULONGLONG Size, _Out_ PCWSTR *Unit)
Definition: drivepage.c:942
VOID GetPartitionTypeString(IN PPARTENTRY PartEntry, OUT PSTR strBuffer, IN ULONG cchBuffer)
Definition: drivepage.c:900
static PPARTITEM GetItemPartition(_In_ HWND hTreeList, _In_ HTLITEM hItem)
Definition: drivepage.c:817
static BOOLEAN DoCreatePartition(_In_ HWND hList, _In_ PPARTLIST List, _Inout_ HTLITEM *phItem, _Inout_opt_ PPARTITEM *pPartItem, _In_opt_ ULONGLONG SizeBytes, _In_opt_ ULONG_PTR PartitionInfo)
Create a partition in the selected disk region in the partition list, and update the partition list U...
Definition: drivepage.c:1425
#define PM_FMTDLG_SHOWHIDE
Definition: drivepage.c:571
#define IDS_LIST_COLUMN_FIRST
Definition: drivepage.c:26
static BOOL DoSanitizeText(_Inout_ PWSTR pszSanitized)
Sanitize a given string in-place, by removing any invalid character found in it.
Definition: drivepage.c:42
static PPARTITEM GetSelectedPartition(_In_ HWND hTreeList, _Out_opt_ HTLITEM *phItem)
Definition: drivepage.c:831
static BOOLEAN SelectInstallPartition(_In_ PSETUPDATA pSetupData, _In_ HWND hwndDlg, _In_opt_ PPARTENTRY CurrentPartition)
Definition: drivepage.c:1625
static INT_PTR CALLBACK FormatDlgProcWorker(_In_ PPARTCREATE_CTX PartCreateCtx, _In_ HWND hDlg, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam)
Definition: drivepage.c:379
static HTLITEM PrintPartitionData(_In_ HWND hWndList, _In_ HTLITEM htiParent, _In_opt_ HTLITEM hInsertAfter, _In_ PPARTENTRY PartEntry)
Definition: drivepage.c:995
static INT_PTR CALLBACK FormatDlgProc(_In_ HWND hDlg, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam)
Definition: drivepage.c:575
HTLITEM TreeListAddItem(_In_ HWND hTreeList, _In_opt_ HTLITEM hParent, _In_opt_ HTLITEM hInsertAfter, _In_ LPCWSTR lpText, _In_ INT iImage, _In_ INT iSelectedImage, _In_ LPARAM lParam)
Definition: drivepage.c:773
struct _PARTITEM PARTITEM
Data structure stored for each partition item in the TreeList. (None for disks items....
static VOID DrawPartitionList(_In_ HWND hWndList, _In_ PPARTLIST List)
Definition: drivepage.c:1373
static INT_PTR CALLBACK MoreOptDlgProc(_In_ HWND hDlg, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam)
Definition: drivepage.c:214
BOOL CreateTreeListColumns(IN HINSTANCE hInstance, IN HWND hWndTreeList, IN const UINT *pIDs, IN const INT *pColsWidth, IN const INT *pColsAlign, IN UINT nNumOfColumns)
Definition: drivepage.c:739
static VOID CleanupPartitionList(_In_ HWND hWndList)
Definition: drivepage.c:1402
struct _PARTCREATE_CTX * PPARTCREATE_CTX
struct _PARTCREATE_CTX PARTCREATE_CTX
Dialog context structure used by PartitionDlgProc() and FormatDlgProc(Worker)().
static VOID PrintDiskData(_In_ HWND hWndList, _In_opt_ HTLITEM hInsertAfter, _In_ PDISKENTRY DiskEntry)
Definition: drivepage.c:1188
static VOID DeleteTreeItem(_In_ HWND hWndList, _In_ TLITEMW *ptlItem)
Called on response to the TVN_DELETEITEM notification sent by the TreeList.
Definition: drivepage.c:1168
static const UINT column_ids[MAX_LIST_COLUMNS]
Definition: drivepage.c:30
static LRESULT CALLBACK InstallDirEditProc(_In_ HWND hWnd, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam)
Subclass edit window procedure to filter allowed characters for the ReactOS installation directory.
Definition: drivepage.c:151
static VOID PrettifySize2(_Inout_ PULONGLONG Size, _Out_ PCWSTR *Unit)
Definition: drivepage.c:965
return ret
Definition: mutex.c:146
#define L(x)
Definition: resources.c:13
@ NOT_AN_ERROR
Definition: errorcode.h:17
@ ERROR_INSUFFICIENT_PARTITION_SIZE
Definition: errorcode.h:57
@ Success
Definition: eventcreate.c:712
#define EnableDlgItem(hDlg, nID, bEnable)
Definition: eventvwr.h:55
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
@ FMIFS_HARDDISK
Definition: fmifs.h:66
Unit
Definition: gdiplusenums.h:26
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int UINT
Definition: sysinfo.c:13
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1390
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
static ERESOURCE GlobalLock
Definition: sys_arch.c:8
#define LOBYTE(W)
Definition: jmemdos.c:487
#define HIBYTE(W)
Definition: jmemdos.c:486
@ Formatted
Definition: partlist.h:37
#define GetDiskSizeInBytes(DiskEntry)
Definition: partlist.h:258
#define GetPartEntrySizeInBytes(PartEntry)
Definition: partlist.h:255
struct _DISKENTRY * PDISKENTRY
if(dx< 0)
Definition: linetemp.h:194
HWND hList
Definition: livecd.c:10
VOID DisplayError(DWORD dwError)
Definition: logoff.c:33
TCHAR szTitle[MAX_LOADSTRING]
Definition: magnifier.c:35
#define ZeroMemory
Definition: minwinbase.h:31
#define LPTR
Definition: minwinbase.h:93
#define CopyMemory
Definition: minwinbase.h:29
LONG_PTR LPARAM
Definition: minwindef.h:175
LONG_PTR LRESULT
Definition: minwindef.h:176
UINT_PTR WPARAM
Definition: minwindef.h:174
#define PCHAR
Definition: match.c:90
UNICODE_STRING Volume
Definition: fltkernel.h:1172
#define ASSERT(a)
Definition: mode.c:44
@ PARTITION_STYLE_GPT
Definition: imports.h:202
@ PARTITION_STYLE_MBR
Definition: imports.h:201
#define ULL(a, b)
Definition: format_msg.c:27
#define min(a, b)
Definition: monoChain.cc:55
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define _Out_opt_
Definition: no_sal2.h:214
#define _Inout_
Definition: no_sal2.h:162
#define _Inout_opt_
Definition: no_sal2.h:216
#define _Out_
Definition: no_sal2.h:160
#define _In_
Definition: no_sal2.h:158
#define _In_opt_
Definition: no_sal2.h:212
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
__GNU_EXTENSION typedef unsigned __int64 * PULONGLONG
Definition: ntbasedef.h:395
#define DBG_UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:330
#define IsContainerPartition(PartitionType)
Definition: ntdddisk.h:321
@ FixedMedia
Definition: ntdddisk.h:383
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
_Must_inspect_result_ _In_ ACCESS_MASK _In_opt_ POBJECT_ATTRIBUTES _In_opt_ LPGUID _In_opt_ HANDLE _In_opt_ ULONG _In_opt_ ULONG _In_opt_ ULONG _In_opt_ PLARGE_INTEGER _In_opt_ PUNICODE_STRING Description
Definition: nttmapi.h:425
#define PARTITION_ENTRY_UNUSED
Definition: part_mbr.h:50
#define PARTITION_EXTENDED
Definition: part_mbr.h:55
#define LOWORD(l)
Definition: pedump.c:82
#define ES_READONLY
Definition: pedump.c:675
short WCHAR
Definition: pedump.c:58
char CHAR
Definition: pedump.c:57
#define PropSheet_PressButton(d, i)
Definition: prsht.h:348
#define PSN_QUERYCANCEL
Definition: prsht.h:123
#define PSN_WIZNEXT
Definition: prsht.h:121
#define PSWIZB_NEXT
Definition: prsht.h:154
#define PSWIZB_BACK
Definition: prsht.h:153
#define PSBTN_NEXT
Definition: prsht.h:147
#define PropSheet_SetWizButtons(d, f)
Definition: prsht.h:357
#define PSN_QUERYINITIALFOCUS
Definition: prsht.h:126
#define PropSheet_SetCurSelByID(d, i)
Definition: prsht.h:354
#define PSN_SETACTIVE
Definition: prsht.h:115
#define TVN_DELETEITEM
Definition: commctrl.h:3747
#define TVN_SELCHANGED
Definition: commctrl.h:3740
#define TVN_KEYDOWN
Definition: commctrl.h:3718
#define TVI_LAST
Definition: commctrl.h:3375
#define TVIF_TEXT
Definition: commctrl.h:3271
#define Edit_ShowBalloonTip(hwnd, peditballoontip)
Definition: commctrl.h:4708
#define TVIF_IMAGE
Definition: commctrl.h:3272
#define TVSIL_NORMAL
Definition: commctrl.h:3448
#define LPNMTREEVIEW
Definition: commctrl.h:3648
#define LVCF_WIDTH
Definition: commctrl.h:2592
#define TVI_FIRST
Definition: commctrl.h:3374
#define TVS_SHOWSELALWAYS
Definition: commctrl.h:3257
#define ILC_COLOR32
Definition: commctrl.h:358
#define TVIS_SELECTED
Definition: commctrl.h:3285
#define TVS_FULLROWSELECT
Definition: commctrl.h:3264
#define TVE_EXPAND
Definition: commctrl.h:3428
#define TVI_ROOT
Definition: commctrl.h:3373
#define NM_RETURN
Definition: commctrl.h:132
#define LVCF_FMT
Definition: commctrl.h:2591
#define ImageList_AddIcon(himl, hicon)
Definition: commctrl.h:415
#define LVCF_SUBITEM
Definition: commctrl.h:2594
#define LVCFMT_LEFT
Definition: commctrl.h:2603
#define TVS_HASBUTTONS
Definition: commctrl.h:3252
#define ILC_MASK
Definition: commctrl.h:351
#define UDM_SETRANGE32
Definition: commctrl.h:2156
#define TTI_ERROR
Definition: commctrl.h:1782
#define LVCFMT_RIGHT
Definition: commctrl.h:2604
#define TVIF_PARAM
Definition: commctrl.h:3273
#define LVCF_TEXT
Definition: commctrl.h:2593
#define UDM_GETPOS32
Definition: commctrl.h:2161
#define TVIF_SELECTEDIMAGE
Definition: commctrl.h:3276
#define TVIF_STATE
Definition: commctrl.h:3274
#define UDM_SETPOS32
Definition: commctrl.h:2160
#define IOCTL_STORAGE_QUERY_PROPERTY
Definition: ntddstor.h:178
@ StorageDeviceProperty
Definition: ntddstor.h:512
@ PropertyStandardQuery
Definition: ntddstor.h:505
_In_opt_ _In_opt_ _In_ _In_ DWORD cbData
Definition: shlwapi.h:761
_In_ UINT uID
Definition: shlwapi.h:156
#define WM_UNICHAR
Definition: richedit.h:67
#define WM_NOTIFY
Definition: richedit.h:61
#define __fallthrough
Definition: sal_old.h:314
#define LoadStringW
Definition: utils.h:64
Entry
Definition: section.c:5216
BOOLEAN NTAPI GetRegisteredFileSystems(IN ULONG Index, OUT PCWSTR *FileSystemName)
Definition: fsutil.c:183
ERROR_NUMBER NTAPI PartitionCreateChecks(_In_ PPARTENTRY PartEntry, _In_opt_ ULONGLONG SizeBytes, _In_opt_ ULONG_PTR PartitionInfo)
Definition: partlist.c:2946
ULONGLONG RoundingDivide(IN ULONGLONG Dividend, IN ULONGLONG Divisor)
Definition: partlist.c:97
PPARTENTRY NTAPI GetAdjUnpartitionedEntry(_In_ PPARTENTRY PartEntry, _In_ BOOLEAN Direction)
Retrieves, if any, the unpartitioned disk region that is adjacent (next or previous) to the specified...
Definition: partlist.c:2856
BOOLEAN NTAPI CreatePartition(_In_ PPARTLIST List, _Inout_ PPARTENTRY PartEntry, _In_opt_ ULONGLONG SizeBytes, _In_opt_ ULONG_PTR PartitionInfo)
Definition: partlist.c:2975
BOOLEAN NTAPI DeletePartition(_In_ PPARTLIST List, _In_ PPARTENTRY PartEntry, _Out_opt_ PPARTENTRY *FreeRegion)
Definition: partlist.c:3075
PPARTENTRY SelectPartition(_In_ PPARTLIST List, _In_ ULONG DiskNumber, _In_ ULONG PartitionNumber)
Definition: partlist.c:2333
BOOLEAN NTAPI IsValidInstallDirectory(_In_ PCWSTR InstallDir)
Verify whether the given directory is suitable for ReactOS installation. Each path component must be ...
Definition: setuplib.c:781
@ ARCH_NEC98x86
Definition: setuplib.h:55
@ ARCH_PcAT
Definition: setuplib.h:54
#define KB
Definition: setuplib.h:74
#define IS_VALID_INSTALL_PATH_CHAR(c)
Defines the class of characters valid for the installation directory.
Definition: setuplib.h:206
#define GB
Definition: setuplib.h:76
#define MB
Definition: setuplib.h:75
static HWND hEdit
Definition: autocomplete.c:34
#define _countof(array)
Definition: sndvol32.h:70
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
STRSAFEAPI StringCchCopyA(STRSAFE_LPSTR pszDest, size_t cchDest, STRSAFE_LPCSTR pszSrc)
Definition: strsafe.h:145
STRSAFEAPI StringCchPrintfA(STRSAFE_LPSTR pszDest, size_t cchDest, STRSAFE_LPCSTR pszFormat,...)
Definition: strsafe.h:520
PPARTENTRY ExtendedPartition
Definition: partlist.h:153
LIST_ENTRY LogicalPartListHead
Definition: partlist.h:150
PARTITION_STYLE DiskStyle
Definition: partlist.h:139
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
Dialog context structure used by PartitionDlgProc() and FormatDlgProc(Worker)().
Definition: drivepage.c:368
BOOLEAN MBRExtPart
Definition: drivepage.c:372
PPARTITEM PartItem
Definition: drivepage.c:369
BOOLEAN AutoFormat
Definition: drivepage.c:374
BOOLEAN ForceFormat
Definition: drivepage.c:373
ULONG PartSizeMB
Definition: drivepage.c:371
BOOLEAN IsPartitioned
Definition: partlist.h:82
UCHAR PartitionType
Definition: partlist.h:73
PVOLENTRY Volume
Definition: partlist.h:95
struct _DISKENTRY * DiskEntry
Definition: partlist.h:66
BOOLEAN LogicalPartition
Definition: partlist.h:79
Data structure stored for each partition item in the TreeList. (None for disks items....
Definition: drivepage.c:357
PPARTENTRY PartEntry
Definition: drivepage.c:358
PVOL_CREATE_INFO VolCreate
Definition: drivepage.c:360
PVOLENTRY Volume
Definition: drivepage.c:359
USETUP_DATA USetupData
Definition: reactos.h:156
HINSTANCE hInstance
Definition: reactos.h:127
PPARTLIST PartitionList
Definition: reactos.h:160
BOOL bUnattend
Definition: reactos.h:128
HWND hPartList
Definition: reactos.h:70
LONG DestinationPartitionNumber
Definition: setuplib.h:130
LONG FsType
Definition: setuplib.h:135
LONG AutoPartition
Definition: setuplib.h:134
WCHAR InstallationDirectory[MAX_PATH]
Definition: setuplib.h:157
LONG BootLoaderLocation
Definition: setuplib.h:132
ULONG RequiredPartitionDiskSpace
Definition: setuplib.h:156
LONG DestinationDiskNumber
Definition: setuplib.h:129
FORMATSTATE FormatState
Definition: partlist.h:48
WCHAR FileSystem[MAX_PATH+1]
Definition: volutil.h:22
WCHAR DriveLetter
Definition: volutil.h:20
WCHAR VolumeLabel[MAXIMUM_VOLUME_LABEL_LENGTH/sizeof(WCHAR)+1]
Volume label, NUL-terminated.
Definition: volutil.h:21
Data structure stored when a partition/volume needs to be formatted.
Definition: reactos.h:187
ULONG ClusterSize
Definition: reactos.h:199
BOOLEAN QuickFormat
Definition: reactos.h:198
PVOLENTRY Volume
Definition: reactos.h:188
WCHAR FileSystemName[MAX_PATH+1]
Definition: reactos.h:195
FMIFS_MEDIA_FLAG MediaFlag
Definition: reactos.h:196
PCWSTR Label
Definition: reactos.h:197
UINT_PTR idFrom
Definition: winuser.h:3266
UINT code
Definition: winuser.h:3267
HWND hwndFrom
Definition: winuser.h:3265
#define max(a, b)
Definition: svc.c:63
#define GWLP_WNDPROC
Definition: treelist.c:66
#define GWLP_USERDATA
Definition: treelist.c:63
#define TLITEMW
Definition: treelist.h:478
#define TreeList_GetNextItem(h, i, c)
Definition: treelist.h:440
#define TreeList_DeleteAllItems(h)
Definition: treelist.h:363
#define TVC_MARK
Definition: treelist.h:145
HTREEITEM hItem
Definition: treelist.h:37
#define TreeList_Expand(h, i, c)
Definition: treelist.h:365
#define TreeList_GetNextSibling(h, i)
Definition: treelist.h:443
#define TreeList_SetColor(h, i, c)
Definition: treelist.h:379
#define TreeList_InsertColumn(h, i, p)
Definition: treelist.h:368
#define TreeList_GetPrevSibling(h, i)
Definition: treelist.h:444
#define TreeList_GetSelection(h)
Definition: treelist.h:450
#define TreeList_SetExtendedStyle(h, d)
Definition: treelist.h:376
#define TreeList_SetItemText(hwndLV, hItem_, iSubItem_, pszText_)
Definition: treelist.h:484
#define HTLITEM
Definition: treelist.h:466
#define TreeList_GetImageList(h, i)
Definition: treelist.h:397
#define TLCOLUMN
Definition: treelist.h:465
#define TreeList_SetStyle(h, d)
Definition: treelist.h:430
#define TreeList_GetParent(h, i)
Definition: treelist.h:442
#define TVS_EX_FULLROWMARK
Definition: treelist.h:272
#define TreeList_DeleteItem(h, i)
Definition: treelist.h:364
#define TVGN_NEXTITEM
Definition: treelist.h:166
#define TreeList_InsertItem(h, p)
Definition: treelist.h:403
#define TLINSERTSTRUCTW
Definition: treelist.h:471
#define TreeList_GetStyle(h)
Definition: treelist.h:429
#define TreeList_SelectItem(h, i)
Definition: treelist.h:436
#define TreeList_GetItem(h, p)
Definition: treelist.h:394
#define TreeList_SetImageList(h, l, i)
Definition: treelist.h:407
uint16_t * PWSTR
Definition: typedefs.h:56
int32_t INT_PTR
Definition: typedefs.h:64
char * PSTR
Definition: typedefs.h:51
const uint16_t * PCWSTR
Definition: typedefs.h:57
const uint16_t * LPCWSTR
Definition: typedefs.h:57
unsigned char UCHAR
Definition: typedefs.h:53
uint16_t * LPWSTR
Definition: typedefs.h:56
ULONG_PTR SIZE_T
Definition: typedefs.h:80
int32_t INT
Definition: typedefs.h:58
uint64_t ULONGLONG
Definition: typedefs.h:67
const char * PCSTR
Definition: typedefs.h:52
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define IN
Definition: typedefs.h:39
uint16_t * PWCHAR
Definition: typedefs.h:56
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
#define HIWORD(l)
Definition: typedefs.h:247
#define OUT
Definition: typedefs.h:40
char * PCHAR
Definition: typedefs.h:51
VOID __cdecl MUIDisplayError(IN ULONG ErrorNum, OUT PINPUT_RECORD Ir, IN ULONG WaitEvent,...)
Definition: mui.c:237
PCSTR MUIGetString(ULONG Number)
Definition: mui.c:251
#define STRING_FORMATUNKNOWN
Definition: mui.h:183
static USETUP_DATA USetupData
Definition: usetup.c:44
static PPARTENTRY CurrentPartition
Definition: usetup.c:78
#define POPUP_WAIT_ANY_KEY
Definition: usetup.h:123
_In_ WDFCOLLECTION _In_ ULONG Index
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4539
_Must_inspect_result_ _In_ WDFCMRESLIST List
Definition: wdfresource.h:550
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1382
#define GMEM_MOVEABLE
Definition: winbase.h:318
#define GMEM_SHARE
Definition: winbase.h:329
struct _STORAGE_DEVICE_DESCRIPTOR * PSTORAGE_DEVICE_DESCRIPTOR
DWORD WINAPI GetSysColor(_In_ int)
#define CB_SETITEMDATA
Definition: winuser.h:1995
#define MAKEWPARAM(l, h)
Definition: winuser.h:4117
#define SW_HIDE
Definition: winuser.h:779
#define GetWindowLongPtrW
Definition: winuser.h:4983
#define WM_PASTE
Definition: winuser.h:1891
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI CheckDlgButton(_In_ HWND, _In_ int, _In_ UINT)
#define IDCANCEL
Definition: winuser.h:842
#define BST_UNCHECKED
Definition: winuser.h:199
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CB_ERRSPACE
Definition: winuser.h:2472
#define COLOR_HIGHLIGHT
Definition: winuser.h:937
HANDLE WINAPI SetClipboardData(_In_ UINT, _In_opt_ HANDLE)
#define WM_COMMAND
Definition: winuser.h:1768
#define CB_ERR
Definition: winuser.h:2471
BOOL WINAPI CloseClipboard(void)
Definition: ntwrapper.h:178
#define CB_SETCURSEL
Definition: winuser.h:1990
#define SM_CYSMICON
Definition: winuser.h:1024
BOOL WINAPI OpenClipboard(_In_opt_ HWND)
#define CB_FINDSTRINGEXACT
Definition: winuser.h:1969
#define WM_INITDIALOG
Definition: winuser.h:1767
#define MB_YESNO
Definition: winuser.h:828
BOOL WINAPI MessageBeep(_In_ UINT uType)
HANDLE WINAPI GetClipboardData(_In_ UINT)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDOK
Definition: winuser.h:841
#define CBN_SELCHANGE
Definition: winuser.h:2008
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define MB_ICONERROR
Definition: winuser.h:798
#define MB_OKCANCEL
Definition: winuser.h:815
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
UINT WINAPI IsDlgButtonChecked(_In_ HWND, _In_ int)
BOOL WINAPI IsWindowUnicode(_In_ HWND)
#define SM_CXSMICON
Definition: winuser.h:1023
#define WM_IME_CHAR
Definition: winuser.h:1862
#define CB_ADDSTRING
Definition: winuser.h:1965
struct tagNMHDR * LPNMHDR
#define CB_GETITEMDATA
Definition: winuser.h:1979
int WINAPI GetWindowTextLengthW(_In_ HWND)
#define MB_OK
Definition: winuser.h:801
#define WM_CHAR
Definition: winuser.h:1745
BOOL WINAPI IsWindowEnabled(_In_ HWND)
#define MB_ICONWARNING
Definition: winuser.h:797
HWND WINAPI GetParent(_In_ HWND)
#define MB_ICONQUESTION
Definition: winuser.h:800
#define DWLP_MSGRESULT
Definition: winuser.h:881
#define MB_DEFBUTTON2
Definition: winuser.h:810
#define BN_CLICKED
Definition: winuser.h:1954
#define SW_SHOW
Definition: winuser.h:786
#define VK_DELETE
Definition: winuser.h:2269
#define WM_DESTROY
Definition: winuser.h:1637
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define CB_INSERTSTRING
Definition: winuser.h:1986
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:3014
#define IDYES
Definition: winuser.h:846
#define CB_GETCURSEL
Definition: winuser.h:1972
#define SetWindowLongPtrW
Definition: winuser.h:5512
LRESULT WINAPI CallWindowProcW(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define GWL_STYLE
Definition: winuser.h:863
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE hInstance, _In_ LPCWSTR lpIconName)
Definition: cursoricon.c:2444
int WINAPI GetSystemMetrics(_In_ int)
#define BST_CHECKED
Definition: winuser.h:197
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
_In_ ULONG _In_ struct _SET_PARTITION_INFORMATION_EX * PartitionInfo
Definition: iofuncs.h:2105