ReactOS  0.4.14-dev-293-g2b39b42
drivepage.c File Reference
#include "reactos.h"
#include <shlwapi.h>
#include <ntddstor.h>
#include <ntddscsi.h>
#include "resource.h"
#include <debug.h>
Include dependency graph for drivepage.c:

Go to the source code of this file.

Macros

#define NDEBUG
 
#define IDS_LIST_COLUMN_FIRST   IDS_PARTITION_NAME
 
#define IDS_LIST_COLUMN_LAST   IDS_PARTITION_STATUS
 
#define MAX_LIST_COLUMNS   (IDS_LIST_COLUMN_LAST - IDS_LIST_COLUMN_FIRST + 1)
 

Functions

static INT_PTR CALLBACK MoreOptDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static INT_PTR CALLBACK PartitionDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
BOOL CreateTreeListColumns (IN HINSTANCE hInstance, IN HWND hWndTreeList, IN const UINT *pIDs, IN const INT *pColsWidth, IN const INT *pColsAlign, IN UINT nNumOfColumns)
 
VOID DisplayStuffUsingWin32Setup (HWND hwndDlg)
 
HTLITEM TreeListAddItem (IN HWND hTreeList, IN HTLITEM hParent, IN LPWSTR lpText, IN INT iImage, IN INT iSelectedImage, IN LPARAM lParam)
 
VOID GetPartTypeStringFromPartitionType (IN UCHAR partitionType, OUT PCHAR strPartType, IN ULONG cchPartType)
 
static HTLITEM PrintPartitionData (IN HWND hWndList, IN PPARTLIST List, IN HTLITEM htiParent, IN PDISKENTRY DiskEntry, IN PPARTENTRY PartEntry)
 
static VOID PrintDiskData (IN HWND hWndList, IN PPARTLIST List, IN PDISKENTRY DiskEntry)
 
VOID DrawPartitionList (IN HWND hWndList, IN PPARTLIST List)
 
INT_PTR CALLBACK DriveDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 

Variables

static const UINT column_ids [MAX_LIST_COLUMNS] = {IDS_LIST_COLUMN_FIRST, IDS_LIST_COLUMN_FIRST + 1, IDS_LIST_COLUMN_FIRST + 2, IDS_LIST_COLUMN_FIRST + 3}
 
static const INT column_widths [MAX_LIST_COLUMNS] = {200, 90, 60, 60}
 
static const INT column_alignment [MAX_LIST_COLUMNS] = {LVCFMT_LEFT, LVCFMT_LEFT, LVCFMT_RIGHT, LVCFMT_RIGHT}
 

Macro Definition Documentation

◆ IDS_LIST_COLUMN_FIRST

#define IDS_LIST_COLUMN_FIRST   IDS_PARTITION_NAME

Definition at line 41 of file drivepage.c.

◆ IDS_LIST_COLUMN_LAST

#define IDS_LIST_COLUMN_LAST   IDS_PARTITION_STATUS

Definition at line 42 of file drivepage.c.

◆ MAX_LIST_COLUMNS

#define MAX_LIST_COLUMNS   (IDS_LIST_COLUMN_LAST - IDS_LIST_COLUMN_FIRST + 1)

Definition at line 44 of file drivepage.c.

◆ NDEBUG

#define NDEBUG

Definition at line 36 of file drivepage.c.

Function Documentation

◆ CreateTreeListColumns()

BOOL CreateTreeListColumns ( IN HINSTANCE  hInstance,
IN HWND  hWndTreeList,
IN const UINT pIDs,
IN const INT pColsWidth,
IN const INT pColsAlign,
IN UINT  nNumOfColumns 
)

Definition at line 127 of file drivepage.c.

134 {
135  UINT i;
136  TLCOLUMN tlC;
137  WCHAR szText[50];
138 
139  /* Create the columns */
140  tlC.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
141  tlC.pszText = szText;
142 
143  /* Load the column labels from the resource file */
144  for (i = 0; i < nNumOfColumns; i++)
145  {
146  tlC.iSubItem = i;
147  tlC.cx = pColsWidth[i];
148  tlC.fmt = pColsAlign[i];
149 
151 
152  if (TreeList_InsertColumn(hWndTreeList, i, &tlC) == -1)
153  return FALSE;
154  }
155 
156  return TRUE;
157 }
#define TRUE
Definition: types.h:120
#define LVCF_WIDTH
Definition: commctrl.h:2583
#define LVCF_TEXT
Definition: commctrl.h:2584
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define TreeList_InsertColumn(h, i, p)
Definition: treelist.h:368
#define LVCF_SUBITEM
Definition: commctrl.h:2585
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
HINSTANCE hInstance
Definition: charmap.c:20
static const WCHAR szText[]
Definition: dialog.c:139
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define LVCF_FMT
Definition: commctrl.h:2582
unsigned int UINT
Definition: ndis.h:50
#define TLCOLUMN
Definition: treelist.h:459

Referenced by DriveDlgProc().

◆ DisplayStuffUsingWin32Setup()

VOID DisplayStuffUsingWin32Setup ( HWND  hwndDlg)

Definition at line 161 of file drivepage.c.

162 {
163  HDEVINFO h;
164  HWND hList;
165  SP_DEVINFO_DATA DevInfoData;
166  DWORD i;
167 
169  if (h == INVALID_HANDLE_VALUE)
170  return;
171 
172  hList = GetDlgItem(hwndDlg, IDC_PARTITION);
173  DevInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
174  for (i=0; SetupDiEnumDeviceInfo(h, i, &DevInfoData); i++)
175  {
176  DWORD DataT;
177  LPTSTR buffer = NULL;
178  DWORD buffersize = 0;
179 
181  &DevInfoData,
183  &DataT,
184  (PBYTE)buffer,
185  buffersize,
186  &buffersize))
187  {
189  {
190  if (buffer) LocalFree(buffer);
191  buffer = LocalAlloc(LPTR, buffersize * 2);
192  }
193  else
194  {
195  return;
196  }
197  }
198  if (buffer)
199  {
201  LocalFree(buffer);
202  }
203  }
205 }
#define IDC_PARTITION
Definition: resource.h:38
BOOL WINAPI SetupDiEnumDeviceInfo(HDEVINFO devinfo, DWORD index, PSP_DEVINFO_DATA info)
Definition: devinst.c:1792
#define LB_ADDSTRING
Definition: winuser.h:2013
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
GLuint buffer
Definition: glext.h:5915
#define SetupDiGetDeviceRegistryProperty
Definition: setupapi.h:2598
UINT_PTR WPARAM
Definition: windef.h:207
CHAR * LPTSTR
Definition: xmlstorage.h:192
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
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
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
struct _SP_DEVINFO_DATA SP_DEVINFO_DATA
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
BOOL WINAPI SetupDiDestroyDeviceInfoList(HDEVINFO devinfo)
Definition: devinst.c:2898
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetupDiGetClassDevs
Definition: setupapi.h:2588
#define SPDRP_DEVICEDESC
Definition: setupapi.h:502
HWND hList
Definition: livecd.c:10
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
static const GUID GUID_DEVCLASS_DISKDRIVE
Definition: drvdefext.cpp:29
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define LPTR
Definition: winbase.h:362
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1373
BYTE * PBYTE
Definition: pedump.c:66
#define DIGCF_PRESENT
Definition: setupapi.h:171
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

◆ DrawPartitionList()

VOID DrawPartitionList ( IN HWND  hWndList,
IN PPARTLIST  List 
)

Definition at line 574 of file drivepage.c.

577 {
579  PDISKENTRY DiskEntry;
580 
581  for (Entry = List->DiskListHead.Flink;
582  Entry != &List->DiskListHead;
583  Entry = Entry->Flink)
584  {
585  DiskEntry = CONTAINING_RECORD(Entry, DISKENTRY, ListEntry);
586 
587  /* Print disk entry */
588  PrintDiskData(hWndList, List, DiskEntry);
589  }
590 }
struct _Entry Entry
Definition: kefuncs.h:640
static VOID PrintDiskData(IN HWND hWndList, IN PPARTLIST List, IN PDISKENTRY DiskEntry)
Definition: drivepage.c:391
static HWND hWndList[5+1]
Definition: SetParent.c:10
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
LIST_ENTRY List
Definition: psmgr.c:57
Definition: typedefs.h:117
base of all file and directory entries
Definition: entries.h:82

Referenced by DriveDlgProc(), and SelectPartitionPage().

◆ DriveDlgProc()

INT_PTR CALLBACK DriveDlgProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 596 of file drivepage.c.

601 {
602  PSETUPDATA pSetupData;
603  HWND hList;
604  HIMAGELIST hSmall;
605 
606  /* Retrieve pointer to the global setup data */
607  pSetupData = (PSETUPDATA)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
608 
609  switch (uMsg)
610  {
611  case WM_INITDIALOG:
612  {
613  /* Save pointer to the global setup data */
614  pSetupData = (PSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
615  SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (DWORD_PTR)pSetupData);
616 
617  /*
618  * Keep the "Next" button disabled. It will be enabled only
619  * when the user selects a valid partition.
620  */
622 
623  hList = GetDlgItem(hwndDlg, IDC_PARTITION);
624 
626  // TreeList_SetExtendedStyleEx(hList, TVS_EX_FULLROWITEMS, TVS_EX_FULLROWITEMS);
627 
628  CreateTreeListColumns(pSetupData->hInstance,
629  hList,
630  column_ids,
634 
635  /* Create the ImageList */
638  ILC_COLOR32 | ILC_MASK, // ILC_COLOR24
639  1, 1);
640 
641  /* Add event type icons to the ImageList */
644 
645  /* Assign the ImageList to the List View */
647 
648  // DisplayStuffUsingWin32Setup(hwndDlg);
649  DrawPartitionList(hList, pSetupData->PartitionList);
650  break;
651  }
652 
653  case WM_DESTROY:
654  {
655  hList = GetDlgItem(hwndDlg, IDC_PARTITION);
658  ImageList_Destroy(hSmall);
659  return TRUE;
660  }
661 
662  case WM_COMMAND:
663  {
664  switch (LOWORD(wParam))
665  {
666  case IDC_PARTMOREOPTS:
667  DialogBoxParamW(pSetupData->hInstance,
669  hwndDlg,
671  (LPARAM)pSetupData);
672  break;
673 
674  case IDC_PARTCREATE:
675  DialogBoxW(pSetupData->hInstance,
677  hwndDlg,
679  break;
680 
681  case IDC_PARTDELETE:
682  break;
683  }
684  break;
685  }
686 
687  case WM_NOTIFY:
688  {
689  LPNMHDR lpnm = (LPNMHDR)lParam;
690 
691  // On Vista+ we can use TVN_ITEMCHANGED instead, with NMTVITEMCHANGE* pointer
692  if (lpnm->idFrom == IDC_PARTITION && lpnm->code == TVN_SELCHANGED)
693  {
695 
696  // if (pnmv->uChanged & TVIF_STATE) /* The state has changed */
697  if (pnmv->itemNew.mask & TVIF_STATE)
698  {
699  /* The item has been (de)selected */
700  // if (pnmv->uNewState & TVIS_SELECTED)
701  if (pnmv->itemNew.state & TVIS_SELECTED)
702  {
703  HTLITEM hParentItem = TreeList_GetParent(lpnm->hwndFrom, pnmv->itemNew.hItem);
704  /* May or may not be a PPARTENTRY: this is a PPARTENTRY only when hParentItem != NULL */
705  PPARTENTRY PartEntry = (PPARTENTRY)pnmv->itemNew.lParam;
706 
707  if (!hParentItem || !PartEntry)
708  {
711  goto DisableWizNext;
712  }
713  else // if (hParentItem && PartEntry)
714  {
715  EnableWindow(GetDlgItem(hwndDlg, IDC_PARTCREATE), !PartEntry->IsPartitioned);
716  EnableWindow(GetDlgItem(hwndDlg, IDC_PARTDELETE), PartEntry->IsPartitioned);
717 
718  if (PartEntry->IsPartitioned &&
719  !IsContainerPartition(PartEntry->PartitionType) /* alternatively: PartEntry->PartitionNumber != 0 */ &&
720  // !PartEntry->New &&
721  (PartEntry->FormatState == Preformatted /* || PartEntry->FormatState == Formatted */))
722  {
724  }
725  else
726  {
727  goto DisableWizNext;
728  }
729  }
730  }
731  else
732  {
733 DisableWizNext:
734  /*
735  * Keep the "Next" button disabled. It will be enabled only
736  * when the user selects a valid partition.
737  */
739  }
740  }
741 
742  break;
743  }
744 
745  switch (lpnm->code)
746  {
747 #if 0
748  case PSN_SETACTIVE:
749  {
750  /*
751  * Keep the "Next" button disabled. It will be enabled only
752  * when the user selects a valid partition.
753  */
755  break;
756  }
757 #endif
758 
760  {
761  /* Give the focus on and select the first item */
762  hList = GetDlgItem(hwndDlg, IDC_PARTITION);
763  // TreeList_SetFocusItem(hList, 1, 1);
766  return TRUE;
767  }
768 
769  case PSN_QUERYCANCEL:
770  {
771  if (MessageBoxW(GetParent(hwndDlg),
772  pSetupData->szAbortMessage,
773  pSetupData->szAbortTitle,
775  {
776  /* Go to the Terminate page */
778  }
779 
780  /* Do not close the wizard too soon */
782  return TRUE;
783  }
784 
785  case PSN_WIZNEXT: /* Set the selected data */
786  {
788 
789  /****/
790  // FIXME: This is my test disk encoding!
791  DISKENTRY DiskEntry;
792  PARTENTRY PartEntry;
793  DiskEntry.DiskNumber = 0;
794  DiskEntry.HwDiskNumber = 0;
795  DiskEntry.HwFixedDiskNumber = 0;
796  PartEntry.DiskEntry = &DiskEntry;
797  PartEntry.PartitionNumber = 1; // 4;
798  /****/
799 
800  Status = InitDestinationPaths(&pSetupData->USetupData,
801  NULL, // pSetupData->USetupData.InstallationDirectory,
802  &PartEntry);
803 
804  if (!NT_SUCCESS(Status))
805  {
806  DPRINT1("InitDestinationPaths() failed with status 0x%08lx\n", Status);
807  }
808 
809  break;
810  }
811 
812  default:
813  break;
814  }
815  }
816  break;
817 
818  default:
819  break;
820  }
821 
822  return FALSE;
823 }
#define IDC_PARTITION
Definition: resource.h:38
static INT_PTR CALLBACK PartitionDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: drivepage.c:99
#define TreeList_SelectItem(h, i)
Definition: treelist.h:430
ULONG PartitionNumber
Definition: partlist.h:48
#define TRUE
Definition: types.h:120
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
#define IDYES
Definition: winuser.h:829
static const INT column_alignment[MAX_LIST_COLUMNS]
Definition: drivepage.c:47
#define TVIS_SELECTED
Definition: commctrl.h:3276
LONG NTSTATUS
Definition: precomp.h:26
#define IDI_DISKDRIVE
Definition: resource.h:11
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:127
TCHAR szAbortMessage[512]
Definition: reactos.h:123
#define PSWIZB_NEXT
Definition: prsht.h:154
#define IDC_PARTMOREOPTS
Definition: resource.h:62
ULONG DiskNumber
Definition: partlist.h:104
#define LPNMTREEVIEW
Definition: commctrl.h:3639
#define SM_CYSMICON
Definition: winuser.h:1003
#define IsContainerPartition(PartitionType)
Definition: ntdddisk.h:245
#define TreeList_GetParent(h, i)
Definition: treelist.h:436
#define GetWindowLongPtrW
Definition: winuser.h:4730
#define PSN_SETACTIVE
Definition: prsht.h:115
#define SetWindowLongPtr
Definition: treelist.c:70
WPARAM wParam
Definition: combotst.c:138
#define DWLP_MSGRESULT
Definition: winuser.h:864
struct tagNMHDR * LPNMHDR
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:928
#define ILC_COLOR32
Definition: commctrl.h:354
#define PSN_QUERYCANCEL
Definition: prsht.h:123
UINT code
Definition: winuser.h:3133
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:804
#define MB_YESNO
Definition: winuser.h:811
#define TreeList_GetImageList(h, i)
Definition: treelist.h:397
FORMATSTATE FormatState
Definition: partlist.h:54
UINT_PTR idFrom
Definition: winuser.h:3132
#define GWLP_USERDATA
Definition: treelist.c:63
#define LPPROPSHEETPAGE
Definition: prsht.h:372
smooth NULL
Definition: ftsmooth.c:416
#define MB_ICONQUESTION
Definition: winuser.h:783
#define PSN_WIZNEXT
Definition: prsht.h:121
LONG_PTR LPARAM
Definition: windef.h:208
VOID DrawPartitionList(IN HWND hWndList, IN PPARTLIST List)
Definition: drivepage.c:574
#define PropSheet_SetWizButtons(d, f)
Definition: prsht.h:339
#define DialogBoxW(i, t, p, f)
Definition: winuser.h:4300
#define WM_DESTROY
Definition: winuser.h:1591
#define IDC_PARTCREATE
Definition: resource.h:39
#define IDI_PARTITION
Definition: resource.h:12
UCHAR PartitionType
Definition: partlist.h:46
struct _DISKENTRY * DiskEntry
Definition: partlist.h:39
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
if(!(yy_init))
Definition: macro.lex.yy.c:714
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define PSWIZB_BACK
Definition: prsht.h:153
#define TVN_SELCHANGED
Definition: commctrl.h:3731
HINSTANCE hInstance
Definition: reactos.h:114
#define IDC_PARTDELETE
Definition: resource.h:40
PPARTLIST PartitionList
Definition: reactos.h:132
int WINAPI GetSystemMetrics(_In_ int)
#define IDD_RESTARTPAGE
Definition: resource.h:59
ULONG HwDiskNumber
Definition: partlist.h:98
INT WINAPI ImageList_AddIcon(HIMAGELIST himl, HICON hIcon)
Definition: imagelist.c:540
#define TreeList_SetImageList(h, l, i)
Definition: treelist.h:407
#define SM_CXSMICON
Definition: winuser.h:1002
#define TreeList_SetExtendedStyleEx(h, d, m)
Definition: treelist.h:377
#define MAX_LIST_COLUMNS
Definition: drivepage.c:44
#define PropSheet_SetCurSelByID(d, i)
Definition: prsht.h:336
#define ILC_MASK
Definition: commctrl.h:347
TCHAR szAbortTitle[64]
Definition: reactos.h:124
#define WM_COMMAND
Definition: winuser.h:1722
HWND hwndFrom
Definition: winuser.h:3131
uint32_t DWORD_PTR
Definition: typedefs.h:63
Status
Definition: gdiplustypes.h:24
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
HWND hList
Definition: livecd.c:10
HWND WINAPI GetParent(_In_ HWND)
struct _PARTENTRY * PPARTENTRY
static INT_PTR CALLBACK MoreOptDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: drivepage.c:52
ULONG HwFixedDiskNumber
Definition: partlist.h:99
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
USETUP_DATA USetupData
Definition: reactos.h:128
#define IDD_PARTITION
Definition: resource.h:70
#define DPRINT1
Definition: precomp.h:8
static const INT column_widths[MAX_LIST_COLUMNS]
Definition: drivepage.c:46
#define IDD_BOOTOPTIONS
Definition: resource.h:64
#define TVSIL_NORMAL
Definition: commctrl.h:3439
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2044
#define TVIF_STATE
Definition: commctrl.h:3265
#define SetWindowLongPtrW
Definition: winuser.h:5247
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
static const UINT column_ids[MAX_LIST_COLUMNS]
Definition: drivepage.c:45
NTSTATUS InitDestinationPaths(IN OUT PUSETUP_DATA pSetupData, IN PCWSTR InstallationDir, IN PPARTENTRY PartEntry)
Definition: setuplib.c:624
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define TVS_EX_FULLROWMARK
Definition: treelist.h:272
#define PSN_QUERYINITIALFOCUS
Definition: settings.cpp:98
#define HTLITEM
Definition: treelist.h:460
#define WM_NOTIFY
Definition: richedit.h:61
BOOLEAN IsPartitioned
Definition: partlist.h:59
struct _SETUPDATA * PSETUPDATA

Referenced by _tWinMain().

◆ GetPartTypeStringFromPartitionType()

VOID GetPartTypeStringFromPartitionType ( IN UCHAR  partitionType,
OUT PCHAR  strPartType,
IN ULONG  cchPartType 
)

Definition at line 237 of file drivepage.c.

241 {
242  /* Determine partition type */
243 
244  if (IsContainerPartition(partitionType))
245  {
246  StringCchCopyA(strPartType, cchPartType, "Extended Partition" /* MUIGetString(STRING_EXTENDED_PARTITION) */);
247  }
248  else if (partitionType == PARTITION_ENTRY_UNUSED)
249  {
250  StringCchCopyA(strPartType, cchPartType, "Unused" /* MUIGetString(STRING_FORMATUNUSED) */);
251  }
252  else
253  {
254  UINT i;
255 
256  /* Do the table lookup */
257  for (i = 0; i < ARRAYSIZE(PartitionTypes); i++)
258  {
259  if (partitionType == PartitionTypes[i].Type)
260  {
261  StringCchCopyA(strPartType, cchPartType, PartitionTypes[i].Description);
262  return;
263  }
264  }
265 
266  /* We are here because the partition type is unknown */
267  StringCchCopyA(strPartType, cchPartType, "Unknown" /* MUIGetString(STRING_FORMATUNKNOWN) */);
268  }
269 }
Type
Definition: Type.h:6
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define IsContainerPartition(PartitionType)
Definition: ntdddisk.h:245
static const WCHAR Description[]
Definition: oid.c:1266
#define PARTITION_ENTRY_UNUSED
Definition: disk.h:86
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
PARTITION_TYPE PartitionTypes[NUM_PARTITION_TYPE_ENTRIES]
Definition: partlist.c:62
STRSAFEAPI StringCchCopyA(STRSAFE_LPSTR pszDest, size_t cchDest, STRSAFE_LPCSTR pszSrc)
Definition: strsafe.h:145
unsigned int UINT
Definition: ndis.h:50

Referenced by DeletePartitionPage(), PrintPartitionData(), and SelectFileSystemPage().

◆ MoreOptDlgProc()

static INT_PTR CALLBACK MoreOptDlgProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 52 of file drivepage.c.

56 {
57  PSETUPDATA pSetupData;
58 
59  /* Retrieve pointer to the global setup data */
60  pSetupData = (PSETUPDATA)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
61 
62  switch (uMsg)
63  {
64  case WM_INITDIALOG:
65  {
66  /* Save pointer to the global setup data */
67  pSetupData = (PSETUPDATA)lParam;
68  SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (DWORD_PTR)pSetupData);
69 
71  SetDlgItemTextW(hwndDlg, IDC_PATH,
72  pSetupData->USetupData.InstallationDirectory);
73  break;
74  }
75 
76  case WM_COMMAND:
77  switch (LOWORD(wParam))
78  {
79  case IDOK:
80  {
81  GetDlgItemTextW(hwndDlg, IDC_PATH,
82  pSetupData->USetupData.InstallationDirectory,
83  ARRAYSIZE(pSetupData->USetupData.InstallationDirectory));
84  EndDialog(hwndDlg, IDOK);
85  return TRUE;
86  }
87 
88  case IDCANCEL:
89  EndDialog(hwndDlg, IDCANCEL);
90  return TRUE;
91  }
92  break;
93  }
94 
95  return FALSE;
96 }
BOOL WINAPI CheckDlgButton(_In_ HWND, _In_ int, _In_ UINT)
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
Definition: dialog.c:2208
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
#define IDC_INSTFREELDR
Definition: resource.h:66
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define IDC_PATH
Definition: resource.h:65
#define GetWindowLongPtrW
Definition: winuser.h:4730
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
#define GWLP_USERDATA
Definition: treelist.c:63
#define WM_COMMAND
Definition: winuser.h:1722
uint32_t DWORD_PTR
Definition: typedefs.h:63
USETUP_DATA USetupData
Definition: reactos.h:128
#define BST_CHECKED
Definition: winuser.h:197
#define SetWindowLongPtrW
Definition: winuser.h:5247
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
struct _SETUPDATA * PSETUPDATA

Referenced by DriveDlgProc().

◆ PartitionDlgProc()

static INT_PTR CALLBACK PartitionDlgProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 99 of file drivepage.c.

103 {
104  switch (uMsg)
105  {
106  case WM_INITDIALOG:
107  break;
108 
109  case WM_COMMAND:
110  {
111  switch (LOWORD(wParam))
112  {
113  case IDOK:
114  EndDialog(hwndDlg, IDOK);
115  return TRUE;
116  case IDCANCEL:
117  EndDialog(hwndDlg, IDCANCEL);
118  return TRUE;
119  }
120  }
121  }
122  return FALSE;
123 }
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
#define WM_COMMAND
Definition: winuser.h:1722
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1721
#define LOWORD(l)
Definition: pedump.c:82

Referenced by DriveDlgProc().

◆ PrintDiskData()

static VOID PrintDiskData ( IN HWND  hWndList,
IN PPARTLIST  List,
IN PDISKENTRY  DiskEntry 
)
static

Definition at line 391 of file drivepage.c.

395 {
396  BOOL Success;
397  HANDLE hDevice;
398  PCHAR DiskName = NULL;
399  ULONG Length = 0;
400  PPARTENTRY PrimaryPartEntry, LogicalPartEntry;
401  PLIST_ENTRY PrimaryEntry, LogicalEntry;
402  ULARGE_INTEGER DiskSize;
403  HTLITEM htiDisk, htiPart;
404  WCHAR LineBuffer[128];
405  UCHAR outBuf[512];
406 
407  StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
408  // L"\\Device\\Harddisk%lu\\Partition%lu",
409  L"\\\\.\\PhysicalDrive%lu",
410  DiskEntry->DiskNumber);
411 
412  hDevice = CreateFileW(
413  LineBuffer, // device interface name
414  GENERIC_READ /*| GENERIC_WRITE*/, // dwDesiredAccess
415  FILE_SHARE_READ | FILE_SHARE_WRITE, // dwShareMode
416  NULL, // lpSecurityAttributes
417  OPEN_EXISTING, // dwCreationDistribution
418  0, // dwFlagsAndAttributes
419  NULL // hTemplateFile
420  );
421  if (hDevice != INVALID_HANDLE_VALUE)
422  {
424 
425  Query.PropertyId = StorageDeviceProperty;
426  Query.QueryType = PropertyStandardQuery;
427 
428  Success = DeviceIoControl(hDevice,
430  &Query,
431  sizeof(Query),
432  &outBuf,
433  sizeof(outBuf),
434  &Length,
435  NULL);
436  if (Success)
437  {
439  if (devDesc->ProductIdOffset)
440  {
441  DiskName = (PCHAR)&outBuf[devDesc->ProductIdOffset];
442  Length -= devDesc->ProductIdOffset;
443  DiskName[min(Length, strlen(DiskName))] = 0;
444  // ( i = devDesc->ProductIdOffset; p[i] != 0 && i < Length; i++ )
445  }
446  }
447 
448  CloseHandle(hDevice);
449  }
450 
451  if (DiskName && *DiskName)
452  {
453  if (DiskEntry->DriverName.Length > 0)
454  {
455  StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
456  // MUIGetString(STRING_HDINFOPARTSELECT_1),
457  L"Harddisk %lu (%S) (Port=%hu, Bus=%hu, Id=%hu) on %wZ",
458  DiskEntry->DiskNumber,
459  DiskName,
460  DiskEntry->Port,
461  DiskEntry->Bus,
462  DiskEntry->Id,
463  &DiskEntry->DriverName);
464  }
465  else
466  {
467  StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
468  // MUIGetString(STRING_HDINFOPARTSELECT_2),
469  L"Harddisk %lu (%S) (Port=%hu, Bus=%hu, Id=%hu)",
470  DiskEntry->DiskNumber,
471  DiskName,
472  DiskEntry->Port,
473  DiskEntry->Bus,
474  DiskEntry->Id);
475  }
476  }
477  else
478  {
479  if (DiskEntry->DriverName.Length > 0)
480  {
481  StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
482  // MUIGetString(STRING_HDINFOPARTSELECT_1),
483  L"Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu) on %wZ",
484  DiskEntry->DiskNumber,
485  DiskEntry->Port,
486  DiskEntry->Bus,
487  DiskEntry->Id,
488  &DiskEntry->DriverName);
489  }
490  else
491  {
492  StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
493  // MUIGetString(STRING_HDINFOPARTSELECT_2),
494  L"Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu)",
495  DiskEntry->DiskNumber,
496  DiskEntry->Port,
497  DiskEntry->Bus,
498  DiskEntry->Id);
499  }
500  }
501 
502  htiDisk = TreeListAddItem(hWndList, NULL, LineBuffer,
503  0, 0,
504  (LPARAM)DiskEntry);
505 
506  /* Disk type: MBR, GPT or RAW (Uninitialized) */
507  TreeList_SetItemText(hWndList, htiDisk, 1,
508  DiskEntry->DiskStyle == PARTITION_STYLE_MBR ? L"MBR" :
509  DiskEntry->DiskStyle == PARTITION_STYLE_GPT ? L"GPT" :
510  L"RAW");
511 
512  /* Format the disk size in KBs, MBs, etc... */
513  DiskSize.QuadPart = DiskEntry->SectorCount.QuadPart * DiskEntry->BytesPerSector;
514  if (StrFormatByteSizeW(DiskSize.QuadPart, LineBuffer, ARRAYSIZE(LineBuffer)) == NULL)
515  {
516  /* We failed for whatever reason, do the hardcoded way */
517  PWCHAR Unit;
518 
519  if (DiskSize.QuadPart >= 10 * GB) /* 10 GB */
520  {
521  DiskSize.QuadPart = RoundingDivide(DiskSize.QuadPart, GB);
522  // Unit = MUIGetString(STRING_GB);
523  Unit = L"GB";
524  }
525  else
526  {
527  DiskSize.QuadPart = RoundingDivide(DiskSize.QuadPart, MB);
528  if (DiskSize.QuadPart == 0)
529  DiskSize.QuadPart = 1;
530  // Unit = MUIGetString(STRING_MB);
531  Unit = L"MB";
532  }
533 
534  StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
535  L"%6lu %s",
536  DiskSize.u.LowPart,
537  Unit);
538  }
539  TreeList_SetItemText(hWndList, htiDisk, 2, LineBuffer);
540 
541 
542  /* Print partition lines */
543  for (PrimaryEntry = DiskEntry->PrimaryPartListHead.Flink;
544  PrimaryEntry != &DiskEntry->PrimaryPartListHead;
545  PrimaryEntry = PrimaryEntry->Flink)
546  {
547  PrimaryPartEntry = CONTAINING_RECORD(PrimaryEntry, PARTENTRY, ListEntry);
548 
549  htiPart = PrintPartitionData(hWndList, List, htiDisk,
550  DiskEntry, PrimaryPartEntry);
551 
552  if (IsContainerPartition(PrimaryPartEntry->PartitionType))
553  {
554  for (LogicalEntry = DiskEntry->LogicalPartListHead.Flink;
555  LogicalEntry != &DiskEntry->LogicalPartListHead;
556  LogicalEntry = LogicalEntry->Flink)
557  {
558  LogicalPartEntry = CONTAINING_RECORD(LogicalEntry, PARTENTRY, ListEntry);
559 
560  PrintPartitionData(hWndList, List, htiPart,
561  DiskEntry, LogicalPartEntry);
562  }
563 
564  /* Expand the extended partition node */
566  }
567  }
568 
569  /* Expand the disk node */
571 }
signed char * PCHAR
Definition: retypes.h:7
LPWSTR WINAPI StrFormatByteSizeW(LONGLONG llBytes, LPWSTR lpszDest, UINT cchMax)
Definition: string.c:2376
#define CloseHandle
Definition: compat.h:398
static HTLITEM PrintPartitionData(IN HWND hWndList, IN PPARTLIST List, IN HTLITEM htiParent, IN PDISKENTRY DiskEntry, IN PPARTENTRY PartEntry)
Definition: drivepage.c:273
Unit
Definition: gdiplusenums.h:25
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define TreeList_Expand(h, i, c)
Definition: treelist.h:365
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
#define IsContainerPartition(PartitionType)
Definition: ntdddisk.h:245
uint16_t * PWCHAR
Definition: typedefs.h:54
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
static HWND hWndList[5+1]
Definition: SetParent.c:10
#define FILE_SHARE_READ
Definition: compat.h:125
#define MB
Definition: setuplib.h:53
* PSTORAGE_DEVICE_DESCRIPTOR
Definition: ntddstor.h:457
ULONGLONG QuadPart
Definition: ms-dtyp.idl:185
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define OPEN_EXISTING
Definition: compat.h:426
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
#define PCHAR
Definition: match.c:90
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
#define IOCTL_STORAGE_QUERY_PROPERTY
Definition: ntddstor.h:167
struct _ULARGE_INTEGER::@3768 u
UCHAR PartitionType
Definition: partlist.h:46
LIST_ENTRY List
Definition: psmgr.c:57
__wchar_t WCHAR
Definition: xmlstorage.h:180
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
BOOL Query(LPCTSTR *ServiceArgs, DWORD ArgCount, BOOL bExtended)
Definition: query.c:292
#define TVE_EXPAND
Definition: commctrl.h:3419
#define TreeList_SetItemText(hwndLV, hItem_, iSubItem_, pszText_)
Definition: treelist.h:467
unsigned char UCHAR
Definition: xmlstorage.h:181
static const WCHAR L[]
Definition: oid.c:1250
HTLITEM TreeListAddItem(IN HWND hTreeList, IN HTLITEM hParent, IN LPWSTR lpText, IN INT iImage, IN INT iSelectedImage, IN LPARAM lParam)
Definition: drivepage.c:209
#define GENERIC_READ
Definition: compat.h:124
Definition: typedefs.h:117
ULONGLONG RoundingDivide(IN ULONGLONG Dividend, IN ULONGLONG Divisor)
Definition: partlist.c:273
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
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
#define min(a, b)
Definition: monoChain.cc:55
#define CreateFileW
Definition: compat.h:400
unsigned int ULONG
Definition: retypes.h:1
#define GB
Definition: setuplib.h:54
#define HTLITEM
Definition: treelist.h:460

Referenced by DrawPartitionList().

◆ PrintPartitionData()

static HTLITEM PrintPartitionData ( IN HWND  hWndList,
IN PPARTLIST  List,
IN HTLITEM  htiParent,
IN PDISKENTRY  DiskEntry,
IN PPARTENTRY  PartEntry 
)
static

Definition at line 273 of file drivepage.c.

279 {
280  LARGE_INTEGER PartSize;
281  HTLITEM htiPart;
282  CHAR PartTypeString[32];
283  PCHAR PartType = PartTypeString;
284  WCHAR LineBuffer[128];
285 
286  /* Volume name */
287  if (PartEntry->IsPartitioned == FALSE)
288  {
289  StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
290  // MUIGetString(STRING_UNPSPACE),
291  L"Unpartitioned space");
292  }
293  else
294  {
295  StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
296  // MUIGetString(STRING_HDDINFOUNK5),
297  L"%s (%c%c)",
298  *PartEntry->VolumeLabel ? PartEntry->VolumeLabel : L"Partition",
299  (PartEntry->DriveLetter == 0) ? L'-' : PartEntry->DriveLetter,
300  (PartEntry->DriveLetter == 0) ? L'-' : L':');
301  }
302 
303  htiPart = TreeListAddItem(hWndList, htiParent, LineBuffer,
304  1, 1,
305  (LPARAM)PartEntry);
306 
307  /* Determine partition type */
308  *LineBuffer = 0;
309  if (PartEntry->IsPartitioned)
310  {
311  PartTypeString[0] = '\0';
312  if (PartEntry->New == TRUE)
313  {
314  PartType = "New (Unformatted)"; // MUIGetString(STRING_UNFORMATTED);
315  }
316  else if (PartEntry->IsPartitioned == TRUE)
317  {
318  GetPartTypeStringFromPartitionType(PartEntry->PartitionType,
319  PartTypeString,
320  ARRAYSIZE(PartTypeString));
321  PartType = PartTypeString;
322  }
323 
324  if (strcmp(PartType, "Unknown" /* MUIGetString(STRING_FORMATUNKNOWN) */) == 0)
325  {
326  StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
327  // MUIGetString(STRING_HDDINFOUNK5),
328  L"Type 0x%02x",
329  PartEntry->PartitionType);
330  }
331  else
332  {
333  StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
334  L"%S",
335  PartType);
336  }
337  }
338  TreeList_SetItemText(hWndList, htiPart, 1, LineBuffer);
339 
340  /* Format the disk size in KBs, MBs, etc... */
341  PartSize.QuadPart = PartEntry->SectorCount.QuadPart * DiskEntry->BytesPerSector;
342  if (StrFormatByteSizeW(PartSize.QuadPart, LineBuffer, ARRAYSIZE(LineBuffer)) == NULL)
343  {
344  /* We failed for whatever reason, do the hardcoded way */
345  PWCHAR Unit;
346 
347 #if 0
348  if (PartSize.QuadPart >= 10 * GB) /* 10 GB */
349  {
350  PartSize.QuadPart = RoundingDivide(PartSize.QuadPart, GB);
351  // Unit = MUIGetString(STRING_GB);
352  Unit = L"GB";
353  }
354  else
355 #endif
356  if (PartSize.QuadPart >= 10 * MB) /* 10 MB */
357  {
358  PartSize.QuadPart = RoundingDivide(PartSize.QuadPart, MB);
359  // Unit = MUIGetString(STRING_MB);
360  Unit = L"MB";
361  }
362  else
363  {
364  PartSize.QuadPart = RoundingDivide(PartSize.QuadPart, KB);
365  // Unit = MUIGetString(STRING_KB);
366  Unit = L"KB";
367  }
368 
369  StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
370  L"%6lu %s",
371  PartSize.u.LowPart,
372  Unit);
373  }
374  TreeList_SetItemText(hWndList, htiPart, 2, LineBuffer);
375 
376  /* Volume status */
377  *LineBuffer = 0;
378  if (PartEntry->IsPartitioned)
379  {
380  StringCchPrintfW(LineBuffer, ARRAYSIZE(LineBuffer),
381  // MUIGetString(STRING_HDDINFOUNK5),
382  PartEntry->BootIndicator ? L"Active" : L"");
383  }
384  TreeList_SetItemText(hWndList, htiPart, 3, LineBuffer);
385 
386  return htiPart;
387 }
signed char * PCHAR
Definition: retypes.h:7
LPWSTR WINAPI StrFormatByteSizeW(LONGLONG llBytes, LPWSTR lpszDest, UINT cchMax)
Definition: string.c:2376
#define TRUE
Definition: types.h:120
Unit
Definition: gdiplusenums.h:25
char CHAR
Definition: xmlstorage.h:175
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
uint16_t * PWCHAR
Definition: typedefs.h:54
static HWND hWndList[5+1]
Definition: SetParent.c:10
#define MB
Definition: setuplib.h:53
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
__wchar_t WCHAR
Definition: xmlstorage.h:180
struct _LARGE_INTEGER::@2219 u
#define TreeList_SetItemText(hwndLV, hItem_, iSubItem_, pszText_)
Definition: treelist.h:467
static const WCHAR L[]
Definition: oid.c:1250
PartType
HTLITEM TreeListAddItem(IN HWND hTreeList, IN HTLITEM hParent, IN LPWSTR lpText, IN INT iImage, IN INT iSelectedImage, IN LPARAM lParam)
Definition: drivepage.c:209
ULONGLONG RoundingDivide(IN ULONGLONG Dividend, IN ULONGLONG Divisor)
Definition: partlist.c:273
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
VOID GetPartTypeStringFromPartitionType(IN UCHAR partitionType, OUT PCHAR strPartType, IN ULONG cchPartType)
Definition: drivepage.c:237
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define GB
Definition: setuplib.h:54
#define KB
Definition: setuplib.h:52
#define HTLITEM
Definition: treelist.h:460
LONGLONG QuadPart
Definition: typedefs.h:112

Referenced by PrintDiskData().

◆ TreeListAddItem()

HTLITEM TreeListAddItem ( IN HWND  hTreeList,
IN HTLITEM  hParent,
IN LPWSTR  lpText,
IN INT  iImage,
IN INT  iSelectedImage,
IN LPARAM  lParam 
)

Definition at line 209 of file drivepage.c.

215 {
216  TL_INSERTSTRUCTW Insert;
217 
218  ZeroMemory(&Insert, sizeof(Insert));
219 
220  Insert.item.mask = TVIF_TEXT | TVIF_PARAM | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
221  Insert.hInsertAfter = TVI_LAST;
222  Insert.hParent = hParent;
223  Insert.item.pszText = lpText;
224  Insert.item.iImage = iImage;
225  Insert.item.iSelectedImage = iSelectedImage;
226  Insert.item.lParam = lParam;
227 
228  // Insert.item.mask |= TVIF_STATE;
229  // Insert.item.stateMask = TVIS_OVERLAYMASK;
230  // Insert.item.state = INDEXTOOVERLAYMASK(1);
231 
232  return TreeList_InsertItem(hTreeList, &Insert);
233 }
#define ZeroMemory
Definition: winbase.h:1642
#define TL_INSERTSTRUCTW
Definition: treelist.h:462
#define TVIF_SELECTEDIMAGE
Definition: commctrl.h:3267
#define TVI_LAST
Definition: commctrl.h:3366
#define TreeList_InsertItem(h, p)
Definition: treelist.h:403
const DOCKBAR PVOID HWND hParent
Definition: tooldock.h:22
#define TVIF_TEXT
Definition: commctrl.h:3262
#define TVIF_IMAGE
Definition: commctrl.h:3263
#define TVIF_PARAM
Definition: commctrl.h:3264
LPARAM lParam
Definition: combotst.c:139

Referenced by PrintDiskData(), and PrintPartitionData().

Variable Documentation

◆ column_alignment

Definition at line 47 of file drivepage.c.

Referenced by DriveDlgProc().

◆ column_ids

Definition at line 45 of file drivepage.c.

Referenced by DriveDlgProc().

◆ column_widths

const INT column_widths[MAX_LIST_COLUMNS] = {200, 90, 60, 60}
static

Definition at line 46 of file drivepage.c.

Referenced by DriveDlgProc().