ReactOS 0.4.17-dev-540-g8f54750
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 switch (LOWORD(wParam))
295 {
296 case IDOK:
297 {
298 HWND hEdit;
299 BOOL bIsValid;
300 WCHAR InstallDir[MAX_PATH];
301 INT iItem;
302 UINT uBldrLoc = CB_ERR;
303
304 /*
305 * Retrieve the installation path and verify its validity.
306 * Check for the validity of the installation directory and
307 * pop up an error if this is not the case.
308 */
309 hEdit = GetDlgItem(hDlg, IDC_PATH);
310 bIsValid = (GetWindowTextLengthW(hEdit) < _countof(InstallDir)); // && IsValidInstallDirectory(InstallDir);
311 GetWindowTextW(hEdit, InstallDir, _countof(InstallDir));
312 bIsValid = bIsValid && IsValidInstallDirectory(InstallDir);
313
314 if (!bIsValid)
315 {
316 // ERROR_DIRECTORY_NAME
317 DisplayError(hDlg,
320 break; // Go back to the dialog.
321 }
322
325 InstallDir);
326
327 /* Retrieve the bootloader location */
329 if (iItem != CB_ERR)
330 uBldrLoc = SendDlgItemMessageW(hDlg, IDC_INSTFREELDR, CB_GETITEMDATA, iItem, 0);
331 if (uBldrLoc == CB_ERR) // Default location: System partition / MBR & VBR
333 uBldrLoc = min(max(uBldrLoc, 0), 3);
334 pSetupData->USetupData.BootLoaderLocation = uBldrLoc;
335
336 EndDialog(hDlg, IDOK);
337 return TRUE;
338 }
339
340 case IDCANCEL:
341 EndDialog(hDlg, IDCANCEL);
342 return TRUE;
343 }
344 break;
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; //< Whether to force formatting ('Do not format' option hidden).
375
376static INT_PTR
379 _In_ PPARTCREATE_CTX PartCreateCtx,
380 _In_ HWND hDlg,
381 _In_ UINT uMsg,
384{
385 switch (uMsg)
386 {
387 case WM_INITDIALOG:
388 {
389 ULONG Index = 0;
390 INT iItem;
392 PCWSTR DefaultFs;
394 PVOL_CREATE_INFO VolCreate;
395
396 /* List the well-known file systems. We use the same strings
397 * for the displayed FS names and their actual ones. */
399 {
401 if (iItem != CB_ERR && iItem != CB_ERRSPACE)
403 }
404
405 /* Add the 'Do not format' entry if needed */
406 if (!PartCreateCtx->ForceFormat)
407 {
408 WCHAR szText[50];
409
411 iItem = SendDlgItemMessageW(hDlg, IDC_FSTYPE, CB_INSERTSTRING, 0, (LPARAM)szText);
412 if (iItem != CB_ERR && iItem != CB_ERRSPACE)
414 }
415
416 // FIXME: Read from SetupData.FsType; select the "FAT" FS instead.
417 DefaultFs = L"FAT";
418
419 /* Retrieve the selected volume and create information */
420 ASSERT(PartCreateCtx->PartItem->Volume == PartCreateCtx->PartItem->PartEntry->Volume);
421 Volume = PartCreateCtx->PartItem->PartEntry->Volume;
422 VolCreate = PartCreateCtx->PartItem->VolCreate;
423
424 /* Select the existing file system in the list if any,
425 * otherwise use the "DefaultFs" */
426 if (VolCreate && *VolCreate->FileSystemName)
427 FileSystem = VolCreate->FileSystemName;
428 else if (Volume && *Volume->Info.FileSystem)
429 FileSystem = Volume->Info.FileSystem;
430 else
431 FileSystem = DefaultFs;
432
434 if (iItem == CB_ERR)
435 iItem = 0;
437
438 /* Check the quick-format option by default as it speeds up formatting */
439 if (!VolCreate || VolCreate->QuickFormat)
441 else
443
444 return TRUE;
445 }
446
447 case WM_COMMAND:
448 {
449 //
450 // NOTE:
451 // - CBN_SELCHANGE sent everytime a combobox list item is selected,
452 // *even if* the list is opened.
453 // - CBN_SELENDOK sent only when user finished to select an item
454 // by clicking on it (if the list is opened), or selection changed
455 // (when the list is closed but selection is done with arrow keys).
456 //
457 if ((HIWORD(wParam) == CBN_SELCHANGE /*|| HIWORD(wParam) == CBN_SELENDOK*/) &&
459 {
460 // HWND hWndList = GetDlgItem(hDlg, IDC_FSTYPE);
462 INT iItem;
463
464 /* Retrieve the selected file system. Use the
465 * item data instead of the displayed string. */
466 iItem = SendDlgItemMessageW(hDlg, IDC_FSTYPE, CB_GETCURSEL, 0, 0);
467 if (iItem == CB_ERR)
468 iItem = 0; // Default entry
470 if (FileSystem == (PCWSTR)CB_ERR)
471 FileSystem = NULL; // Default data
472
473 /* Enable or disable formatting options,
474 * depending on whether we need to format */
476 break;
477 }
478
479 if (HIWORD(wParam) != BN_CLICKED)
480 break;
481
482 switch (LOWORD(wParam))
483 {
484 case IDOK:
485 {
486 PPARTITEM PartItem = PartCreateCtx->PartItem;
487 PVOL_CREATE_INFO VolCreate;
489 INT iItem;
490
491 /*
492 * Retrieve the formatting options
493 */
494
495 /* Retrieve the selected file system. Use the
496 * item data instead of the displayed string. */
497 iItem = SendDlgItemMessageW(hDlg, IDC_FSTYPE, CB_GETCURSEL, 0, 0);
498 if (iItem == CB_ERR)
499 iItem = 0; // Default entry
501 if (FileSystem == (PCWSTR)CB_ERR)
502 FileSystem = NULL; // Default data
503
504 VolCreate = PartItem->VolCreate;
505
506 /* Check if we need to format */
507 if (!FileSystem || !*FileSystem)
508 {
509 /* We don't format. If there is an existing
510 * volume-create structure, free it. */
511 if (VolCreate)
512 LocalFree(VolCreate);
513 PartItem->VolCreate = NULL;
514
515 /* And return */
516 return TRUE;
517 }
518
519 /* We will format: allocate and initialize
520 * a volume-create structure if needed */
521 if (!VolCreate)
522 VolCreate = LocalAlloc(LPTR, sizeof(*VolCreate));
523 if (!VolCreate)
524 {
525 DPRINT1("Failed to allocate volume-create structure\n");
526 return TRUE;
527 }
528
529 /* Cached input information that will be set to
530 * the FORMAT_VOLUME_INFO structure given to the
531 * 'FSVOLNOTIFY_STARTFORMAT' step */
532 // TODO: Think about which values could be defaulted...
534 _countof(VolCreate->FileSystemName),
535 FileSystem);
536 VolCreate->MediaFlag = FMIFS_HARDDISK;
537 VolCreate->Label = NULL;
538 VolCreate->QuickFormat =
540 VolCreate->ClusterSize = 0;
541
542 /* Set the volume associated to the new create information */
543 VolCreate->Volume = PartItem->Volume;
544
545 /* Associate the new, or update the volume create information */
546 PartItem->VolCreate = VolCreate;
547 return TRUE;
548 }
549 }
550 }
551 }
552 return FALSE;
553}
554
555static INT_PTR
558 _In_ HWND hDlg,
559 _In_ UINT uMsg,
562{
563 PPARTCREATE_CTX PartCreateCtx;
564
565 /* Retrieve dialog context pointer */
566 PartCreateCtx = (PPARTCREATE_CTX)GetWindowLongPtrW(hDlg, GWLP_USERDATA);
567
568 switch (uMsg)
569 {
570 case WM_INITDIALOG:
571 {
572 /* Save dialog context pointer */
573 PartCreateCtx = (PPARTCREATE_CTX)lParam;
574 SetWindowLongPtrW(hDlg, GWLP_USERDATA, (LONG_PTR)PartCreateCtx);
575
576 /* We actually want to format, so set the flag */
577 PartCreateCtx->ForceFormat = TRUE;
578 break;
579 }
580
581 case WM_COMMAND:
582 {
583 if (HIWORD(wParam) != BN_CLICKED)
584 break;
585
586 switch (LOWORD(wParam))
587 {
588 case IDOK:
589 {
590 /* Retrieve the formatting options */
591 FormatDlgProcWorker(PartCreateCtx, hDlg, uMsg, wParam, lParam);
592 EndDialog(hDlg, IDOK);
593 return TRUE;
594 }
595
596 case IDCANCEL:
597 {
598 EndDialog(hDlg, IDCANCEL);
599 return TRUE;
600 }
601 }
602 }
603 }
604
605 return FormatDlgProcWorker(PartCreateCtx, hDlg, uMsg, wParam, lParam);
606}
607
608static INT_PTR
611 _In_ HWND hDlg,
612 _In_ UINT uMsg,
615{
616 PPARTCREATE_CTX PartCreateCtx;
617
618 /* Retrieve dialog context pointer */
619 PartCreateCtx = (PPARTCREATE_CTX)GetWindowLongPtrW(hDlg, GWLP_USERDATA);
620
621 switch (uMsg)
622 {
623 case WM_INITDIALOG:
624 {
625 PPARTENTRY PartEntry;
626 PDISKENTRY DiskEntry;
627 ULONG MaxSizeMB;
628
629 /* Save dialog context pointer */
630 PartCreateCtx = (PPARTCREATE_CTX)lParam;
631 SetWindowLongPtrW(hDlg, GWLP_USERDATA, (LONG_PTR)PartCreateCtx);
632
633 /* Retrieve the selected partition */
634 PartEntry = PartCreateCtx->PartItem->PartEntry;
635 DiskEntry = PartEntry->DiskEntry;
636
637 /* Set the spinner to the maximum size in MB the partition can have */
638 MaxSizeMB = PartCreateCtx->MaxSizeMB;
641
642 /* Default to regular partition (non-extended on MBR disks) */
644
645 /* Also, disable and hide IDC_CHECK_MBREXTPART
646 * if space is logical or the disk is not MBR */
647 if ((DiskEntry->DiskStyle == PARTITION_STYLE_MBR) &&
648 !PartEntry->LogicalPartition)
649 {
652 }
653 else
654 {
657 }
658
659 break;
660 }
661
662 case WM_COMMAND:
663 {
664 if (HIWORD(wParam) != BN_CLICKED)
665 break;
666
667 switch (LOWORD(wParam))
668 {
670 {
671 /* Check for MBR-extended (container) partition */
672 // BST_UNCHECKED or BST_INDETERMINATE => FALSE
674 {
675 /* It is, disable formatting options */
679 }
680 else
681 {
682 /* It is not, re-enable formatting options */
686 }
687 break;
688 }
689
690 case IDOK:
691 {
692 /* Collect all the information and return it
693 * to the caller for creating the partition */
695 PartCreateCtx->PartSizeMB = min(max(PartCreateCtx->PartSizeMB, 1), PartCreateCtx->MaxSizeMB);
697
698 /* Retrieve the formatting options */
699 FormatDlgProcWorker(PartCreateCtx, hDlg, uMsg, wParam, lParam);
700
701 EndDialog(hDlg, IDOK);
702 return TRUE;
703 }
704
705 case IDCANCEL:
706 {
707 EndDialog(hDlg, IDCANCEL);
708 return TRUE;
709 }
710 }
711 }
712 }
713
714 return FormatDlgProcWorker(PartCreateCtx, hDlg, uMsg, wParam, lParam);
715}
716
717
718BOOL
721 IN HWND hWndTreeList,
722 IN const UINT* pIDs,
723 IN const INT* pColsWidth,
724 IN const INT* pColsAlign,
725 IN UINT nNumOfColumns)
726{
727 UINT i;
728 TLCOLUMN tlC;
729 WCHAR szText[50];
730
731 /* Create the columns */
732 tlC.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
733 tlC.pszText = szText;
734
735 /* Load the column labels from the resource file */
736 for (i = 0; i < nNumOfColumns; i++)
737 {
738 tlC.iSubItem = i;
739 tlC.cx = pColsWidth[i];
740 tlC.fmt = pColsAlign[i];
741
742 LoadStringW(hInstance, pIDs[i], szText, ARRAYSIZE(szText));
743
744 if (TreeList_InsertColumn(hWndTreeList, i, &tlC) == -1)
745 return FALSE;
746 }
747
748 return TRUE;
749}
750
751
754 _In_ HWND hTreeList,
755 _In_opt_ HTLITEM hParent,
756 _In_opt_ HTLITEM hInsertAfter,
757 _In_ LPCWSTR lpText,
758 _In_ INT iImage,
759 _In_ INT iSelectedImage,
761{
762 TLINSERTSTRUCTW Insert;
763
764 ZeroMemory(&Insert, sizeof(Insert));
765
766 Insert.item.mask = TVIF_TEXT | TVIF_PARAM | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
767 Insert.hParent = hParent;
768 Insert.hInsertAfter = (hInsertAfter ? hInsertAfter : TVI_LAST);
769 Insert.item.pszText = (LPWSTR)lpText;
770 Insert.item.iImage = iImage;
771 Insert.item.iSelectedImage = iSelectedImage;
772 Insert.item.lParam = lParam;
773
774 // Insert.item.mask |= TVIF_STATE;
775 // Insert.item.stateMask = TVIS_OVERLAYMASK;
776 // Insert.item.state = INDEXTOOVERLAYMASK(1);
777
778 return TreeList_InsertItem(hTreeList, &Insert);
779}
780
781LPARAM
783 _In_ HWND hTreeList,
785{
786 TLITEMW tlItem;
787
788 tlItem.mask = TVIF_PARAM;
789 tlItem.hItem = hItem;
790
791 TreeList_GetItem(hTreeList, &tlItem);
792
793 return tlItem.lParam;
794}
795
796static
799 _In_ HWND hTreeList,
801{
802 HTLITEM hParentItem;
803 PPARTITEM PartItem;
804
805 hParentItem = TreeList_GetParent(hTreeList, hItem);
806 /* May or may not be a PPARTITEM: this is a PPARTITEM only when hParentItem != NULL */
807 PartItem = (PPARTITEM)TreeListGetItemData(hTreeList, hItem);
808 if (!hParentItem || !PartItem)
809 return NULL;
810
811 return PartItem;
812}
813
814static
817 _In_ HWND hTreeList,
818 _Out_opt_ HTLITEM* phItem)
819{
821 PPARTITEM PartItem;
822
823 hItem = TreeList_GetSelection(hTreeList);
824 if (!hItem)
825 return NULL;
826
827 PartItem = GetItemPartition(hTreeList, hItem);
828 if (PartItem && phItem)
829 *phItem = hItem;
830
831 return PartItem;
832}
833
836 _In_ HWND hTreeList,
838{
840
841 /* Enumerate every cached data in the TreeList, and for each, check
842 * whether its corresponding PPARTENTRY is the one we are looking for */
843 // for (hItem = TVI_ROOT; hItem; hItem = TreeList_GetNextItem(...)) { }
844 hItem = TVI_ROOT;
845 while ((hItem = TreeList_GetNextItem(hTreeList, hItem, TVGN_NEXTITEM)))
846 {
847 PPARTITEM PartItem = GetItemPartition(hTreeList, hItem);
848 if (!PartItem || !PartItem->VolCreate /* || !PartItem->Volume */)
849 continue;
850
851 if (PartItem->Volume == Volume)
852 {
853 /* Found it, return the associated volume-create structure */
854 return PartItem->VolCreate;
855 }
856 }
857
858 /* Nothing was found */
859 return NULL;
860}
861
862
863VOID
865 IN PPARTENTRY PartEntry,
866 OUT PSTR strBuffer,
868{
869 if (PartEntry->PartitionType == PARTITION_ENTRY_UNUSED)
870 {
871 StringCchCopyA(strBuffer, cchBuffer,
872 "Unused" /* MUIGetString(STRING_FORMATUNUSED) */);
873 }
874 // else if (PartEntry == PartEntry->DiskEntry->ExtendedPartition)
875 else if (IsContainerPartition(PartEntry->PartitionType))
876 {
877 StringCchCopyA(strBuffer, cchBuffer,
878 "Extended Partition" /* MUIGetString(STRING_EXTENDED_PARTITION) */);
879 }
880 else
881 {
882 /* Do the table lookup */
883 PCSTR Description = LookupPartitionTypeString(PartEntry->DiskEntry->DiskStyle,
884 &PartEntry->PartitionType);
885 if (Description)
886 {
888 return;
889 }
890
891 /* We are here because the partition type is unknown */
892 if (cchBuffer > 0) *strBuffer = '\0';
893 }
894
895 if ((cchBuffer > 0) && (*strBuffer == '\0'))
896 {
897 StringCchPrintfA(strBuffer, cchBuffer,
898 // MUIGetString(STRING_PARTTYPE),
899 "Type 0x%02x",
900 PartEntry->PartitionType);
901 }
902}
903
904
905static VOID
909{
910 ULONGLONG DiskSize = *Size;
911
912 if (DiskSize >= 10 * GB) /* 10 GB */
913 {
914 DiskSize = RoundingDivide(DiskSize, GB);
915 *Unit = L"GB"; // MUIGetString(STRING_GB);
916 }
917 else
918 {
919 DiskSize = RoundingDivide(DiskSize, MB);
920 if (DiskSize == 0)
921 DiskSize = 1;
922 *Unit = L"MB"; // MUIGetString(STRING_MB);
923 }
924
925 *Size = DiskSize;
926}
927
928static VOID
932{
933 ULONGLONG PartSize = *Size;
934
935#if 0
936 if (PartSize >= 10 * GB) /* 10 GB */
937 {
938 PartSize = RoundingDivide(PartSize, GB);
939 *Unit = L"GB"; // MUIGetString(STRING_GB);
940 }
941 else
942#endif
943 if (PartSize >= 10 * MB) /* 10 MB */
944 {
945 PartSize = RoundingDivide(PartSize, MB);
946 *Unit = L"MB"; // MUIGetString(STRING_MB);
947 }
948 else
949 {
950 PartSize = RoundingDivide(PartSize, KB);
951 *Unit = L"KB"; // MUIGetString(STRING_KB);
952 }
953
954 *Size = PartSize;
955}
956
957static
961 _In_ HTLITEM htiParent,
962 _In_opt_ HTLITEM hInsertAfter,
963 _In_ PPARTENTRY PartEntry)
964{
965 PDISKENTRY DiskEntry = PartEntry->DiskEntry;
966 PVOLINFO VolInfo = (PartEntry->Volume ? &PartEntry->Volume->Info : NULL);
967 PPARTITEM PartItem;
968 ULONGLONG PartSize;
969 HTLITEM htiPart;
970 CHAR PartTypeString[32];
971 PCHAR PartType = PartTypeString;
972 WCHAR LineBuffer[128];
973
974 /* Volume name */
975 if (PartEntry->IsPartitioned == FALSE)
976 {
977 /* Unpartitioned space: Just display the description */
978 StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
979 // MUIGetString(STRING_UNPSPACE)
980 L"Unpartitioned space");
981 }
982 else
983//
984// NOTE: This could be done with the next case.
985//
986 if ((DiskEntry->DiskStyle == PARTITION_STYLE_MBR) &&
987 IsContainerPartition(PartEntry->PartitionType))
988 {
989 /* Extended partition container: Just display the partition's type */
990 StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
991 // MUIGetString(STRING_EXTENDED_PARTITION)
992 L"Extended Partition");
993 }
994 else
995 {
996 /* Drive letter and partition number */
997 StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
998 // MUIGetString(STRING_HDDINFOUNK5),
999 L"%s (%c%c)",
1000 (VolInfo && *VolInfo->VolumeLabel) ? VolInfo->VolumeLabel : L"Partition",
1001 !(VolInfo && VolInfo->DriveLetter) ? L'-' : VolInfo->DriveLetter,
1002 !(VolInfo && VolInfo->DriveLetter) ? L'-' : L':');
1003 }
1004
1005 /* Allocate and initialize a partition-info structure */
1006 PartItem = LocalAlloc(LPTR, sizeof(*PartItem));
1007 if (!PartItem)
1008 {
1009 DPRINT1("Failed to allocate partition-info structure\n");
1010 // return NULL;
1011 // We'll store a NULL pointer?!
1012 }
1013
1014 PartItem->PartEntry = PartEntry;
1015 PartItem->Volume = PartEntry->Volume;
1016
1017 htiPart = TreeListAddItem(hWndList, htiParent, hInsertAfter,
1018 LineBuffer, 1, 1,
1019 (LPARAM)PartItem);
1020
1021 *LineBuffer = 0;
1022 if (PartEntry->IsPartitioned)
1023 {
1024 PartTypeString[0] = '\0';
1025
1026 /*
1027 * If the volume's file system is recognized, display the volume label
1028 * (if any) and the file system name. Otherwise, display the partition
1029 * type if it's not a new partition.
1030 */
1031 if (VolInfo && *VolInfo->FileSystem &&
1032 _wcsicmp(VolInfo->FileSystem, L"RAW") != 0)
1033 {
1034 // TODO: Group this part together with the similar one
1035 // from below once the strings are in the same encoding...
1036 if (PartEntry->New)
1037 {
1038 StringCchPrintfA(PartTypeString,
1039 ARRAYSIZE(PartTypeString),
1040 "New (%S)",
1041 VolInfo->FileSystem);
1042 }
1043 else
1044 {
1045 StringCchPrintfA(PartTypeString,
1046 ARRAYSIZE(PartTypeString),
1047 "%S",
1048 VolInfo->FileSystem);
1049 }
1050 PartType = PartTypeString;
1051 }
1052 else
1053 /* Determine partition type */
1054 if (PartEntry->New)
1055 {
1056 /* Use this description if the partition is new and not planned for formatting */
1057 PartType = "New (Unformatted)"; // MUIGetString(STRING_UNFORMATTED);
1058 }
1059 else
1060 {
1061 /* If the partition is not new but its file system is not recognized
1062 * (or is not formatted), use the partition type description. */
1063 GetPartitionTypeString(PartEntry,
1064 PartTypeString,
1065 ARRAYSIZE(PartTypeString));
1066 PartType = PartTypeString;
1067 }
1068#if 0
1069 if (!PartType || !*PartType)
1070 {
1072 }
1073#endif
1074
1075 StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
1076 L"%S",
1077 PartType);
1078 }
1079 TreeList_SetItemText(hWndList, htiPart, 1, LineBuffer);
1080
1081 /* Format the partition size */
1082 PartSize = GetPartEntrySizeInBytes(PartEntry);
1083 if (!StrFormatByteSizeW(PartSize, LineBuffer, ARRAYSIZE(LineBuffer)))
1084 {
1085 /* We failed for whatever reason, do the hardcoded way */
1086 PCWSTR Unit;
1087 PrettifySize2(&PartSize, &Unit);
1088 StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
1089 L"%6I64u %s",
1090 PartSize, Unit);
1091 }
1092 TreeList_SetItemText(hWndList, htiPart, 2, LineBuffer);
1093
1094 /* Volume status */
1095 *LineBuffer = 0;
1096 if (PartEntry->IsPartitioned)
1097 {
1098 StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
1099 // MUIGetString(STRING_HDDINFOUNK5),
1100 PartEntry->BootIndicator ? L"Active" : L"");
1101 }
1102 TreeList_SetItemText(hWndList, htiPart, 3, LineBuffer);
1103
1104
1105 /* If this is the single extended partition of an MBR disk,
1106 * recursively display its logical partitions */
1107 if (PartEntry == DiskEntry->ExtendedPartition)
1108 {
1109 PLIST_ENTRY LogicalEntry;
1110
1111 for (LogicalEntry = DiskEntry->LogicalPartListHead.Flink;
1112 LogicalEntry != &DiskEntry->LogicalPartListHead;
1113 LogicalEntry = LogicalEntry->Flink)
1114 {
1115 PPARTENTRY LogicalPartEntry = CONTAINING_RECORD(LogicalEntry, PARTENTRY, ListEntry);
1116 PrintPartitionData(hWndList, htiPart, NULL, LogicalPartEntry);
1117 }
1118
1119 /* Expand the extended partition node */
1121 }
1122
1123 return htiPart;
1124}
1125
1130static
1131VOID
1134 _In_ TLITEMW* ptlItem)
1135{
1136 PPARTITEM PartItem;
1137
1138 /* Code below is equivalent to: PartItem = GetItemPartition(hWndList, ptlItem->hItem);
1139 * except that we already have the data structure in ptlItem->lParam, so there is
1140 * no need to call extra helpers as GetItemPartition() does. */
1141 HTLITEM hParentItem = TreeList_GetParent(hWndList, ptlItem->hItem);
1142 /* May or may not be a PPARTITEM: this is a PPARTITEM only when hParentItem != NULL */
1143 PartItem = (PPARTITEM)ptlItem->lParam;
1144 if (!hParentItem || !PartItem)
1145 return;
1146
1147 if (PartItem->VolCreate)
1148 LocalFree(PartItem->VolCreate);
1149 LocalFree(PartItem);
1150}
1151
1152static
1153VOID
1156 _In_opt_ HTLITEM hInsertAfter,
1157 _In_ PDISKENTRY DiskEntry)
1158{
1159 BOOL Success;
1160 HANDLE hDevice;
1161 PCHAR DiskName = NULL;
1162 ULONG Length = 0;
1163 PLIST_ENTRY PrimaryEntry;
1164 ULONGLONG DiskSize;
1165 HTLITEM htiDisk;
1166 WCHAR LineBuffer[128];
1167 UCHAR outBuf[512];
1168
1169 StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
1170 // L"\\Device\\Harddisk%lu\\Partition%lu",
1171 L"\\\\.\\PhysicalDrive%lu",
1172 DiskEntry->DiskNumber);
1173
1174 hDevice = CreateFileW(
1175 LineBuffer, // device interface name
1176 GENERIC_READ /*| GENERIC_WRITE*/, // dwDesiredAccess
1177 FILE_SHARE_READ | FILE_SHARE_WRITE, // dwShareMode
1178 NULL, // lpSecurityAttributes
1179 OPEN_EXISTING, // dwCreationDistribution
1180 0, // dwFlagsAndAttributes
1181 NULL // hTemplateFile
1182 );
1183 if (hDevice != INVALID_HANDLE_VALUE)
1184 {
1186
1187 Query.PropertyId = StorageDeviceProperty;
1188 Query.QueryType = PropertyStandardQuery;
1189
1190 Success = DeviceIoControl(hDevice,
1192 &Query,
1193 sizeof(Query),
1194 &outBuf,
1195 sizeof(outBuf),
1196 &Length,
1197 NULL);
1198 if (Success)
1199 {
1201 if (devDesc->ProductIdOffset)
1202 {
1203 DiskName = (PCHAR)&outBuf[devDesc->ProductIdOffset];
1204 Length -= devDesc->ProductIdOffset;
1205 DiskName[min(Length, strlen(DiskName))] = 0;
1206 // ( i = devDesc->ProductIdOffset; p[i] != 0 && i < Length; i++ )
1207 }
1208 }
1209
1210 CloseHandle(hDevice);
1211 }
1212
1213 if (DiskName && *DiskName)
1214 {
1215 if (DiskEntry->DriverName.Length > 0)
1216 {
1217 StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
1218 // MUIGetString(STRING_HDDINFO_1),
1219 L"Harddisk %lu (%S) (Port=%hu, Bus=%hu, Id=%hu) on %wZ",
1220 DiskEntry->DiskNumber,
1221 DiskName,
1222 DiskEntry->Port,
1223 DiskEntry->Bus,
1224 DiskEntry->Id,
1225 &DiskEntry->DriverName);
1226 }
1227 else
1228 {
1229 StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
1230 // MUIGetString(STRING_HDDINFO_2),
1231 L"Harddisk %lu (%S) (Port=%hu, Bus=%hu, Id=%hu)",
1232 DiskEntry->DiskNumber,
1233 DiskName,
1234 DiskEntry->Port,
1235 DiskEntry->Bus,
1236 DiskEntry->Id);
1237 }
1238 }
1239 else
1240 {
1241 if (DiskEntry->DriverName.Length > 0)
1242 {
1243 StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
1244 // MUIGetString(STRING_HDDINFO_1),
1245 L"Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu) on %wZ",
1246 DiskEntry->DiskNumber,
1247 DiskEntry->Port,
1248 DiskEntry->Bus,
1249 DiskEntry->Id,
1250 &DiskEntry->DriverName);
1251 }
1252 else
1253 {
1254 StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
1255 // MUIGetString(STRING_HDDINFO_2),
1256 L"Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu)",
1257 DiskEntry->DiskNumber,
1258 DiskEntry->Port,
1259 DiskEntry->Bus,
1260 DiskEntry->Id);
1261 }
1262 }
1263
1264 htiDisk = TreeListAddItem(hWndList, NULL, hInsertAfter,
1265 LineBuffer, 0, 0,
1266 (LPARAM)DiskEntry);
1267
1268 /* Disk type: MBR, GPT or RAW (Uninitialized) */
1269 TreeList_SetItemText(hWndList, htiDisk, 1,
1270 DiskEntry->DiskStyle == PARTITION_STYLE_MBR ? L"MBR" :
1271 DiskEntry->DiskStyle == PARTITION_STYLE_GPT ? L"GPT" :
1272 L"RAW");
1273
1274 /* Format the disk size */
1275 DiskSize = GetDiskSizeInBytes(DiskEntry);
1276 if (!StrFormatByteSizeW(DiskSize, LineBuffer, ARRAYSIZE(LineBuffer)))
1277 {
1278 /* We failed for whatever reason, do the hardcoded way */
1279 PCWSTR Unit;
1280 PrettifySize1(&DiskSize, &Unit);
1281 StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
1282 L"%6I64u %s",
1283 DiskSize, Unit);
1284 }
1285 TreeList_SetItemText(hWndList, htiDisk, 2, LineBuffer);
1286
1287 /* Print partition lines */
1288 for (PrimaryEntry = DiskEntry->PrimaryPartListHead.Flink;
1289 PrimaryEntry != &DiskEntry->PrimaryPartListHead;
1290 PrimaryEntry = PrimaryEntry->Flink)
1291 {
1292 /* If this is an extended partition, recursively print the logical partitions */
1293 PPARTENTRY PartEntry = CONTAINING_RECORD(PrimaryEntry, PARTENTRY, ListEntry);
1294 PrintPartitionData(hWndList, htiDisk, NULL, PartEntry);
1295 }
1296
1297 /* Expand the disk node */
1299}
1300
1301static VOID
1305{
1306 const DWORD dwStyle = TVS_HASBUTTONS | /*TVS_HASLINES | TVS_LINESATROOT |*/ TVS_SHOWSELALWAYS | TVS_FULLROWSELECT;
1307 const DWORD dwExStyle = TVS_EX_FULLROWMARK /* | TVS_EX_FULLROWITEMS*/;
1308 HIMAGELIST hSmall;
1309
1310 /* Set the TreeList styles and fixup the item selection color */
1312 // TreeList_SetStyleEx(hWndList, dwStyle, dwStyle);
1315
1316 /* Initialize its columns */
1318 hWndList,
1319 column_ids,
1323
1324 /* Create the ImageList */
1327 ILC_COLOR32 | ILC_MASK, // ILC_COLOR24
1328 1, 1);
1329
1330 /* Add event type icons to the ImageList */
1333
1334 /* Assign the ImageList to the List View */
1336}
1337
1338static VOID
1342{
1344
1345 /* Clear the list first */
1347
1348 /* Insert all the detected disks and partitions */
1349 for (Entry = List->DiskListHead.Flink;
1350 Entry != &List->DiskListHead;
1351 Entry = Entry->Flink)
1352 {
1353 /* Print disk entry */
1354 PDISKENTRY DiskEntry = CONTAINING_RECORD(Entry, DISKENTRY, ListEntry);
1355 PrintDiskData(hWndList, NULL, DiskEntry);
1356 }
1357
1358 /* Select the first item */
1359 // TreeList_SetFocusItem(hWndList, 1, 1);
1361}
1362
1363static VOID
1366{
1367 HIMAGELIST hSmall;
1368
1369 /* Cleanup all the items. Their cached data will be automatically deleted
1370 * on response to the TVN_DELETEITEM notification sent by the TreeList
1371 * by DeleteTreeItem() */
1373
1374 /* And cleanup the imagelist */
1377 ImageList_Destroy(hSmall);
1378}
1379
1380
1386static BOOLEAN
1388 _In_ HWND hList,
1390 _Inout_ HTLITEM* phItem,
1391 _Inout_opt_ PPARTITEM* pPartItem,
1392 _In_opt_ ULONGLONG SizeBytes,
1394{
1396 PPARTITEM PartItem;
1397 PPARTENTRY PartEntry;
1398 HTLITEM hParentItem;
1399 HTLITEM hInsertAfter;
1400 PPARTENTRY NextPart;
1401
1402 PartItem = (pPartItem ? *pPartItem : GetItemPartition(hList, *phItem));
1403 if (!PartItem)
1404 {
1405 /* We must have a disk region... */
1406 ASSERT(FALSE);
1407 return FALSE;
1408 }
1409 PartEntry = PartItem->PartEntry;
1410#if 0
1411 if (PartEntry->IsPartitioned)
1412 {
1413 /* Don't create a partition when one already exists */
1414 ASSERT(FALSE);
1415 return FALSE;
1416 }
1417 ASSERT(!PartEntry->Volume);
1418#endif
1419
1421 PartEntry,
1422 SizeBytes,
1424 if (!Success)
1425 return Success;
1426
1427 /* Retrieve the parent item (disk or MBR extended partition) */
1428 hParentItem = TreeList_GetParent(hList, *phItem);
1429 hInsertAfter = TreeList_GetPrevSibling(hList, *phItem);
1430 if (!hInsertAfter)
1431 hInsertAfter = TVI_FIRST;
1432
1433 /*
1434 * The current entry has been recreated and maybe split
1435 * in two: new partition and remaining unused space.
1436 * Thus, recreate the current entry.
1437 *
1438 * NOTE: Since we create a partition we don't care
1439 * about its previous PartItem, so it can be deleted.
1440 */
1441 {
1442 /* Cache out the original item's volume create info */
1443 PVOL_CREATE_INFO VolCreate = PartItem->VolCreate;
1444 PartItem->VolCreate = NULL;
1445
1446 /* Remove the current item */
1447 TreeList_DeleteItem(hList, *phItem);
1448
1449 /* Recreate the entry */
1450 *phItem = PrintPartitionData(hList, hParentItem, hInsertAfter, PartEntry);
1451
1452 /* Retrieve the new PartItem and restore the volume create
1453 * information associated to the newly-created partition */
1454 PartItem = GetItemPartition(hList, *phItem);
1455 ASSERT(PartItem);
1456
1457 /* Update the volume associated to the create information */
1458 if (VolCreate)
1459 VolCreate->Volume = PartItem->Volume;
1460
1461 /* Restore the volume create information */
1462 PartItem->VolCreate = VolCreate;
1463
1464 if (pPartItem)
1465 *pPartItem = PartItem;
1466 }
1467
1468 /* Add also the following unused space, if any */
1469 // NextPart = GetAdjDiskRegion(NULL, PartEntry, ENUM_REGION_NEXT);
1470 NextPart = GetAdjUnpartitionedEntry(PartEntry, TRUE);
1471 if (NextPart /*&& !NextPart->IsPartitioned*/)
1472 PrintPartitionData(hList, hParentItem, *phItem, NextPart);
1473
1474 /* Give the focus on and select the created partition */
1475 // TreeList_SetFocusItem(hList, 1, 1);
1476 TreeList_SelectItem(hList, *phItem);
1477
1478 return TRUE;
1479}
1480
1486static BOOLEAN
1488 _In_ HWND hList,
1490 _Inout_ HTLITEM* phItem,
1491 _In_ PPARTITEM PartItem)
1492{
1493 PPARTENTRY PartEntry = PartItem->PartEntry;
1494 PPARTENTRY PrevPart, NextPart;
1495 BOOLEAN PrevIsPartitioned, NextIsPartitioned;
1497
1498 HTLITEM hParentItem;
1499 HTLITEM hInsertAfter;
1500 HTLITEM hAdjItem;
1501 PPARTITEM AdjPartItem;
1502
1503#if 0
1504 if (!PartEntry->IsPartitioned)
1505 {
1506 /* Don't delete an unpartitioned disk region */
1507 ASSERT(FALSE);
1508 return FALSE;
1509 }
1510#endif
1511
1512 /*
1513 * Determine the nature of the previous and next disk regions,
1514 * in order to know what to do on the corresponding tree items
1515 * after the selected partition has been deleted.
1516 *
1517 * NOTE: Don't reference these pointers after DeletePartition(),
1518 * since these disk regions might have been coalesced/reallocated.
1519 * However we can check whether they were NULL or not.
1520 */
1521 // PrevPart = GetAdjDiskRegion(NULL, PartEntry, ENUM_REGION_PREV);
1522 // NextPart = GetAdjDiskRegion(NULL, PartEntry, ENUM_REGION_NEXT);
1523 PrevPart = GetAdjUnpartitionedEntry(PartEntry, FALSE);
1524 NextPart = GetAdjUnpartitionedEntry(PartEntry, TRUE);
1525
1526 PrevIsPartitioned = (PrevPart && PrevPart->IsPartitioned);
1527 NextIsPartitioned = (NextPart && NextPart->IsPartitioned);
1528
1529 ASSERT(PartEntry->IsPartitioned); // The current partition must be partitioned.
1531 PartEntry,
1532 &PartEntry);
1533 if (!Success)
1534 return Success;
1535
1536 /* Retrieve the parent item (disk or MBR extended partition) */
1537 hParentItem = TreeList_GetParent(hList, *phItem);
1538
1539 /* If previous sibling isn't partitioned, remove it */
1540 if (PrevPart && !PrevIsPartitioned)
1541 {
1542 hAdjItem = TreeList_GetPrevSibling(hList, *phItem);
1543 ASSERT(hAdjItem); // TODO: Investigate
1544 if (hAdjItem)
1545 {
1546 AdjPartItem = GetItemPartition(hList, hAdjItem);
1547 ASSERT(AdjPartItem && (AdjPartItem->PartEntry == PrevPart));
1548 AdjPartItem = NULL;
1549 TreeList_DeleteItem(hList, hAdjItem);
1550 }
1551 }
1552 /* If next sibling isn't partitioned, remove it */
1553 if (NextPart && !NextIsPartitioned)
1554 {
1555 hAdjItem = TreeList_GetNextSibling(hList, *phItem);
1556 ASSERT(hAdjItem); // TODO: Investigate
1557 if (hAdjItem)
1558 {
1559 AdjPartItem = GetItemPartition(hList, hAdjItem);
1560 ASSERT(AdjPartItem && (AdjPartItem->PartEntry == NextPart));
1561 AdjPartItem = NULL;
1562 TreeList_DeleteItem(hList, hAdjItem);
1563 }
1564 }
1565
1566 /* We are going to insert the updated entry after
1567 * either, the original previous sibling (if it is
1568 * partitioned), or the second-previous sibling
1569 * (if the first one was already removed, see above) */
1570 hInsertAfter = TreeList_GetPrevSibling(hList, *phItem);
1571 if (!hInsertAfter)
1572 hInsertAfter = TVI_FIRST;
1573
1574 /* Remove the current item */
1575 TreeList_DeleteItem(hList, *phItem);
1576
1577 /* Add back the "new" unpartitioned space */
1578 *phItem = PrintPartitionData(hList, hParentItem, hInsertAfter, PartEntry);
1579
1580 /* Give the focus on and select the unpartitioned space */
1581 // TreeList_SetFocusItem(hList, 1, 1);
1582 TreeList_SelectItem(hList, *phItem);
1583
1584 return TRUE;
1585}
1586
1587
1588static BOOLEAN
1590 _In_ PSETUPDATA pSetupData,
1591 _In_ HWND hwndDlg)
1592{
1593 HWND hList;
1594 HTLITEM hItem;
1595 PPARTITEM PartItem;
1596 PPARTENTRY PartEntry;
1597
1598 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
1599 PartItem = GetSelectedPartition(hList, &hItem);
1600 if (!PartItem)
1601 return FALSE; // Fail
1602 PartEntry = PartItem->PartEntry;
1603 ASSERT(PartEntry);
1604
1605 /*
1606 * Check whether the user wants to install ReactOS on a disk that
1607 * is not recognized by the computer's firmware and if so, display
1608 * a warning since such disks may not be bootable.
1609 */
1610 if (PartEntry->DiskEntry->MediaType == FixedMedia &&
1611 !PartEntry->DiskEntry->BiosFound)
1612 {
1613 INT nRet;
1614
1615 nRet = DisplayMessage(hwndDlg,
1617 L"Warning",
1618 L"The disk you have selected for installing ReactOS\n"
1619 L"is not visible by the firmware of your computer,\n"
1620 L"and so may not be bootable.\n"
1621 L"\nClick on OK to continue anyway."
1622 L"\nClick on CANCEL to go back to the partitions list.");
1623 if (nRet != IDOK)
1624 return FALSE; // Fail
1625 }
1626
1627 /* If this is an empty region, auto-create the partition if conditions are OK */
1628 if (!PartEntry->IsPartitioned)
1629 {
1630 ULONG Error;
1631
1632 Error = PartitionCreateChecks(PartEntry, 0ULL, 0);
1633 if (Error != NOT_AN_ERROR)
1634 {
1635 // MUIDisplayError(Error, Ir, POPUP_WAIT_ANY_KEY);
1637 L"Could not create a partition on the selected disk region.");
1638 return FALSE; // Fail
1639 }
1640
1641 /* Automatically create the partition on the whole empty space;
1642 * it will be formatted later with default parameters */
1643 if (!DoCreatePartition(hList, pSetupData->PartitionList,
1644 &hItem, &PartItem,
1645 0ULL, 0))
1646 {
1647 DisplayError(GetParent(hwndDlg),
1650 return FALSE; // Fail
1651 }
1652 /* Update PartEntry */
1653 PartEntry = PartItem->PartEntry;
1654 }
1655
1656 ASSERT(PartEntry->IsPartitioned);
1657 // ASSERT(PartEntry != PartEntry->DiskEntry->ExtendedPartition);
1659 ASSERT(PartEntry->Volume);
1660
1661#if 0 // TODO: Implement!
1662 if (!IsPartitionLargeEnough(PartEntry))
1663 {
1666 return FALSE; // Fail
1667 }
1668#endif
1669
1670 /* Force formatting only if the partition doesn't have a volume (may or may not be formatted) */
1671 if (PartEntry->Volume &&
1672 ((PartEntry->Volume->FormatState == Formatted) ||
1673 (PartItem->VolCreate && *PartItem->VolCreate->FileSystemName)))
1674 {
1675 /*NOTHING*/;
1676 }
1677 else /* Request formatting of the selected region if it's not already formatted */
1678 {
1679 INT_PTR ret;
1680 PARTCREATE_CTX PartCreateCtx = {0};
1681
1682 /* Show the formatting dialog */
1683 PartCreateCtx.PartItem = PartItem;
1684 ret = DialogBoxParamW(pSetupData->hInstance,
1686 hwndDlg,
1688 (LPARAM)&PartCreateCtx);
1689
1690 /* If the user refuses to format the partition, fail */
1691 if (ret != IDOK)
1692 return FALSE;
1693
1694 /* The partition will be formatted */
1695 }
1696
1697 /* The install partition has been found */
1698 InstallPartition = PartEntry;
1699 return TRUE;
1700}
1701
1702INT_PTR
1705 _In_ HWND hwndDlg,
1706 _In_ UINT uMsg,
1709{
1710 PSETUPDATA pSetupData;
1711 HWND hList;
1712
1713 /* Retrieve pointer to the global setup data */
1714 pSetupData = (PSETUPDATA)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
1715
1716 switch (uMsg)
1717 {
1718 case WM_INITDIALOG:
1719 {
1720 /* Save pointer to the global setup data */
1721 pSetupData = (PSETUPDATA)((LPPROPSHEETPAGEW)lParam)->lParam;
1722 SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (LONG_PTR)pSetupData);
1723
1724 /* Initially hide and disable all partitioning buttons */
1725 ShowDlgItem(hwndDlg, IDC_INITDISK, SW_HIDE);
1726 EnableDlgItem(hwndDlg, IDC_INITDISK, FALSE);
1733
1734 /* Initialize the partitions list */
1735 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
1737 InitPartitionList(pSetupData->hInstance, hList);
1738 DrawPartitionList(hList, pSetupData->PartitionList);
1739 break;
1740 }
1741
1742 case WM_DESTROY:
1743 {
1744 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
1748 return TRUE;
1749 }
1750
1751 case WM_COMMAND:
1752 {
1753 switch (LOWORD(wParam))
1754 {
1755 case IDC_PARTMOREOPTS:
1756 {
1757 DialogBoxParamW(pSetupData->hInstance,
1759 hwndDlg,
1761 (LPARAM)pSetupData);
1762 break;
1763 }
1764
1765 case IDC_INITDISK:
1766 {
1767 // TODO: Implement disk partitioning initialization
1768 break;
1769 }
1770
1771 case IDC_PARTCREATE:
1772 {
1773 HTLITEM hItem;
1774 PPARTITEM PartItem;
1775 PPARTENTRY PartEntry;
1776 ULONGLONG PartSize;
1777 ULONGLONG MaxPartSize;
1778 ULONG MaxSizeMB;
1779 INT_PTR ret;
1780 PARTCREATE_CTX PartCreateCtx = {0};
1781
1782 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
1783 PartItem = GetSelectedPartition(hList, &hItem);
1784 if (!PartItem)
1785 {
1786 /* If the button was clicked, an empty disk
1787 * region should have been selected first */
1788 ASSERT(FALSE);
1789 break;
1790 }
1791 PartEntry = PartItem->PartEntry;
1792 if (PartEntry->IsPartitioned)
1793 {
1794 /* Don't create a partition when one already exists */
1795 ASSERT(FALSE);
1796 break;
1797 }
1798 ASSERT(!PartEntry->Volume);
1799
1800 /* Get the partition info stored in the TreeList */
1801 PartCreateCtx.PartItem = PartItem;
1802
1803 /* Retrieve the maximum size in MB (rounded up) the partition can have */
1804 MaxPartSize = GetPartEntrySizeInBytes(PartEntry);
1805 MaxSizeMB = (ULONG)RoundingDivide(MaxPartSize, MB);
1806 PartCreateCtx.MaxSizeMB = MaxSizeMB;
1807
1808 /* Don't force formatting by default */
1809 PartCreateCtx.ForceFormat = FALSE;
1810
1811 /* Show the partitioning dialog */
1812 ret = DialogBoxParamW(pSetupData->hInstance,
1814 hwndDlg,
1816 (LPARAM)&PartCreateCtx);
1817 if (ret != IDOK)
1818 break;
1819
1820 /*
1821 * If the input size, given in MB, specifies the maximum partition
1822 * size, it may slightly under- or over-estimate the latter due to
1823 * rounding error. In this case, use all of the unpartitioned space.
1824 * Otherwise, directly convert the size to bytes.
1825 */
1826 PartSize = PartCreateCtx.PartSizeMB;
1827 if (PartSize == MaxSizeMB)
1828 PartSize = MaxPartSize;
1829 else // if (PartSize < MaxSizeMB)
1830 PartSize *= MB;
1831
1832 ASSERT(PartSize <= MaxPartSize);
1833
1834 if (!DoCreatePartition(hList, pSetupData->PartitionList,
1835 &hItem, &PartItem,
1836 PartSize,
1837 !PartCreateCtx.MBRExtPart
1838 ? 0 : PARTITION_EXTENDED))
1839 {
1840 DisplayError(GetParent(hwndDlg),
1843 }
1844
1845 break;
1846 }
1847
1848 case IDC_PARTFORMAT:
1849 {
1850 PPARTITEM PartItem;
1851 PPARTENTRY PartEntry;
1852 INT_PTR ret;
1853 PARTCREATE_CTX PartCreateCtx = {0};
1854
1855 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
1856 PartItem = GetSelectedPartition(hList, NULL);
1857 if (!PartItem)
1858 {
1859 /* If the button was clicked, an empty disk
1860 * region should have been selected first */
1861 ASSERT(FALSE);
1862 break;
1863 }
1864 PartEntry = PartItem->PartEntry;
1865 if (!PartEntry->Volume)
1866 {
1867 /* Don't format an unformattable partition */
1868 ASSERT(FALSE);
1869 break;
1870 }
1871
1872 /* Show the formatting dialog */
1873 PartCreateCtx.PartItem = PartItem;
1874 ret = DialogBoxParamW(pSetupData->hInstance,
1876 hwndDlg,
1878 (LPARAM)&PartCreateCtx);
1880 break;
1881 }
1882
1883 case IDC_PARTDELETE:
1884 {
1885 HTLITEM hItem;
1886 PPARTITEM PartItem;
1887 PPARTENTRY PartEntry;
1888 UINT uIDWarnMsg;
1889
1890 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
1891 PartItem = GetSelectedPartition(hList, &hItem);
1892 if (!PartItem)
1893 {
1894 // If the button was clicked, a partition
1895 // should have been selected first...
1896 ASSERT(FALSE);
1897 break;
1898 }
1899 PartEntry = PartItem->PartEntry;
1900 if (!PartEntry->IsPartitioned)
1901 {
1902 /* Don't delete an unpartitioned disk region */
1903 ASSERT(FALSE);
1904 break;
1905 }
1906
1907 /* Choose the correct warning message to display:
1908 * MBR-extended (container) vs. standard partition */
1909 if (PartEntry == PartEntry->DiskEntry->ExtendedPartition)
1911 else
1912 uIDWarnMsg = IDS_WARN_DELETE_PARTITION;
1913
1914 /* If the user really wants to delete the partition... */
1915 if (DisplayMessage(GetParent(hwndDlg),
1918 MAKEINTRESOURCEW(uIDWarnMsg)) == IDYES)
1919 {
1920 /* ... make it so! */
1921 if (!DoDeletePartition(hList, pSetupData->PartitionList,
1922 &hItem, PartItem))
1923 {
1925 L"Could not delete the selected partition.");
1926 }
1927 }
1928
1929 break;
1930 }
1931 }
1932 break;
1933 }
1934
1935 case WM_NOTIFY:
1936 {
1937 LPNMHDR lpnm = (LPNMHDR)lParam;
1938
1939 // On Vista+ we can use TVN_ITEMCHANGED instead, with NMTVITEMCHANGE* pointer
1940 if (lpnm->idFrom == IDC_PARTITION && lpnm->code == TVN_SELCHANGED)
1941 {
1943
1944 /* Check whether the item has been (de)selected */
1945#if 0 // When using NMTVITEMCHANGE
1946 if (!(pnmv->uChanged & TVIF_STATE) ||
1947 !((pnmv->uStateOld ^ pnmv->uStateNew) & TVIS_SELECTED))
1948 { break; }
1949#endif
1950 if (!((pnmv->itemOld.mask | pnmv->itemNew.mask) & TVIF_STATE) ||
1951 !((pnmv->itemOld.state ^ pnmv->itemNew.state) & TVIS_SELECTED))
1952 {
1953 break;
1954 }
1955
1956 if (pnmv->itemNew.state & TVIS_SELECTED)
1957 {
1958 HTLITEM hParentItem = TreeList_GetParent(lpnm->hwndFrom, pnmv->itemNew.hItem);
1959 /* May or may not be a PPARTENTRY: this is a PPARTENTRY only when hParentItem != NULL */
1960
1961 if (!hParentItem)
1962 {
1963 /* Hard disk */
1964 PDISKENTRY DiskEntry = (PDISKENTRY)pnmv->itemNew.lParam;
1965 ASSERT(DiskEntry);
1966
1967 /* Show the "Initialize" disk button and hide and disable the others */
1968 ShowDlgItem(hwndDlg, IDC_INITDISK, SW_SHOW);
1969
1970#if 0 // FIXME: Init disk not implemented yet!
1971 EnableDlgItem(hwndDlg, IDC_INITDISK,
1972 DiskEntry->DiskStyle == PARTITION_STYLE_RAW);
1973#else
1974 EnableDlgItem(hwndDlg, IDC_INITDISK, FALSE);
1975#endif
1976
1979
1982
1985
1986 /* Disable the "Next" button */
1987 goto DisableWizNext;
1988 }
1989 else
1990 {
1991 /* Partition or unpartitioned space */
1992 PPARTITEM PartItem = (PPARTITEM)pnmv->itemNew.lParam;
1993 PPARTENTRY PartEntry;
1994 ASSERT(PartItem);
1995 PartEntry = PartItem->PartEntry;
1996 ASSERT(PartEntry);
1997
1998 /* Hide and disable the "Initialize" disk button */
1999 ShowDlgItem(hwndDlg, IDC_INITDISK, SW_HIDE);
2000 EnableDlgItem(hwndDlg, IDC_INITDISK, FALSE);
2001
2002 if (!PartEntry->IsPartitioned)
2003 {
2004 /* Show and enable the "Create" partition button */
2007
2008 /* Hide and disable the "Format" button */
2011 }
2012 else
2013 {
2014 /* Hide and disable the "Create" partition button */
2017
2018 /* Show the "Format" button, but enable or disable it if a formattable volume is present */
2020 EnableDlgItem(hwndDlg, IDC_PARTFORMAT, !!PartEntry->Volume);
2021 }
2022
2023 /* Show the "Delete" partition button, but enable or disable it if the disk region is partitioned */
2025 EnableDlgItem(hwndDlg, IDC_PARTDELETE, PartEntry->IsPartitioned);
2026
2027 /*
2028 * Enable the "Next" button if:
2029 *
2030 * 1. the selected disk region is partitioned:
2031 * it can either have a volume attached (and be either
2032 * formatted or ready to be formatted),
2033 * or it's not yet formatted (the installer will prompt
2034 * for formatting parameters).
2035 *
2036 * 2. Or, the selected disk region is not partitioned but
2037 * can be partitioned according to the disk's partitioning
2038 * scheme (the installer will auto-partition the region
2039 * and prompt for formatting parameters).
2040 *
2041 * In all other cases, the "Next" button is disabled.
2042 */
2043
2044 // TODO: In the future: first test needs to be augmented with:
2045 // (... && PartEntry->Volume->IsSimpleVolume)
2046 if ((PartEntry->IsPartitioned && PartEntry->Volume) ||
2047 (!PartEntry->IsPartitioned && (PartitionCreateChecks(PartEntry, 0ULL, 0) == NOT_AN_ERROR)))
2048 {
2049 // ASSERT(PartEntry != PartEntry->DiskEntry->ExtendedPartition);
2050 ASSERT(!IsContainerPartition(PartEntry->PartitionType));
2052 }
2053 else
2054 {
2055 goto DisableWizNext;
2056 }
2057 }
2058 }
2059 else
2060 {
2061DisableWizNext:
2062 /* Keep the "Next" button disabled. It will be enabled
2063 * only when the user selects a valid partition. */
2065 }
2066
2067 break;
2068 }
2069
2070 if (lpnm->idFrom == IDC_PARTITION && lpnm->code == TVN_DELETEITEM)
2071 {
2072 /* Deleting an item from the partition list */
2074 DeleteTreeItem(lpnm->hwndFrom, (TLITEMW*)&pnmv->itemOld);
2075 break;
2076 }
2077
2078 switch (lpnm->code)
2079 {
2080 case PSN_SETACTIVE:
2081 {
2082 /* Keep the "Next" button disabled. It will be enabled
2083 * only when the user selects a valid partition. */
2085 break;
2086 }
2087
2089 {
2090 /* Reselect the currently selected item, so as to refresh the UI buttons */
2091 HTLITEM hItem;
2092 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
2094 if (hItem)
2095 {
2096 /* Don't use TreeList_SelectItem() directly. Instead,
2097 * deselect first the item before reselecting it, so as to
2098 * invalidate its cached state and have the TVN_SELCHANGED
2099 * notification sent. */
2100 TreeList_SetItemState(hList, hItem, 0, TVIS_SELECTED);
2101 TreeList_SetItemState(hList, hItem, TVIS_SELECTED, TVIS_SELECTED);
2102 }
2103
2104 /* Focus on the partition list */
2106 return TRUE;
2107 }
2108
2109 case PSN_QUERYCANCEL:
2110 {
2111 if (DisplayMessage(GetParent(hwndDlg),
2115 {
2116 /* Go to the Abort page */
2118 }
2119
2120 /* Do not close the wizard too soon */
2122 return TRUE;
2123 }
2124
2125 case PSN_WIZNEXT:
2126 {
2127 /* Select the install partition and if success, go to the next page */
2128 if (SelectInstallPartition(pSetupData, hwndDlg))
2129 break;
2130 /* Failed, stay on the page */
2131 SetWindowLongPtrW(hwndDlg, DWLP_MSGRESULT, -1);
2132 return TRUE;
2133 }
2134
2135 default:
2136 break;
2137 }
2138 break;
2139 }
2140
2141 default:
2142 break;
2143 }
2144
2145 return FALSE;
2146}
2147
2148/* 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:38
PPARTENTRY InstallPartition
Definition: reactos.c:28
INT __cdecl DisplayMessage(_In_opt_ HWND hWnd, _In_ UINT uType, _In_opt_ PCWSTR pszTitle, _In_opt_ PCWSTR pszFormatMessage,...)
Definition: reactos.c:245
SETUPDATA SetupData
Definition: reactos.c:24
#define ShowDlgItem(hDlg, nID, nCmdShow)
Definition: reactos.h:34
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:1302
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:1487
LPARAM TreeListGetItemData(_In_ HWND hTreeList, _In_ HTLITEM hItem)
Definition: drivepage.c:782
static BOOLEAN SelectInstallPartition(_In_ PSETUPDATA pSetupData, _In_ HWND hwndDlg)
Definition: drivepage.c:1589
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:835
INT_PTR CALLBACK DriveDlgProc(_In_ HWND hwndDlg, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam)
Definition: drivepage.c:1704
static INT_PTR CALLBACK PartitionDlgProc(_In_ HWND hDlg, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam)
Definition: drivepage.c:610
static VOID PrettifySize1(_Inout_ PULONGLONG Size, _Out_ PCWSTR *Unit)
Definition: drivepage.c:906
VOID GetPartitionTypeString(IN PPARTENTRY PartEntry, OUT PSTR strBuffer, IN ULONG cchBuffer)
Definition: drivepage.c:864
static PPARTITEM GetItemPartition(_In_ HWND hTreeList, _In_ HTLITEM hItem)
Definition: drivepage.c:798
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:1387
#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:816
static INT_PTR CALLBACK FormatDlgProcWorker(_In_ PPARTCREATE_CTX PartCreateCtx, _In_ HWND hDlg, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam)
Definition: drivepage.c:378
static HTLITEM PrintPartitionData(_In_ HWND hWndList, _In_ HTLITEM htiParent, _In_opt_ HTLITEM hInsertAfter, _In_ PPARTENTRY PartEntry)
Definition: drivepage.c:959
static INT_PTR CALLBACK FormatDlgProc(_In_ HWND hDlg, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam)
Definition: drivepage.c:557
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:753
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:1339
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:719
static VOID CleanupPartitionList(_In_ HWND hWndList)
Definition: drivepage.c:1364
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:1154
static VOID DeleteTreeItem(_In_ HWND hWndList, _In_ TLITEMW *ptlItem)
Called on response to the TVN_DELETEITEM notification sent by the TreeList.
Definition: drivepage.c:1132
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:929
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 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 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 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 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
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 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
HWND hPartList
Definition: reactos.h:70
WCHAR InstallationDirectory[MAX_PATH]
Definition: setuplib.h:157
LONG BootLoaderLocation
Definition: setuplib.h:132
ULONG RequiredPartitionDiskSpace
Definition: setuplib.h:156
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
#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 SW_HIDE
Definition: winuser.h:779
#define GetWindowLongPtrW
Definition: winuser.h:4983
#define WM_PASTE
Definition: winuser.h:1891
BOOL WINAPI CheckDlgButton(_In_ HWND, _In_ int, _In_ UINT)
#define IDCANCEL
Definition: winuser.h:842
#define BST_UNCHECKED
Definition: winuser.h:199
#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
#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 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