ReactOS 0.4.17-dev-218-g5635d24
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: Resource header
5 * COPYRIGHT: Copyright 2008-2010 Matthias Kupfer <mkupfer@reactos.org>
6 * Copyright 2008-2009 Dmitry Chapyshev <dmitry@reactos.org>
7 * Copyright 2018-2024 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 break;
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 break;
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 PPARTENTRY LogicalPartEntry;
1111
1112 for (LogicalEntry = DiskEntry->LogicalPartListHead.Flink;
1113 LogicalEntry != &DiskEntry->LogicalPartListHead;
1114 LogicalEntry = LogicalEntry->Flink)
1115 {
1116 LogicalPartEntry = CONTAINING_RECORD(LogicalEntry, PARTENTRY, ListEntry);
1117 PrintPartitionData(hWndList, htiPart, NULL, LogicalPartEntry);
1118 }
1119
1120 /* Expand the extended partition node */
1122 }
1123
1124 return htiPart;
1125}
1126
1131static
1132VOID
1135 _In_ TLITEMW* ptlItem)
1136{
1137 PPARTITEM PartItem;
1138
1139 /* Code below is equivalent to: PartItem = GetItemPartition(hWndList, ptlItem->hItem);
1140 * except that we already have the data structure in ptlItem->lParam, so there is
1141 * no need to call extra helpers as GetItemPartition() does. */
1142 HTLITEM hParentItem = TreeList_GetParent(hWndList, ptlItem->hItem);
1143 /* May or may not be a PPARTITEM: this is a PPARTITEM only when hParentItem != NULL */
1144 PartItem = (PPARTITEM)ptlItem->lParam;
1145 if (!hParentItem || !PartItem)
1146 return;
1147
1148 if (PartItem->VolCreate)
1149 LocalFree(PartItem->VolCreate);
1150 LocalFree(PartItem);
1151}
1152
1153static
1154VOID
1157 _In_opt_ HTLITEM hInsertAfter,
1158 _In_ PDISKENTRY DiskEntry)
1159{
1160 BOOL Success;
1161 HANDLE hDevice;
1162 PCHAR DiskName = NULL;
1163 ULONG Length = 0;
1164 PPARTENTRY PrimaryPartEntry;
1165 PLIST_ENTRY PrimaryEntry;
1166 ULONGLONG DiskSize;
1167 HTLITEM htiDisk;
1168 WCHAR LineBuffer[128];
1169 UCHAR outBuf[512];
1170
1171 StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
1172 // L"\\Device\\Harddisk%lu\\Partition%lu",
1173 L"\\\\.\\PhysicalDrive%lu",
1174 DiskEntry->DiskNumber);
1175
1176 hDevice = CreateFileW(
1177 LineBuffer, // device interface name
1178 GENERIC_READ /*| GENERIC_WRITE*/, // dwDesiredAccess
1179 FILE_SHARE_READ | FILE_SHARE_WRITE, // dwShareMode
1180 NULL, // lpSecurityAttributes
1181 OPEN_EXISTING, // dwCreationDistribution
1182 0, // dwFlagsAndAttributes
1183 NULL // hTemplateFile
1184 );
1185 if (hDevice != INVALID_HANDLE_VALUE)
1186 {
1188
1189 Query.PropertyId = StorageDeviceProperty;
1190 Query.QueryType = PropertyStandardQuery;
1191
1192 Success = DeviceIoControl(hDevice,
1194 &Query,
1195 sizeof(Query),
1196 &outBuf,
1197 sizeof(outBuf),
1198 &Length,
1199 NULL);
1200 if (Success)
1201 {
1203 if (devDesc->ProductIdOffset)
1204 {
1205 DiskName = (PCHAR)&outBuf[devDesc->ProductIdOffset];
1206 Length -= devDesc->ProductIdOffset;
1207 DiskName[min(Length, strlen(DiskName))] = 0;
1208 // ( i = devDesc->ProductIdOffset; p[i] != 0 && i < Length; i++ )
1209 }
1210 }
1211
1212 CloseHandle(hDevice);
1213 }
1214
1215 if (DiskName && *DiskName)
1216 {
1217 if (DiskEntry->DriverName.Length > 0)
1218 {
1219 StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
1220 // MUIGetString(STRING_HDDINFO_1),
1221 L"Harddisk %lu (%S) (Port=%hu, Bus=%hu, Id=%hu) on %wZ",
1222 DiskEntry->DiskNumber,
1223 DiskName,
1224 DiskEntry->Port,
1225 DiskEntry->Bus,
1226 DiskEntry->Id,
1227 &DiskEntry->DriverName);
1228 }
1229 else
1230 {
1231 StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
1232 // MUIGetString(STRING_HDDINFO_2),
1233 L"Harddisk %lu (%S) (Port=%hu, Bus=%hu, Id=%hu)",
1234 DiskEntry->DiskNumber,
1235 DiskName,
1236 DiskEntry->Port,
1237 DiskEntry->Bus,
1238 DiskEntry->Id);
1239 }
1240 }
1241 else
1242 {
1243 if (DiskEntry->DriverName.Length > 0)
1244 {
1245 StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
1246 // MUIGetString(STRING_HDDINFO_1),
1247 L"Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu) on %wZ",
1248 DiskEntry->DiskNumber,
1249 DiskEntry->Port,
1250 DiskEntry->Bus,
1251 DiskEntry->Id,
1252 &DiskEntry->DriverName);
1253 }
1254 else
1255 {
1256 StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
1257 // MUIGetString(STRING_HDDINFO_2),
1258 L"Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu)",
1259 DiskEntry->DiskNumber,
1260 DiskEntry->Port,
1261 DiskEntry->Bus,
1262 DiskEntry->Id);
1263 }
1264 }
1265
1266 htiDisk = TreeListAddItem(hWndList, NULL, hInsertAfter,
1267 LineBuffer, 0, 0,
1268 (LPARAM)DiskEntry);
1269
1270 /* Disk type: MBR, GPT or RAW (Uninitialized) */
1271 TreeList_SetItemText(hWndList, htiDisk, 1,
1272 DiskEntry->DiskStyle == PARTITION_STYLE_MBR ? L"MBR" :
1273 DiskEntry->DiskStyle == PARTITION_STYLE_GPT ? L"GPT" :
1274 L"RAW");
1275
1276 /* Format the disk size */
1277 DiskSize = GetDiskSizeInBytes(DiskEntry);
1278 if (!StrFormatByteSizeW(DiskSize, LineBuffer, ARRAYSIZE(LineBuffer)))
1279 {
1280 /* We failed for whatever reason, do the hardcoded way */
1281 PCWSTR Unit;
1282 PrettifySize1(&DiskSize, &Unit);
1283 StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
1284 L"%6I64u %s",
1285 DiskSize, Unit);
1286 }
1287 TreeList_SetItemText(hWndList, htiDisk, 2, LineBuffer);
1288
1289 /* Print partition lines */
1290 for (PrimaryEntry = DiskEntry->PrimaryPartListHead.Flink;
1291 PrimaryEntry != &DiskEntry->PrimaryPartListHead;
1292 PrimaryEntry = PrimaryEntry->Flink)
1293 {
1294 PrimaryPartEntry = CONTAINING_RECORD(PrimaryEntry, PARTENTRY, ListEntry);
1295
1296 /* If this is an extended partition, recursively print the logical partitions */
1297 PrintPartitionData(hWndList, htiDisk, NULL, PrimaryPartEntry);
1298 }
1299
1300 /* Expand the disk node */
1302}
1303
1304static VOID
1308{
1309 const DWORD dwStyle = TVS_HASBUTTONS | /*TVS_HASLINES | TVS_LINESATROOT |*/ TVS_SHOWSELALWAYS | TVS_FULLROWSELECT;
1310 const DWORD dwExStyle = TVS_EX_FULLROWMARK /* | TVS_EX_FULLROWITEMS*/;
1311 HIMAGELIST hSmall;
1312
1313 /* Set the TreeList styles and fixup the item selection color */
1315 // TreeList_SetStyleEx(hWndList, dwStyle, dwStyle);
1318
1319 /* Initialize its columns */
1321 hWndList,
1322 column_ids,
1326
1327 /* Create the ImageList */
1330 ILC_COLOR32 | ILC_MASK, // ILC_COLOR24
1331 1, 1);
1332
1333 /* Add event type icons to the ImageList */
1336
1337 /* Assign the ImageList to the List View */
1339}
1340
1341static VOID
1345{
1347 PDISKENTRY DiskEntry;
1348
1349 /* Clear the list first */
1351
1352 /* Insert all the detected disks and partitions */
1353 for (Entry = List->DiskListHead.Flink;
1354 Entry != &List->DiskListHead;
1355 Entry = Entry->Flink)
1356 {
1357 DiskEntry = CONTAINING_RECORD(Entry, DISKENTRY, ListEntry);
1358
1359 /* Print disk entry */
1360 PrintDiskData(hWndList, NULL, DiskEntry);
1361 }
1362
1363 /* Select the first item */
1364 // TreeList_SetFocusItem(hWndList, 1, 1);
1366}
1367
1368static VOID
1371{
1372 HIMAGELIST hSmall;
1373
1374 /* Cleanup all the items. Their cached data will be automatically deleted
1375 * on response to the TVN_DELETEITEM notification sent by the TreeList
1376 * by DeleteTreeItem() */
1378
1379 /* And cleanup the imagelist */
1382 ImageList_Destroy(hSmall);
1383}
1384
1385
1391static BOOLEAN
1393 _In_ HWND hList,
1395 _Inout_ HTLITEM* phItem,
1396 _Inout_opt_ PPARTITEM* pPartItem,
1397 _In_opt_ ULONGLONG SizeBytes,
1399{
1401 PPARTITEM PartItem;
1402 PPARTENTRY PartEntry;
1403 HTLITEM hParentItem;
1404 HTLITEM hInsertAfter;
1405 PPARTENTRY NextPart;
1406
1407 PartItem = (pPartItem ? *pPartItem : GetItemPartition(hList, *phItem));
1408 if (!PartItem)
1409 {
1410 /* We must have a disk region... */
1411 ASSERT(FALSE);
1412 return FALSE;
1413 }
1414 PartEntry = PartItem->PartEntry;
1415#if 0
1416 if (PartEntry->IsPartitioned)
1417 {
1418 /* Don't create a partition when one already exists */
1419 ASSERT(FALSE);
1420 return FALSE;
1421 }
1422 ASSERT(!PartEntry->Volume);
1423#endif
1424
1426 PartEntry,
1427 SizeBytes,
1429 if (!Success)
1430 return Success;
1431
1432 /* Retrieve the parent item (disk or MBR extended partition) */
1433 hParentItem = TreeList_GetParent(hList, *phItem);
1434 hInsertAfter = TreeList_GetPrevSibling(hList, *phItem);
1435 if (!hInsertAfter)
1436 hInsertAfter = TVI_FIRST;
1437
1438 /*
1439 * The current entry has been recreated and maybe split
1440 * in two: new partition and remaining unused space.
1441 * Thus, recreate the current entry.
1442 *
1443 * NOTE: Since we create a partition we don't care
1444 * about its previous PartItem, so it can be deleted.
1445 */
1446 {
1447 /* Cache out the original item's volume create info */
1448 PVOL_CREATE_INFO VolCreate = PartItem->VolCreate;
1449 PartItem->VolCreate = NULL;
1450
1451 /* Remove the current item */
1452 TreeList_DeleteItem(hList, *phItem);
1453
1454 /* Recreate the entry */
1455 *phItem = PrintPartitionData(hList, hParentItem, hInsertAfter, PartEntry);
1456
1457 /* Retrieve the new PartItem and restore the volume create
1458 * information associated to the newly-created partition */
1459 PartItem = GetItemPartition(hList, *phItem);
1460 ASSERT(PartItem);
1461
1462 /* Update the volume associated to the create information */
1463 if (VolCreate)
1464 VolCreate->Volume = PartItem->Volume;
1465
1466 /* Restore the volume create information */
1467 PartItem->VolCreate = VolCreate;
1468
1469 if (pPartItem)
1470 *pPartItem = PartItem;
1471 }
1472
1473 /* Add also the following unused space, if any */
1474 // NextPart = GetAdjDiskRegion(NULL, PartEntry, ENUM_REGION_NEXT);
1475 NextPart = GetAdjUnpartitionedEntry(PartEntry, TRUE);
1476 if (NextPart /*&& !NextPart->IsPartitioned*/)
1477 PrintPartitionData(hList, hParentItem, *phItem, NextPart);
1478
1479 /* Give the focus on and select the created partition */
1480 // TreeList_SetFocusItem(hList, 1, 1);
1481 TreeList_SelectItem(hList, *phItem);
1482
1483 return TRUE;
1484}
1485
1491static BOOLEAN
1493 _In_ HWND hList,
1495 _Inout_ HTLITEM* phItem,
1496 _In_ PPARTITEM PartItem)
1497{
1498 PPARTENTRY PartEntry = PartItem->PartEntry;
1499 PPARTENTRY PrevPart, NextPart;
1500 BOOLEAN PrevIsPartitioned, NextIsPartitioned;
1502
1503 HTLITEM hParentItem;
1504 HTLITEM hInsertAfter;
1505 HTLITEM hAdjItem;
1506 PPARTITEM AdjPartItem;
1507
1508#if 0
1509 if (!PartEntry->IsPartitioned)
1510 {
1511 /* Don't delete an unpartitioned disk region */
1512 ASSERT(FALSE);
1513 return FALSE;
1514 }
1515#endif
1516
1517 /*
1518 * Determine the nature of the previous and next disk regions,
1519 * in order to know what to do on the corresponding tree items
1520 * after the selected partition has been deleted.
1521 *
1522 * NOTE: Don't reference these pointers after DeletePartition(),
1523 * since these disk regions might have been coalesced/reallocated.
1524 * However we can check whether they were NULL or not.
1525 */
1526 // PrevPart = GetAdjDiskRegion(NULL, PartEntry, ENUM_REGION_PREV);
1527 // NextPart = GetAdjDiskRegion(NULL, PartEntry, ENUM_REGION_NEXT);
1528 PrevPart = GetAdjUnpartitionedEntry(PartEntry, FALSE);
1529 NextPart = GetAdjUnpartitionedEntry(PartEntry, TRUE);
1530
1531 PrevIsPartitioned = (PrevPart && PrevPart->IsPartitioned);
1532 NextIsPartitioned = (NextPart && NextPart->IsPartitioned);
1533
1534 ASSERT(PartEntry->IsPartitioned); // The current partition must be partitioned.
1536 PartEntry,
1537 &PartEntry);
1538 if (!Success)
1539 return Success;
1540
1541 /* Retrieve the parent item (disk or MBR extended partition) */
1542 hParentItem = TreeList_GetParent(hList, *phItem);
1543
1544 /* If previous sibling isn't partitioned, remove it */
1545 if (PrevPart && !PrevIsPartitioned)
1546 {
1547 hAdjItem = TreeList_GetPrevSibling(hList, *phItem);
1548 ASSERT(hAdjItem); // TODO: Investigate
1549 if (hAdjItem)
1550 {
1551 AdjPartItem = GetItemPartition(hList, hAdjItem);
1552 ASSERT(AdjPartItem && (AdjPartItem->PartEntry == PrevPart));
1553 AdjPartItem = NULL;
1554 TreeList_DeleteItem(hList, hAdjItem);
1555 }
1556 }
1557 /* If next sibling isn't partitioned, remove it */
1558 if (NextPart && !NextIsPartitioned)
1559 {
1560 hAdjItem = TreeList_GetNextSibling(hList, *phItem);
1561 ASSERT(hAdjItem); // TODO: Investigate
1562 if (hAdjItem)
1563 {
1564 AdjPartItem = GetItemPartition(hList, hAdjItem);
1565 ASSERT(AdjPartItem && (AdjPartItem->PartEntry == NextPart));
1566 AdjPartItem = NULL;
1567 TreeList_DeleteItem(hList, hAdjItem);
1568 }
1569 }
1570
1571 /* We are going to insert the updated entry after
1572 * either, the original previous sibling (if it is
1573 * partitioned), or the second-previous sibling
1574 * (if the first one was already removed, see above) */
1575 hInsertAfter = TreeList_GetPrevSibling(hList, *phItem);
1576 if (!hInsertAfter)
1577 hInsertAfter = TVI_FIRST;
1578
1579 /* Remove the current item */
1580 TreeList_DeleteItem(hList, *phItem);
1581
1582 /* Add back the "new" unpartitioned space */
1583 *phItem = PrintPartitionData(hList, hParentItem, hInsertAfter, PartEntry);
1584
1585 /* Give the focus on and select the unpartitioned space */
1586 // TreeList_SetFocusItem(hList, 1, 1);
1587 TreeList_SelectItem(hList, *phItem);
1588
1589 return TRUE;
1590}
1591
1592
1593INT_PTR
1596 _In_ HWND hwndDlg,
1597 _In_ UINT uMsg,
1600{
1601 PSETUPDATA pSetupData;
1602 HWND hList;
1603
1604 /* Retrieve pointer to the global setup data */
1605 pSetupData = (PSETUPDATA)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
1606
1607 switch (uMsg)
1608 {
1609 case WM_INITDIALOG:
1610 {
1611 /* Save pointer to the global setup data */
1612 pSetupData = (PSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
1613 SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (LONG_PTR)pSetupData);
1614
1615 /* Initially hide and disable all partitioning buttons */
1616 ShowDlgItem(hwndDlg, IDC_INITDISK, SW_HIDE);
1617 EnableDlgItem(hwndDlg, IDC_INITDISK, FALSE);
1624
1625 /* Initialize the partitions list */
1626 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
1628 InitPartitionList(pSetupData->hInstance, hList);
1629 DrawPartitionList(hList, pSetupData->PartitionList);
1630
1631 // HACK: Wine "kwality" code doesn't still implement
1632 // PSN_QUERYINITIALFOCUS so we "emulate" its call there...
1633 {
1634 PSHNOTIFY pshn = {{hwndDlg, GetWindowLong(hwndDlg, GWL_ID), PSN_QUERYINITIALFOCUS}, (LPARAM)hList};
1635 SendMessageW(hwndDlg, WM_NOTIFY, (WPARAM)pshn.hdr.idFrom, (LPARAM)&pshn);
1636 }
1637 break;
1638 }
1639
1640 case WM_DESTROY:
1641 {
1642 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
1646 return TRUE;
1647 }
1648
1649 case WM_COMMAND:
1650 {
1651 switch (LOWORD(wParam))
1652 {
1653 case IDC_PARTMOREOPTS:
1654 {
1655 DialogBoxParamW(pSetupData->hInstance,
1657 hwndDlg,
1659 (LPARAM)pSetupData);
1660 break;
1661 }
1662
1663 case IDC_INITDISK:
1664 {
1665 // TODO: Implement disk partitioning initialization
1666 break;
1667 }
1668
1669 case IDC_PARTCREATE:
1670 {
1671 HTLITEM hItem;
1672 PPARTITEM PartItem;
1673 PPARTENTRY PartEntry;
1674 ULONGLONG PartSize;
1675 ULONGLONG MaxPartSize;
1676 ULONG MaxSizeMB;
1677 INT_PTR ret;
1678 PARTCREATE_CTX PartCreateCtx = {0};
1679
1680 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
1681 PartItem = GetSelectedPartition(hList, &hItem);
1682 if (!PartItem)
1683 {
1684 /* If the button was clicked, an empty disk
1685 * region should have been selected first */
1686 ASSERT(FALSE);
1687 break;
1688 }
1689 PartEntry = PartItem->PartEntry;
1690 if (PartEntry->IsPartitioned)
1691 {
1692 /* Don't create a partition when one already exists */
1693 ASSERT(FALSE);
1694 break;
1695 }
1696 ASSERT(!PartEntry->Volume);
1697
1698 /* Get the partition info stored in the TreeList */
1699 PartCreateCtx.PartItem = PartItem;
1700
1701 /* Retrieve the maximum size in MB (rounded up) the partition can have */
1702 MaxPartSize = GetPartEntrySizeInBytes(PartEntry);
1703 MaxSizeMB = (ULONG)RoundingDivide(MaxPartSize, MB);
1704 PartCreateCtx.MaxSizeMB = MaxSizeMB;
1705
1706 /* Don't force formatting by default */
1707 PartCreateCtx.ForceFormat = FALSE;
1708
1709 /* Show the partitioning dialog */
1710 ret = DialogBoxParamW(pSetupData->hInstance,
1712 hwndDlg,
1714 (LPARAM)&PartCreateCtx);
1715 if (ret != IDOK)
1716 break;
1717
1718 /*
1719 * If the input size, given in MB, specifies the maximum partition
1720 * size, it may slightly under- or over-estimate the latter due to
1721 * rounding error. In this case, use all of the unpartitioned space.
1722 * Otherwise, directly convert the size to bytes.
1723 */
1724 PartSize = PartCreateCtx.PartSizeMB;
1725 if (PartSize == MaxSizeMB)
1726 PartSize = MaxPartSize;
1727 else // if (PartSize < MaxSizeMB)
1728 PartSize *= MB;
1729
1730 ASSERT(PartSize <= MaxPartSize);
1731
1732 if (!DoCreatePartition(hList, pSetupData->PartitionList,
1733 &hItem, &PartItem,
1734 PartSize,
1735 !PartCreateCtx.MBRExtPart
1736 ? 0 : PARTITION_EXTENDED))
1737 {
1738 DisplayError(GetParent(hwndDlg),
1741 }
1742
1743 break;
1744 }
1745
1746 case IDC_PARTFORMAT:
1747 {
1748 HTLITEM hItem;
1749 PPARTITEM PartItem;
1750 PPARTENTRY PartEntry;
1751 INT_PTR ret;
1752 PARTCREATE_CTX PartCreateCtx = {0};
1753
1754 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
1755 PartItem = GetSelectedPartition(hList, &hItem);
1756 if (!PartItem)
1757 {
1758 /* If the button was clicked, an empty disk
1759 * region should have been selected first */
1760 ASSERT(FALSE);
1761 break;
1762 }
1763 PartEntry = PartItem->PartEntry;
1764 if (!PartEntry->Volume)
1765 {
1766 /* Don't format an unformattable partition */
1767 ASSERT(FALSE);
1768 break;
1769 }
1770
1771 /* Show the formatting dialog */
1772 PartCreateCtx.PartItem = PartItem;
1773 ret = DialogBoxParamW(pSetupData->hInstance,
1775 hwndDlg,
1777 (LPARAM)&PartCreateCtx);
1779 break;
1780 }
1781
1782 case IDC_PARTDELETE:
1783 {
1784 PPARTITEM PartItem;
1785 PPARTENTRY PartEntry;
1786 HTLITEM hItem;
1787 UINT uIDWarnMsg;
1788
1789 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
1790 PartItem = GetSelectedPartition(hList, &hItem);
1791 if (!PartItem)
1792 {
1793 // If the button was clicked, a partition
1794 // should have been selected first...
1795 ASSERT(FALSE);
1796 break;
1797 }
1798 PartEntry = PartItem->PartEntry;
1799 if (!PartEntry->IsPartitioned)
1800 {
1801 /* Don't delete an unpartitioned disk region */
1802 ASSERT(FALSE);
1803 break;
1804 }
1805
1806 /* Choose the correct warning message to display:
1807 * MBR-extended (container) vs. standard partition */
1808 if (PartEntry == PartEntry->DiskEntry->ExtendedPartition)
1810 else
1811 uIDWarnMsg = IDS_WARN_DELETE_PARTITION;
1812
1813 /* If the user really wants to delete the partition... */
1814 if (DisplayMessage(GetParent(hwndDlg),
1817 MAKEINTRESOURCEW(uIDWarnMsg)) == IDYES)
1818 {
1819 /* ... make it so! */
1820 if (!DoDeletePartition(hList, pSetupData->PartitionList,
1821 &hItem, PartItem))
1822 {
1823 // TODO: Show error if partition couldn't be deleted?
1824 }
1825 }
1826
1827 break;
1828 }
1829 }
1830 break;
1831 }
1832
1833 case WM_NOTIFY:
1834 {
1835 LPNMHDR lpnm = (LPNMHDR)lParam;
1836
1837 // On Vista+ we can use TVN_ITEMCHANGED instead, with NMTVITEMCHANGE* pointer
1838 if (lpnm->idFrom == IDC_PARTITION && lpnm->code == TVN_SELCHANGED)
1839 {
1841
1842 // if (!(pnmv->uChanged & TVIF_STATE)) /* The state has changed */
1843 if (!(pnmv->itemNew.mask & TVIF_STATE))
1844 break;
1845
1846 /* The item has been (de)selected */
1847 // if (pnmv->uNewState & TVIS_SELECTED)
1848 if (pnmv->itemNew.state & TVIS_SELECTED)
1849 {
1850 HTLITEM hParentItem = TreeList_GetParent(lpnm->hwndFrom, pnmv->itemNew.hItem);
1851 /* May or may not be a PPARTENTRY: this is a PPARTENTRY only when hParentItem != NULL */
1852
1853 if (!hParentItem)
1854 {
1855 /* Hard disk */
1856 PDISKENTRY DiskEntry = (PDISKENTRY)pnmv->itemNew.lParam;
1857 ASSERT(DiskEntry);
1858
1859 /* Show the "Initialize" disk button and hide and disable the others */
1860 ShowDlgItem(hwndDlg, IDC_INITDISK, SW_SHOW);
1861
1862#if 0 // FIXME: Init disk not implemented yet!
1863 EnableDlgItem(hwndDlg, IDC_INITDISK,
1864 DiskEntry->DiskStyle == PARTITION_STYLE_RAW);
1865#else
1866 EnableDlgItem(hwndDlg, IDC_INITDISK, FALSE);
1867#endif
1868
1871
1874
1877
1878 /* Disable the "Next" button */
1879 goto DisableWizNext;
1880 }
1881 else
1882 {
1883 /* Partition or unpartitioned space */
1884 PPARTITEM PartItem = (PPARTITEM)pnmv->itemNew.lParam;
1885 PPARTENTRY PartEntry;
1886 ASSERT(PartItem);
1887 PartEntry = PartItem->PartEntry;
1888 ASSERT(PartEntry);
1889
1890 /* Hide and disable the "Initialize" disk button */
1891 ShowDlgItem(hwndDlg, IDC_INITDISK, SW_HIDE);
1892 EnableDlgItem(hwndDlg, IDC_INITDISK, FALSE);
1893
1894 if (!PartEntry->IsPartitioned)
1895 {
1896 /* Show and enable the "Create" partition button */
1899
1900 /* Hide and disable the "Format" button */
1903 }
1904 else
1905 {
1906 /* Hide and disable the "Create" partition button */
1909
1910 /* Show the "Format" button, but enable or disable it if a formattable volume is present */
1912 EnableDlgItem(hwndDlg, IDC_PARTFORMAT, !!PartEntry->Volume);
1913 }
1914
1915 /* Show the "Delete" partition button, but enable or disable it if the disk region is partitioned */
1917 EnableDlgItem(hwndDlg, IDC_PARTDELETE, PartEntry->IsPartitioned);
1918
1919 /*
1920 * Enable the "Next" button if:
1921 *
1922 * 1. the selected disk region is partitioned:
1923 * it can either have a volume attached (and be either
1924 * formatted or ready to be formatted),
1925 * or it's not yet formatted (the installer will prompt
1926 * for formatting parameters).
1927 *
1928 * 2. Or, the selected disk region is not partitioned but
1929 * can be partitioned according to the disk's partitioning
1930 * scheme (the installer will auto-partition the region
1931 * and prompt for formatting parameters).
1932 *
1933 * In all other cases, the "Next" button is disabled.
1934 */
1935
1936 // TODO: In the future: first test needs to be augmented with:
1937 // (... && PartEntry->Volume->IsSimpleVolume)
1938 if ((PartEntry->IsPartitioned && PartEntry->Volume) ||
1939 (!PartEntry->IsPartitioned && (PartitionCreateChecks(PartEntry, 0ULL, 0) == NOT_AN_ERROR)))
1940 {
1941 // ASSERT(PartEntry != PartEntry->DiskEntry->ExtendedPartition);
1942 ASSERT(!IsContainerPartition(PartEntry->PartitionType));
1944 }
1945 else
1946 {
1947 goto DisableWizNext;
1948 }
1949 }
1950 }
1951 else
1952 {
1953DisableWizNext:
1954 /* Keep the "Next" button disabled. It will be enabled
1955 * only when the user selects a valid partition. */
1957 }
1958
1959 break;
1960 }
1961
1962 if (lpnm->idFrom == IDC_PARTITION && lpnm->code == TVN_DELETEITEM)
1963 {
1964 /* Deleting an item from the partition list */
1966 DeleteTreeItem(lpnm->hwndFrom, (TLITEMW*)&pnmv->itemOld);
1967 break;
1968 }
1969
1970 switch (lpnm->code)
1971 {
1972 case PSN_SETACTIVE:
1973 {
1974 /* Keep the "Next" button disabled. It will be enabled
1975 * only when the user selects a valid partition. */
1977 break;
1978 }
1979
1981 {
1982 /* Give the focus on and select the first item */
1983 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
1984 // TreeList_SetFocusItem(hList, 1, 1);
1987 return TRUE;
1988 }
1989
1990 case PSN_QUERYCANCEL:
1991 {
1992 if (DisplayMessage(GetParent(hwndDlg),
1996 {
1997 /* Go to the Abort page */
1999 }
2000
2001 /* Do not close the wizard too soon */
2003 return TRUE;
2004 }
2005
2006 case PSN_WIZNEXT: /* Set the selected data */
2007 {
2008 HTLITEM hItem;
2009 PPARTITEM PartItem;
2010 PPARTENTRY PartEntry;
2011
2012 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
2013 PartItem = GetSelectedPartition(hList, &hItem);
2014 if (!PartItem)
2015 {
2016 /* Fail and don't continue the installation */
2017 SetWindowLongPtrW(hwndDlg, DWLP_MSGRESULT, -1);
2018 return TRUE;
2019 }
2020 PartEntry = PartItem->PartEntry;
2021 ASSERT(PartEntry);
2022
2023 /*
2024 * Check whether the user wants to install ReactOS on a disk that
2025 * is not recognized by the computer's firmware and if so, display
2026 * a warning since such disks may not be bootable.
2027 */
2028 if (PartEntry->DiskEntry->MediaType == FixedMedia &&
2029 !PartEntry->DiskEntry->BiosFound)
2030 {
2031 INT nRet;
2032
2033 nRet = DisplayMessage(hwndDlg,
2035 L"Warning",
2036 L"The disk you have selected for installing ReactOS\n"
2037 L"is not visible by the firmware of your computer,\n"
2038 L"and so may not be bootable.\n"
2039 L"\nClick on OK to continue anyway."
2040 L"\nClick on CANCEL to go back to the partitions list.");
2041 if (nRet != IDOK)
2042 {
2043 /* Fail and don't continue the installation */
2044 SetWindowLongPtrW(hwndDlg, DWLP_MSGRESULT, -1);
2045 return TRUE;
2046 }
2047 }
2048
2049 /* If this is an empty region, auto-create the partition if conditions are OK */
2050 if (!PartEntry->IsPartitioned)
2051 {
2052 ULONG Error;
2053
2054 Error = PartitionCreateChecks(PartEntry, 0ULL, 0);
2055 if (Error != NOT_AN_ERROR)
2056 {
2057 // MUIDisplayError(Error, Ir, POPUP_WAIT_ANY_KEY);
2059 L"Could not create a partition on the selected disk region");
2060
2061 /* Fail and don't continue the installation */
2062 SetWindowLongPtrW(hwndDlg, DWLP_MSGRESULT, -1);
2063 return TRUE;
2064 }
2065
2066 /* Automatically create the partition on the whole empty space;
2067 * it will be formatted later with default parameters */
2068 if (!DoCreatePartition(hList, pSetupData->PartitionList,
2069 &hItem, &PartItem,
2070 0ULL,
2071 0))
2072 {
2073 DisplayError(GetParent(hwndDlg),
2076
2077 /* Fail and don't continue the installation */
2078 SetWindowLongPtrW(hwndDlg, DWLP_MSGRESULT, -1);
2079 return TRUE;
2080 }
2081 /* Update PartEntry */
2082 PartEntry = PartItem->PartEntry;
2083 }
2084
2085 ASSERT(PartEntry->IsPartitioned);
2086 // ASSERT(PartEntry != PartEntry->DiskEntry->ExtendedPartition);
2088 ASSERT(PartEntry->Volume);
2089
2090#if 0 // TODO: Implement!
2091 if (!IsPartitionLargeEnough(PartEntry))
2092 {
2095
2096 /* Fail and don't continue the installation */
2097 SetWindowLongPtrW(hwndDlg, DWLP_MSGRESULT, -1);
2098 return TRUE;
2099 }
2100#endif
2101
2102 /* Force formatting only if the partition doesn't have a volume (may or may not be formatted) */
2103 if (PartEntry->Volume &&
2104 ((PartEntry->Volume->FormatState == Formatted) ||
2105 (PartItem->VolCreate && *PartItem->VolCreate->FileSystemName)))
2106 {
2107 /*NOTHING*/;
2108 }
2109 else /* Request formatting of the selected region if it's not already formatted */
2110 {
2111 INT_PTR ret;
2112 PARTCREATE_CTX PartCreateCtx = {0};
2113
2114 /* Show the formatting dialog */
2115 PartCreateCtx.PartItem = PartItem;
2116 ret = DialogBoxParamW(pSetupData->hInstance,
2118 hwndDlg,
2120 (LPARAM)&PartCreateCtx);
2121
2122 /* If the user refuses to format the partition,
2123 * fail and don't continue the installation */
2124 if (ret != IDOK)
2125 {
2126 SetWindowLongPtrW(hwndDlg, DWLP_MSGRESULT, -1);
2127 return TRUE;
2128 }
2129
2130 /* The partition will be formatted */
2131 }
2132
2133 InstallPartition = PartEntry;
2134 break;
2135 }
2136
2137 default:
2138 break;
2139 }
2140 break;
2141 }
2142
2143 default:
2144 break;
2145 }
2146
2147 return FALSE;
2148}
2149
2150/* 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:243
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
static const WCHAR Description[]
Definition: oid.c:1266
#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:159
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
Definition: wcs.c:2983
_ACRTIMP wchar_t *__cdecl _wcsdup(const wchar_t *) __WINE_DEALLOC(free) __WINE_MALLOC
Definition: wcs.c:81
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1592
LPWSTR WINAPI StrFormatByteSizeW(LONGLONG llBytes, LPWSTR lpszDest, UINT cchMax)
Definition: string.c:2524
static VOID ShowErrorTip(_In_ HWND hEdit)
Definition: drivepage.c:116
static VOID InitPartitionList(_In_ HINSTANCE hInstance, _In_ HWND hWndList)
Definition: drivepage.c:1305
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:1492
LPARAM TreeListGetItemData(_In_ HWND hTreeList, _In_ HTLITEM hItem)
Definition: drivepage.c:782
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:1595
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:1392
#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:1342
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:1369
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:1155
static VOID DeleteTreeItem(_In_ HWND hWndList, _In_ TLITEMW *ptlItem)
Called on response to the TVN_DELETEITEM notification sent by the TreeList.
Definition: drivepage.c:1133
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
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
unsigned int UINT
Definition: ndis.h:50
#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
#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 LPPROPSHEETPAGE
Definition: prsht.h:390
#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:779
@ 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
NMHDR hdr
Definition: prsht.h:330
USETUP_DATA USetupData
Definition: reactos.h:134
HINSTANCE hInstance
Definition: reactos.h:121
PPARTLIST PartitionList
Definition: reactos.h:138
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:165
ULONG ClusterSize
Definition: reactos.h:177
BOOLEAN QuickFormat
Definition: reactos.h:176
PVOLENTRY Volume
Definition: reactos.h:166
WCHAR FileSystemName[MAX_PATH+1]
Definition: reactos.h:173
FMIFS_MEDIA_FLAG MediaFlag
Definition: reactos.h:174
PCWSTR Label
Definition: reactos.h:175
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 SetWindowLongPtr
Definition: treelist.c:70
#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 GWL_ID
Definition: winuser.h:870
#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 GetWindowLong
Definition: winuser.h:5962
#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)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#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