ReactOS 0.4.16-dev-13-ge2fc578
drivepage.c
Go to the documentation of this file.
1/*
2 * ReactOS applications
3 * Copyright (C) 2004-2008 ReactOS Team
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19/*
20 * COPYRIGHT: See COPYING in the top level directory
21 * PROJECT: ReactOS GUI first stage setup application
22 * FILE: base/setup/reactos/drivepage.c
23 * PROGRAMMERS: Matthias Kupfer
24 * Dmitry Chapyshev (dmitry@reactos.org)
25 */
26
27#include "reactos.h"
28#include <shlwapi.h>
29
30#include <math.h> // For pow()
31
32// #include <ntdddisk.h>
33#include <ntddstor.h>
34#include <ntddscsi.h>
35
36#include "resource.h"
37
38#define NDEBUG
39#include <debug.h>
40
41/* GLOBALS ******************************************************************/
42
43#define IDS_LIST_COLUMN_FIRST IDS_PARTITION_NAME
44#define IDS_LIST_COLUMN_LAST IDS_PARTITION_STATUS
45
46#define MAX_LIST_COLUMNS (IDS_LIST_COLUMN_LAST - IDS_LIST_COLUMN_FIRST + 1)
48static const INT column_widths[MAX_LIST_COLUMNS] = {200, 90, 60, 60};
50
51/* FUNCTIONS ****************************************************************/
52
58static BOOL
60 _Inout_ PWSTR pszSanitized)
61{
62 PWCHAR pch1, pch2;
63 BOOL bSanitized = FALSE;
64
65 for (pch1 = pch2 = pszSanitized; *pch1; ++pch1)
66 {
67 /* Skip any invalid character found */
69 {
70 bSanitized = TRUE;
71 continue;
72 }
73
74 /* Copy over the valid ones */
75 *pch2 = *pch1;
76 ++pch2;
77 }
78 *pch2 = 0;
79
80 return bSanitized;
81}
82
87static BOOL
90{
91 HGLOBAL hData;
92 LPWSTR pszText, pszSanitized;
93 BOOL bSanitized;
94
95 /* Protect read-only edit control from modification */
97 return FALSE;
98
99 if (!OpenClipboard(hWnd))
100 return FALSE;
101
103 pszText = GlobalLock(hData);
104 if (!pszText)
105 {
107 return FALSE;
108 }
109
110 pszSanitized = _wcsdup(pszText);
111 GlobalUnlock(hData);
112 bSanitized = (pszSanitized && DoSanitizeText(pszSanitized));
113 if (bSanitized)
114 {
115 /* Update clipboard text */
116 SIZE_T cbData = (wcslen(pszSanitized) + 1) * sizeof(WCHAR);
117 hData = GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, cbData);
118 pszText = GlobalLock(hData);
119 if (pszText)
120 {
121 CopyMemory(pszText, pszSanitized, cbData);
122 GlobalUnlock(hData);
124 }
125 }
126 free(pszSanitized);
127
129 return bSanitized;
130}
131
132static VOID
135{
136 EDITBALLOONTIP balloon;
137 WCHAR szTitle[512];
138 WCHAR szText[512];
139
140 /* Load the resources */
143
144 /* Show a warning balloon */
145 balloon.cbStruct = sizeof(balloon);
146 balloon.pszTitle = szTitle;
147 balloon.pszText = szText;
148#if (_WIN32_WINNT < _WIN32_WINNT_VISTA)
149 balloon.ttiIcon = TTI_ERROR;
150#else
151 balloon.ttiIcon = TTI_ERROR_LARGE;
152#endif
153
155 Edit_ShowBalloonTip(hEdit, &balloon);
156
157 // NOTE: There is no need to hide it when other keys are pressed;
158 // the EDIT control will deal with that itself.
159}
160
166static LRESULT
169 _In_ HWND hWnd,
170 _In_ UINT uMsg,
173{
175
176 switch (uMsg)
177 {
178 case WM_UNICHAR:
179 if (wParam == UNICODE_NOCHAR)
180 return TRUE;
182
183 case WM_IME_CHAR:
184 case WM_CHAR:
185 {
186 WCHAR wch = (WCHAR)wParam;
187
188 /* Let the EDIT control deal with Control characters.
189 * It won't emit them as raw data in the text. */
190 if (wParam < ' ')
191 break;
192
193 /* Ignore Ctrl-Backspace */
194 if (wParam == '\x7F')
195 return 0;
196
197 /* Protect read-only edit control from modification */
199 break;
200
201 if (uMsg == WM_IME_CHAR)
202 {
203 if (!IsWindowUnicode(hWnd) && HIBYTE(wch) != 0)
204 {
205 CHAR data[] = {HIBYTE(wch), LOBYTE(wch)};
206 MultiByteToWideChar(CP_ACP, 0, data, 2, &wch, 1);
207 }
208 }
209
210 /* Show an error and ignore input character if it's invalid */
212 {
214 return 0;
215 }
216 break;
217 }
218
219 case WM_PASTE:
220 /* Verify the text being pasted; if it was sanitized, show an error */
223 break;
224 }
225
226 return CallWindowProcW(orgEditProc, hWnd, uMsg, wParam, lParam);
227}
228
229static INT_PTR
232 _In_ HWND hDlg,
233 _In_ UINT uMsg,
236{
237 PSETUPDATA pSetupData;
238
239 /* Retrieve pointer to the global setup data */
240 pSetupData = (PSETUPDATA)GetWindowLongPtrW(hDlg, GWLP_USERDATA);
241
242 switch (uMsg)
243 {
244 case WM_INITDIALOG:
245 {
246 HWND hEdit;
247 WNDPROC orgEditProc;
248 BOOL bIsBIOS;
249 UINT uID;
250 INT iItem, iCurrent = CB_ERR, iDefault = 0;
251 WCHAR szText[50];
252
253 /* Save pointer to the global setup data */
254 pSetupData = (PSETUPDATA)lParam;
255 SetWindowLongPtrW(hDlg, GWLP_USERDATA, (LONG_PTR)pSetupData);
256
257 /* Subclass the install-dir edit control */
258 hEdit = GetDlgItem(hDlg, IDC_PATH);
262
263 /* Set the current installation directory */
264 SetWindowTextW(hEdit, pSetupData->USetupData.InstallationDirectory);
265
266
267 /* Initialize the list of available bootloader locations */
268 bIsBIOS = ((pSetupData->USetupData.ArchType == ARCH_PcAT) ||
269 (pSetupData->USetupData.ArchType == ARCH_NEC98x86));
270 for (uID = IDS_BOOTLOADER_NOINST; uID <= IDS_BOOTLOADER_VBRONLY; ++uID)
271 {
272 if ( ( bIsBIOS && (uID == IDS_BOOTLOADER_SYSTEM)) ||
273 (!bIsBIOS && (uID == IDS_BOOTLOADER_MBRVBR || uID == IDS_BOOTLOADER_VBRONLY)) )
274 {
275 continue; // Skip this choice.
276 }
277
278 LoadStringW(pSetupData->hInstance, uID, szText, ARRAYSIZE(szText));
279 iItem = SendDlgItemMessageW(hDlg, IDC_INSTFREELDR, CB_ADDSTRING, 0, (LPARAM)szText);
280 if (iItem != CB_ERR && iItem != CB_ERRSPACE)
281 {
282 UINT uBldrLoc = uID - IDS_BOOTLOADER_NOINST
283 - (bIsBIOS && (uID >= IDS_BOOTLOADER_SYSTEM) ? 1 : 0);
284 SendDlgItemMessageW(hDlg, IDC_INSTFREELDR, CB_SETITEMDATA, iItem, uBldrLoc);
285
286 /* Find the index of the current and default locations */
287 if (uBldrLoc == pSetupData->USetupData.BootLoaderLocation)
288 iCurrent = iItem;
290 iDefault = iItem;
291 }
292 }
293 /* Select the current location or fall back to the default one */
294 if (iCurrent == CB_ERR)
295 iCurrent = iDefault;
297
298 break;
299 }
300
301 case WM_DESTROY:
302 {
303 /* Unsubclass the edit control */
304 HWND hEdit = GetDlgItem(hDlg, IDC_PATH);
306 if (orgEditProc) SetWindowLongPtrW(hEdit, GWLP_WNDPROC, (LONG_PTR)orgEditProc);
307 break;
308 }
309
310 case WM_COMMAND:
311 switch (LOWORD(wParam))
312 {
313 case IDOK:
314 {
315 HWND hEdit;
316 BOOL bIsValid;
317 WCHAR InstallDir[MAX_PATH];
318 INT iItem;
319 UINT uBldrLoc = CB_ERR;
320
321 /*
322 * Retrieve the installation path and verify its validity.
323 * Check for the validity of the installation directory and
324 * pop up an error if this is not the case.
325 */
326 hEdit = GetDlgItem(hDlg, IDC_PATH);
327 bIsValid = (GetWindowTextLengthW(hEdit) < _countof(InstallDir)); // && IsValidInstallDirectory(InstallDir);
328 GetWindowTextW(hEdit, InstallDir, _countof(InstallDir));
329 bIsValid = bIsValid && IsValidInstallDirectory(InstallDir);
330
331 if (!bIsValid)
332 {
333 // ERROR_DIRECTORY_NAME
334 DisplayError(hDlg,
337 break; // Go back to the dialog.
338 }
339
342 InstallDir);
343
344 /* Retrieve the bootloader location */
346 if (iItem != CB_ERR)
347 uBldrLoc = SendDlgItemMessageW(hDlg, IDC_INSTFREELDR, CB_GETITEMDATA, iItem, 0);
348 if (uBldrLoc == CB_ERR) // Default location: System partition / MBR & VBR
350 uBldrLoc = min(max(uBldrLoc, 0), 3);
351 pSetupData->USetupData.BootLoaderLocation = uBldrLoc;
352
353 EndDialog(hDlg, IDOK);
354 return TRUE;
355 }
356
357 case IDCANCEL:
358 EndDialog(hDlg, IDCANCEL);
359 return TRUE;
360 }
361 break;
362 }
363
364 return FALSE;
365}
366
367
373typedef struct _PARTITEM
374{
375 PPARTENTRY PartEntry; //< Disk region this structure is associated to.
376 PVOLENTRY Volume; //< Associated file system volume if any, or NULL.
377 PVOL_CREATE_INFO VolCreate; //< Volume create information (allocated).
379
384typedef struct _PARTCREATE_CTX
385{
386 PPARTITEM PartItem; //< Partition item info stored in the TreeList.
387 ULONG MaxSizeMB; //< Maximum possible partition size in MB.
388 ULONG PartSizeMB; //< Selected partition size in MB.
389 BOOLEAN MBRExtPart; //< Whether to create an MBR extended partition.
390 BOOLEAN ForceFormat; //< Whether to force formatting ('Do not format' option hidden).
392
393static INT_PTR
396 _In_ PPARTCREATE_CTX PartCreateCtx,
397 _In_ HWND hDlg,
398 _In_ UINT uMsg,
401{
402 switch (uMsg)
403 {
404 case WM_INITDIALOG:
405 {
406 ULONG Index = 0;
407 INT iItem;
409 PCWSTR DefaultFs;
411 PVOL_CREATE_INFO VolCreate;
412
413 /* List the well-known file systems. We use the same strings
414 * for the displayed FS names and their actual ones. */
416 {
418 if (iItem != CB_ERR && iItem != CB_ERRSPACE)
420 }
421
422 /* Add the 'Do not format' entry if needed */
423 if (!PartCreateCtx->ForceFormat)
424 {
425 WCHAR szText[50];
426
428 iItem = SendDlgItemMessageW(hDlg, IDC_FSTYPE, CB_INSERTSTRING, 0, (LPARAM)szText);
429 if (iItem != CB_ERR && iItem != CB_ERRSPACE)
431 }
432
433 // FIXME: Read from SetupData.FsType; select the "FAT" FS instead.
434 DefaultFs = L"FAT";
435
436 /* Retrieve the selected volume and create information */
437 ASSERT(PartCreateCtx->PartItem->Volume == PartCreateCtx->PartItem->PartEntry->Volume);
438 Volume = PartCreateCtx->PartItem->PartEntry->Volume;
439 VolCreate = PartCreateCtx->PartItem->VolCreate;
440
441 /* Select the existing file system in the list if any,
442 * otherwise use the "DefaultFs" */
443 if (VolCreate && *VolCreate->FileSystemName)
444 FileSystem = VolCreate->FileSystemName;
445 else if (Volume && *Volume->Info.FileSystem)
446 FileSystem = Volume->Info.FileSystem;
447 else
448 FileSystem = DefaultFs;
449
451 if (iItem == CB_ERR)
452 iItem = 0;
454
455 /* Check the quick-format option by default as it speeds up formatting */
456 if (!VolCreate || VolCreate->QuickFormat)
458 else
460
461 break;
462 }
463
464 case WM_COMMAND:
465 {
466 //
467 // NOTE:
468 // - CBN_SELCHANGE sent everytime a combobox list item is selected,
469 // *even if* the list is opened.
470 // - CBN_SELENDOK sent only when user finished to select an item
471 // by clicking on it (if the list is opened), or selection changed
472 // (when the list is closed but selection is done with arrow keys).
473 //
474 if ((HIWORD(wParam) == CBN_SELCHANGE /*|| HIWORD(wParam) == CBN_SELENDOK*/) &&
476 {
477 // HWND hWndList = GetDlgItem(hDlg, IDC_FSTYPE);
479 INT iItem;
480
481 /* Retrieve the selected file system. Use the
482 * item data instead of the displayed string. */
483 iItem = SendDlgItemMessageW(hDlg, IDC_FSTYPE, CB_GETCURSEL, 0, 0);
484 if (iItem == CB_ERR)
485 iItem = 0; // Default entry
487 if (FileSystem == (PCWSTR)CB_ERR)
488 FileSystem = NULL; // Default data
489
490 /* Enable or disable formatting options,
491 * depending on whether we need to format */
493 break;
494 }
495
496 if (HIWORD(wParam) != BN_CLICKED)
497 break;
498
499 switch (LOWORD(wParam))
500 {
501 case IDOK:
502 {
503 PPARTITEM PartItem = PartCreateCtx->PartItem;
504 PVOL_CREATE_INFO VolCreate;
506 INT iItem;
507
508 /*
509 * Retrieve the formatting options
510 */
511
512 /* Retrieve the selected file system. Use the
513 * item data instead of the displayed string. */
514 iItem = SendDlgItemMessageW(hDlg, IDC_FSTYPE, CB_GETCURSEL, 0, 0);
515 if (iItem == CB_ERR)
516 iItem = 0; // Default entry
518 if (FileSystem == (PCWSTR)CB_ERR)
519 FileSystem = NULL; // Default data
520
521 VolCreate = PartItem->VolCreate;
522
523 /* Check if we need to format */
524 if (!FileSystem || !*FileSystem)
525 {
526 /* We don't format. If there is an existing
527 * volume-create structure, free it. */
528 if (VolCreate)
529 LocalFree(VolCreate);
530 PartItem->VolCreate = NULL;
531
532 /* And return */
533 return TRUE;
534 }
535
536 /* We will format: allocate and initialize
537 * a volume-create structure if needed */
538 if (!VolCreate)
539 VolCreate = LocalAlloc(LPTR, sizeof(*VolCreate));
540 if (!VolCreate)
541 {
542 DPRINT1("Failed to allocate volume-create structure\n");
543 return TRUE;
544 }
545
546 /* Cached input information that will be set to
547 * the FORMAT_VOLUME_INFO structure given to the
548 * 'FSVOLNOTIFY_STARTFORMAT' step */
549 // TODO: Think about which values could be defaulted...
551 _countof(VolCreate->FileSystemName),
552 FileSystem);
553 VolCreate->MediaFlag = FMIFS_HARDDISK;
554 VolCreate->Label = NULL;
555 VolCreate->QuickFormat =
557 VolCreate->ClusterSize = 0;
558
559 /* Set the volume associated to the new create information */
560 VolCreate->Volume = PartItem->Volume;
561
562 /* Associate the new, or update the volume create information */
563 PartItem->VolCreate = VolCreate;
564 return TRUE;
565 }
566 }
567 }
568 }
569 return FALSE;
570}
571
572static INT_PTR
575 _In_ HWND hDlg,
576 _In_ UINT uMsg,
579{
580 PPARTCREATE_CTX PartCreateCtx;
581
582 /* Retrieve dialog context pointer */
583 PartCreateCtx = (PPARTCREATE_CTX)GetWindowLongPtrW(hDlg, GWLP_USERDATA);
584
585 switch (uMsg)
586 {
587 case WM_INITDIALOG:
588 {
589 /* Save dialog context pointer */
590 PartCreateCtx = (PPARTCREATE_CTX)lParam;
591 SetWindowLongPtrW(hDlg, GWLP_USERDATA, (LONG_PTR)PartCreateCtx);
592
593 /* We actually want to format, so set the flag */
594 PartCreateCtx->ForceFormat = TRUE;
595 break;
596 }
597
598 case WM_COMMAND:
599 {
600 if (HIWORD(wParam) != BN_CLICKED)
601 break;
602
603 switch (LOWORD(wParam))
604 {
605 case IDOK:
606 {
607 /* Retrieve the formatting options */
608 FormatDlgProcWorker(PartCreateCtx, hDlg, uMsg, wParam, lParam);
609 EndDialog(hDlg, IDOK);
610 return TRUE;
611 }
612
613 case IDCANCEL:
614 {
615 EndDialog(hDlg, IDCANCEL);
616 return TRUE;
617 }
618 }
619 }
620 }
621
622 return FormatDlgProcWorker(PartCreateCtx, hDlg, uMsg, wParam, lParam);
623}
624
625static INT_PTR
628 _In_ HWND hDlg,
629 _In_ UINT uMsg,
632{
633 PPARTCREATE_CTX PartCreateCtx;
634
635 /* Retrieve dialog context pointer */
636 PartCreateCtx = (PPARTCREATE_CTX)GetWindowLongPtrW(hDlg, GWLP_USERDATA);
637
638 switch (uMsg)
639 {
640 case WM_INITDIALOG:
641 {
642 PPARTENTRY PartEntry;
643 PDISKENTRY DiskEntry;
644 ULONG MaxSizeMB;
645
646 /* Save dialog context pointer */
647 PartCreateCtx = (PPARTCREATE_CTX)lParam;
648 SetWindowLongPtrW(hDlg, GWLP_USERDATA, (LONG_PTR)PartCreateCtx);
649
650 /* Retrieve the selected partition */
651 PartEntry = PartCreateCtx->PartItem->PartEntry;
652 DiskEntry = PartEntry->DiskEntry;
653
654 /* Set the spinner to the maximum size in MB the partition can have */
655 MaxSizeMB = PartCreateCtx->MaxSizeMB;
658
659 /* Default to regular partition (non-extended on MBR disks) */
661
662 /* Also, disable and hide IDC_CHECK_MBREXTPART
663 * if space is logical or the disk is not MBR */
664 if ((DiskEntry->DiskStyle == PARTITION_STYLE_MBR) &&
665 !PartEntry->LogicalPartition)
666 {
669 }
670 else
671 {
674 }
675
676 break;
677 }
678
679 case WM_COMMAND:
680 {
681 if (HIWORD(wParam) != BN_CLICKED)
682 break;
683
684 switch (LOWORD(wParam))
685 {
687 {
688 /* Check for MBR-extended (container) partition */
689 // BST_UNCHECKED or BST_INDETERMINATE => FALSE
691 {
692 /* It is, disable formatting options */
696 }
697 else
698 {
699 /* It is not, re-enable formatting options */
703 }
704 break;
705 }
706
707 case IDOK:
708 {
709 /* Collect all the information and return it
710 * to the caller for creating the partition */
712 PartCreateCtx->PartSizeMB = min(max(PartCreateCtx->PartSizeMB, 1), PartCreateCtx->MaxSizeMB);
714
715 /* Retrieve the formatting options */
716 FormatDlgProcWorker(PartCreateCtx, hDlg, uMsg, wParam, lParam);
717
718 EndDialog(hDlg, IDOK);
719 return TRUE;
720 }
721
722 case IDCANCEL:
723 {
724 EndDialog(hDlg, IDCANCEL);
725 return TRUE;
726 }
727 }
728 }
729 }
730
731 return FormatDlgProcWorker(PartCreateCtx, hDlg, uMsg, wParam, lParam);
732}
733
734
735BOOL
738 IN HWND hWndTreeList,
739 IN const UINT* pIDs,
740 IN const INT* pColsWidth,
741 IN const INT* pColsAlign,
742 IN UINT nNumOfColumns)
743{
744 UINT i;
745 TLCOLUMN tlC;
746 WCHAR szText[50];
747
748 /* Create the columns */
749 tlC.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
750 tlC.pszText = szText;
751
752 /* Load the column labels from the resource file */
753 for (i = 0; i < nNumOfColumns; i++)
754 {
755 tlC.iSubItem = i;
756 tlC.cx = pColsWidth[i];
757 tlC.fmt = pColsAlign[i];
758
759 LoadStringW(hInstance, pIDs[i], szText, ARRAYSIZE(szText));
760
761 if (TreeList_InsertColumn(hWndTreeList, i, &tlC) == -1)
762 return FALSE;
763 }
764
765 return TRUE;
766}
767
768
771 _In_ HWND hTreeList,
772 _In_opt_ HTLITEM hParent,
773 _In_opt_ HTLITEM hInsertAfter,
774 _In_ LPCWSTR lpText,
775 _In_ INT iImage,
776 _In_ INT iSelectedImage,
778{
779 TLINSERTSTRUCTW Insert;
780
781 ZeroMemory(&Insert, sizeof(Insert));
782
783 Insert.item.mask = TVIF_TEXT | TVIF_PARAM | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
784 Insert.hParent = hParent;
785 Insert.hInsertAfter = (hInsertAfter ? hInsertAfter : TVI_LAST);
786 Insert.item.pszText = (LPWSTR)lpText;
787 Insert.item.iImage = iImage;
788 Insert.item.iSelectedImage = iSelectedImage;
789 Insert.item.lParam = lParam;
790
791 // Insert.item.mask |= TVIF_STATE;
792 // Insert.item.stateMask = TVIS_OVERLAYMASK;
793 // Insert.item.state = INDEXTOOVERLAYMASK(1);
794
795 return TreeList_InsertItem(hTreeList, &Insert);
796}
797
798LPARAM
800 _In_ HWND hTreeList,
802{
803 TLITEMW tlItem;
804
805 tlItem.mask = TVIF_PARAM;
806 tlItem.hItem = hItem;
807
808 TreeList_GetItem(hTreeList, &tlItem);
809
810 return tlItem.lParam;
811}
812
813static
816 _In_ HWND hTreeList,
818{
819 HTLITEM hParentItem;
820 PPARTITEM PartItem;
821
822 hParentItem = TreeList_GetParent(hTreeList, hItem);
823 /* May or may not be a PPARTITEM: this is a PPARTITEM only when hParentItem != NULL */
824 PartItem = (PPARTITEM)TreeListGetItemData(hTreeList, hItem);
825 if (!hParentItem || !PartItem)
826 return NULL;
827
828 return PartItem;
829}
830
831static
834 _In_ HWND hTreeList,
835 _Out_opt_ HTLITEM* phItem)
836{
838 PPARTITEM PartItem;
839
840 hItem = TreeList_GetSelection(hTreeList);
841 if (!hItem)
842 return NULL;
843
844 PartItem = GetItemPartition(hTreeList, hItem);
845 if (PartItem && phItem)
846 *phItem = hItem;
847
848 return PartItem;
849}
850
853 _In_ HWND hTreeList,
855{
857
858 /* Enumerate every cached data in the TreeList, and for each, check
859 * whether its corresponding PPARTENTRY is the one we are looking for */
860 // for (hItem = TVI_ROOT; hItem; hItem = TreeList_GetNextItem(...)) { }
861 hItem = TVI_ROOT;
862 while ((hItem = TreeList_GetNextItem(hTreeList, hItem, TVGN_NEXTITEM)))
863 {
864 PPARTITEM PartItem = GetItemPartition(hTreeList, hItem);
865 if (!PartItem || !PartItem->VolCreate /* || !PartItem->Volume */)
866 continue;
867
868 if (PartItem->Volume == Volume)
869 {
870 /* Found it, return the associated volume-create structure */
871 return PartItem->VolCreate;
872 }
873 }
874
875 /* Nothing was found */
876 return NULL;
877}
878
879
880VOID
882 IN PPARTENTRY PartEntry,
883 OUT PSTR strBuffer,
885{
886 if (PartEntry->PartitionType == PARTITION_ENTRY_UNUSED)
887 {
888 StringCchCopyA(strBuffer, cchBuffer,
889 "Unused" /* MUIGetString(STRING_FORMATUNUSED) */);
890 }
891 // else if (PartEntry == PartEntry->DiskEntry->ExtendedPartition)
892 else if (IsContainerPartition(PartEntry->PartitionType))
893 {
894 StringCchCopyA(strBuffer, cchBuffer,
895 "Extended Partition" /* MUIGetString(STRING_EXTENDED_PARTITION) */);
896 }
897 else
898 {
899 UINT i;
900
901 /* Do the table lookup */
902 if (PartEntry->DiskEntry->DiskStyle == PARTITION_STYLE_MBR)
903 {
904 for (i = 0; i < ARRAYSIZE(MbrPartitionTypes); ++i)
905 {
906 if (PartEntry->PartitionType == MbrPartitionTypes[i].Type)
907 {
908 StringCchCopyA(strBuffer, cchBuffer,
910 return;
911 }
912 }
913 }
914#if 0 // TODO: GPT support!
915 else if (PartEntry->DiskEntry->DiskStyle == PARTITION_STYLE_GPT)
916 {
917 for (i = 0; i < ARRAYSIZE(GptPartitionTypes); ++i)
918 {
919 if (IsEqualPartitionType(PartEntry->PartitionType,
921 {
922 StringCchCopyA(strBuffer, cchBuffer,
924 return;
925 }
926 }
927 }
928#endif
929
930 /* We are here because the partition type is unknown */
931 if (cchBuffer > 0) *strBuffer = '\0';
932 }
933
934 if ((cchBuffer > 0) && (*strBuffer == '\0'))
935 {
936 StringCchPrintfA(strBuffer, cchBuffer,
937 // MUIGetString(STRING_PARTTYPE),
938 "Type 0x%02x",
939 PartEntry->PartitionType);
940 }
941}
942
943
944static VOID
948{
949 ULONGLONG DiskSize = *Size;
950
951 if (DiskSize >= 10 * GB) /* 10 GB */
952 {
953 DiskSize = RoundingDivide(DiskSize, GB);
954 *Unit = L"GB"; // MUIGetString(STRING_GB);
955 }
956 else
957 {
958 DiskSize = RoundingDivide(DiskSize, MB);
959 if (DiskSize == 0)
960 DiskSize = 1;
961 *Unit = L"MB"; // MUIGetString(STRING_MB);
962 }
963
964 *Size = DiskSize;
965}
966
967static VOID
971{
972 ULONGLONG PartSize = *Size;
973
974#if 0
975 if (PartSize >= 10 * GB) /* 10 GB */
976 {
977 PartSize = RoundingDivide(PartSize, GB);
978 *Unit = L"GB"; // MUIGetString(STRING_GB);
979 }
980 else
981#endif
982 if (PartSize >= 10 * MB) /* 10 MB */
983 {
984 PartSize = RoundingDivide(PartSize, MB);
985 *Unit = L"MB"; // MUIGetString(STRING_MB);
986 }
987 else
988 {
989 PartSize = RoundingDivide(PartSize, KB);
990 *Unit = L"KB"; // MUIGetString(STRING_KB);
991 }
992
993 *Size = PartSize;
994}
995
996static
1000 _In_ HTLITEM htiParent,
1001 _In_opt_ HTLITEM hInsertAfter,
1002 _In_ PPARTENTRY PartEntry)
1003{
1004 PDISKENTRY DiskEntry = PartEntry->DiskEntry;
1005 PVOLINFO VolInfo = (PartEntry->Volume ? &PartEntry->Volume->Info : NULL);
1006 PPARTITEM PartItem;
1007 ULONGLONG PartSize;
1008 HTLITEM htiPart;
1009 CHAR PartTypeString[32];
1010 PCHAR PartType = PartTypeString;
1011 WCHAR LineBuffer[128];
1012
1013 /* Volume name */
1014 if (PartEntry->IsPartitioned == FALSE)
1015 {
1016 /* Unpartitioned space: Just display the description */
1017 StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
1018 // MUIGetString(STRING_UNPSPACE)
1019 L"Unpartitioned space");
1020 }
1021 else
1022//
1023// NOTE: This could be done with the next case.
1024//
1025 if ((DiskEntry->DiskStyle == PARTITION_STYLE_MBR) &&
1026 IsContainerPartition(PartEntry->PartitionType))
1027 {
1028 /* Extended partition container: Just display the partition's type */
1029 StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
1030 // MUIGetString(STRING_EXTENDED_PARTITION)
1031 L"Extended Partition");
1032 }
1033 else
1034 {
1035 /* Drive letter and partition number */
1036 StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
1037 // MUIGetString(STRING_HDDINFOUNK5),
1038 L"%s (%c%c)",
1039 (VolInfo && *VolInfo->VolumeLabel) ? VolInfo->VolumeLabel : L"Partition",
1040 !(VolInfo && VolInfo->DriveLetter) ? L'-' : VolInfo->DriveLetter,
1041 !(VolInfo && VolInfo->DriveLetter) ? L'-' : L':');
1042 }
1043
1044 /* Allocate and initialize a partition-info structure */
1045 PartItem = LocalAlloc(LPTR, sizeof(*PartItem));
1046 if (!PartItem)
1047 {
1048 DPRINT1("Failed to allocate partition-info structure\n");
1049 // return NULL;
1050 // We'll store a NULL pointer?!
1051 }
1052
1053 PartItem->PartEntry = PartEntry;
1054 PartItem->Volume = PartEntry->Volume;
1055
1056 htiPart = TreeListAddItem(hWndList, htiParent, hInsertAfter,
1057 LineBuffer, 1, 1,
1058 (LPARAM)PartItem);
1059
1060 *LineBuffer = 0;
1061 if (PartEntry->IsPartitioned)
1062 {
1063 PartTypeString[0] = '\0';
1064
1065 /*
1066 * If the volume's file system is recognized, display the volume label
1067 * (if any) and the file system name. Otherwise, display the partition
1068 * type if it's not a new partition.
1069 */
1070 if (VolInfo && *VolInfo->FileSystem &&
1071 _wcsicmp(VolInfo->FileSystem, L"RAW") != 0)
1072 {
1073 // TODO: Group this part together with the similar one
1074 // from below once the strings are in the same encoding...
1075 if (PartEntry->New)
1076 {
1077 StringCchPrintfA(PartTypeString,
1078 ARRAYSIZE(PartTypeString),
1079 "New (%S)",
1080 VolInfo->FileSystem);
1081 }
1082 else
1083 {
1084 StringCchPrintfA(PartTypeString,
1085 ARRAYSIZE(PartTypeString),
1086 "%S",
1087 VolInfo->FileSystem);
1088 }
1089 PartType = PartTypeString;
1090 }
1091 else
1092 /* Determine partition type */
1093 if (PartEntry->New)
1094 {
1095 /* Use this description if the partition is new and not planned for formatting */
1096 PartType = "New (Unformatted)"; // MUIGetString(STRING_UNFORMATTED);
1097 }
1098 else
1099 {
1100 /* If the partition is not new but its file system is not recognized
1101 * (or is not formatted), use the partition type description. */
1102 GetPartitionTypeString(PartEntry,
1103 PartTypeString,
1104 ARRAYSIZE(PartTypeString));
1105 PartType = PartTypeString;
1106 }
1107#if 0
1108 if (!PartType || !*PartType)
1109 {
1111 }
1112#endif
1113
1114 StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
1115 L"%S",
1116 PartType);
1117 }
1118 TreeList_SetItemText(hWndList, htiPart, 1, LineBuffer);
1119
1120 /* Format the partition size */
1121 PartSize = GetPartEntrySizeInBytes(PartEntry);
1122 if (!StrFormatByteSizeW(PartSize, LineBuffer, ARRAYSIZE(LineBuffer)))
1123 {
1124 /* We failed for whatever reason, do the hardcoded way */
1125 PCWSTR Unit;
1126 PrettifySize2(&PartSize, &Unit);
1127 StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
1128 L"%6I64u %s",
1129 PartSize, Unit);
1130 }
1131 TreeList_SetItemText(hWndList, htiPart, 2, LineBuffer);
1132
1133 /* Volume status */
1134 *LineBuffer = 0;
1135 if (PartEntry->IsPartitioned)
1136 {
1137 StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
1138 // MUIGetString(STRING_HDDINFOUNK5),
1139 PartEntry->BootIndicator ? L"Active" : L"");
1140 }
1141 TreeList_SetItemText(hWndList, htiPart, 3, LineBuffer);
1142
1143
1144 /* If this is the single extended partition of an MBR disk,
1145 * recursively display its logical partitions */
1146 if (PartEntry == DiskEntry->ExtendedPartition)
1147 {
1148 PLIST_ENTRY LogicalEntry;
1149 PPARTENTRY LogicalPartEntry;
1150
1151 for (LogicalEntry = DiskEntry->LogicalPartListHead.Flink;
1152 LogicalEntry != &DiskEntry->LogicalPartListHead;
1153 LogicalEntry = LogicalEntry->Flink)
1154 {
1155 LogicalPartEntry = CONTAINING_RECORD(LogicalEntry, PARTENTRY, ListEntry);
1156 PrintPartitionData(hWndList, htiPart, NULL, LogicalPartEntry);
1157 }
1158
1159 /* Expand the extended partition node */
1161 }
1162
1163 return htiPart;
1164}
1165
1170static
1171VOID
1174 _In_ TLITEMW* ptlItem)
1175{
1176 PPARTITEM PartItem;
1177
1178 /* Code below is equivalent to: PartItem = GetItemPartition(hWndList, ptlItem->hItem);
1179 * except that we already have the data structure in ptlItem->lParam, so there is
1180 * no need to call extra helpers as GetItemPartition() does. */
1181 HTLITEM hParentItem = TreeList_GetParent(hWndList, ptlItem->hItem);
1182 /* May or may not be a PPARTITEM: this is a PPARTITEM only when hParentItem != NULL */
1183 PartItem = (PPARTITEM)ptlItem->lParam;
1184 if (!hParentItem || !PartItem)
1185 return;
1186
1187 if (PartItem->VolCreate)
1188 LocalFree(PartItem->VolCreate);
1189 LocalFree(PartItem);
1190}
1191
1192static
1193VOID
1196 _In_opt_ HTLITEM hInsertAfter,
1197 _In_ PDISKENTRY DiskEntry)
1198{
1199 BOOL Success;
1200 HANDLE hDevice;
1201 PCHAR DiskName = NULL;
1202 ULONG Length = 0;
1203 PPARTENTRY PrimaryPartEntry;
1204 PLIST_ENTRY PrimaryEntry;
1205 ULONGLONG DiskSize;
1206 HTLITEM htiDisk;
1207 WCHAR LineBuffer[128];
1208 UCHAR outBuf[512];
1209
1210 StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
1211 // L"\\Device\\Harddisk%lu\\Partition%lu",
1212 L"\\\\.\\PhysicalDrive%lu",
1213 DiskEntry->DiskNumber);
1214
1215 hDevice = CreateFileW(
1216 LineBuffer, // device interface name
1217 GENERIC_READ /*| GENERIC_WRITE*/, // dwDesiredAccess
1218 FILE_SHARE_READ | FILE_SHARE_WRITE, // dwShareMode
1219 NULL, // lpSecurityAttributes
1220 OPEN_EXISTING, // dwCreationDistribution
1221 0, // dwFlagsAndAttributes
1222 NULL // hTemplateFile
1223 );
1224 if (hDevice != INVALID_HANDLE_VALUE)
1225 {
1227
1228 Query.PropertyId = StorageDeviceProperty;
1229 Query.QueryType = PropertyStandardQuery;
1230
1231 Success = DeviceIoControl(hDevice,
1233 &Query,
1234 sizeof(Query),
1235 &outBuf,
1236 sizeof(outBuf),
1237 &Length,
1238 NULL);
1239 if (Success)
1240 {
1242 if (devDesc->ProductIdOffset)
1243 {
1244 DiskName = (PCHAR)&outBuf[devDesc->ProductIdOffset];
1245 Length -= devDesc->ProductIdOffset;
1246 DiskName[min(Length, strlen(DiskName))] = 0;
1247 // ( i = devDesc->ProductIdOffset; p[i] != 0 && i < Length; i++ )
1248 }
1249 }
1250
1251 CloseHandle(hDevice);
1252 }
1253
1254 if (DiskName && *DiskName)
1255 {
1256 if (DiskEntry->DriverName.Length > 0)
1257 {
1258 StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
1259 // MUIGetString(STRING_HDDINFO_1),
1260 L"Harddisk %lu (%S) (Port=%hu, Bus=%hu, Id=%hu) on %wZ",
1261 DiskEntry->DiskNumber,
1262 DiskName,
1263 DiskEntry->Port,
1264 DiskEntry->Bus,
1265 DiskEntry->Id,
1266 &DiskEntry->DriverName);
1267 }
1268 else
1269 {
1270 StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
1271 // MUIGetString(STRING_HDDINFO_2),
1272 L"Harddisk %lu (%S) (Port=%hu, Bus=%hu, Id=%hu)",
1273 DiskEntry->DiskNumber,
1274 DiskName,
1275 DiskEntry->Port,
1276 DiskEntry->Bus,
1277 DiskEntry->Id);
1278 }
1279 }
1280 else
1281 {
1282 if (DiskEntry->DriverName.Length > 0)
1283 {
1284 StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
1285 // MUIGetString(STRING_HDDINFO_1),
1286 L"Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu) on %wZ",
1287 DiskEntry->DiskNumber,
1288 DiskEntry->Port,
1289 DiskEntry->Bus,
1290 DiskEntry->Id,
1291 &DiskEntry->DriverName);
1292 }
1293 else
1294 {
1295 StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
1296 // MUIGetString(STRING_HDDINFO_2),
1297 L"Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu)",
1298 DiskEntry->DiskNumber,
1299 DiskEntry->Port,
1300 DiskEntry->Bus,
1301 DiskEntry->Id);
1302 }
1303 }
1304
1305 htiDisk = TreeListAddItem(hWndList, NULL, hInsertAfter,
1306 LineBuffer, 0, 0,
1307 (LPARAM)DiskEntry);
1308
1309 /* Disk type: MBR, GPT or RAW (Uninitialized) */
1310 TreeList_SetItemText(hWndList, htiDisk, 1,
1311 DiskEntry->DiskStyle == PARTITION_STYLE_MBR ? L"MBR" :
1312 DiskEntry->DiskStyle == PARTITION_STYLE_GPT ? L"GPT" :
1313 L"RAW");
1314
1315 /* Format the disk size */
1316 DiskSize = GetDiskSizeInBytes(DiskEntry);
1317 if (!StrFormatByteSizeW(DiskSize, LineBuffer, ARRAYSIZE(LineBuffer)))
1318 {
1319 /* We failed for whatever reason, do the hardcoded way */
1320 PCWSTR Unit;
1321 PrettifySize1(&DiskSize, &Unit);
1322 StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
1323 L"%6I64u %s",
1324 DiskSize, Unit);
1325 }
1326 TreeList_SetItemText(hWndList, htiDisk, 2, LineBuffer);
1327
1328 /* Print partition lines */
1329 for (PrimaryEntry = DiskEntry->PrimaryPartListHead.Flink;
1330 PrimaryEntry != &DiskEntry->PrimaryPartListHead;
1331 PrimaryEntry = PrimaryEntry->Flink)
1332 {
1333 PrimaryPartEntry = CONTAINING_RECORD(PrimaryEntry, PARTENTRY, ListEntry);
1334
1335 /* If this is an extended partition, recursively print the logical partitions */
1336 PrintPartitionData(hWndList, htiDisk, NULL, PrimaryPartEntry);
1337 }
1338
1339 /* Expand the disk node */
1341}
1342
1343static VOID
1347{
1348 const DWORD dwStyle = TVS_HASBUTTONS | /*TVS_HASLINES | TVS_LINESATROOT |*/ TVS_SHOWSELALWAYS | TVS_FULLROWSELECT;
1349 const DWORD dwExStyle = TVS_EX_FULLROWMARK /* | TVS_EX_FULLROWITEMS*/;
1350 HIMAGELIST hSmall;
1351
1352 /* Set the TreeList styles and fixup the item selection color */
1354 // TreeList_SetStyleEx(hWndList, dwStyle, dwStyle);
1357
1358 /* Initialize its columns */
1360 hWndList,
1361 column_ids,
1365
1366 /* Create the ImageList */
1369 ILC_COLOR32 | ILC_MASK, // ILC_COLOR24
1370 1, 1);
1371
1372 /* Add event type icons to the ImageList */
1375
1376 /* Assign the ImageList to the List View */
1378}
1379
1380static VOID
1384{
1386 PDISKENTRY DiskEntry;
1387
1388 /* Clear the list first */
1390
1391 /* Insert all the detected disks and partitions */
1392 for (Entry = List->DiskListHead.Flink;
1393 Entry != &List->DiskListHead;
1394 Entry = Entry->Flink)
1395 {
1396 DiskEntry = CONTAINING_RECORD(Entry, DISKENTRY, ListEntry);
1397
1398 /* Print disk entry */
1399 PrintDiskData(hWndList, NULL, DiskEntry);
1400 }
1401
1402 /* Select the first item */
1403 // TreeList_SetFocusItem(hWndList, 1, 1);
1405}
1406
1407static VOID
1410{
1411 HIMAGELIST hSmall;
1412
1413 /* Cleanup all the items. Their cached data will be automatically deleted
1414 * on response to the TVN_DELETEITEM notification sent by the TreeList
1415 * by DeleteTreeItem() */
1417
1418 /* And cleanup the imagelist */
1421 ImageList_Destroy(hSmall);
1422}
1423
1424
1430static BOOLEAN
1432 _In_ HWND hList,
1434 _Inout_ HTLITEM* phItem,
1435 _Inout_opt_ PPARTITEM* pPartItem,
1436 _In_opt_ ULONGLONG SizeBytes,
1438{
1440 PPARTITEM PartItem;
1441 PPARTENTRY PartEntry;
1442 HTLITEM hParentItem;
1443 HTLITEM hInsertAfter;
1444 PPARTENTRY NextPart;
1445
1446 PartItem = (pPartItem ? *pPartItem : GetItemPartition(hList, *phItem));
1447 if (!PartItem)
1448 {
1449 /* We must have a disk region... */
1450 ASSERT(FALSE);
1451 return FALSE;
1452 }
1453 PartEntry = PartItem->PartEntry;
1454#if 0
1455 if (PartEntry->IsPartitioned)
1456 {
1457 /* Don't create a partition when one already exists */
1458 ASSERT(FALSE);
1459 return FALSE;
1460 }
1461 ASSERT(!PartEntry->Volume);
1462#endif
1463
1465 PartEntry,
1466 SizeBytes,
1468 if (!Success)
1469 return Success;
1470
1471 /* Retrieve the parent item (disk or MBR extended partition) */
1472 hParentItem = TreeList_GetParent(hList, *phItem);
1473 hInsertAfter = TreeList_GetPrevSibling(hList, *phItem);
1474 if (!hInsertAfter)
1475 hInsertAfter = TVI_FIRST;
1476
1477 /*
1478 * The current entry has been recreated and maybe split
1479 * in two: new partition and remaining unused space.
1480 * Thus, recreate the current entry.
1481 *
1482 * NOTE: Since we create a partition we don't care
1483 * about its previous PartItem, so it can be deleted.
1484 */
1485 {
1486 /* Cache out the original item's volume create info */
1487 PVOL_CREATE_INFO VolCreate = PartItem->VolCreate;
1488 PartItem->VolCreate = NULL;
1489
1490 /* Remove the current item */
1491 TreeList_DeleteItem(hList, *phItem);
1492
1493 /* Recreate the entry */
1494 *phItem = PrintPartitionData(hList, hParentItem, hInsertAfter, PartEntry);
1495
1496 /* Retrieve the new PartItem and restore the volume create
1497 * information associated to the newly-created partition */
1498 PartItem = GetItemPartition(hList, *phItem);
1499 ASSERT(PartItem);
1500
1501 /* Update the volume associated to the create information */
1502 if (VolCreate)
1503 VolCreate->Volume = PartItem->Volume;
1504
1505 /* Restore the volume create information */
1506 PartItem->VolCreate = VolCreate;
1507
1508 if (pPartItem)
1509 *pPartItem = PartItem;
1510 }
1511
1512 /* Add also the following unused space, if any */
1513 // NextPart = GetAdjDiskRegion(NULL, PartEntry, ENUM_REGION_NEXT);
1514 NextPart = GetAdjUnpartitionedEntry(PartEntry, TRUE);
1515 if (NextPart /*&& !NextPart->IsPartitioned*/)
1516 PrintPartitionData(hList, hParentItem, *phItem, NextPart);
1517
1518 /* Give the focus on and select the created partition */
1519 // TreeList_SetFocusItem(hList, 1, 1);
1520 TreeList_SelectItem(hList, *phItem);
1521
1522 return TRUE;
1523}
1524
1530static BOOLEAN
1532 _In_ HWND hList,
1534 _Inout_ HTLITEM* phItem,
1535 _In_ PPARTITEM PartItem)
1536{
1537 PPARTENTRY PartEntry = PartItem->PartEntry;
1538 PPARTENTRY PrevPart, NextPart;
1539 BOOLEAN PrevIsPartitioned, NextIsPartitioned;
1541
1542 HTLITEM hParentItem;
1543 HTLITEM hInsertAfter;
1544 HTLITEM hAdjItem;
1545 PPARTITEM AdjPartItem;
1546
1547#if 0
1548 if (!PartEntry->IsPartitioned)
1549 {
1550 /* Don't delete an unpartitioned disk region */
1551 ASSERT(FALSE);
1552 return FALSE;
1553 }
1554#endif
1555
1556 /*
1557 * Determine the nature of the previous and next disk regions,
1558 * in order to know what to do on the corresponding tree items
1559 * after the selected partition has been deleted.
1560 *
1561 * NOTE: Don't reference these pointers after DeletePartition(),
1562 * since these disk regions might have been coalesced/reallocated.
1563 * However we can check whether they were NULL or not.
1564 */
1565 // PrevPart = GetAdjDiskRegion(NULL, PartEntry, ENUM_REGION_PREV);
1566 // NextPart = GetAdjDiskRegion(NULL, PartEntry, ENUM_REGION_NEXT);
1567 PrevPart = GetAdjUnpartitionedEntry(PartEntry, FALSE);
1568 NextPart = GetAdjUnpartitionedEntry(PartEntry, TRUE);
1569
1570 PrevIsPartitioned = (PrevPart && PrevPart->IsPartitioned);
1571 NextIsPartitioned = (NextPart && NextPart->IsPartitioned);
1572
1573 ASSERT(PartEntry->IsPartitioned); // The current partition must be partitioned.
1575 PartEntry,
1576 &PartEntry);
1577 if (!Success)
1578 return Success;
1579
1580 /* Retrieve the parent item (disk or MBR extended partition) */
1581 hParentItem = TreeList_GetParent(hList, *phItem);
1582
1583 /* If previous sibling isn't partitioned, remove it */
1584 if (PrevPart && !PrevIsPartitioned)
1585 {
1586 hAdjItem = TreeList_GetPrevSibling(hList, *phItem);
1587 ASSERT(hAdjItem); // TODO: Investigate
1588 if (hAdjItem)
1589 {
1590 AdjPartItem = GetItemPartition(hList, hAdjItem);
1591 ASSERT(AdjPartItem && (AdjPartItem->PartEntry == PrevPart));
1592 AdjPartItem = NULL;
1593 TreeList_DeleteItem(hList, hAdjItem);
1594 }
1595 }
1596 /* If next sibling isn't partitioned, remove it */
1597 if (NextPart && !NextIsPartitioned)
1598 {
1599 hAdjItem = TreeList_GetNextSibling(hList, *phItem);
1600 ASSERT(hAdjItem); // TODO: Investigate
1601 if (hAdjItem)
1602 {
1603 AdjPartItem = GetItemPartition(hList, hAdjItem);
1604 ASSERT(AdjPartItem && (AdjPartItem->PartEntry == NextPart));
1605 AdjPartItem = NULL;
1606 TreeList_DeleteItem(hList, hAdjItem);
1607 }
1608 }
1609
1610 /* We are going to insert the updated entry after
1611 * either, the original previous sibling (if it is
1612 * partitioned), or the second-previous sibling
1613 * (if the first one was already removed, see above) */
1614 hInsertAfter = TreeList_GetPrevSibling(hList, *phItem);
1615 if (!hInsertAfter)
1616 hInsertAfter = TVI_FIRST;
1617
1618 /* Remove the current item */
1619 TreeList_DeleteItem(hList, *phItem);
1620
1621 /* Add back the "new" unpartitioned space */
1622 *phItem = PrintPartitionData(hList, hParentItem, hInsertAfter, PartEntry);
1623
1624 /* Give the focus on and select the unpartitioned space */
1625 // TreeList_SetFocusItem(hList, 1, 1);
1626 TreeList_SelectItem(hList, *phItem);
1627
1628 return TRUE;
1629}
1630
1631
1632INT_PTR
1635 _In_ HWND hwndDlg,
1636 _In_ UINT uMsg,
1639{
1640 PSETUPDATA pSetupData;
1641 HWND hList;
1642
1643 /* Retrieve pointer to the global setup data */
1644 pSetupData = (PSETUPDATA)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
1645
1646 switch (uMsg)
1647 {
1648 case WM_INITDIALOG:
1649 {
1650 /* Save pointer to the global setup data */
1651 pSetupData = (PSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
1652 SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (LONG_PTR)pSetupData);
1653
1654 /* Initially hide and disable all partitioning buttons */
1655 ShowDlgItem(hwndDlg, IDC_INITDISK, SW_HIDE);
1656 EnableDlgItem(hwndDlg, IDC_INITDISK, FALSE);
1663
1664 /* Initialize the partitions list */
1665 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
1667 InitPartitionList(pSetupData->hInstance, hList);
1668 DrawPartitionList(hList, pSetupData->PartitionList);
1669
1670 // HACK: Wine "kwality" code doesn't still implement
1671 // PSN_QUERYINITIALFOCUS so we "emulate" its call there...
1672 {
1673 PSHNOTIFY pshn = {{hwndDlg, GetWindowLong(hwndDlg, GWL_ID), PSN_QUERYINITIALFOCUS}, (LPARAM)hList};
1674 SendMessageW(hwndDlg, WM_NOTIFY, (WPARAM)pshn.hdr.idFrom, (LPARAM)&pshn);
1675 }
1676 break;
1677 }
1678
1679 case WM_DESTROY:
1680 {
1681 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
1685 return TRUE;
1686 }
1687
1688 case WM_COMMAND:
1689 {
1690 switch (LOWORD(wParam))
1691 {
1692 case IDC_PARTMOREOPTS:
1693 {
1694 DialogBoxParamW(pSetupData->hInstance,
1696 hwndDlg,
1698 (LPARAM)pSetupData);
1699 break;
1700 }
1701
1702 case IDC_INITDISK:
1703 {
1704 // TODO: Implement disk partitioning initialization
1705 break;
1706 }
1707
1708 case IDC_PARTCREATE:
1709 {
1710 HTLITEM hItem;
1711 PPARTITEM PartItem;
1712 PPARTENTRY PartEntry;
1713 ULONGLONG PartSize;
1714 ULONGLONG MaxPartSize;
1715 ULONG MaxSizeMB;
1716 INT_PTR ret;
1717 PARTCREATE_CTX PartCreateCtx = {0};
1718
1719 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
1720 PartItem = GetSelectedPartition(hList, &hItem);
1721 if (!PartItem)
1722 {
1723 /* If the button was clicked, an empty disk
1724 * region should have been selected first */
1725 ASSERT(FALSE);
1726 break;
1727 }
1728 PartEntry = PartItem->PartEntry;
1729 if (PartEntry->IsPartitioned)
1730 {
1731 /* Don't create a partition when one already exists */
1732 ASSERT(FALSE);
1733 break;
1734 }
1735 ASSERT(!PartEntry->Volume);
1736
1737 /* Get the partition info stored in the TreeList */
1738 PartCreateCtx.PartItem = PartItem;
1739
1740 /* Retrieve the maximum size in MB (rounded up) the partition can have */
1741 MaxPartSize = GetPartEntrySizeInBytes(PartEntry);
1742 MaxSizeMB = (ULONG)RoundingDivide(MaxPartSize, MB);
1743 PartCreateCtx.MaxSizeMB = MaxSizeMB;
1744
1745 /* Don't force formatting by default */
1746 PartCreateCtx.ForceFormat = FALSE;
1747
1748 /* Show the partitioning dialog */
1749 ret = DialogBoxParamW(pSetupData->hInstance,
1751 hwndDlg,
1753 (LPARAM)&PartCreateCtx);
1754 if (ret != IDOK)
1755 break;
1756
1757 /*
1758 * If the input size, given in MB, specifies the maximum partition
1759 * size, it may slightly under- or over-estimate the latter due to
1760 * rounding error. In this case, use all of the unpartitioned space.
1761 * Otherwise, directly convert the size to bytes.
1762 */
1763 PartSize = PartCreateCtx.PartSizeMB;
1764 if (PartSize == MaxSizeMB)
1765 PartSize = MaxPartSize;
1766 else // if (PartSize < MaxSizeMB)
1767 PartSize *= MB;
1768
1769 ASSERT(PartSize <= MaxPartSize);
1770
1771 if (!DoCreatePartition(hList, pSetupData->PartitionList,
1772 &hItem, &PartItem,
1773 PartSize,
1774 !PartCreateCtx.MBRExtPart
1775 ? 0 : PARTITION_EXTENDED))
1776 {
1777 DisplayError(GetParent(hwndDlg),
1780 }
1781
1782 break;
1783 }
1784
1785 case IDC_PARTFORMAT:
1786 {
1787 HTLITEM hItem;
1788 PPARTITEM PartItem;
1789 PPARTENTRY PartEntry;
1790 INT_PTR ret;
1791 PARTCREATE_CTX PartCreateCtx = {0};
1792
1793 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
1794 PartItem = GetSelectedPartition(hList, &hItem);
1795 if (!PartItem)
1796 {
1797 /* If the button was clicked, an empty disk
1798 * region should have been selected first */
1799 ASSERT(FALSE);
1800 break;
1801 }
1802 PartEntry = PartItem->PartEntry;
1803 if (!PartEntry->Volume)
1804 {
1805 /* Don't format an unformattable partition */
1806 ASSERT(FALSE);
1807 break;
1808 }
1809
1810 /* Show the formatting dialog */
1811 PartCreateCtx.PartItem = PartItem;
1812 ret = DialogBoxParamW(pSetupData->hInstance,
1814 hwndDlg,
1816 (LPARAM)&PartCreateCtx);
1818 break;
1819 }
1820
1821 case IDC_PARTDELETE:
1822 {
1823 PPARTITEM PartItem;
1824 PPARTENTRY PartEntry;
1825 HTLITEM hItem;
1826 UINT uIDWarnMsg;
1827
1828 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
1829 PartItem = GetSelectedPartition(hList, &hItem);
1830 if (!PartItem)
1831 {
1832 // If the button was clicked, a partition
1833 // should have been selected first...
1834 ASSERT(FALSE);
1835 break;
1836 }
1837 PartEntry = PartItem->PartEntry;
1838 if (!PartEntry->IsPartitioned)
1839 {
1840 /* Don't delete an unpartitioned disk region */
1841 ASSERT(FALSE);
1842 break;
1843 }
1844
1845 /* Choose the correct warning message to display:
1846 * MBR-extended (container) vs. standard partition */
1847 if (PartEntry == PartEntry->DiskEntry->ExtendedPartition)
1849 else
1850 uIDWarnMsg = IDS_WARN_DELETE_PARTITION;
1851
1852 /* If the user really wants to delete the partition... */
1853 if (DisplayMessage(GetParent(hwndDlg),
1856 MAKEINTRESOURCEW(uIDWarnMsg)) == IDYES)
1857 {
1858 /* ... make it so! */
1859 if (!DoDeletePartition(hList, pSetupData->PartitionList,
1860 &hItem, PartItem))
1861 {
1862 // TODO: Show error if partition couldn't be deleted?
1863 }
1864 }
1865
1866 break;
1867 }
1868 }
1869 break;
1870 }
1871
1872 case WM_NOTIFY:
1873 {
1874 LPNMHDR lpnm = (LPNMHDR)lParam;
1875
1876 // On Vista+ we can use TVN_ITEMCHANGED instead, with NMTVITEMCHANGE* pointer
1877 if (lpnm->idFrom == IDC_PARTITION && lpnm->code == TVN_SELCHANGED)
1878 {
1880
1881 // if (!(pnmv->uChanged & TVIF_STATE)) /* The state has changed */
1882 if (!(pnmv->itemNew.mask & TVIF_STATE))
1883 break;
1884
1885 /* The item has been (de)selected */
1886 // if (pnmv->uNewState & TVIS_SELECTED)
1887 if (pnmv->itemNew.state & TVIS_SELECTED)
1888 {
1889 HTLITEM hParentItem = TreeList_GetParent(lpnm->hwndFrom, pnmv->itemNew.hItem);
1890 /* May or may not be a PPARTENTRY: this is a PPARTENTRY only when hParentItem != NULL */
1891
1892 if (!hParentItem)
1893 {
1894 /* Hard disk */
1895 PDISKENTRY DiskEntry = (PDISKENTRY)pnmv->itemNew.lParam;
1896 ASSERT(DiskEntry);
1897
1898 /* Show the "Initialize" disk button and hide and disable the others */
1899 ShowDlgItem(hwndDlg, IDC_INITDISK, SW_SHOW);
1900
1901#if 0 // FIXME: Init disk not implemented yet!
1902 EnableDlgItem(hwndDlg, IDC_INITDISK,
1903 DiskEntry->DiskStyle == PARTITION_STYLE_RAW);
1904#else
1905 EnableDlgItem(hwndDlg, IDC_INITDISK, FALSE);
1906#endif
1907
1910
1913
1916
1917 /* Disable the "Next" button */
1918 goto DisableWizNext;
1919 }
1920 else
1921 {
1922 /* Partition or unpartitioned space */
1923 PPARTITEM PartItem = (PPARTITEM)pnmv->itemNew.lParam;
1924 PPARTENTRY PartEntry;
1925 ASSERT(PartItem);
1926 PartEntry = PartItem->PartEntry;
1927 ASSERT(PartEntry);
1928
1929 /* Hide and disable the "Initialize" disk button */
1930 ShowDlgItem(hwndDlg, IDC_INITDISK, SW_HIDE);
1931 EnableDlgItem(hwndDlg, IDC_INITDISK, FALSE);
1932
1933 if (!PartEntry->IsPartitioned)
1934 {
1935 /* Show and enable the "Create" partition button */
1938
1939 /* Hide and disable the "Format" button */
1942 }
1943 else
1944 {
1945 /* Hide and disable the "Create" partition button */
1948
1949 /* Show the "Format" button, but enable or disable it if a formattable volume is present */
1951 EnableDlgItem(hwndDlg, IDC_PARTFORMAT, !!PartEntry->Volume);
1952 }
1953
1954 /* Show the "Delete" partition button, but enable or disable it if the disk region is partitioned */
1956 EnableDlgItem(hwndDlg, IDC_PARTDELETE, PartEntry->IsPartitioned);
1957
1958 /*
1959 * Enable the "Next" button if:
1960 *
1961 * 1. the selected disk region is partitioned:
1962 * it can either have a volume attached (and be either
1963 * formatted or ready to be formatted),
1964 * or it's not yet formatted (the installer will prompt
1965 * for formatting parameters).
1966 *
1967 * 2. Or, the selected disk region is not partitioned but
1968 * can be partitioned according to the disk's partitioning
1969 * scheme (the installer will auto-partition the region
1970 * and prompt for formatting parameters).
1971 *
1972 * In all other cases, the "Next" button is disabled.
1973 */
1974
1975 // TODO: In the future: first test needs to be augmented with:
1976 // (... && PartEntry->Volume->IsSimpleVolume)
1977 if ((PartEntry->IsPartitioned && PartEntry->Volume) ||
1978 (!PartEntry->IsPartitioned && (PartitionCreationChecks(PartEntry) == NOT_AN_ERROR)))
1979 {
1980 // ASSERT(PartEntry != PartEntry->DiskEntry->ExtendedPartition);
1981 ASSERT(!IsContainerPartition(PartEntry->PartitionType));
1983 }
1984 else
1985 {
1986 goto DisableWizNext;
1987 }
1988 }
1989 }
1990 else
1991 {
1992DisableWizNext:
1993 /* Keep the "Next" button disabled. It will be enabled
1994 * only when the user selects a valid partition. */
1996 }
1997
1998 break;
1999 }
2000
2001 if (lpnm->idFrom == IDC_PARTITION && lpnm->code == TVN_DELETEITEM)
2002 {
2003 /* Deleting an item from the partition list */
2005 DeleteTreeItem(lpnm->hwndFrom, (TLITEMW*)&pnmv->itemOld);
2006 break;
2007 }
2008
2009 switch (lpnm->code)
2010 {
2011 case PSN_SETACTIVE:
2012 {
2013 /* Keep the "Next" button disabled. It will be enabled
2014 * only when the user selects a valid partition. */
2016 break;
2017 }
2018
2020 {
2021 /* Give the focus on and select the first item */
2022 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
2023 // TreeList_SetFocusItem(hList, 1, 1);
2026 return TRUE;
2027 }
2028
2029 case PSN_QUERYCANCEL:
2030 {
2031 if (DisplayMessage(GetParent(hwndDlg),
2035 {
2036 /* Go to the Terminate page */
2038 }
2039
2040 /* Do not close the wizard too soon */
2042 return TRUE;
2043 }
2044
2045 case PSN_WIZNEXT: /* Set the selected data */
2046 {
2047 HTLITEM hItem;
2048 PPARTITEM PartItem;
2049 PPARTENTRY PartEntry;
2050
2051 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
2052 PartItem = GetSelectedPartition(hList, &hItem);
2053 if (!PartItem)
2054 {
2055 /* Fail and don't continue the installation */
2056 SetWindowLongPtrW(hwndDlg, DWLP_MSGRESULT, -1);
2057 return TRUE;
2058 }
2059 PartEntry = PartItem->PartEntry;
2060 ASSERT(PartEntry);
2061
2062 /*
2063 * Check whether the user wants to install ReactOS on a disk that
2064 * is not recognized by the computer's firmware and if so, display
2065 * a warning since such disks may not be bootable.
2066 */
2067 if (PartEntry->DiskEntry->MediaType == FixedMedia &&
2068 !PartEntry->DiskEntry->BiosFound)
2069 {
2070 INT nRet;
2071
2072 nRet = DisplayMessage(hwndDlg,
2074 L"Warning",
2075 L"The disk you have selected for installing ReactOS\n"
2076 L"is not visible by the firmware of your computer,\n"
2077 L"and so may not be bootable.\n"
2078 L"\nClick on OK to continue anyway."
2079 L"\nClick on CANCEL to go back to the partitions list.");
2080 if (nRet != IDOK)
2081 {
2082 /* Fail and don't continue the installation */
2083 SetWindowLongPtrW(hwndDlg, DWLP_MSGRESULT, -1);
2084 return TRUE;
2085 }
2086 }
2087
2088 /* If this is an empty region, auto-create the partition if conditions are OK */
2089 if (!PartEntry->IsPartitioned)
2090 {
2091 ULONG Error;
2092
2093 Error = PartitionCreationChecks(PartEntry);
2094 if (Error != NOT_AN_ERROR)
2095 {
2096 // MUIDisplayError(Error, Ir, POPUP_WAIT_ANY_KEY);
2098 L"Could not create a partition on the selected disk region");
2099
2100 /* Fail and don't continue the installation */
2101 SetWindowLongPtrW(hwndDlg, DWLP_MSGRESULT, -1);
2102 return TRUE;
2103 }
2104
2105 /* Automatically create the partition on the whole empty space;
2106 * it will be formatted later with default parameters */
2107 if (!DoCreatePartition(hList, pSetupData->PartitionList,
2108 &hItem, &PartItem,
2109 0ULL,
2110 0))
2111 {
2112 DisplayError(GetParent(hwndDlg),
2115
2116 /* Fail and don't continue the installation */
2117 SetWindowLongPtrW(hwndDlg, DWLP_MSGRESULT, -1);
2118 return TRUE;
2119 }
2120 /* Update PartEntry */
2121 PartEntry = PartItem->PartEntry;
2122 }
2123
2124 ASSERT(PartEntry->IsPartitioned);
2125 // ASSERT(PartEntry != PartEntry->DiskEntry->ExtendedPartition);
2127 ASSERT(PartEntry->Volume);
2128
2129#if 0 // TODO: Implement!
2130 if (!IsPartitionLargeEnough(PartEntry))
2131 {
2134
2135 /* Fail and don't continue the installation */
2136 SetWindowLongPtrW(hwndDlg, DWLP_MSGRESULT, -1);
2137 return TRUE;
2138 }
2139#endif
2140
2141 /* Force formatting only if the partition doesn't have a volume (may or may not be formatted) */
2142 if (PartEntry->Volume &&
2143 ((PartEntry->Volume->FormatState == Formatted) ||
2144 (PartItem->VolCreate && *PartItem->VolCreate->FileSystemName)))
2145 {
2146 /*NOTHING*/;
2147 }
2148 else /* Request formatting of the selected region if it's not already formatted */
2149 {
2150 INT_PTR ret;
2151 PARTCREATE_CTX PartCreateCtx = {0};
2152
2153 /* Show the formatting dialog */
2154 PartCreateCtx.PartItem = PartItem;
2155 ret = DialogBoxParamW(pSetupData->hInstance,
2157 hwndDlg,
2159 (LPARAM)&PartCreateCtx);
2160
2161 /* If the user refuses to format the partition,
2162 * fail and don't continue the installation */
2163 if (ret != IDOK)
2164 {
2165 SetWindowLongPtrW(hwndDlg, DWLP_MSGRESULT, -1);
2166 return TRUE;
2167 }
2168
2169 /* The partition will be formatted */
2170 }
2171
2172 InstallPartition = PartEntry;
2173 break;
2174 }
2175
2176 default:
2177 break;
2178 }
2179 break;
2180 }
2181
2182 default:
2183 break;
2184 }
2185
2186 return FALSE;
2187}
2188
2189/* EOF */
unsigned char BOOLEAN
static HWND hWndList[5+1]
Definition: SetParent.c:10
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
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
const GPT_PARTITION_TYPE GptPartitionTypes[NUM_GPT_PARTITION_TYPES]
Definition: partinfo.c:271
const MBR_PARTITION_TYPE MbrPartitionTypes[NUM_MBR_PARTITION_TYPES]
Definition: partinfo.c:46
UI_CONTEXT UiContext
Definition: reactos.c:55
PPARTENTRY InstallPartition
Definition: reactos.c:45
INT __cdecl DisplayMessage(_In_opt_ HWND hWnd, _In_ UINT uType, _In_opt_ PCWSTR pszTitle, _In_opt_ PCWSTR pszFormatMessage,...)
Definition: reactos.c:211
SETUPDATA SetupData
Definition: reactos.c:42
#define ShowDlgItem(hDlg, nID, nCmdShow)
Definition: reactos.h:51
struct _SETUPDATA * PSETUPDATA
#define IDC_CHECK_MBREXTPART
Definition: resource.h:74
#define IDS_BOOTLOADER_MBRVBR
Definition: resource.h:114
#define IDS_BOOTLOADER_SYSTEM
Definition: resource.h:113
#define IDD_RESTARTPAGE
Definition: resource.h:62
#define IDC_FSTYPE
Definition: resource.h:76
#define IDI_PARTITION
Definition: resource.h:12
#define IDS_WARN_DELETE_PARTITION
Definition: resource.h:157
#define IDC_INITDISK
Definition: resource.h:39
#define IDC_FS_STATIC
Definition: resource.h:75
#define IDS_ERROR_INVALID_INSTALLDIR_CHAR
Definition: resource.h:146
#define IDC_PARTMOREOPTS
Definition: resource.h:44
#define IDS_ERROR_CREATE_PARTITION_TITLE
Definition: resource.h:153
#define IDC_CHECK_QUICKFMT
Definition: resource.h:77
#define IDC_PARTDELETE
Definition: resource.h:42
#define IDS_WARN_DELETE_PARTITION_TITLE
Definition: resource.h:156
#define IDS_ERROR_CREATE_PARTITION
Definition: resource.h:154
#define IDS_BOOTLOADER_VBRONLY
Definition: resource.h:115
#define IDC_PARTITION
Definition: resource.h:38
#define IDD_FORMAT
Definition: resource.h:79
#define IDC_PATH
Definition: resource.h:67
#define IDC_INSTFREELDR
Definition: resource.h:68
#define IDD_ADVINSTOPTS
Definition: resource.h:66
#define IDI_DISKDRIVE
Definition: resource.h:11
#define IDC_PARTFORMAT
Definition: resource.h:41
#define IDC_PARTCREATE
Definition: resource.h:40
#define IDS_ABORTSETUP2
Definition: resource.h:94
#define IDS_ERROR_DIRECTORY_NAME_TITLE
Definition: resource.h:149
#define IDC_UPDOWN_PARTSIZE
Definition: resource.h:72
#define IDS_ABORTSETUP
Definition: resource.h:93
#define IDD_PARTITION
Definition: resource.h:70
#define IDS_WARN_DELETE_MBR_EXTENDED_PARTITION
Definition: resource.h:158
#define IDS_ERROR_DIRECTORY_NAME
Definition: resource.h:150
#define IDS_ERROR_INVALID_INSTALLDIR_CHAR_TITLE
Definition: resource.h:145
#define IDS_BOOTLOADER_NOINST
Definition: resource.h:111
#define IDS_VOLUME_NOFORMAT
Definition: resource.h:99
BOOL Error
Definition: chkdsk.c:66
PWCHAR FileSystem
Definition: format.c:72
#define PARTITION_ENTRY_UNUSED
Definition: disk.h:86
#define PARTITION_EXTENDED
Definition: disk.h:91
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:928
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:804
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
LPWSTR WINAPI StrFormatByteSizeW(LONGLONG llBytes, LPWSTR lpszDest, UINT cchMax)
Definition: string.c:2388
static VOID ShowErrorTip(_In_ HWND hEdit)
Definition: drivepage.c:133
static VOID InitPartitionList(_In_ HINSTANCE hInstance, _In_ HWND hWndList)
Definition: drivepage.c:1344
static const INT column_widths[MAX_LIST_COLUMNS]
Definition: drivepage.c:48
static BOOL DoSanitizeClipboard(_In_ HWND hWnd)
Sanitize in-place any text found in the clipboard.
Definition: drivepage.c:88
#define MAX_LIST_COLUMNS
Definition: drivepage.c:46
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:1531
LPARAM TreeListGetItemData(_In_ HWND hTreeList, _In_ HTLITEM hItem)
Definition: drivepage.c:799
static const INT column_alignment[MAX_LIST_COLUMNS]
Definition: drivepage.c:49
PVOL_CREATE_INFO FindVolCreateInTreeByVolume(_In_ HWND hTreeList, _In_ PVOLENTRY Volume)
Definition: drivepage.c:852
INT_PTR CALLBACK DriveDlgProc(_In_ HWND hwndDlg, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam)
Definition: drivepage.c:1634
static INT_PTR CALLBACK PartitionDlgProc(_In_ HWND hDlg, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam)
Definition: drivepage.c:627
static VOID PrettifySize1(_Inout_ PULONGLONG Size, _Out_ PCWSTR *Unit)
Definition: drivepage.c:945
VOID GetPartitionTypeString(IN PPARTENTRY PartEntry, OUT PSTR strBuffer, IN ULONG cchBuffer)
Definition: drivepage.c:881
static PPARTITEM GetItemPartition(_In_ HWND hTreeList, _In_ HTLITEM hItem)
Definition: drivepage.c:815
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:1431
#define IDS_LIST_COLUMN_FIRST
Definition: drivepage.c:43
static BOOL DoSanitizeText(_Inout_ PWSTR pszSanitized)
Sanitize a given string in-place, by removing any invalid character found in it.
Definition: drivepage.c:59
static PPARTITEM GetSelectedPartition(_In_ HWND hTreeList, _Out_opt_ HTLITEM *phItem)
Definition: drivepage.c:833
static INT_PTR CALLBACK FormatDlgProcWorker(_In_ PPARTCREATE_CTX PartCreateCtx, _In_ HWND hDlg, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam)
Definition: drivepage.c:395
static HTLITEM PrintPartitionData(_In_ HWND hWndList, _In_ HTLITEM htiParent, _In_opt_ HTLITEM hInsertAfter, _In_ PPARTENTRY PartEntry)
Definition: drivepage.c:998
static INT_PTR CALLBACK FormatDlgProc(_In_ HWND hDlg, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam)
Definition: drivepage.c:574
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:770
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:1381
static INT_PTR CALLBACK MoreOptDlgProc(_In_ HWND hDlg, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam)
Definition: drivepage.c:231
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:736
static VOID CleanupPartitionList(_In_ HWND hWndList)
Definition: drivepage.c:1408
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:1194
static VOID DeleteTreeItem(_In_ HWND hWndList, _In_ TLITEMW *ptlItem)
Called on response to the TVN_DELETEITEM notification sent by the TreeList.
Definition: drivepage.c:1172
static const UINT column_ids[MAX_LIST_COLUMNS]
Definition: drivepage.c:47
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:168
static VOID PrettifySize2(_Inout_ PULONGLONG Size, _Out_ PCWSTR *Unit)
Definition: drivepage.c:968
@ 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:51
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
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
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
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#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:257
#define GetPartEntrySizeInBytes(PartEntry)
Definition: partlist.h:254
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 PCHAR
Definition: match.c:90
UNICODE_STRING Volume
Definition: fltkernel.h:1172
#define ASSERT(a)
Definition: mode.c:44
#define PSN_QUERYINITIALFOCUS
Definition: settings.cpp:98
@ 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
#define _Out_opt_
Definition: ms_sal.h:346
#define _Inout_
Definition: ms_sal.h:378
#define _Inout_opt_
Definition: ms_sal.h:379
#define _Out_
Definition: ms_sal.h:345
#define _In_
Definition: ms_sal.h:308
#define __fallthrough
Definition: ms_sal.h:2886
#define _In_opt_
Definition: ms_sal.h:309
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
unsigned int UINT
Definition: ndis.h:50
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
__GNU_EXTENSION typedef unsigned __int64 * PULONGLONG
Definition: ntbasedef.h:383
#define DBG_UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:318
#define IsContainerPartition(PartitionType)
Definition: ntdddisk.h:321
@ FixedMedia
Definition: ntdddisk.h:383
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
#define IOCTL_STORAGE_QUERY_PROPERTY
Definition: ntddstor.h:178
* PSTORAGE_DEVICE_DESCRIPTOR
Definition: ntddstor.h:576
@ StorageDeviceProperty
Definition: ntddstor.h:512
@ PropertyStandardQuery
Definition: ntddstor.h:505
#define L(x)
Definition: ntvdm.h:50
#define LOWORD(l)
Definition: pedump.c:82
#define ES_READONLY
Definition: pedump.c:675
#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 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 WM_UNICHAR
Definition: richedit.h:67
#define WM_NOTIFY
Definition: richedit.h:61
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
_Check_return_ _CRTIMP wchar_t *__cdecl _wcsdup(_In_z_ const wchar_t *_Str)
BOOLEAN GetRegisteredFileSystems(IN ULONG Index, OUT PCWSTR *FileSystemName)
Definition: fsutil.c:182
ERROR_NUMBER PartitionCreationChecks(_In_ PPARTENTRY PartEntry)
Definition: partlist.c:2760
PPARTENTRY 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:2724
ULONGLONG RoundingDivide(IN ULONGLONG Dividend, IN ULONGLONG Divisor)
Definition: partlist.c:95
BOOLEAN CreatePartition(_In_ PPARTLIST List, _Inout_ PPARTENTRY PartEntry, _In_opt_ ULONGLONG SizeBytes, _In_opt_ ULONG_PTR PartitionInfo)
Definition: partlist.c:2843
BOOLEAN DeletePartition(_In_ PPARTLIST List, _In_ PPARTENTRY PartEntry, _Out_opt_ PPARTENTRY *FreeRegion)
Definition: partlist.c:2936
BOOLEAN IsValidInstallDirectory(_In_ PCWSTR InstallDir)
Verify whether the given directory is suitable for ReactOS installation. Each path component must be ...
Definition: setuplib.c:713
@ ARCH_NEC98x86
Definition: setuplib.h:72
@ ARCH_PcAT
Definition: setuplib.h:71
#define KB
Definition: setuplib.h:55
#define IS_VALID_INSTALL_PATH_CHAR(c)
Defines the class of characters valid for the installation directory.
Definition: setuplib.h:198
#define GB
Definition: setuplib.h:57
#define MB
Definition: setuplib.h:56
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
base of all file and directory entries
Definition: entries.h:83
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:385
BOOLEAN MBRExtPart
Definition: drivepage.c:389
PPARTITEM PartItem
Definition: drivepage.c:386
BOOLEAN ForceFormat
Definition: drivepage.c:390
ULONG PartSizeMB
Definition: drivepage.c:388
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:374
PPARTENTRY PartEntry
Definition: drivepage.c:375
PVOL_CREATE_INFO VolCreate
Definition: drivepage.c:377
PVOLENTRY Volume
Definition: drivepage.c:376
NMHDR hdr
Definition: prsht.h:330
USETUP_DATA USetupData
Definition: reactos.h:144
HINSTANCE hInstance
Definition: reactos.h:133
PPARTLIST PartitionList
Definition: reactos.h:148
HWND hPartList
Definition: reactos.h:82
WCHAR InstallationDirectory[MAX_PATH]
Definition: setuplib.h:148
LONG BootLoaderLocation
Definition: setuplib.h:123
ULONG RequiredPartitionDiskSpace
Definition: setuplib.h:147
FORMATSTATE FormatState
Definition: partlist.h:48
WCHAR VolumeLabel[20]
Definition: volutil.h:16
WCHAR FileSystem[MAX_PATH+1]
Definition: volutil.h:17
WCHAR DriveLetter
Definition: volutil.h:15
Data structure stored when a partition/volume needs to be formatted.
Definition: reactos.h:177
ULONG ClusterSize
Definition: reactos.h:189
BOOLEAN QuickFormat
Definition: reactos.h:188
PVOLENTRY Volume
Definition: reactos.h:178
WCHAR FileSystemName[MAX_PATH+1]
Definition: reactos.h:185
FMIFS_MEDIA_FLAG MediaFlag
Definition: reactos.h:186
PCWSTR Label
Definition: reactos.h:187
UINT_PTR idFrom
Definition: winuser.h:3161
UINT code
Definition: winuser.h:3162
HWND hwndFrom
Definition: winuser.h:3160
#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
ULONG_PTR SIZE_T
Definition: typedefs.h:80
int32_t INT
Definition: typedefs.h:58
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
uint64_t ULONGLONG
Definition: typedefs.h:67
#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:45
static BOOLEAN IsPartitionLargeEnough(_In_ PPARTENTRY PartEntry)
Definition: usetup.c:1504
#define POPUP_WAIT_ANY_KEY
Definition: usetup.h:123
int ret
_In_ WDFCOLLECTION _In_ ULONG Index
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
_Must_inspect_result_ _In_ WDFCMRESLIST List
Definition: wdfresource.h:550
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1384
#define ZeroMemory
Definition: winbase.h:1712
#define LPTR
Definition: winbase.h:381
#define CopyMemory
Definition: winbase.h:1710
#define GMEM_MOVEABLE
Definition: winbase.h:294
#define GMEM_SHARE
Definition: winbase.h:305
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
DWORD WINAPI GetSysColor(_In_ int)
#define CB_SETITEMDATA
Definition: winuser.h:1969
#define SW_HIDE
Definition: winuser.h:771
#define GetWindowLongPtrW
Definition: winuser.h:4832
#define WM_PASTE
Definition: winuser.h:1866
BOOL WINAPI CheckDlgButton(_In_ HWND, _In_ int, _In_ UINT)
#define IDCANCEL
Definition: winuser.h:834
#define BST_UNCHECKED
Definition: winuser.h:199
#define CB_ERRSPACE
Definition: winuser.h:2439
#define GWL_ID
Definition: winuser.h:862
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define COLOR_HIGHLIGHT
Definition: winuser.h:929
HANDLE WINAPI SetClipboardData(_In_ UINT, _In_opt_ HANDLE)
#define WM_COMMAND
Definition: winuser.h:1743
#define CB_ERR
Definition: winuser.h:2438
BOOL WINAPI CloseClipboard(void)
Definition: ntwrapper.h:178
#define CB_SETCURSEL
Definition: winuser.h:1964
#define SM_CYSMICON
Definition: winuser.h:1016
BOOL WINAPI OpenClipboard(_In_opt_ HWND)
#define CB_FINDSTRINGEXACT
Definition: winuser.h:1943
#define WM_INITDIALOG
Definition: winuser.h:1742
#define MB_YESNO
Definition: winuser.h:820
BOOL WINAPI MessageBeep(_In_ UINT uType)
HANDLE WINAPI GetClipboardData(_In_ UINT)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDOK
Definition: winuser.h:833
#define CBN_SELCHANGE
Definition: winuser.h:1982
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define MB_ICONERROR
Definition: winuser.h:790
#define MB_OKCANCEL
Definition: winuser.h:807
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:1015
#define WM_IME_CHAR
Definition: winuser.h:1837
#define CB_ADDSTRING
Definition: winuser.h:1939
struct tagNMHDR * LPNMHDR
#define CB_GETITEMDATA
Definition: winuser.h:1953
int WINAPI GetWindowTextLengthW(_In_ HWND)
#define GetWindowLong
Definition: winuser.h:5808
#define MB_OK
Definition: winuser.h:793
#define WM_CHAR
Definition: winuser.h:1720
#define MB_ICONWARNING
Definition: winuser.h:789
HWND WINAPI GetParent(_In_ HWND)
#define MB_ICONQUESTION
Definition: winuser.h:792
#define DWLP_MSGRESULT
Definition: winuser.h:873
#define MB_DEFBUTTON2
Definition: winuser.h:802
#define BN_CLICKED
Definition: winuser.h:1928
#define SW_SHOW
Definition: winuser.h:778
#define WM_DESTROY
Definition: winuser.h:1612
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define CB_INSERTSTRING
Definition: winuser.h:1960
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2909
#define IDYES
Definition: winuser.h:838
#define CB_GETCURSEL
Definition: winuser.h:1946
#define SetWindowLongPtrW
Definition: winuser.h:5358
LRESULT WINAPI CallWindowProcW(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define GWL_STYLE
Definition: winuser.h:855
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE hInstance, _In_ LPCWSTR lpIconName)
Definition: cursoricon.c:2119
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
unsigned char UCHAR
Definition: xmlstorage.h:181
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
char CHAR
Definition: xmlstorage.h:175