ReactOS 0.4.16-dev-974-g5022a45
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 /* Do the table lookup */
900 PCSTR Description = LookupPartitionTypeString(PartEntry->DiskEntry->DiskStyle,
901 &PartEntry->PartitionType);
902 if (Description)
903 {
905 return;
906 }
907
908 /* We are here because the partition type is unknown */
909 if (cchBuffer > 0) *strBuffer = '\0';
910 }
911
912 if ((cchBuffer > 0) && (*strBuffer == '\0'))
913 {
914 StringCchPrintfA(strBuffer, cchBuffer,
915 // MUIGetString(STRING_PARTTYPE),
916 "Type 0x%02x",
917 PartEntry->PartitionType);
918 }
919}
920
921
922static VOID
926{
927 ULONGLONG DiskSize = *Size;
928
929 if (DiskSize >= 10 * GB) /* 10 GB */
930 {
931 DiskSize = RoundingDivide(DiskSize, GB);
932 *Unit = L"GB"; // MUIGetString(STRING_GB);
933 }
934 else
935 {
936 DiskSize = RoundingDivide(DiskSize, MB);
937 if (DiskSize == 0)
938 DiskSize = 1;
939 *Unit = L"MB"; // MUIGetString(STRING_MB);
940 }
941
942 *Size = DiskSize;
943}
944
945static VOID
949{
950 ULONGLONG PartSize = *Size;
951
952#if 0
953 if (PartSize >= 10 * GB) /* 10 GB */
954 {
955 PartSize = RoundingDivide(PartSize, GB);
956 *Unit = L"GB"; // MUIGetString(STRING_GB);
957 }
958 else
959#endif
960 if (PartSize >= 10 * MB) /* 10 MB */
961 {
962 PartSize = RoundingDivide(PartSize, MB);
963 *Unit = L"MB"; // MUIGetString(STRING_MB);
964 }
965 else
966 {
967 PartSize = RoundingDivide(PartSize, KB);
968 *Unit = L"KB"; // MUIGetString(STRING_KB);
969 }
970
971 *Size = PartSize;
972}
973
974static
978 _In_ HTLITEM htiParent,
979 _In_opt_ HTLITEM hInsertAfter,
980 _In_ PPARTENTRY PartEntry)
981{
982 PDISKENTRY DiskEntry = PartEntry->DiskEntry;
983 PVOLINFO VolInfo = (PartEntry->Volume ? &PartEntry->Volume->Info : NULL);
984 PPARTITEM PartItem;
985 ULONGLONG PartSize;
986 HTLITEM htiPart;
987 CHAR PartTypeString[32];
988 PCHAR PartType = PartTypeString;
989 WCHAR LineBuffer[128];
990
991 /* Volume name */
992 if (PartEntry->IsPartitioned == FALSE)
993 {
994 /* Unpartitioned space: Just display the description */
995 StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
996 // MUIGetString(STRING_UNPSPACE)
997 L"Unpartitioned space");
998 }
999 else
1000//
1001// NOTE: This could be done with the next case.
1002//
1003 if ((DiskEntry->DiskStyle == PARTITION_STYLE_MBR) &&
1004 IsContainerPartition(PartEntry->PartitionType))
1005 {
1006 /* Extended partition container: Just display the partition's type */
1007 StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
1008 // MUIGetString(STRING_EXTENDED_PARTITION)
1009 L"Extended Partition");
1010 }
1011 else
1012 {
1013 /* Drive letter and partition number */
1014 StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
1015 // MUIGetString(STRING_HDDINFOUNK5),
1016 L"%s (%c%c)",
1017 (VolInfo && *VolInfo->VolumeLabel) ? VolInfo->VolumeLabel : L"Partition",
1018 !(VolInfo && VolInfo->DriveLetter) ? L'-' : VolInfo->DriveLetter,
1019 !(VolInfo && VolInfo->DriveLetter) ? L'-' : L':');
1020 }
1021
1022 /* Allocate and initialize a partition-info structure */
1023 PartItem = LocalAlloc(LPTR, sizeof(*PartItem));
1024 if (!PartItem)
1025 {
1026 DPRINT1("Failed to allocate partition-info structure\n");
1027 // return NULL;
1028 // We'll store a NULL pointer?!
1029 }
1030
1031 PartItem->PartEntry = PartEntry;
1032 PartItem->Volume = PartEntry->Volume;
1033
1034 htiPart = TreeListAddItem(hWndList, htiParent, hInsertAfter,
1035 LineBuffer, 1, 1,
1036 (LPARAM)PartItem);
1037
1038 *LineBuffer = 0;
1039 if (PartEntry->IsPartitioned)
1040 {
1041 PartTypeString[0] = '\0';
1042
1043 /*
1044 * If the volume's file system is recognized, display the volume label
1045 * (if any) and the file system name. Otherwise, display the partition
1046 * type if it's not a new partition.
1047 */
1048 if (VolInfo && *VolInfo->FileSystem &&
1049 _wcsicmp(VolInfo->FileSystem, L"RAW") != 0)
1050 {
1051 // TODO: Group this part together with the similar one
1052 // from below once the strings are in the same encoding...
1053 if (PartEntry->New)
1054 {
1055 StringCchPrintfA(PartTypeString,
1056 ARRAYSIZE(PartTypeString),
1057 "New (%S)",
1058 VolInfo->FileSystem);
1059 }
1060 else
1061 {
1062 StringCchPrintfA(PartTypeString,
1063 ARRAYSIZE(PartTypeString),
1064 "%S",
1065 VolInfo->FileSystem);
1066 }
1067 PartType = PartTypeString;
1068 }
1069 else
1070 /* Determine partition type */
1071 if (PartEntry->New)
1072 {
1073 /* Use this description if the partition is new and not planned for formatting */
1074 PartType = "New (Unformatted)"; // MUIGetString(STRING_UNFORMATTED);
1075 }
1076 else
1077 {
1078 /* If the partition is not new but its file system is not recognized
1079 * (or is not formatted), use the partition type description. */
1080 GetPartitionTypeString(PartEntry,
1081 PartTypeString,
1082 ARRAYSIZE(PartTypeString));
1083 PartType = PartTypeString;
1084 }
1085#if 0
1086 if (!PartType || !*PartType)
1087 {
1089 }
1090#endif
1091
1092 StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
1093 L"%S",
1094 PartType);
1095 }
1096 TreeList_SetItemText(hWndList, htiPart, 1, LineBuffer);
1097
1098 /* Format the partition size */
1099 PartSize = GetPartEntrySizeInBytes(PartEntry);
1100 if (!StrFormatByteSizeW(PartSize, LineBuffer, ARRAYSIZE(LineBuffer)))
1101 {
1102 /* We failed for whatever reason, do the hardcoded way */
1103 PCWSTR Unit;
1104 PrettifySize2(&PartSize, &Unit);
1105 StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
1106 L"%6I64u %s",
1107 PartSize, Unit);
1108 }
1109 TreeList_SetItemText(hWndList, htiPart, 2, LineBuffer);
1110
1111 /* Volume status */
1112 *LineBuffer = 0;
1113 if (PartEntry->IsPartitioned)
1114 {
1115 StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
1116 // MUIGetString(STRING_HDDINFOUNK5),
1117 PartEntry->BootIndicator ? L"Active" : L"");
1118 }
1119 TreeList_SetItemText(hWndList, htiPart, 3, LineBuffer);
1120
1121
1122 /* If this is the single extended partition of an MBR disk,
1123 * recursively display its logical partitions */
1124 if (PartEntry == DiskEntry->ExtendedPartition)
1125 {
1126 PLIST_ENTRY LogicalEntry;
1127 PPARTENTRY LogicalPartEntry;
1128
1129 for (LogicalEntry = DiskEntry->LogicalPartListHead.Flink;
1130 LogicalEntry != &DiskEntry->LogicalPartListHead;
1131 LogicalEntry = LogicalEntry->Flink)
1132 {
1133 LogicalPartEntry = CONTAINING_RECORD(LogicalEntry, PARTENTRY, ListEntry);
1134 PrintPartitionData(hWndList, htiPart, NULL, LogicalPartEntry);
1135 }
1136
1137 /* Expand the extended partition node */
1139 }
1140
1141 return htiPart;
1142}
1143
1148static
1149VOID
1152 _In_ TLITEMW* ptlItem)
1153{
1154 PPARTITEM PartItem;
1155
1156 /* Code below is equivalent to: PartItem = GetItemPartition(hWndList, ptlItem->hItem);
1157 * except that we already have the data structure in ptlItem->lParam, so there is
1158 * no need to call extra helpers as GetItemPartition() does. */
1159 HTLITEM hParentItem = TreeList_GetParent(hWndList, ptlItem->hItem);
1160 /* May or may not be a PPARTITEM: this is a PPARTITEM only when hParentItem != NULL */
1161 PartItem = (PPARTITEM)ptlItem->lParam;
1162 if (!hParentItem || !PartItem)
1163 return;
1164
1165 if (PartItem->VolCreate)
1166 LocalFree(PartItem->VolCreate);
1167 LocalFree(PartItem);
1168}
1169
1170static
1171VOID
1174 _In_opt_ HTLITEM hInsertAfter,
1175 _In_ PDISKENTRY DiskEntry)
1176{
1177 BOOL Success;
1178 HANDLE hDevice;
1179 PCHAR DiskName = NULL;
1180 ULONG Length = 0;
1181 PPARTENTRY PrimaryPartEntry;
1182 PLIST_ENTRY PrimaryEntry;
1183 ULONGLONG DiskSize;
1184 HTLITEM htiDisk;
1185 WCHAR LineBuffer[128];
1186 UCHAR outBuf[512];
1187
1188 StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
1189 // L"\\Device\\Harddisk%lu\\Partition%lu",
1190 L"\\\\.\\PhysicalDrive%lu",
1191 DiskEntry->DiskNumber);
1192
1193 hDevice = CreateFileW(
1194 LineBuffer, // device interface name
1195 GENERIC_READ /*| GENERIC_WRITE*/, // dwDesiredAccess
1196 FILE_SHARE_READ | FILE_SHARE_WRITE, // dwShareMode
1197 NULL, // lpSecurityAttributes
1198 OPEN_EXISTING, // dwCreationDistribution
1199 0, // dwFlagsAndAttributes
1200 NULL // hTemplateFile
1201 );
1202 if (hDevice != INVALID_HANDLE_VALUE)
1203 {
1205
1206 Query.PropertyId = StorageDeviceProperty;
1207 Query.QueryType = PropertyStandardQuery;
1208
1209 Success = DeviceIoControl(hDevice,
1211 &Query,
1212 sizeof(Query),
1213 &outBuf,
1214 sizeof(outBuf),
1215 &Length,
1216 NULL);
1217 if (Success)
1218 {
1220 if (devDesc->ProductIdOffset)
1221 {
1222 DiskName = (PCHAR)&outBuf[devDesc->ProductIdOffset];
1223 Length -= devDesc->ProductIdOffset;
1224 DiskName[min(Length, strlen(DiskName))] = 0;
1225 // ( i = devDesc->ProductIdOffset; p[i] != 0 && i < Length; i++ )
1226 }
1227 }
1228
1229 CloseHandle(hDevice);
1230 }
1231
1232 if (DiskName && *DiskName)
1233 {
1234 if (DiskEntry->DriverName.Length > 0)
1235 {
1236 StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
1237 // MUIGetString(STRING_HDDINFO_1),
1238 L"Harddisk %lu (%S) (Port=%hu, Bus=%hu, Id=%hu) on %wZ",
1239 DiskEntry->DiskNumber,
1240 DiskName,
1241 DiskEntry->Port,
1242 DiskEntry->Bus,
1243 DiskEntry->Id,
1244 &DiskEntry->DriverName);
1245 }
1246 else
1247 {
1248 StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
1249 // MUIGetString(STRING_HDDINFO_2),
1250 L"Harddisk %lu (%S) (Port=%hu, Bus=%hu, Id=%hu)",
1251 DiskEntry->DiskNumber,
1252 DiskName,
1253 DiskEntry->Port,
1254 DiskEntry->Bus,
1255 DiskEntry->Id);
1256 }
1257 }
1258 else
1259 {
1260 if (DiskEntry->DriverName.Length > 0)
1261 {
1262 StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
1263 // MUIGetString(STRING_HDDINFO_1),
1264 L"Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu) on %wZ",
1265 DiskEntry->DiskNumber,
1266 DiskEntry->Port,
1267 DiskEntry->Bus,
1268 DiskEntry->Id,
1269 &DiskEntry->DriverName);
1270 }
1271 else
1272 {
1273 StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
1274 // MUIGetString(STRING_HDDINFO_2),
1275 L"Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu)",
1276 DiskEntry->DiskNumber,
1277 DiskEntry->Port,
1278 DiskEntry->Bus,
1279 DiskEntry->Id);
1280 }
1281 }
1282
1283 htiDisk = TreeListAddItem(hWndList, NULL, hInsertAfter,
1284 LineBuffer, 0, 0,
1285 (LPARAM)DiskEntry);
1286
1287 /* Disk type: MBR, GPT or RAW (Uninitialized) */
1288 TreeList_SetItemText(hWndList, htiDisk, 1,
1289 DiskEntry->DiskStyle == PARTITION_STYLE_MBR ? L"MBR" :
1290 DiskEntry->DiskStyle == PARTITION_STYLE_GPT ? L"GPT" :
1291 L"RAW");
1292
1293 /* Format the disk size */
1294 DiskSize = GetDiskSizeInBytes(DiskEntry);
1295 if (!StrFormatByteSizeW(DiskSize, LineBuffer, ARRAYSIZE(LineBuffer)))
1296 {
1297 /* We failed for whatever reason, do the hardcoded way */
1298 PCWSTR Unit;
1299 PrettifySize1(&DiskSize, &Unit);
1300 StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
1301 L"%6I64u %s",
1302 DiskSize, Unit);
1303 }
1304 TreeList_SetItemText(hWndList, htiDisk, 2, LineBuffer);
1305
1306 /* Print partition lines */
1307 for (PrimaryEntry = DiskEntry->PrimaryPartListHead.Flink;
1308 PrimaryEntry != &DiskEntry->PrimaryPartListHead;
1309 PrimaryEntry = PrimaryEntry->Flink)
1310 {
1311 PrimaryPartEntry = CONTAINING_RECORD(PrimaryEntry, PARTENTRY, ListEntry);
1312
1313 /* If this is an extended partition, recursively print the logical partitions */
1314 PrintPartitionData(hWndList, htiDisk, NULL, PrimaryPartEntry);
1315 }
1316
1317 /* Expand the disk node */
1319}
1320
1321static VOID
1325{
1326 const DWORD dwStyle = TVS_HASBUTTONS | /*TVS_HASLINES | TVS_LINESATROOT |*/ TVS_SHOWSELALWAYS | TVS_FULLROWSELECT;
1327 const DWORD dwExStyle = TVS_EX_FULLROWMARK /* | TVS_EX_FULLROWITEMS*/;
1328 HIMAGELIST hSmall;
1329
1330 /* Set the TreeList styles and fixup the item selection color */
1332 // TreeList_SetStyleEx(hWndList, dwStyle, dwStyle);
1335
1336 /* Initialize its columns */
1338 hWndList,
1339 column_ids,
1343
1344 /* Create the ImageList */
1347 ILC_COLOR32 | ILC_MASK, // ILC_COLOR24
1348 1, 1);
1349
1350 /* Add event type icons to the ImageList */
1353
1354 /* Assign the ImageList to the List View */
1356}
1357
1358static VOID
1362{
1364 PDISKENTRY DiskEntry;
1365
1366 /* Clear the list first */
1368
1369 /* Insert all the detected disks and partitions */
1370 for (Entry = List->DiskListHead.Flink;
1371 Entry != &List->DiskListHead;
1372 Entry = Entry->Flink)
1373 {
1374 DiskEntry = CONTAINING_RECORD(Entry, DISKENTRY, ListEntry);
1375
1376 /* Print disk entry */
1377 PrintDiskData(hWndList, NULL, DiskEntry);
1378 }
1379
1380 /* Select the first item */
1381 // TreeList_SetFocusItem(hWndList, 1, 1);
1383}
1384
1385static VOID
1388{
1389 HIMAGELIST hSmall;
1390
1391 /* Cleanup all the items. Their cached data will be automatically deleted
1392 * on response to the TVN_DELETEITEM notification sent by the TreeList
1393 * by DeleteTreeItem() */
1395
1396 /* And cleanup the imagelist */
1399 ImageList_Destroy(hSmall);
1400}
1401
1402
1408static BOOLEAN
1410 _In_ HWND hList,
1412 _Inout_ HTLITEM* phItem,
1413 _Inout_opt_ PPARTITEM* pPartItem,
1414 _In_opt_ ULONGLONG SizeBytes,
1416{
1418 PPARTITEM PartItem;
1419 PPARTENTRY PartEntry;
1420 HTLITEM hParentItem;
1421 HTLITEM hInsertAfter;
1422 PPARTENTRY NextPart;
1423
1424 PartItem = (pPartItem ? *pPartItem : GetItemPartition(hList, *phItem));
1425 if (!PartItem)
1426 {
1427 /* We must have a disk region... */
1428 ASSERT(FALSE);
1429 return FALSE;
1430 }
1431 PartEntry = PartItem->PartEntry;
1432#if 0
1433 if (PartEntry->IsPartitioned)
1434 {
1435 /* Don't create a partition when one already exists */
1436 ASSERT(FALSE);
1437 return FALSE;
1438 }
1439 ASSERT(!PartEntry->Volume);
1440#endif
1441
1443 PartEntry,
1444 SizeBytes,
1446 if (!Success)
1447 return Success;
1448
1449 /* Retrieve the parent item (disk or MBR extended partition) */
1450 hParentItem = TreeList_GetParent(hList, *phItem);
1451 hInsertAfter = TreeList_GetPrevSibling(hList, *phItem);
1452 if (!hInsertAfter)
1453 hInsertAfter = TVI_FIRST;
1454
1455 /*
1456 * The current entry has been recreated and maybe split
1457 * in two: new partition and remaining unused space.
1458 * Thus, recreate the current entry.
1459 *
1460 * NOTE: Since we create a partition we don't care
1461 * about its previous PartItem, so it can be deleted.
1462 */
1463 {
1464 /* Cache out the original item's volume create info */
1465 PVOL_CREATE_INFO VolCreate = PartItem->VolCreate;
1466 PartItem->VolCreate = NULL;
1467
1468 /* Remove the current item */
1469 TreeList_DeleteItem(hList, *phItem);
1470
1471 /* Recreate the entry */
1472 *phItem = PrintPartitionData(hList, hParentItem, hInsertAfter, PartEntry);
1473
1474 /* Retrieve the new PartItem and restore the volume create
1475 * information associated to the newly-created partition */
1476 PartItem = GetItemPartition(hList, *phItem);
1477 ASSERT(PartItem);
1478
1479 /* Update the volume associated to the create information */
1480 if (VolCreate)
1481 VolCreate->Volume = PartItem->Volume;
1482
1483 /* Restore the volume create information */
1484 PartItem->VolCreate = VolCreate;
1485
1486 if (pPartItem)
1487 *pPartItem = PartItem;
1488 }
1489
1490 /* Add also the following unused space, if any */
1491 // NextPart = GetAdjDiskRegion(NULL, PartEntry, ENUM_REGION_NEXT);
1492 NextPart = GetAdjUnpartitionedEntry(PartEntry, TRUE);
1493 if (NextPart /*&& !NextPart->IsPartitioned*/)
1494 PrintPartitionData(hList, hParentItem, *phItem, NextPart);
1495
1496 /* Give the focus on and select the created partition */
1497 // TreeList_SetFocusItem(hList, 1, 1);
1498 TreeList_SelectItem(hList, *phItem);
1499
1500 return TRUE;
1501}
1502
1508static BOOLEAN
1510 _In_ HWND hList,
1512 _Inout_ HTLITEM* phItem,
1513 _In_ PPARTITEM PartItem)
1514{
1515 PPARTENTRY PartEntry = PartItem->PartEntry;
1516 PPARTENTRY PrevPart, NextPart;
1517 BOOLEAN PrevIsPartitioned, NextIsPartitioned;
1519
1520 HTLITEM hParentItem;
1521 HTLITEM hInsertAfter;
1522 HTLITEM hAdjItem;
1523 PPARTITEM AdjPartItem;
1524
1525#if 0
1526 if (!PartEntry->IsPartitioned)
1527 {
1528 /* Don't delete an unpartitioned disk region */
1529 ASSERT(FALSE);
1530 return FALSE;
1531 }
1532#endif
1533
1534 /*
1535 * Determine the nature of the previous and next disk regions,
1536 * in order to know what to do on the corresponding tree items
1537 * after the selected partition has been deleted.
1538 *
1539 * NOTE: Don't reference these pointers after DeletePartition(),
1540 * since these disk regions might have been coalesced/reallocated.
1541 * However we can check whether they were NULL or not.
1542 */
1543 // PrevPart = GetAdjDiskRegion(NULL, PartEntry, ENUM_REGION_PREV);
1544 // NextPart = GetAdjDiskRegion(NULL, PartEntry, ENUM_REGION_NEXT);
1545 PrevPart = GetAdjUnpartitionedEntry(PartEntry, FALSE);
1546 NextPart = GetAdjUnpartitionedEntry(PartEntry, TRUE);
1547
1548 PrevIsPartitioned = (PrevPart && PrevPart->IsPartitioned);
1549 NextIsPartitioned = (NextPart && NextPart->IsPartitioned);
1550
1551 ASSERT(PartEntry->IsPartitioned); // The current partition must be partitioned.
1553 PartEntry,
1554 &PartEntry);
1555 if (!Success)
1556 return Success;
1557
1558 /* Retrieve the parent item (disk or MBR extended partition) */
1559 hParentItem = TreeList_GetParent(hList, *phItem);
1560
1561 /* If previous sibling isn't partitioned, remove it */
1562 if (PrevPart && !PrevIsPartitioned)
1563 {
1564 hAdjItem = TreeList_GetPrevSibling(hList, *phItem);
1565 ASSERT(hAdjItem); // TODO: Investigate
1566 if (hAdjItem)
1567 {
1568 AdjPartItem = GetItemPartition(hList, hAdjItem);
1569 ASSERT(AdjPartItem && (AdjPartItem->PartEntry == PrevPart));
1570 AdjPartItem = NULL;
1571 TreeList_DeleteItem(hList, hAdjItem);
1572 }
1573 }
1574 /* If next sibling isn't partitioned, remove it */
1575 if (NextPart && !NextIsPartitioned)
1576 {
1577 hAdjItem = TreeList_GetNextSibling(hList, *phItem);
1578 ASSERT(hAdjItem); // TODO: Investigate
1579 if (hAdjItem)
1580 {
1581 AdjPartItem = GetItemPartition(hList, hAdjItem);
1582 ASSERT(AdjPartItem && (AdjPartItem->PartEntry == NextPart));
1583 AdjPartItem = NULL;
1584 TreeList_DeleteItem(hList, hAdjItem);
1585 }
1586 }
1587
1588 /* We are going to insert the updated entry after
1589 * either, the original previous sibling (if it is
1590 * partitioned), or the second-previous sibling
1591 * (if the first one was already removed, see above) */
1592 hInsertAfter = TreeList_GetPrevSibling(hList, *phItem);
1593 if (!hInsertAfter)
1594 hInsertAfter = TVI_FIRST;
1595
1596 /* Remove the current item */
1597 TreeList_DeleteItem(hList, *phItem);
1598
1599 /* Add back the "new" unpartitioned space */
1600 *phItem = PrintPartitionData(hList, hParentItem, hInsertAfter, PartEntry);
1601
1602 /* Give the focus on and select the unpartitioned space */
1603 // TreeList_SetFocusItem(hList, 1, 1);
1604 TreeList_SelectItem(hList, *phItem);
1605
1606 return TRUE;
1607}
1608
1609
1610INT_PTR
1613 _In_ HWND hwndDlg,
1614 _In_ UINT uMsg,
1617{
1618 PSETUPDATA pSetupData;
1619 HWND hList;
1620
1621 /* Retrieve pointer to the global setup data */
1622 pSetupData = (PSETUPDATA)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
1623
1624 switch (uMsg)
1625 {
1626 case WM_INITDIALOG:
1627 {
1628 /* Save pointer to the global setup data */
1629 pSetupData = (PSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
1630 SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (LONG_PTR)pSetupData);
1631
1632 /* Initially hide and disable all partitioning buttons */
1633 ShowDlgItem(hwndDlg, IDC_INITDISK, SW_HIDE);
1634 EnableDlgItem(hwndDlg, IDC_INITDISK, FALSE);
1641
1642 /* Initialize the partitions list */
1643 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
1645 InitPartitionList(pSetupData->hInstance, hList);
1646 DrawPartitionList(hList, pSetupData->PartitionList);
1647
1648 // HACK: Wine "kwality" code doesn't still implement
1649 // PSN_QUERYINITIALFOCUS so we "emulate" its call there...
1650 {
1651 PSHNOTIFY pshn = {{hwndDlg, GetWindowLong(hwndDlg, GWL_ID), PSN_QUERYINITIALFOCUS}, (LPARAM)hList};
1652 SendMessageW(hwndDlg, WM_NOTIFY, (WPARAM)pshn.hdr.idFrom, (LPARAM)&pshn);
1653 }
1654 break;
1655 }
1656
1657 case WM_DESTROY:
1658 {
1659 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
1663 return TRUE;
1664 }
1665
1666 case WM_COMMAND:
1667 {
1668 switch (LOWORD(wParam))
1669 {
1670 case IDC_PARTMOREOPTS:
1671 {
1672 DialogBoxParamW(pSetupData->hInstance,
1674 hwndDlg,
1676 (LPARAM)pSetupData);
1677 break;
1678 }
1679
1680 case IDC_INITDISK:
1681 {
1682 // TODO: Implement disk partitioning initialization
1683 break;
1684 }
1685
1686 case IDC_PARTCREATE:
1687 {
1688 HTLITEM hItem;
1689 PPARTITEM PartItem;
1690 PPARTENTRY PartEntry;
1691 ULONGLONG PartSize;
1692 ULONGLONG MaxPartSize;
1693 ULONG MaxSizeMB;
1694 INT_PTR ret;
1695 PARTCREATE_CTX PartCreateCtx = {0};
1696
1697 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
1698 PartItem = GetSelectedPartition(hList, &hItem);
1699 if (!PartItem)
1700 {
1701 /* If the button was clicked, an empty disk
1702 * region should have been selected first */
1703 ASSERT(FALSE);
1704 break;
1705 }
1706 PartEntry = PartItem->PartEntry;
1707 if (PartEntry->IsPartitioned)
1708 {
1709 /* Don't create a partition when one already exists */
1710 ASSERT(FALSE);
1711 break;
1712 }
1713 ASSERT(!PartEntry->Volume);
1714
1715 /* Get the partition info stored in the TreeList */
1716 PartCreateCtx.PartItem = PartItem;
1717
1718 /* Retrieve the maximum size in MB (rounded up) the partition can have */
1719 MaxPartSize = GetPartEntrySizeInBytes(PartEntry);
1720 MaxSizeMB = (ULONG)RoundingDivide(MaxPartSize, MB);
1721 PartCreateCtx.MaxSizeMB = MaxSizeMB;
1722
1723 /* Don't force formatting by default */
1724 PartCreateCtx.ForceFormat = FALSE;
1725
1726 /* Show the partitioning dialog */
1727 ret = DialogBoxParamW(pSetupData->hInstance,
1729 hwndDlg,
1731 (LPARAM)&PartCreateCtx);
1732 if (ret != IDOK)
1733 break;
1734
1735 /*
1736 * If the input size, given in MB, specifies the maximum partition
1737 * size, it may slightly under- or over-estimate the latter due to
1738 * rounding error. In this case, use all of the unpartitioned space.
1739 * Otherwise, directly convert the size to bytes.
1740 */
1741 PartSize = PartCreateCtx.PartSizeMB;
1742 if (PartSize == MaxSizeMB)
1743 PartSize = MaxPartSize;
1744 else // if (PartSize < MaxSizeMB)
1745 PartSize *= MB;
1746
1747 ASSERT(PartSize <= MaxPartSize);
1748
1749 if (!DoCreatePartition(hList, pSetupData->PartitionList,
1750 &hItem, &PartItem,
1751 PartSize,
1752 !PartCreateCtx.MBRExtPart
1753 ? 0 : PARTITION_EXTENDED))
1754 {
1755 DisplayError(GetParent(hwndDlg),
1758 }
1759
1760 break;
1761 }
1762
1763 case IDC_PARTFORMAT:
1764 {
1765 HTLITEM hItem;
1766 PPARTITEM PartItem;
1767 PPARTENTRY PartEntry;
1768 INT_PTR ret;
1769 PARTCREATE_CTX PartCreateCtx = {0};
1770
1771 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
1772 PartItem = GetSelectedPartition(hList, &hItem);
1773 if (!PartItem)
1774 {
1775 /* If the button was clicked, an empty disk
1776 * region should have been selected first */
1777 ASSERT(FALSE);
1778 break;
1779 }
1780 PartEntry = PartItem->PartEntry;
1781 if (!PartEntry->Volume)
1782 {
1783 /* Don't format an unformattable partition */
1784 ASSERT(FALSE);
1785 break;
1786 }
1787
1788 /* Show the formatting dialog */
1789 PartCreateCtx.PartItem = PartItem;
1790 ret = DialogBoxParamW(pSetupData->hInstance,
1792 hwndDlg,
1794 (LPARAM)&PartCreateCtx);
1796 break;
1797 }
1798
1799 case IDC_PARTDELETE:
1800 {
1801 PPARTITEM PartItem;
1802 PPARTENTRY PartEntry;
1803 HTLITEM hItem;
1804 UINT uIDWarnMsg;
1805
1806 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
1807 PartItem = GetSelectedPartition(hList, &hItem);
1808 if (!PartItem)
1809 {
1810 // If the button was clicked, a partition
1811 // should have been selected first...
1812 ASSERT(FALSE);
1813 break;
1814 }
1815 PartEntry = PartItem->PartEntry;
1816 if (!PartEntry->IsPartitioned)
1817 {
1818 /* Don't delete an unpartitioned disk region */
1819 ASSERT(FALSE);
1820 break;
1821 }
1822
1823 /* Choose the correct warning message to display:
1824 * MBR-extended (container) vs. standard partition */
1825 if (PartEntry == PartEntry->DiskEntry->ExtendedPartition)
1827 else
1828 uIDWarnMsg = IDS_WARN_DELETE_PARTITION;
1829
1830 /* If the user really wants to delete the partition... */
1831 if (DisplayMessage(GetParent(hwndDlg),
1834 MAKEINTRESOURCEW(uIDWarnMsg)) == IDYES)
1835 {
1836 /* ... make it so! */
1837 if (!DoDeletePartition(hList, pSetupData->PartitionList,
1838 &hItem, PartItem))
1839 {
1840 // TODO: Show error if partition couldn't be deleted?
1841 }
1842 }
1843
1844 break;
1845 }
1846 }
1847 break;
1848 }
1849
1850 case WM_NOTIFY:
1851 {
1852 LPNMHDR lpnm = (LPNMHDR)lParam;
1853
1854 // On Vista+ we can use TVN_ITEMCHANGED instead, with NMTVITEMCHANGE* pointer
1855 if (lpnm->idFrom == IDC_PARTITION && lpnm->code == TVN_SELCHANGED)
1856 {
1858
1859 // if (!(pnmv->uChanged & TVIF_STATE)) /* The state has changed */
1860 if (!(pnmv->itemNew.mask & TVIF_STATE))
1861 break;
1862
1863 /* The item has been (de)selected */
1864 // if (pnmv->uNewState & TVIS_SELECTED)
1865 if (pnmv->itemNew.state & TVIS_SELECTED)
1866 {
1867 HTLITEM hParentItem = TreeList_GetParent(lpnm->hwndFrom, pnmv->itemNew.hItem);
1868 /* May or may not be a PPARTENTRY: this is a PPARTENTRY only when hParentItem != NULL */
1869
1870 if (!hParentItem)
1871 {
1872 /* Hard disk */
1873 PDISKENTRY DiskEntry = (PDISKENTRY)pnmv->itemNew.lParam;
1874 ASSERT(DiskEntry);
1875
1876 /* Show the "Initialize" disk button and hide and disable the others */
1877 ShowDlgItem(hwndDlg, IDC_INITDISK, SW_SHOW);
1878
1879#if 0 // FIXME: Init disk not implemented yet!
1880 EnableDlgItem(hwndDlg, IDC_INITDISK,
1881 DiskEntry->DiskStyle == PARTITION_STYLE_RAW);
1882#else
1883 EnableDlgItem(hwndDlg, IDC_INITDISK, FALSE);
1884#endif
1885
1888
1891
1894
1895 /* Disable the "Next" button */
1896 goto DisableWizNext;
1897 }
1898 else
1899 {
1900 /* Partition or unpartitioned space */
1901 PPARTITEM PartItem = (PPARTITEM)pnmv->itemNew.lParam;
1902 PPARTENTRY PartEntry;
1903 ASSERT(PartItem);
1904 PartEntry = PartItem->PartEntry;
1905 ASSERT(PartEntry);
1906
1907 /* Hide and disable the "Initialize" disk button */
1908 ShowDlgItem(hwndDlg, IDC_INITDISK, SW_HIDE);
1909 EnableDlgItem(hwndDlg, IDC_INITDISK, FALSE);
1910
1911 if (!PartEntry->IsPartitioned)
1912 {
1913 /* Show and enable the "Create" partition button */
1916
1917 /* Hide and disable the "Format" button */
1920 }
1921 else
1922 {
1923 /* Hide and disable the "Create" partition button */
1926
1927 /* Show the "Format" button, but enable or disable it if a formattable volume is present */
1929 EnableDlgItem(hwndDlg, IDC_PARTFORMAT, !!PartEntry->Volume);
1930 }
1931
1932 /* Show the "Delete" partition button, but enable or disable it if the disk region is partitioned */
1934 EnableDlgItem(hwndDlg, IDC_PARTDELETE, PartEntry->IsPartitioned);
1935
1936 /*
1937 * Enable the "Next" button if:
1938 *
1939 * 1. the selected disk region is partitioned:
1940 * it can either have a volume attached (and be either
1941 * formatted or ready to be formatted),
1942 * or it's not yet formatted (the installer will prompt
1943 * for formatting parameters).
1944 *
1945 * 2. Or, the selected disk region is not partitioned but
1946 * can be partitioned according to the disk's partitioning
1947 * scheme (the installer will auto-partition the region
1948 * and prompt for formatting parameters).
1949 *
1950 * In all other cases, the "Next" button is disabled.
1951 */
1952
1953 // TODO: In the future: first test needs to be augmented with:
1954 // (... && PartEntry->Volume->IsSimpleVolume)
1955 if ((PartEntry->IsPartitioned && PartEntry->Volume) ||
1956 (!PartEntry->IsPartitioned && (PartitionCreateChecks(PartEntry, 0ULL, 0) == NOT_AN_ERROR)))
1957 {
1958 // ASSERT(PartEntry != PartEntry->DiskEntry->ExtendedPartition);
1959 ASSERT(!IsContainerPartition(PartEntry->PartitionType));
1961 }
1962 else
1963 {
1964 goto DisableWizNext;
1965 }
1966 }
1967 }
1968 else
1969 {
1970DisableWizNext:
1971 /* Keep the "Next" button disabled. It will be enabled
1972 * only when the user selects a valid partition. */
1974 }
1975
1976 break;
1977 }
1978
1979 if (lpnm->idFrom == IDC_PARTITION && lpnm->code == TVN_DELETEITEM)
1980 {
1981 /* Deleting an item from the partition list */
1983 DeleteTreeItem(lpnm->hwndFrom, (TLITEMW*)&pnmv->itemOld);
1984 break;
1985 }
1986
1987 switch (lpnm->code)
1988 {
1989 case PSN_SETACTIVE:
1990 {
1991 /* Keep the "Next" button disabled. It will be enabled
1992 * only when the user selects a valid partition. */
1994 break;
1995 }
1996
1998 {
1999 /* Give the focus on and select the first item */
2000 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
2001 // TreeList_SetFocusItem(hList, 1, 1);
2004 return TRUE;
2005 }
2006
2007 case PSN_QUERYCANCEL:
2008 {
2009 if (DisplayMessage(GetParent(hwndDlg),
2013 {
2014 /* Go to the Terminate page */
2016 }
2017
2018 /* Do not close the wizard too soon */
2020 return TRUE;
2021 }
2022
2023 case PSN_WIZNEXT: /* Set the selected data */
2024 {
2025 HTLITEM hItem;
2026 PPARTITEM PartItem;
2027 PPARTENTRY PartEntry;
2028
2029 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
2030 PartItem = GetSelectedPartition(hList, &hItem);
2031 if (!PartItem)
2032 {
2033 /* Fail and don't continue the installation */
2034 SetWindowLongPtrW(hwndDlg, DWLP_MSGRESULT, -1);
2035 return TRUE;
2036 }
2037 PartEntry = PartItem->PartEntry;
2038 ASSERT(PartEntry);
2039
2040 /*
2041 * Check whether the user wants to install ReactOS on a disk that
2042 * is not recognized by the computer's firmware and if so, display
2043 * a warning since such disks may not be bootable.
2044 */
2045 if (PartEntry->DiskEntry->MediaType == FixedMedia &&
2046 !PartEntry->DiskEntry->BiosFound)
2047 {
2048 INT nRet;
2049
2050 nRet = DisplayMessage(hwndDlg,
2052 L"Warning",
2053 L"The disk you have selected for installing ReactOS\n"
2054 L"is not visible by the firmware of your computer,\n"
2055 L"and so may not be bootable.\n"
2056 L"\nClick on OK to continue anyway."
2057 L"\nClick on CANCEL to go back to the partitions list.");
2058 if (nRet != IDOK)
2059 {
2060 /* Fail and don't continue the installation */
2061 SetWindowLongPtrW(hwndDlg, DWLP_MSGRESULT, -1);
2062 return TRUE;
2063 }
2064 }
2065
2066 /* If this is an empty region, auto-create the partition if conditions are OK */
2067 if (!PartEntry->IsPartitioned)
2068 {
2069 ULONG Error;
2070
2071 Error = PartitionCreateChecks(PartEntry, 0ULL, 0);
2072 if (Error != NOT_AN_ERROR)
2073 {
2074 // MUIDisplayError(Error, Ir, POPUP_WAIT_ANY_KEY);
2076 L"Could not create a partition on the selected disk region");
2077
2078 /* Fail and don't continue the installation */
2079 SetWindowLongPtrW(hwndDlg, DWLP_MSGRESULT, -1);
2080 return TRUE;
2081 }
2082
2083 /* Automatically create the partition on the whole empty space;
2084 * it will be formatted later with default parameters */
2085 if (!DoCreatePartition(hList, pSetupData->PartitionList,
2086 &hItem, &PartItem,
2087 0ULL,
2088 0))
2089 {
2090 DisplayError(GetParent(hwndDlg),
2093
2094 /* Fail and don't continue the installation */
2095 SetWindowLongPtrW(hwndDlg, DWLP_MSGRESULT, -1);
2096 return TRUE;
2097 }
2098 /* Update PartEntry */
2099 PartEntry = PartItem->PartEntry;
2100 }
2101
2102 ASSERT(PartEntry->IsPartitioned);
2103 // ASSERT(PartEntry != PartEntry->DiskEntry->ExtendedPartition);
2105 ASSERT(PartEntry->Volume);
2106
2107#if 0 // TODO: Implement!
2108 if (!IsPartitionLargeEnough(PartEntry))
2109 {
2112
2113 /* Fail and don't continue the installation */
2114 SetWindowLongPtrW(hwndDlg, DWLP_MSGRESULT, -1);
2115 return TRUE;
2116 }
2117#endif
2118
2119 /* Force formatting only if the partition doesn't have a volume (may or may not be formatted) */
2120 if (PartEntry->Volume &&
2121 ((PartEntry->Volume->FormatState == Formatted) ||
2122 (PartItem->VolCreate && *PartItem->VolCreate->FileSystemName)))
2123 {
2124 /*NOTHING*/;
2125 }
2126 else /* Request formatting of the selected region if it's not already formatted */
2127 {
2128 INT_PTR ret;
2129 PARTCREATE_CTX PartCreateCtx = {0};
2130
2131 /* Show the formatting dialog */
2132 PartCreateCtx.PartItem = PartItem;
2133 ret = DialogBoxParamW(pSetupData->hInstance,
2135 hwndDlg,
2137 (LPARAM)&PartCreateCtx);
2138
2139 /* If the user refuses to format the partition,
2140 * fail and don't continue the installation */
2141 if (ret != IDOK)
2142 {
2143 SetWindowLongPtrW(hwndDlg, DWLP_MSGRESULT, -1);
2144 return TRUE;
2145 }
2146
2147 /* The partition will be formatted */
2148 }
2149
2150 InstallPartition = PartEntry;
2151 break;
2152 }
2153
2154 default:
2155 break;
2156 }
2157 break;
2158 }
2159
2160 default:
2161 break;
2162 }
2163
2164 return FALSE;
2165}
2166
2167/* 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
PCSTR NTAPI LookupPartitionTypeString(_In_ PARTITION_STYLE PartitionStyle, _In_ PVOID PartitionType)
Definition: partinfo.c:804
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:232
SETUPDATA SetupData
Definition: reactos.c:41
#define ShowDlgItem(hDlg, nID, nCmdShow)
Definition: reactos.h:51
struct _SETUPDATA * PSETUPDATA
#define IDC_CHECK_MBREXTPART
Definition: resource.h:77
#define IDS_BOOTLOADER_MBRVBR
Definition: resource.h:120
#define IDS_BOOTLOADER_SYSTEM
Definition: resource.h:119
#define IDD_RESTARTPAGE
Definition: resource.h:65
#define IDC_FSTYPE
Definition: resource.h:79
#define IDI_PARTITION
Definition: resource.h:12
#define IDS_WARN_DELETE_PARTITION
Definition: resource.h:166
#define IDC_INITDISK
Definition: resource.h:42
#define IDC_FS_STATIC
Definition: resource.h:78
#define IDS_ERROR_INVALID_INSTALLDIR_CHAR
Definition: resource.h:155
#define IDC_PARTMOREOPTS
Definition: resource.h:47
#define IDS_ERROR_CREATE_PARTITION_TITLE
Definition: resource.h:162
#define IDC_CHECK_QUICKFMT
Definition: resource.h:80
#define IDC_PARTDELETE
Definition: resource.h:45
#define IDS_WARN_DELETE_PARTITION_TITLE
Definition: resource.h:165
#define IDS_ERROR_CREATE_PARTITION
Definition: resource.h:163
#define IDS_BOOTLOADER_VBRONLY
Definition: resource.h:121
#define IDC_PARTITION
Definition: resource.h:41
#define IDD_FORMAT
Definition: resource.h:82
#define IDC_PATH
Definition: resource.h:70
#define IDC_INSTFREELDR
Definition: resource.h:71
#define IDD_ADVINSTOPTS
Definition: resource.h:69
#define IDI_DISKDRIVE
Definition: resource.h:11
#define IDC_PARTFORMAT
Definition: resource.h:44
#define IDC_PARTCREATE
Definition: resource.h:43
#define IDS_ABORTSETUP2
Definition: resource.h:102
#define IDS_ERROR_DIRECTORY_NAME_TITLE
Definition: resource.h:158
#define IDC_UPDOWN_PARTSIZE
Definition: resource.h:75
#define IDS_ABORTSETUP
Definition: resource.h:101
#define IDD_PARTITION
Definition: resource.h:73
#define IDS_WARN_DELETE_MBR_EXTENDED_PARTITION
Definition: resource.h:167
#define IDS_ERROR_DIRECTORY_NAME
Definition: resource.h:159
#define IDS_ERROR_INVALID_INSTALLDIR_CHAR_TITLE
Definition: resource.h:154
#define IDS_BOOTLOADER_NOINST
Definition: resource.h:117
#define IDS_VOLUME_NOFORMAT
Definition: resource.h:105
BOOL Error
Definition: chkdsk.c:66
PWCHAR FileSystem
Definition: format.c:72
#define PARTITION_ENTRY_UNUSED
Definition: disk.h:87
#define PARTITION_EXTENDED
Definition: disk.h:92
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
LPWSTR WINAPI StrFormatByteSizeW(LONGLONG llBytes, LPWSTR lpszDest, UINT cchMax)
Definition: string.c:2394
static VOID ShowErrorTip(_In_ HWND hEdit)
Definition: drivepage.c:133
static VOID InitPartitionList(_In_ HINSTANCE hInstance, _In_ HWND hWndList)
Definition: drivepage.c:1322
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:1509
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:1612
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:923
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:1409
#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:976
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:1359
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:1386
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:1172
static VOID DeleteTreeItem(_In_ HWND hWndList, _In_ TLITEMW *ptlItem)
Called on response to the TVN_DELETEITEM notification sent by the TreeList.
Definition: drivepage.c:1150
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:946
@ 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:65
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
__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:391
#define DBG_UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:326
#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
#define __fallthrough
Definition: sal_old.h:314
_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 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:2881
ULONGLONG RoundingDivide(IN ULONGLONG Dividend, IN ULONGLONG Divisor)
Definition: partlist.c:95
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:2791
BOOLEAN NTAPI CreatePartition(_In_ PPARTLIST List, _Inout_ PPARTENTRY PartEntry, _In_opt_ ULONGLONG SizeBytes, _In_opt_ ULONG_PTR PartitionInfo)
Definition: partlist.c:2910
BOOLEAN NTAPI DeletePartition(_In_ PPARTLIST List, _In_ PPARTENTRY PartEntry, _Out_opt_ PPARTENTRY *FreeRegion)
Definition: partlist.c:3001
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
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:148
HINSTANCE hInstance
Definition: reactos.h:136
PPARTLIST PartitionList
Definition: reactos.h:152
HWND hPartList
Definition: reactos.h:85
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 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:179
ULONG ClusterSize
Definition: reactos.h:191
BOOLEAN QuickFormat
Definition: reactos.h:190
PVOLENTRY Volume
Definition: reactos.h:180
WCHAR FileSystemName[MAX_PATH+1]
Definition: reactos.h:187
FMIFS_MEDIA_FLAG MediaFlag
Definition: reactos.h:188
PCWSTR Label
Definition: reactos.h:189
UINT_PTR idFrom
Definition: winuser.h:3169
UINT code
Definition: winuser.h:3170
HWND hwndFrom
Definition: winuser.h:3168
#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
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
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:44
#define POPUP_WAIT_ANY_KEY
Definition: usetup.h:122
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:1394
#define ZeroMemory
Definition: winbase.h:1743
#define LPTR
Definition: winbase.h:407
#define CopyMemory
Definition: winbase.h:1741
#define GMEM_MOVEABLE
Definition: winbase.h:320
#define GMEM_SHARE
Definition: winbase.h:331
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:1977
#define SW_HIDE
Definition: winuser.h:779
#define GetWindowLongPtrW
Definition: winuser.h:4840
#define WM_PASTE
Definition: winuser.h:1874
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:2447
#define GWL_ID
Definition: winuser.h:870
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:937
HANDLE WINAPI SetClipboardData(_In_ UINT, _In_opt_ HANDLE)
#define WM_COMMAND
Definition: winuser.h:1751
#define CB_ERR
Definition: winuser.h:2446
BOOL WINAPI CloseClipboard(void)
Definition: ntwrapper.h:178
#define CB_SETCURSEL
Definition: winuser.h:1972
#define SM_CYSMICON
Definition: winuser.h:1024
BOOL WINAPI OpenClipboard(_In_opt_ HWND)
#define CB_FINDSTRINGEXACT
Definition: winuser.h:1951
#define WM_INITDIALOG
Definition: winuser.h:1750
#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:1990
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:1845
#define CB_ADDSTRING
Definition: winuser.h:1947
struct tagNMHDR * LPNMHDR
#define CB_GETITEMDATA
Definition: winuser.h:1961
int WINAPI GetWindowTextLengthW(_In_ HWND)
#define GetWindowLong
Definition: winuser.h:5816
#define MB_OK
Definition: winuser.h:801
#define WM_CHAR
Definition: winuser.h:1728
#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:1936
#define SW_SHOW
Definition: winuser.h:786
#define WM_DESTROY
Definition: winuser.h:1620
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define CB_INSERTSTRING
Definition: winuser.h:1968
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2917
#define IDYES
Definition: winuser.h:846
#define CB_GETCURSEL
Definition: winuser.h:1954
#define SetWindowLongPtrW
Definition: winuser.h:5366
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:2413
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