ReactOS  0.4.15-dev-1070-ge1a01de
partlist.h File Reference
#include <pshpack1.h>
#include <poppack.h>
Include dependency graph for partlist.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _PARTITION_TYPE
 
struct  _PARTENTRY
 
struct  _DISKENTRY
 
struct  _BIOSDISKENTRY
 
struct  _PARTLIST
 
struct  _PARTITION
 
struct  _PARTITION_SECTOR
 
struct  BIOS_DISK
 

Macros

#define NUM_PARTITION_TYPE_ENTRIES   143
 
#define PARTITION_TBL_SIZE   4
 
#define PARTITION_MAGIC   0xAA55
 
#define EFI_PMBR_OSTYPE_EFI   0xEE
 

Typedefs

typedef struct _PARTITION_TYPE PARTITION_TYPE
 
typedef struct _PARTITION_TYPEPPARTITION_TYPE
 
typedef enum _FORMATSTATE FORMATSTATE
 
typedef enum _FORMATSTATEPFORMATSTATE
 
typedef struct _PARTENTRY PARTENTRY
 
typedef struct _PARTENTRYPPARTENTRY
 
typedef struct _DISKENTRY DISKENTRY
 
typedef struct _DISKENTRYPDISKENTRY
 
typedef struct _BIOSDISKENTRY BIOSDISKENTRY
 
typedef struct _BIOSDISKENTRYPBIOSDISKENTRY
 
typedef struct _PARTLIST PARTLIST
 
typedef struct _PARTLISTPPARTLIST
 
typedef struct _PARTITION PARTITION
 
typedef struct _PARTITIONPPARTITION
 
typedef struct _PARTITION_SECTOR PARTITION_SECTOR
 
typedef struct _PARTITION_SECTORPPARTITION_SECTOR
 
typedef struct BIOS_DISKPBIOS_DISK
 

Enumerations

enum  _FORMATSTATE {
  Unformatted, UnformattedOrDamaged, UnknownFormat, Preformatted,
  Formatted, Unformatted, UnformattedOrDamaged, UnknownFormat,
  Preformatted, Formatted
}
 

Functions

ULONGLONG AlignDown (IN ULONGLONG Value, IN ULONG Alignment)
 
ULONGLONG AlignUp (IN ULONGLONG Value, IN ULONG Alignment)
 
ULONGLONG RoundingDivide (IN ULONGLONG Dividend, IN ULONGLONG Divisor)
 
BOOLEAN IsSuperFloppy (IN PDISKENTRY DiskEntry)
 
BOOLEAN IsPartitionActive (IN PPARTENTRY PartEntry)
 
PPARTLIST CreatePartitionList (VOID)
 
VOID DestroyPartitionList (IN PPARTLIST List)
 
PDISKENTRY GetDiskByBiosNumber (IN PPARTLIST List, IN ULONG HwDiskNumber)
 
PDISKENTRY GetDiskByNumber (IN PPARTLIST List, IN ULONG DiskNumber)
 
PDISKENTRY GetDiskBySCSI (IN PPARTLIST List, IN USHORT Port, IN USHORT Bus, IN USHORT Id)
 
PDISKENTRY GetDiskBySignature (IN PPARTLIST List, IN ULONG Signature)
 
PPARTENTRY GetPartition (IN PDISKENTRY DiskEntry, IN ULONG PartitionNumber)
 
BOOLEAN GetDiskOrPartition (IN PPARTLIST List, IN ULONG DiskNumber, IN ULONG PartitionNumber OPTIONAL, OUT PDISKENTRY *pDiskEntry, OUT PPARTENTRY *pPartEntry OPTIONAL)
 
PPARTENTRY SelectPartition (IN PPARTLIST List, IN ULONG DiskNumber, IN ULONG PartitionNumber)
 
PPARTENTRY GetNextPartition (IN PPARTLIST List, IN PPARTENTRY CurrentPart OPTIONAL)
 
PPARTENTRY GetPrevPartition (IN PPARTLIST List, IN PPARTENTRY CurrentPart OPTIONAL)
 
BOOLEAN CreatePrimaryPartition (IN PPARTLIST List, IN OUT PPARTENTRY PartEntry, IN ULONGLONG SectorCount, IN BOOLEAN AutoCreate)
 
BOOLEAN CreateExtendedPartition (IN PPARTLIST List, IN OUT PPARTENTRY PartEntry, IN ULONGLONG SectorCount)
 
BOOLEAN CreateLogicalPartition (IN PPARTLIST List, IN OUT PPARTENTRY PartEntry, IN ULONGLONG SectorCount, IN BOOLEAN AutoCreate)
 
NTSTATUS DismountVolume (IN PPARTENTRY PartEntry)
 
BOOLEAN DeletePartition (IN PPARTLIST List, IN PPARTENTRY PartEntry, OUT PPARTENTRY *FreeRegion OPTIONAL)
 
PPARTENTRY FindSupportedSystemPartition (IN PPARTLIST List, IN BOOLEAN ForceSelect, IN PDISKENTRY AlternativeDisk OPTIONAL, IN PPARTENTRY AlternativePart OPTIONAL)
 
BOOLEAN SetActivePartition (IN PPARTLIST List, IN PPARTENTRY PartEntry, IN PPARTENTRY OldActivePart OPTIONAL)
 
NTSTATUS WritePartitions (IN PDISKENTRY DiskEntry)
 
BOOLEAN WritePartitionsToDisk (IN PPARTLIST List)
 
BOOLEAN SetMountedDeviceValue (IN WCHAR Letter, IN ULONG Signature, IN LARGE_INTEGER StartingOffset)
 
BOOLEAN SetMountedDeviceValues (IN PPARTLIST List)
 
VOID SetPartitionType (IN PPARTENTRY PartEntry, IN UCHAR PartitionType)
 
ERROR_NUMBER PrimaryPartitionCreationChecks (IN PPARTENTRY PartEntry)
 
ERROR_NUMBER ExtendedPartitionCreationChecks (IN PPARTENTRY PartEntry)
 
ERROR_NUMBER LogicalPartitionCreationChecks (IN PPARTENTRY PartEntry)
 
BOOLEAN GetNextUnformattedPartition (IN PPARTLIST List, OUT PDISKENTRY *pDiskEntry OPTIONAL, OUT PPARTENTRY *pPartEntry)
 
BOOLEAN GetNextUncheckedPartition (IN PPARTLIST List, OUT PDISKENTRY *pDiskEntry OPTIONAL, OUT PPARTENTRY *pPartEntry)
 

Variables

PARTITION_TYPE PartitionTypes [NUM_PARTITION_TYPE_ENTRIES]
 

Macro Definition Documentation

◆ EFI_PMBR_OSTYPE_EFI

#define EFI_PMBR_OSTYPE_EFI   0xEE

Definition at line 168 of file partlist.h.

◆ NUM_PARTITION_TYPE_ENTRIES

#define NUM_PARTITION_TYPE_ENTRIES   143

Definition at line 19 of file partlist.h.

◆ PARTITION_MAGIC

#define PARTITION_MAGIC   0xAA55

Definition at line 165 of file partlist.h.

◆ PARTITION_TBL_SIZE

#define PARTITION_TBL_SIZE   4

Definition at line 163 of file partlist.h.

Typedef Documentation

◆ BIOSDISKENTRY

◆ DISKENTRY

◆ FORMATSTATE

◆ PARTENTRY

◆ PARTITION

◆ PARTITION_SECTOR

◆ PARTITION_TYPE

◆ PARTLIST

◆ PBIOS_DISK

◆ PBIOSDISKENTRY

◆ PDISKENTRY

◆ PFORMATSTATE

◆ PPARTENTRY

◆ PPARTITION

◆ PPARTITION_SECTOR

◆ PPARTITION_TYPE

◆ PPARTLIST

Enumeration Type Documentation

◆ _FORMATSTATE

Enumerator
Unformatted 
UnformattedOrDamaged 
UnknownFormat 
Preformatted 
Formatted 
Unformatted 
UnformattedOrDamaged 
UnknownFormat 
Preformatted 
Formatted 

Definition at line 25 of file partlist.h.

26 {
31  Formatted
enum _FORMATSTATE FORMATSTATE
enum _FORMATSTATE * PFORMATSTATE

Function Documentation

◆ AlignDown()

ULONGLONG AlignDown ( IN ULONGLONG  Value,
IN ULONG  Alignment 
)

Definition at line 246 of file partlist.c.

249 {
250  ULONGLONG Temp;
251 
252  Temp = Value / Alignment;
253 
254  return Temp * Alignment;
255 }
IN UCHAR Value
Definition: halp.h:394
union Alignment_ Alignment
uint64_t ULONGLONG
Definition: typedefs.h:67

Referenced by InitializePartitionEntry(), and ScanForUnpartitionedDiskSpace().

◆ AlignUp()

ULONGLONG AlignUp ( IN ULONGLONG  Value,
IN ULONG  Alignment 
)

Definition at line 258 of file partlist.c.

261 {
262  ULONGLONG Temp, Result;
263 
264  Temp = Value / Alignment;
265 
266  Result = Temp * Alignment;
267  if (Value % Alignment)
268  Result += Alignment;
269 
270  return Result;
271 }
IN UCHAR Value
Definition: halp.h:394
union Alignment_ Alignment
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
uint64_t ULONGLONG
Definition: typedefs.h:67

Referenced by PeFmtCreateSection().

◆ CreateExtendedPartition()

BOOLEAN CreateExtendedPartition ( IN PPARTLIST  List,
IN OUT PPARTENTRY  PartEntry,
IN ULONGLONG  SectorCount 
)

Definition at line 3024 of file partlist.c.

3028 {
3030 
3031  DPRINT1("CreateExtendedPartition(%I64u)\n", SectorCount);
3032 
3033  if (List == NULL || PartEntry == NULL ||
3034  PartEntry->DiskEntry == NULL || PartEntry->IsPartitioned)
3035  {
3036  return FALSE;
3037  }
3038 
3040  if (Error != NOT_AN_ERROR)
3041  {
3042  DPRINT1("ExtendedPartitionCreationChecks() failed with error %lu\n", Error);
3043  return FALSE;
3044  }
3045 
3046  /* Initialize the partition entry, inserting a new blank region if needed */
3047  if (!InitializePartitionEntry(PartEntry, SectorCount, FALSE))
3048  return FALSE;
3049 
3050  ASSERT(PartEntry->LogicalPartition == FALSE);
3051 
3052  if (PartEntry->StartSector.QuadPart < 1450560)
3053  {
3054  /* Partition starts below the 8.4GB boundary ==> CHS partition */
3055  PartEntry->PartitionType = PARTITION_EXTENDED;
3056  }
3057  else
3058  {
3059  /* Partition starts above the 8.4GB boundary ==> LBA partition */
3060  PartEntry->PartitionType = PARTITION_XINT13_EXTENDED;
3061  }
3062 
3063  // FIXME? Possibly to make GetNextUnformattedPartition work (i.e. skip the extended partition container)
3064  PartEntry->New = FALSE;
3065  PartEntry->FormatState = Formatted;
3066 
3067  PartEntry->DiskEntry->ExtendedPartition = PartEntry;
3068 
3069  AddLogicalDiskSpace(PartEntry->DiskEntry);
3070 
3071  UpdateDiskLayout(PartEntry->DiskEntry);
3073 
3074  return TRUE;
3075 }
ERROR_NUMBER ExtendedPartitionCreationChecks(IN PPARTENTRY PartEntry)
Definition: partlist.c:4150
#define TRUE
Definition: types.h:120
static BOOLEAN InitializePartitionEntry(IN OUT PPARTENTRY PartEntry, IN ULONGLONG SectorCount, IN BOOLEAN AutoCreate)
Definition: partlist.c:857
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
static VOID UpdateDiskLayout(IN PDISKENTRY DiskEntry)
Definition: partlist.c:2711
#define PARTITION_EXTENDED
Definition: disk.h:91
LIST_ENTRY List
Definition: psmgr.c:57
BOOL Error
Definition: chkdsk.c:66
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
enum _ERROR_NUMBER ERROR_NUMBER
ULONG SectorCount
Definition: part_xbox.c:31
#define PARTITION_XINT13_EXTENDED
Definition: disk.h:98
#define DPRINT1
Definition: precomp.h:8
static VOID AddLogicalDiskSpace(IN PDISKENTRY DiskEntry)
Definition: partlist.c:2997
static VOID AssignDriveLetters(IN PPARTLIST List)
Definition: partlist.c:317

Referenced by CreateExtendedPartitionPage().

◆ CreateLogicalPartition()

BOOLEAN CreateLogicalPartition ( IN PPARTLIST  List,
IN OUT PPARTENTRY  PartEntry,
IN ULONGLONG  SectorCount,
IN BOOLEAN  AutoCreate 
)

Definition at line 3078 of file partlist.c.

3083 {
3085 
3086  DPRINT1("CreateLogicalPartition(%I64u)\n", SectorCount);
3087 
3088  if (List == NULL || PartEntry == NULL ||
3089  PartEntry->DiskEntry == NULL || PartEntry->IsPartitioned)
3090  {
3091  return FALSE;
3092  }
3093 
3095  if (Error != NOT_AN_ERROR)
3096  {
3097  DPRINT1("LogicalPartitionCreationChecks() failed with error %lu\n", Error);
3098  return FALSE;
3099  }
3100 
3101  /* Initialize the partition entry, inserting a new blank region if needed */
3102  if (!InitializePartitionEntry(PartEntry, SectorCount, AutoCreate))
3103  return FALSE;
3104 
3105  ASSERT(PartEntry->LogicalPartition == TRUE);
3106 
3107  UpdateDiskLayout(PartEntry->DiskEntry);
3109 
3110  return TRUE;
3111 }
#define TRUE
Definition: types.h:120
ERROR_NUMBER LogicalPartitionCreationChecks(IN PPARTENTRY PartEntry)
Definition: partlist.c:4181
static BOOLEAN InitializePartitionEntry(IN OUT PPARTENTRY PartEntry, IN ULONGLONG SectorCount, IN BOOLEAN AutoCreate)
Definition: partlist.c:857
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
static VOID UpdateDiskLayout(IN PDISKENTRY DiskEntry)
Definition: partlist.c:2711
LIST_ENTRY List
Definition: psmgr.c:57
BOOL Error
Definition: chkdsk.c:66
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
enum _ERROR_NUMBER ERROR_NUMBER
ULONG SectorCount
Definition: part_xbox.c:31
#define DPRINT1
Definition: precomp.h:8
static VOID AssignDriveLetters(IN PPARTLIST List)
Definition: partlist.c:317

Referenced by CreateLogicalPartitionPage(), and SelectPartitionPage().

◆ CreatePartitionList()

PPARTLIST CreatePartitionList ( VOID  )

Definition at line 2024 of file partlist.c.

2025 {
2026  PPARTLIST List;
2027  PDISKENTRY SystemDisk;
2031  ULONG ReturnSize;
2032  NTSTATUS Status;
2033  ULONG DiskNumber;
2037 
2039  0,
2040  sizeof(PARTLIST));
2041  if (List == NULL)
2042  return NULL;
2043 
2044  List->SystemPartition = NULL;
2045 
2046  InitializeListHead(&List->DiskListHead);
2047  InitializeListHead(&List->BiosDiskListHead);
2048 
2049  /*
2050  * Enumerate the disks seen by the BIOS; this will be used later
2051  * to map drives seen by NTOS with their corresponding BIOS names.
2052  */
2054 
2055  /* Enumerate disks seen by NTOS */
2057  &Sdi,
2058  sizeof(Sdi),
2059  &ReturnSize);
2060  if (!NT_SUCCESS(Status))
2061  {
2062  DPRINT1("NtQuerySystemInformation() failed, Status 0x%08lx", Status);
2064  return NULL;
2065  }
2066 
2067  for (DiskNumber = 0; DiskNumber < Sdi.NumberOfDisks; DiskNumber++)
2068  {
2070  L"\\Device\\Harddisk%lu\\Partition0",
2071  DiskNumber);
2073 
2075  &Name,
2077  NULL,
2078  NULL);
2079 
2083  &Iosb,
2086  if (NT_SUCCESS(Status))
2087  {
2088  AddDiskToList(FileHandle, DiskNumber, List);
2090  }
2091  }
2092 
2096 
2097  /*
2098  * Retrieve the system partition: the active partition on the system
2099  * disk (the one that will be booted by default by the hardware).
2100  */
2101  SystemDisk = GetSystemDisk(List);
2102  List->SystemPartition = (SystemDisk ? GetActiveDiskPartition(SystemDisk) : NULL);
2103 
2104  return List;
2105 }
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
NTSYSAPI NTSTATUS NTAPI NtQuerySystemInformation(IN SYSTEM_INFORMATION_CLASS SystemInfoClass, OUT PVOID SystemInfoBuffer, IN ULONG SystemInfoBufferSize, OUT PULONG BytesReturned OPTIONAL)
struct _PARTLIST * PPARTLIST
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
static PPARTENTRY GetActiveDiskPartition(IN PDISKENTRY DiskEntry)
Definition: partlist.c:1968
NTSTRSAFEVAPI RtlStringCchPrintfW(_Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cchDest, _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,...)
Definition: ntstrsafe.h:1110
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
static VOID UpdateDiskSignatures(IN PPARTLIST List)
Definition: partlist.c:1392
#define FILE_SHARE_READ
Definition: compat.h:136
HANDLE FileHandle
Definition: stats.c:38
#define FILE_READ_DATA
Definition: nt_native.h:628
struct NameRec_ * Name
Definition: cdprocs.h:459
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:588
NTSYSAPI NTSTATUS NTAPI NtOpenFile(OUT PHANDLE phFile, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN ULONG ShareMode, IN ULONG OpenMode)
Definition: file.c:3951
LIST_ENTRY List
Definition: psmgr.c:57
__wchar_t WCHAR
Definition: xmlstorage.h:180
return Iosb
Definition: create.c:4402
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
static VOID UpdateHwDiskNumbers(IN PPARTLIST List)
Definition: partlist.c:1422
#define MAX_PATH
Definition: compat.h:34
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
#define FILE_READ_ATTRIBUTES
Definition: nt_native.h:647
static PDISKENTRY GetSystemDisk(IN PPARTLIST List)
Definition: partlist.c:1895
Status
Definition: gdiplustypes.h:24
static const WCHAR L[]
Definition: oid.c:1250
#define SYNCHRONIZE
Definition: nt_native.h:61
HANDLE ProcessHeap
Definition: servman.c:15
static VOID EnumerateBiosDiskEntries(IN PPARTLIST PartList)
Definition: partlist.c:516
static VOID AddDiskToList(IN HANDLE FileHandle, IN ULONG DiskNumber, IN PPARTLIST List)
Definition: partlist.c:1483
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define DPRINT1
Definition: precomp.h:8
#define FILE_SYNCHRONOUS_IO_NONALERT
Definition: from_kernel.h:31
unsigned int ULONG
Definition: retypes.h:1
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
static VOID AssignDriveLetters(IN PPARTLIST List)
Definition: partlist.c:317

◆ CreatePrimaryPartition()

BOOLEAN CreatePrimaryPartition ( IN PPARTLIST  List,
IN OUT PPARTENTRY  PartEntry,
IN ULONGLONG  SectorCount,
IN BOOLEAN  AutoCreate 
)

Definition at line 2960 of file partlist.c.

2965 {
2967 
2968  DPRINT1("CreatePrimaryPartition(%I64u)\n", SectorCount);
2969 
2970  if (List == NULL || PartEntry == NULL ||
2971  PartEntry->DiskEntry == NULL || PartEntry->IsPartitioned)
2972  {
2973  return FALSE;
2974  }
2975 
2977  if (Error != NOT_AN_ERROR)
2978  {
2979  DPRINT1("PrimaryPartitionCreationChecks() failed with error %lu\n", Error);
2980  return FALSE;
2981  }
2982 
2983  /* Initialize the partition entry, inserting a new blank region if needed */
2984  if (!InitializePartitionEntry(PartEntry, SectorCount, AutoCreate))
2985  return FALSE;
2986 
2987  ASSERT(PartEntry->LogicalPartition == FALSE);
2988 
2989  UpdateDiskLayout(PartEntry->DiskEntry);
2991 
2992  return TRUE;
2993 }
#define TRUE
Definition: types.h:120
static BOOLEAN InitializePartitionEntry(IN OUT PPARTENTRY PartEntry, IN ULONGLONG SectorCount, IN BOOLEAN AutoCreate)
Definition: partlist.c:857
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
static VOID UpdateDiskLayout(IN PDISKENTRY DiskEntry)
Definition: partlist.c:2711
ERROR_NUMBER PrimaryPartitionCreationChecks(IN PPARTENTRY PartEntry)
Definition: partlist.c:4123
LIST_ENTRY List
Definition: psmgr.c:57
BOOL Error
Definition: chkdsk.c:66
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
enum _ERROR_NUMBER ERROR_NUMBER
ULONG SectorCount
Definition: part_xbox.c:31
#define DPRINT1
Definition: precomp.h:8
static VOID AssignDriveLetters(IN PPARTLIST List)
Definition: partlist.c:317

Referenced by CreatePrimaryPartitionPage(), SelectFileSystemPage(), and SelectPartitionPage().

◆ DeletePartition()

BOOLEAN DeletePartition ( IN PPARTLIST  List,
IN PPARTENTRY  PartEntry,
OUT PPARTENTRY *FreeRegion  OPTIONAL 
)

Definition at line 3221 of file partlist.c.

3225 {
3226  PDISKENTRY DiskEntry;
3227  PPARTENTRY PrevPartEntry;
3228  PPARTENTRY NextPartEntry;
3229  PPARTENTRY LogicalPartEntry;
3231 
3232  if (List == NULL || PartEntry == NULL ||
3233  PartEntry->DiskEntry == NULL || PartEntry->IsPartitioned == FALSE)
3234  {
3235  return FALSE;
3236  }
3237 
3238  ASSERT(PartEntry->PartitionType != PARTITION_ENTRY_UNUSED);
3239 
3240  /* Clear the system partition if it is being deleted */
3241  if (List->SystemPartition == PartEntry)
3242  {
3243  ASSERT(List->SystemPartition);
3244  List->SystemPartition = NULL;
3245  }
3246 
3247  DiskEntry = PartEntry->DiskEntry;
3248 
3249  /* Check which type of partition (primary/logical or extended) is being deleted */
3250  if (DiskEntry->ExtendedPartition == PartEntry)
3251  {
3252  /* An extended partition is being deleted: delete all logical partition entries */
3253  while (!IsListEmpty(&DiskEntry->LogicalPartListHead))
3254  {
3255  Entry = RemoveHeadList(&DiskEntry->LogicalPartListHead);
3256  LogicalPartEntry = CONTAINING_RECORD(Entry, PARTENTRY, ListEntry);
3257 
3258  /* Dismount the logical partition */
3259  DismountVolume(LogicalPartEntry);
3260 
3261  /* Delete it */
3262  RtlFreeHeap(ProcessHeap, 0, LogicalPartEntry);
3263  }
3264 
3265  DiskEntry->ExtendedPartition = NULL;
3266  }
3267  else
3268  {
3269  /* A primary partition is being deleted: dismount it */
3270  DismountVolume(PartEntry);
3271  }
3272 
3273  /* Adjust the unpartitioned disk space entries */
3274 
3275  /* Get pointer to previous and next unpartitioned entries */
3276  PrevPartEntry = GetPrevUnpartitionedEntry(PartEntry);
3277  NextPartEntry = GetNextUnpartitionedEntry(PartEntry);
3278 
3279  if (PrevPartEntry != NULL && NextPartEntry != NULL)
3280  {
3281  /* Merge the previous, current and next unpartitioned entries */
3282 
3283  /* Adjust the previous entry length */
3284  PrevPartEntry->SectorCount.QuadPart += (PartEntry->SectorCount.QuadPart + NextPartEntry->SectorCount.QuadPart);
3285 
3286  /* Remove the current and next entries */
3287  RemoveEntryList(&PartEntry->ListEntry);
3288  RtlFreeHeap(ProcessHeap, 0, PartEntry);
3289  RemoveEntryList(&NextPartEntry->ListEntry);
3290  RtlFreeHeap(ProcessHeap, 0, NextPartEntry);
3291 
3292  /* Optionally return the freed region */
3293  if (FreeRegion)
3294  *FreeRegion = PrevPartEntry;
3295  }
3296  else if (PrevPartEntry != NULL && NextPartEntry == NULL)
3297  {
3298  /* Merge the current and the previous unpartitioned entries */
3299 
3300  /* Adjust the previous entry length */
3301  PrevPartEntry->SectorCount.QuadPart += PartEntry->SectorCount.QuadPart;
3302 
3303  /* Remove the current entry */
3304  RemoveEntryList(&PartEntry->ListEntry);
3305  RtlFreeHeap(ProcessHeap, 0, PartEntry);
3306 
3307  /* Optionally return the freed region */
3308  if (FreeRegion)
3309  *FreeRegion = PrevPartEntry;
3310  }
3311  else if (PrevPartEntry == NULL && NextPartEntry != NULL)
3312  {
3313  /* Merge the current and the next unpartitioned entries */
3314 
3315  /* Adjust the next entry offset and length */
3316  NextPartEntry->StartSector.QuadPart = PartEntry->StartSector.QuadPart;
3317  NextPartEntry->SectorCount.QuadPart += PartEntry->SectorCount.QuadPart;
3318 
3319  /* Remove the current entry */
3320  RemoveEntryList(&PartEntry->ListEntry);
3321  RtlFreeHeap(ProcessHeap, 0, PartEntry);
3322 
3323  /* Optionally return the freed region */
3324  if (FreeRegion)
3325  *FreeRegion = NextPartEntry;
3326  }
3327  else
3328  {
3329  /* Nothing to merge but change the current entry */
3330  PartEntry->IsPartitioned = FALSE;
3331  PartEntry->OnDiskPartitionNumber = 0;
3332  PartEntry->PartitionNumber = 0;
3333  // PartEntry->PartitionIndex = 0;
3334  PartEntry->BootIndicator = FALSE;
3335  PartEntry->PartitionType = PARTITION_ENTRY_UNUSED;
3336  PartEntry->FormatState = Unformatted;
3337  PartEntry->FileSystem[0] = L'\0';
3338  PartEntry->DriveLetter = 0;
3339  RtlZeroMemory(PartEntry->VolumeLabel, sizeof(PartEntry->VolumeLabel));
3340 
3341  /* Optionally return the freed region */
3342  if (FreeRegion)
3343  *FreeRegion = PartEntry;
3344  }
3345 
3346  UpdateDiskLayout(DiskEntry);
3348 
3349  return TRUE;
3350 }
ULARGE_INTEGER StartSector
Definition: partlist.h:42
struct _Entry Entry
Definition: kefuncs.h:627
#define TRUE
Definition: types.h:120
ULARGE_INTEGER SectorCount
Definition: partlist.h:43
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
PPARTENTRY ExtendedPartition
Definition: partlist.h:128
FORCEINLINE BOOLEAN RemoveEntryList(_In_ PLIST_ENTRY Entry)
Definition: rtlfuncs.h:105
#define PARTITION_ENTRY_UNUSED
Definition: disk.h:86
LIST_ENTRY ListEntry
Definition: partlist.h:36
NTSTATUS DismountVolume(IN PPARTENTRY PartEntry)
Definition: partlist.c:3114
ULONGLONG QuadPart
Definition: ms-dtyp.idl:185
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
FORCEINLINE PLIST_ENTRY RemoveHeadList(_Inout_ PLIST_ENTRY ListHead)
Definition: rtlfuncs.h:128
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
static VOID UpdateDiskLayout(IN PDISKENTRY DiskEntry)
Definition: partlist.c:2711
LIST_ENTRY List
Definition: psmgr.c:57
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
static const WCHAR L[]
Definition: oid.c:1250
Definition: typedefs.h:119
HANDLE ProcessHeap
Definition: servman.c:15
static PPARTENTRY GetPrevUnpartitionedEntry(IN PPARTENTRY PartEntry)
Definition: partlist.c:2891
LIST_ENTRY LogicalPartListHead
Definition: partlist.h:125
static PPARTENTRY GetNextUnpartitionedEntry(IN PPARTENTRY PartEntry)
Definition: partlist.c:2926
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
base of all file and directory entries
Definition: entries.h:82
static VOID AssignDriveLetters(IN PPARTLIST List)
Definition: partlist.c:317
BOOLEAN IsPartitioned
Definition: partlist.h:59

Referenced by DeletePartitionPage().

◆ DestroyPartitionList()

VOID DestroyPartitionList ( IN PPARTLIST  List)

Definition at line 2108 of file partlist.c.

2110 {
2111  PDISKENTRY DiskEntry;
2112  PBIOSDISKENTRY BiosDiskEntry;
2113  PPARTENTRY PartEntry;
2115 
2116  /* Release disk and partition info */
2117  while (!IsListEmpty(&List->DiskListHead))
2118  {
2119  Entry = RemoveHeadList(&List->DiskListHead);
2120  DiskEntry = CONTAINING_RECORD(Entry, DISKENTRY, ListEntry);
2121 
2122  /* Release driver name */
2123  RtlFreeUnicodeString(&DiskEntry->DriverName);
2124 
2125  /* Release primary partition list */
2126  while (!IsListEmpty(&DiskEntry->PrimaryPartListHead))
2127  {
2128  Entry = RemoveHeadList(&DiskEntry->PrimaryPartListHead);
2129  PartEntry = CONTAINING_RECORD(Entry, PARTENTRY, ListEntry);
2130 
2131  RtlFreeHeap(ProcessHeap, 0, PartEntry);
2132  }
2133 
2134  /* Release logical partition list */
2135  while (!IsListEmpty(&DiskEntry->LogicalPartListHead))
2136  {
2137  Entry = RemoveHeadList(&DiskEntry->LogicalPartListHead);
2138  PartEntry = CONTAINING_RECORD(Entry, PARTENTRY, ListEntry);
2139 
2140  RtlFreeHeap(ProcessHeap, 0, PartEntry);
2141  }
2142 
2143  /* Release layout buffer */
2144  if (DiskEntry->LayoutBuffer != NULL)
2145  RtlFreeHeap(ProcessHeap, 0, DiskEntry->LayoutBuffer);
2146 
2147  /* Release disk entry */
2148  RtlFreeHeap(ProcessHeap, 0, DiskEntry);
2149  }
2150 
2151  /* Release the bios disk info */
2152  while (!IsListEmpty(&List->BiosDiskListHead))
2153  {
2154  Entry = RemoveHeadList(&List->BiosDiskListHead);
2155  BiosDiskEntry = CONTAINING_RECORD(Entry, BIOSDISKENTRY, ListEntry);
2156 
2157  RtlFreeHeap(ProcessHeap, 0, BiosDiskEntry);
2158  }
2159 
2160  /* Release list head */
2162 }
LIST_ENTRY PrimaryPartListHead
Definition: partlist.h:124
struct _Entry Entry
Definition: kefuncs.h:627
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
smooth NULL
Definition: ftsmooth.c:416
FORCEINLINE PLIST_ENTRY RemoveHeadList(_Inout_ PLIST_ENTRY ListHead)
Definition: rtlfuncs.h:128
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
LIST_ENTRY List
Definition: psmgr.c:57
UNICODE_STRING DriverName
Definition: partlist.h:116
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
Definition: typedefs.h:119
HANDLE ProcessHeap
Definition: servman.c:15
LIST_ENTRY LogicalPartListHead
Definition: partlist.h:125
PDRIVE_LAYOUT_INFORMATION LayoutBuffer
Definition: partlist.h:118
base of all file and directory entries
Definition: entries.h:82

Referenced by QuitPage(), rescan_main(), SelectPartitionPage(), and wmain().

◆ DismountVolume()

NTSTATUS DismountVolume ( IN PPARTENTRY  PartEntry)

Definition at line 3114 of file partlist.c.

3116 {
3117  NTSTATUS Status;
3118  NTSTATUS LockStatus;
3122  HANDLE PartitionHandle;
3124 
3125  /* Check whether the partition is valid and was mounted by the system */
3126  if (!PartEntry->IsPartitioned ||
3127  IsContainerPartition(PartEntry->PartitionType) ||
3128  !IsRecognizedPartition(PartEntry->PartitionType) ||
3129  PartEntry->FormatState == UnknownFormat ||
3130  // NOTE: If FormatState == Unformatted but *FileSystem != 0 this means
3131  // it has been usually mounted with RawFS and thus needs to be dismounted.
3132  !*PartEntry->FileSystem ||
3133  PartEntry->PartitionNumber == 0)
3134  {
3135  /* The partition is not mounted, so just return success */
3136  return STATUS_SUCCESS;
3137  }
3138 
3139  ASSERT(PartEntry->PartitionType != PARTITION_ENTRY_UNUSED);
3140 
3141  /* Open the volume */
3143  L"\\Device\\Harddisk%lu\\Partition%lu",
3144  PartEntry->DiskEntry->DiskNumber,
3145  PartEntry->PartitionNumber);
3147 
3149  &Name,
3151  NULL,
3152  NULL);
3153 
3154  Status = NtOpenFile(&PartitionHandle,
3157  &IoStatusBlock,
3160  if (!NT_SUCCESS(Status))
3161  {
3162  DPRINT1("ERROR: Cannot open volume %wZ for dismounting! (Status 0x%lx)\n", &Name, Status);
3163  return Status;
3164  }
3165 
3166  /* Lock the volume */
3167  LockStatus = NtFsControlFile(PartitionHandle,
3168  NULL,
3169  NULL,
3170  NULL,
3171  &IoStatusBlock,
3173  NULL,
3174  0,
3175  NULL,
3176  0);
3177  if (!NT_SUCCESS(LockStatus))
3178  {
3179  DPRINT1("WARNING: Failed to lock volume! Operations may fail! (Status 0x%lx)\n", LockStatus);
3180  }
3181 
3182  /* Dismount the volume */
3183  Status = NtFsControlFile(PartitionHandle,
3184  NULL,
3185  NULL,
3186  NULL,
3187  &IoStatusBlock,
3189  NULL,
3190  0,
3191  NULL,
3192  0);
3193  if (!NT_SUCCESS(Status))
3194  {
3195  DPRINT1("Failed to unmount volume (Status 0x%lx)\n", Status);
3196  }
3197 
3198  /* Unlock the volume */
3199  LockStatus = NtFsControlFile(PartitionHandle,
3200  NULL,
3201  NULL,
3202  NULL,
3203  &IoStatusBlock,
3205  NULL,
3206  0,
3207  NULL,
3208  0);
3209  if (!NT_SUCCESS(LockStatus))
3210  {
3211  DPRINT1("Failed to unlock volume (Status 0x%lx)\n", LockStatus);
3212  }
3213 
3214  /* Close the volume */
3215  NtClose(PartitionHandle);
3216 
3217  return Status;
3218 }
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
#define FSCTL_UNLOCK_VOLUME
Definition: nt_native.h:833
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
NTSTRSAFEVAPI RtlStringCchPrintfW(_Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cchDest, _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,...)
Definition: ntstrsafe.h:1110
LONG NTSTATUS
Definition: precomp.h:26
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define IsContainerPartition(PartitionType)
Definition: ntdddisk.h:316
NTSYSCALLAPI NTSTATUS NTAPI NtFsControlFile(HANDLE FileHandle, HANDLE Event, PIO_APC_ROUTINE ApcRoutine, PVOID ApcContext, PIO_STATUS_BLOCK IoStatusBlock, ULONG FsControlCode, PVOID InputBuffer, ULONG InputBufferLength, PVOID OutputBuffer, ULONG OutputBufferLength)
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define FILE_SHARE_READ
Definition: compat.h:136
#define PARTITION_ENTRY_UNUSED
Definition: disk.h:86
#define GENERIC_WRITE
Definition: nt_native.h:90
struct NameRec_ * Name
Definition: cdprocs.h:459
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
#define FSCTL_DISMOUNT_VOLUME
Definition: nt_native.h:834
NTSYSAPI NTSTATUS NTAPI NtOpenFile(OUT PHANDLE phFile, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN ULONG ShareMode, IN ULONG OpenMode)
Definition: file.c:3951
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define IsRecognizedPartition(PartitionType)
Definition: ntdddisk.h:342
#define MAX_PATH
Definition: compat.h:34
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
Status
Definition: gdiplustypes.h:24
static const WCHAR L[]
Definition: oid.c:1250
#define GENERIC_READ
Definition: compat.h:135
#define SYNCHRONIZE
Definition: nt_native.h:61
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
#define DPRINT1
Definition: precomp.h:8
#define FILE_SYNCHRONOUS_IO_NONALERT
Definition: from_kernel.h:31
#define FSCTL_LOCK_VOLUME
Definition: nt_native.h:832
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
return STATUS_SUCCESS
Definition: btrfs.c:3014

Referenced by AddPartitionToDisk(), and DeletePartition().

◆ ExtendedPartitionCreationChecks()

ERROR_NUMBER ExtendedPartitionCreationChecks ( IN PPARTENTRY  PartEntry)

Definition at line 4150 of file partlist.c.

4152 {
4153  PDISKENTRY DiskEntry = PartEntry->DiskEntry;
4154 
4155  if (DiskEntry->DiskStyle == PARTITION_STYLE_GPT)
4156  {
4157  DPRINT1("GPT-partitioned disk detected, not currently supported by SETUP!\n");
4158  return ERROR_WARN_PARTITION;
4159  }
4160 
4161  /* Fail if the partition is already in use */
4162  if (PartEntry->IsPartitioned)
4163  return ERROR_NEW_PARTITION;
4164 
4165  /* Only one primary partition is allowed on super-floppy */
4166  if (IsSuperFloppy(DiskEntry))
4168 
4169  /* Fail if there are already 4 primary partitions in the list */
4170  if (GetPrimaryPartitionCount(DiskEntry) >= 4)
4172 
4173  /* Fail if there is another extended partition in the list */
4174  if (DiskEntry->ExtendedPartition != NULL)
4175  return ERROR_ONLY_ONE_EXTENDED;
4176 
4177  return ERROR_SUCCESS;
4178 }
#define ERROR_SUCCESS
Definition: deptool.c:10
PPARTENTRY ExtendedPartition
Definition: partlist.h:128
PARTITION_STYLE DiskStyle
Definition: partlist.h:114
smooth NULL
Definition: ftsmooth.c:416
static ULONG GetPrimaryPartitionCount(IN PDISKENTRY DiskEntry)
Definition: partlist.c:2605
BOOLEAN IsSuperFloppy(IN PDISKENTRY DiskEntry)
Definition: partlist.c:680
#define DPRINT1
Definition: precomp.h:8

Referenced by CreateExtendedPartition(), and SelectPartitionPage().

◆ FindSupportedSystemPartition()

PPARTENTRY FindSupportedSystemPartition ( IN PPARTLIST  List,
IN BOOLEAN  ForceSelect,
IN PDISKENTRY AlternativeDisk  OPTIONAL,
IN PPARTENTRY AlternativePart  OPTIONAL 
)

Definition at line 3434 of file partlist.c.

3439 {
3440  PLIST_ENTRY ListEntry;
3441  PDISKENTRY DiskEntry;
3442  PPARTENTRY PartEntry;
3443  PPARTENTRY ActivePartition;
3444  PPARTENTRY CandidatePartition = NULL;
3445 
3446  /* Check for empty disk list */
3447  if (IsListEmpty(&List->DiskListHead))
3448  {
3449  /* No system partition! */
3450  ASSERT(List->SystemPartition == NULL);
3451  goto NoSystemPartition;
3452  }
3453 
3454  /* Adjust the optional alternative disk if needed */
3455  if (!AlternativeDisk && AlternativePart)
3456  AlternativeDisk = AlternativePart->DiskEntry;
3457 
3458  /* Ensure that the alternative partition is on the alternative disk */
3459  if (AlternativePart)
3460  ASSERT(AlternativeDisk && (AlternativePart->DiskEntry == AlternativeDisk));
3461 
3462  /* Ensure that the alternative disk is in the list */
3463  if (AlternativeDisk)
3464  ASSERT(AlternativeDisk->PartList == List);
3465 
3466  /* Start fresh */
3467  CandidatePartition = NULL;
3468 
3469 //
3470 // Step 1 : Check the system disk.
3471 //
3472 
3473  /*
3474  * First, check whether the system disk, i.e. the one that will be booted
3475  * by default by the hardware, contains an active partition. If so this
3476  * should be our system partition.
3477  */
3478  DiskEntry = GetSystemDisk(List);
3479 
3480  if (DiskEntry->DiskStyle == PARTITION_STYLE_GPT)
3481  {
3482  DPRINT1("System disk -- GPT-partitioned disk detected, not currently supported by SETUP!\n");
3483  goto UseAlternativeDisk;
3484  }
3485 
3486  /* If we have a system partition (in the system disk), validate it */
3487  ActivePartition = List->SystemPartition;
3488  if (ActivePartition && IsSupportedActivePartition(ActivePartition))
3489  {
3490  CandidatePartition = ActivePartition;
3491 
3492  DPRINT1("Use the current system partition %lu in disk %lu, drive letter %C\n",
3493  CandidatePartition->PartitionNumber,
3494  CandidatePartition->DiskEntry->DiskNumber,
3495  (CandidatePartition->DriveLetter == 0) ? L'-' : CandidatePartition->DriveLetter);
3496 
3497  /* Return the candidate system partition */
3498  return CandidatePartition;
3499  }
3500 
3501  /* If the system disk is not the optional alternative disk, perform the minimal checks */
3502  if (DiskEntry != AlternativeDisk)
3503  {
3504  /*
3505  * No active partition has been recognized. Enumerate all the (primary)
3506  * partitions in the system disk, excluding the possible current active
3507  * partition, to find a new candidate.
3508  */
3509  for (ListEntry = DiskEntry->PrimaryPartListHead.Flink;
3510  ListEntry != &DiskEntry->PrimaryPartListHead;
3511  ListEntry = ListEntry->Flink)
3512  {
3513  /* Retrieve the partition */
3514  PartEntry = CONTAINING_RECORD(ListEntry, PARTENTRY, ListEntry);
3515 
3516  /* Skip the current active partition */
3517  if (PartEntry == ActivePartition)
3518  continue;
3519 
3520  /* Check if the partition is partitioned and used */
3521  if (PartEntry->IsPartitioned &&
3522  !IsContainerPartition(PartEntry->PartitionType))
3523  {
3525 
3526  /* If we get a candidate active partition in the disk, validate it */
3527  if (IsSupportedActivePartition(PartEntry))
3528  {
3529  CandidatePartition = PartEntry;
3530  goto UseAlternativePartition;
3531  }
3532  }
3533 
3534 #if 0
3535  /* Check if the partition is partitioned and used */
3536  if (!PartEntry->IsPartitioned)
3537  {
3539 
3540  // TODO: Check for minimal size!!
3541  CandidatePartition = PartEntry;
3542  goto UseAlternativePartition;
3543  }
3544 #endif
3545  }
3546 
3547  /*
3548  * Still nothing, look whether there is some free space that we can use
3549  * for the new system partition. We must be sure that the total number
3550  * of partition is less than the maximum allowed, and that the minimal
3551  * size is fine.
3552  */
3553 //
3554 // TODO: Fix the handling of system partition being created in unpartitioned space!!
3555 // --> When to partition it? etc...
3556 //
3557  if (GetPrimaryPartitionCount(DiskEntry) < 4)
3558  {
3559  for (ListEntry = DiskEntry->PrimaryPartListHead.Flink;
3560  ListEntry != &DiskEntry->PrimaryPartListHead;
3561  ListEntry = ListEntry->Flink)
3562  {
3563  /* Retrieve the partition */
3564  PartEntry = CONTAINING_RECORD(ListEntry, PARTENTRY, ListEntry);
3565 
3566  /* Skip the current active partition */
3567  if (PartEntry == ActivePartition)
3568  continue;
3569 
3570  /* Check for unpartitioned space */
3571  if (!PartEntry->IsPartitioned)
3572  {
3574 
3575  // TODO: Check for minimal size!!
3576  CandidatePartition = PartEntry;
3577  goto UseAlternativePartition;
3578  }
3579  }
3580  }
3581  }
3582 
3583 
3584 //
3585 // Step 2 : No active partition found: Check the alternative disk if specified.
3586 //
3587 
3588 UseAlternativeDisk:
3589  if (!AlternativeDisk || (!ForceSelect && (DiskEntry != AlternativeDisk)))
3590  goto NoSystemPartition;
3591 
3592  if (AlternativeDisk->DiskStyle == PARTITION_STYLE_GPT)
3593  {
3594  DPRINT1("Alternative disk -- GPT-partitioned disk detected, not currently supported by SETUP!\n");
3595  goto NoSystemPartition;
3596  }
3597 
3598  if (DiskEntry != AlternativeDisk)
3599  {
3600  /* Choose the alternative disk */
3601  DiskEntry = AlternativeDisk;
3602 
3603  /* If we get a candidate active partition, validate it */
3604  ActivePartition = GetActiveDiskPartition(DiskEntry);
3605  if (ActivePartition && IsSupportedActivePartition(ActivePartition))
3606  {
3607  CandidatePartition = ActivePartition;
3608  goto UseAlternativePartition;
3609  }
3610  }
3611 
3612  /* We now may have an unsupported active partition, or none */
3613 
3614 /***
3615  *** TODO: Improve the selection:
3616  *** - If we want a really separate system partition from the partition where
3617  *** we install, do something similar to what's done below in the code.
3618  *** - Otherwise if we allow for the system partition to be also the partition
3619  *** where we install, just directly fall down to using AlternativePart.
3620  ***/
3621 
3622  /* Retrieve the first partition of the disk */
3623  PartEntry = CONTAINING_RECORD(DiskEntry->PrimaryPartListHead.Flink,
3624  PARTENTRY, ListEntry);
3625  ASSERT(DiskEntry == PartEntry->DiskEntry);
3626 
3627  CandidatePartition = PartEntry;
3628 
3629  //
3630  // See: https://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/partlist.c?r1=63355&r2=63354&pathrev=63355#l2318
3631  //
3632 
3633  /* Check if the disk is new and if so, use its first partition as the active system partition */
3634  if (DiskEntry->NewDisk)
3635  {
3636  // !IsContainerPartition(PartEntry->PartitionType);
3637  if (!CandidatePartition->IsPartitioned || !CandidatePartition->BootIndicator) /* CandidatePartition != ActivePartition */
3638  {
3639  ASSERT(DiskEntry == CandidatePartition->DiskEntry);
3640 
3641  DPRINT1("Use new first active system partition %lu in disk %lu, drive letter %C\n",
3642  CandidatePartition->PartitionNumber,
3643  CandidatePartition->DiskEntry->DiskNumber,
3644  (CandidatePartition->DriveLetter == 0) ? L'-' : CandidatePartition->DriveLetter);
3645 
3646  /* Return the candidate system partition */
3647  return CandidatePartition;
3648  }
3649 
3650  // FIXME: What to do??
3651  DPRINT1("NewDisk TRUE but first partition is used?\n");
3652  }
3653 
3654  /*
3655  * The disk is not new, check if any partition is initialized;
3656  * if not, the first one becomes the system partition.
3657  */
3658  for (ListEntry = DiskEntry->PrimaryPartListHead.Flink;
3659  ListEntry != &DiskEntry->PrimaryPartListHead;
3660  ListEntry = ListEntry->Flink)
3661  {
3662  /* Retrieve the partition */
3663  PartEntry = CONTAINING_RECORD(ListEntry, PARTENTRY, ListEntry);
3664 
3665  /* Check if the partition is partitioned and is used */
3666  // !IsContainerPartition(PartEntry->PartitionType);
3667  if (/* PartEntry->IsPartitioned && */
3668  PartEntry->PartitionType != PARTITION_ENTRY_UNUSED || PartEntry->BootIndicator)
3669  {
3670  break;
3671  }
3672  }
3673  if (ListEntry == &DiskEntry->PrimaryPartListHead)
3674  {
3675  /*
3676  * OK we haven't encountered any used and active partition,
3677  * so use the first one as the system partition.
3678  */
3679  ASSERT(DiskEntry == CandidatePartition->DiskEntry);
3680 
3681  DPRINT1("Use first active system partition %lu in disk %lu, drive letter %C\n",
3682  CandidatePartition->PartitionNumber,
3683  CandidatePartition->DiskEntry->DiskNumber,
3684  (CandidatePartition->DriveLetter == 0) ? L'-' : CandidatePartition->DriveLetter);
3685 
3686  /* Return the candidate system partition */
3687  return CandidatePartition;
3688  }
3689 
3690  /*
3691  * The disk is not new, we did not find any actual active partition,
3692  * or the one we found was not supported, or any possible other candidate
3693  * is not supported. We then use the alternative partition if specified.
3694  */
3695  if (AlternativePart)
3696  {
3697  DPRINT1("No valid or supported system partition has been found, use the alternative partition!\n");
3698  CandidatePartition = AlternativePart;
3699  goto UseAlternativePartition;
3700  }
3701  else
3702  {
3703 NoSystemPartition:
3704  DPRINT1("No valid or supported system partition has been found on this system!\n");
3705  return NULL;
3706  }
3707 
3708 UseAlternativePartition:
3709  /*
3710  * We are here because we did not find any (active) candidate system
3711  * partition that we know how to support. What we are going to do is
3712  * to change the existing system partition and use the alternative partition
3713  * (e.g. on which we install ReactOS) as the new system partition.
3714  * Then we will need to add in FreeLdr's boot menu an entry for booting
3715  * from the original system partition.
3716  */
3717  ASSERT(CandidatePartition);
3718 
3719  DPRINT1("Use alternative active system partition %lu in disk %lu, drive letter %C\n",
3720  CandidatePartition->PartitionNumber,
3721  CandidatePartition->DiskEntry->DiskNumber,
3722  (CandidatePartition->DriveLetter == 0) ? L'-' : CandidatePartition->DriveLetter);
3723 
3724  /* Return the candidate system partition */
3725  return CandidatePartition;
3726 }
LIST_ENTRY PrimaryPartListHead
Definition: partlist.h:124
WCHAR DriveLetter
Definition: partlist.h:51
ULONG PartitionNumber
Definition: partlist.h:48
static PPARTENTRY GetActiveDiskPartition(IN PDISKENTRY DiskEntry)
Definition: partlist.c:1968
static BOOLEAN IsSupportedActivePartition(IN PPARTENTRY PartEntry)
Definition: partlist.c:3354
#define IsContainerPartition(PartitionType)
Definition: ntdddisk.h:316
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
#define PARTITION_ENTRY_UNUSED
Definition: disk.h:86
PARTITION_STYLE DiskStyle
Definition: partlist.h:114
smooth NULL
Definition: ftsmooth.c:416
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:121
UCHAR PartitionType
Definition: partlist.h:46
struct _DISKENTRY * DiskEntry
Definition: partlist.h:39
LIST_ENTRY List
Definition: psmgr.c:57
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
static ULONG GetPrimaryPartitionCount(IN PDISKENTRY DiskEntry)
Definition: partlist.c:2605
static PDISKENTRY GetSystemDisk(IN PPARTLIST List)
Definition: partlist.c:1895
static const WCHAR L[]
Definition: oid.c:1250
Definition: typedefs.h:119
#define DPRINT1
Definition: precomp.h:8
BOOLEAN BootIndicator
Definition: partlist.h:45
BOOLEAN NewDisk
Definition: partlist.h:113
BOOLEAN IsPartitioned
Definition: partlist.h:59

Referenced by SelectFileSystemPage().

◆ GetDiskByBiosNumber()

PDISKENTRY GetDiskByBiosNumber ( IN PPARTLIST  List,
IN ULONG  HwDiskNumber 
)

Definition at line 2165 of file partlist.c.

2168 {
2169  PDISKENTRY DiskEntry;
2171 
2172  /* Loop over the disks and find the correct one */
2173  for (Entry = List->DiskListHead.Flink;
2174  Entry != &List->DiskListHead;
2175  Entry = Entry->Flink)
2176  {
2177  DiskEntry = CONTAINING_RECORD(Entry, DISKENTRY, ListEntry);
2178 
2179  if (DiskEntry->HwDiskNumber == HwDiskNumber)
2180  {
2181  /* Disk found */
2182  return DiskEntry;
2183  }
2184  }
2185 
2186  /* Disk not found, stop there */
2187  return NULL;
2188 }
struct _Entry Entry
Definition: kefuncs.h:627
smooth NULL
Definition: ftsmooth.c:416
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:121
LIST_ENTRY List
Definition: psmgr.c:57
ULONG HwDiskNumber
Definition: partlist.h:98
Definition: typedefs.h:119
base of all file and directory entries
Definition: entries.h:82

◆ GetDiskByNumber()

PDISKENTRY GetDiskByNumber ( IN PPARTLIST  List,
IN ULONG  DiskNumber 
)

Definition at line 2191 of file partlist.c.

2194 {
2195  PDISKENTRY DiskEntry;
2197 
2198  /* Loop over the disks and find the correct one */
2199  for (Entry = List->DiskListHead.Flink;
2200  Entry != &List->DiskListHead;
2201  Entry = Entry->Flink)
2202  {
2203  DiskEntry = CONTAINING_RECORD(Entry, DISKENTRY, ListEntry);
2204 
2205  if (DiskEntry->DiskNumber == DiskNumber)
2206  {
2207  /* Disk found */
2208  return DiskEntry;
2209  }
2210  }
2211 
2212  /* Disk not found, stop there */
2213  return NULL;
2214 }
struct _Entry Entry
Definition: kefuncs.h:627
ULONG DiskNumber
Definition: partlist.h:104
smooth NULL
Definition: ftsmooth.c:416
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:121
LIST_ENTRY List
Definition: psmgr.c:57
Definition: typedefs.h:119
base of all file and directory entries
Definition: entries.h:82

Referenced by GetDiskOrPartition(), and SelectPartition().

◆ GetDiskBySCSI()

PDISKENTRY GetDiskBySCSI ( IN PPARTLIST  List,
IN USHORT  Port,
IN USHORT  Bus,
IN USHORT  Id 
)

Definition at line 2217 of file partlist.c.

2222 {
2223  PDISKENTRY DiskEntry;
2225 
2226  /* Loop over the disks and find the correct one */
2227  for (Entry = List->DiskListHead.Flink;
2228  Entry != &List->DiskListHead;
2229  Entry = Entry->Flink)
2230  {
2231  DiskEntry = CONTAINING_RECORD(Entry, DISKENTRY, ListEntry);
2232 
2233  if (DiskEntry->Port == Port &&
2234  DiskEntry->Bus == Bus &&
2235  DiskEntry->Id == Id)
2236  {
2237  /* Disk found */
2238  return DiskEntry;
2239  }
2240  }
2241 
2242  /* Disk not found, stop there */
2243  return NULL;
2244 }
CPPORT Port[4]
Definition: headless.c:34
USHORT Id
Definition: partlist.h:108
struct _Entry Entry
Definition: kefuncs.h:627
USHORT Bus
Definition: partlist.h:107
DWORD Id
smooth NULL
Definition: ftsmooth.c:416
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:121
LIST_ENTRY List
Definition: psmgr.c:57
Definition: typedefs.h:119
USHORT Port
Definition: partlist.h:106
base of all file and directory entries
Definition: entries.h:82

Referenced by ResolveArcNameManually().

◆ GetDiskBySignature()

PDISKENTRY GetDiskBySignature ( IN PPARTLIST  List,
IN ULONG  Signature 
)

Definition at line 2247 of file partlist.c.

2250 {
2251  PDISKENTRY DiskEntry;
2253 
2254  /* Loop over the disks and find the correct one */
2255  for (Entry = List->DiskListHead.Flink;
2256  Entry != &List->DiskListHead;
2257  Entry = Entry->Flink)
2258  {
2259  DiskEntry = CONTAINING_RECORD(Entry, DISKENTRY, ListEntry);
2260 
2261  if (DiskEntry->LayoutBuffer->Signature == Signature)
2262  {
2263  /* Disk found */
2264  return DiskEntry;
2265  }
2266  }
2267 
2268  /* Disk not found, stop there */
2269  return NULL;
2270 }
struct _Entry Entry
Definition: kefuncs.h:627
smooth NULL
Definition: ftsmooth.c:416
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:121
LIST_ENTRY List
Definition: psmgr.c:57
Definition: typedefs.h:119
static const WCHAR Signature[]
Definition: parser.c:141
PDRIVE_LAYOUT_INFORMATION LayoutBuffer
Definition: partlist.h:118
base of all file and directory entries
Definition: entries.h:82

Referenced by ResolveArcNameManually().

◆ GetDiskOrPartition()

BOOLEAN GetDiskOrPartition ( IN PPARTLIST  List,
IN ULONG  DiskNumber,
IN ULONG PartitionNumber  OPTIONAL,
OUT PDISKENTRY pDiskEntry,
OUT PPARTENTRY *pPartEntry  OPTIONAL 
)

Definition at line 2320 of file partlist.c.

2326 {
2327  PDISKENTRY DiskEntry;
2328  PPARTENTRY PartEntry = NULL;
2329 
2330  /* Find the disk */
2331  DiskEntry = GetDiskByNumber(List, DiskNumber);
2332  if (!DiskEntry)
2333  return FALSE;
2334 
2335  /* If we have a partition (PartitionNumber != 0), find it */
2336  if (PartitionNumber != 0)
2337  {
2338  if (DiskEntry->DiskStyle == PARTITION_STYLE_GPT)
2339  {
2340  DPRINT("GPT-partitioned disk detected, not currently supported by SETUP!\n");
2341  return FALSE;
2342  }
2343 
2344  PartEntry = GetPartition(/*List,*/ DiskEntry, PartitionNumber);
2345  if (!PartEntry)
2346  return FALSE;
2347  ASSERT(PartEntry->DiskEntry == DiskEntry);
2348  }
2349 
2350  /* Return the disk (and optionally the partition) */
2351  *pDiskEntry = DiskEntry;
2352  if (pPartEntry) *pPartEntry = PartEntry;
2353  return TRUE;
2354 }
#define TRUE
Definition: types.h:120
_In_ ULONG _In_ ULONG PartitionNumber
Definition: iofuncs.h:2056
PPARTENTRY GetPartition(IN PDISKENTRY DiskEntry, IN ULONG PartitionNumber)
Definition: partlist.c:2273
PARTITION_STYLE DiskStyle
Definition: partlist.h:114
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
PDISKENTRY GetDiskByNumber(IN PPARTLIST List, IN ULONG DiskNumber)
Definition: partlist.c:2191
struct _DISKENTRY * DiskEntry
Definition: partlist.h:39
LIST_ENTRY List
Definition: psmgr.c:57
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)

Referenced by EnumerateInstallations().

◆ GetNextPartition()

PPARTENTRY GetNextPartition ( IN PPARTLIST  List,
IN PPARTENTRY CurrentPart  OPTIONAL 
)

Definition at line 2384 of file partlist.c.

2387 {
2388  PLIST_ENTRY DiskListEntry;
2389  PLIST_ENTRY PartListEntry;
2391 
2392  /* Fail if no disks are available */
2393  if (IsListEmpty(&List->DiskListHead))
2394  return NULL;
2395 
2396  /* Check for the next usable entry on the current partition's disk */
2397  if (CurrentPart != NULL)
2398  {
2399  CurrentDisk = CurrentPart->DiskEntry;
2400 
2401  if (CurrentPart->LogicalPartition)
2402  {
2403  /* Logical partition */
2404 
2405  PartListEntry = CurrentPart->ListEntry.Flink;
2406  if (PartListEntry != &CurrentDisk->LogicalPartListHead)
2407  {
2408  /* Next logical partition */
2409  CurrentPart = CONTAINING_RECORD(PartListEntry, PARTENTRY, ListEntry);
2410  return CurrentPart;
2411  }
2412  else
2413  {
2414  PartListEntry = CurrentDisk->ExtendedPartition->ListEntry.Flink;
2415  if (PartListEntry != &CurrentDisk->PrimaryPartListHead)
2416  {
2417  CurrentPart = CONTAINING_RECORD(PartListEntry, PARTENTRY, ListEntry);
2418  return CurrentPart;
2419  }
2420  }
2421  }
2422  else
2423  {
2424  /* Primary or extended partition */
2425 
2426  if (CurrentPart->IsPartitioned &&
2427  IsContainerPartition(CurrentPart->PartitionType))
2428  {
2429  /* First logical partition */
2430  PartListEntry = CurrentDisk->LogicalPartListHead.Flink;
2431  if (PartListEntry != &CurrentDisk->LogicalPartListHead)
2432  {
2433  CurrentPart = CONTAINING_RECORD(PartListEntry, PARTENTRY, ListEntry);
2434  return CurrentPart;
2435  }
2436  }
2437  else
2438  {
2439  /* Next primary partition */
2440  PartListEntry = CurrentPart->ListEntry.Flink;
2441  if (PartListEntry != &CurrentDisk->PrimaryPartListHead)
2442  {
2443  CurrentPart = CONTAINING_RECORD(PartListEntry, PARTENTRY, ListEntry);
2444  return CurrentPart;
2445  }
2446  }
2447  }
2448  }
2449 
2450  /* Search for the first partition entry on the next disk */
2451  for (DiskListEntry = (CurrentPart ? CurrentDisk->ListEntry.Flink
2452  : List->DiskListHead.Flink);
2453  DiskListEntry != &List->DiskListHead;
2454  DiskListEntry = DiskListEntry->Flink)
2455  {
2456  CurrentDisk = CONTAINING_RECORD(DiskListEntry, DISKENTRY, ListEntry);
2457 
2459  {
2460  DPRINT("GPT-partitioned disk detected, not currently supported by SETUP!\n");
2461  continue;
2462  }
2463 
2464  PartListEntry = CurrentDisk->PrimaryPartListHead.Flink;
2465  if (PartListEntry != &CurrentDisk->PrimaryPartListHead)
2466  {
2467  CurrentPart = CONTAINING_RECORD(PartListEntry, PARTENTRY, ListEntry);
2468  return CurrentPart;
2469  }
2470  }
2471 
2472  return NULL;
2473 }
LIST_ENTRY PrimaryPartListHead
Definition: partlist.h:124
PDISKENTRY CurrentDisk
Definition: partlist.c:73
#define IsContainerPartition(PartitionType)
Definition: ntdddisk.h:316
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
PPARTENTRY ExtendedPartition
Definition: partlist.h:128
LIST_ENTRY ListEntry
Definition: partlist.h:36
PARTITION_STYLE DiskStyle
Definition: partlist.h:114
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
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:121
LIST_ENTRY List
Definition: psmgr.c:57
LIST_ENTRY ListEntry
Definition: partlist.h:76
Definition: typedefs.h:119
LIST_ENTRY LogicalPartListHead
Definition: partlist.h:125

Referenced by ScrollDownPartitionList().

◆ GetNextUncheckedPartition()

BOOLEAN GetNextUncheckedPartition ( IN PPARTLIST  List,
OUT PDISKENTRY *pDiskEntry  OPTIONAL,
OUT PPARTENTRY pPartEntry 
)

Definition at line 4263 of file partlist.c.

4267 {
4268  PLIST_ENTRY Entry1, Entry2;
4269  PDISKENTRY DiskEntry;
4270  PPARTENTRY PartEntry;
4271 
4272  for (Entry1 = List->DiskListHead.Flink;
4273  Entry1 != &List->DiskListHead;
4274  Entry1 = Entry1->Flink)
4275  {
4276  DiskEntry = CONTAINING_RECORD(Entry1,
4277  DISKENTRY,
4278  ListEntry);
4279 
4280  if (DiskEntry->DiskStyle == PARTITION_STYLE_GPT)
4281  {
4282  DPRINT("GPT-partitioned disk detected, not currently supported by SETUP!\n");
4283  continue;
4284  }
4285 
4286  for (Entry2 = DiskEntry->PrimaryPartListHead.Flink;
4287  Entry2 != &DiskEntry->PrimaryPartListHead;
4288  Entry2 = Entry2->Flink)
4289  {
4290  PartEntry = CONTAINING_RECORD(Entry2, PARTENTRY, ListEntry);
4291  if (PartEntry->IsPartitioned && PartEntry->NeedsCheck)
4292  {
4293  ASSERT(DiskEntry == PartEntry->DiskEntry);
4294  if (pDiskEntry) *pDiskEntry = DiskEntry;
4295  *pPartEntry = PartEntry;
4296  return TRUE;
4297  }
4298  }
4299 
4300  for (Entry2 = DiskEntry->LogicalPartListHead.Flink;
4301  Entry2 != &DiskEntry->LogicalPartListHead;
4302  Entry2 = Entry2->Flink)
4303  {
4304  PartEntry = CONTAINING_RECORD(Entry2, PARTENTRY, ListEntry);
4305  if (PartEntry->IsPartitioned && PartEntry->NeedsCheck)
4306  {
4307  ASSERT(DiskEntry == PartEntry->DiskEntry);
4308  if (pDiskEntry) *pDiskEntry = DiskEntry;
4309  *pPartEntry = PartEntry;
4310  return TRUE;
4311  }
4312  }
4313  }
4314 
4315  if (pDiskEntry) *pDiskEntry = NULL;
4316  *pPartEntry = NULL;
4317 
4318  return FALSE;
4319 }
LIST_ENTRY PrimaryPartListHead
Definition: partlist.h:124
#define TRUE
Definition: types.h:120
PARTITION_STYLE DiskStyle
Definition: partlist.h:114
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
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:121
struct _DISKENTRY * DiskEntry
Definition: partlist.h:39
LIST_ENTRY List
Definition: psmgr.c:57
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
Definition: typedefs.h:119
BOOLEAN NeedsCheck
Definition: partlist.h:70
LIST_ENTRY LogicalPartListHead
Definition: partlist.h:125
BOOLEAN IsPartitioned
Definition: partlist.h:59

Referenced by CheckFileSystemPage().

◆ GetNextUnformattedPartition()

BOOLEAN GetNextUnformattedPartition ( IN PPARTLIST  List,
OUT PDISKENTRY *pDiskEntry  OPTIONAL,
OUT PPARTENTRY pPartEntry 
)

Definition at line 4204 of file partlist.c.

4208 {
4209  PLIST_ENTRY Entry1, Entry2;
4210  PDISKENTRY DiskEntry;
4211  PPARTENTRY PartEntry;
4212 
4213  for (Entry1 = List->DiskListHead.Flink;
4214  Entry1 != &List->DiskListHead;
4215  Entry1 = Entry1->Flink)
4216  {
4217  DiskEntry = CONTAINING_RECORD(Entry1,
4218  DISKENTRY,
4219  ListEntry);
4220 
4221  if (DiskEntry->DiskStyle == PARTITION_STYLE_GPT)
4222  {
4223  DPRINT("GPT-partitioned disk detected, not currently supported by SETUP!\n");
4224  continue;
4225  }
4226 
4227  for (Entry2 = DiskEntry->PrimaryPartListHead.Flink;
4228  Entry2 != &DiskEntry->PrimaryPartListHead;
4229  Entry2 = Entry2->Flink)
4230  {
4231  PartEntry = CONTAINING_RECORD(Entry2, PARTENTRY, ListEntry);
4232  if (PartEntry->IsPartitioned && PartEntry->New)
4233  {
4234  ASSERT(DiskEntry == PartEntry->DiskEntry);
4235  if (pDiskEntry) *pDiskEntry = DiskEntry;
4236  *pPartEntry = PartEntry;
4237  return TRUE;
4238  }
4239  }
4240 
4241  for (Entry2 = DiskEntry->LogicalPartListHead.Flink;
4242  Entry2 != &DiskEntry->LogicalPartListHead;
4243  Entry2 = Entry2->Flink)
4244  {
4245  PartEntry = CONTAINING_RECORD(Entry2, PARTENTRY, ListEntry);
4246  if (PartEntry->IsPartitioned && PartEntry->New)
4247  {
4248  ASSERT(DiskEntry == PartEntry->DiskEntry);
4249  if (pDiskEntry) *pDiskEntry = DiskEntry;
4250  *pPartEntry = PartEntry;
4251  return TRUE;
4252  }
4253  }
4254  }
4255 
4256  if (pDiskEntry) *pDiskEntry = NULL;
4257  *pPartEntry = NULL;
4258 
4259  return FALSE;
4260 }
LIST_ENTRY PrimaryPartListHead
Definition: partlist.h:124
#define TRUE
Definition: types.h:120
PARTITION_STYLE DiskStyle
Definition: partlist.h:114
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
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:121
struct _DISKENTRY * DiskEntry
Definition: partlist.h:39
LIST_ENTRY List
Definition: psmgr.c:57
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
Definition: typedefs.h:119
BOOLEAN New
Definition: partlist.h:64
LIST_ENTRY LogicalPartListHead
Definition: partlist.h:125
BOOLEAN IsPartitioned
Definition: partlist.h:59

Referenced by SelectFileSystemPage().

◆ GetPartition()

PPARTENTRY GetPartition ( IN PDISKENTRY  DiskEntry,
IN ULONG  PartitionNumber 
)

Definition at line 2273 of file partlist.c.

2277 {
2278  PPARTENTRY PartEntry;
2280 
2281  if (DiskEntry->DiskStyle == PARTITION_STYLE_GPT)
2282  {
2283  DPRINT("GPT-partitioned disk detected, not currently supported by SETUP!\n");
2284  return NULL;
2285  }
2286 
2287  /* Disk found, loop over the primary partitions first... */
2288  for (Entry = DiskEntry->PrimaryPartListHead.Flink;
2289  Entry != &DiskEntry->PrimaryPartListHead;
2290  Entry = Entry->Flink)
2291  {
2292  PartEntry = CONTAINING_RECORD(Entry, PARTENTRY, ListEntry);
2293 
2294  if (PartEntry->PartitionNumber == PartitionNumber)
2295  {
2296  /* Partition found */
2297  return PartEntry;
2298  }
2299  }
2300 
2301  /* ... then over the logical partitions if needed */
2302  for (Entry = DiskEntry->LogicalPartListHead.Flink;
2303  Entry != &DiskEntry->LogicalPartListHead;
2304  Entry = Entry->Flink)
2305  {
2306  PartEntry = CONTAINING_RECORD(Entry, PARTENTRY, ListEntry);
2307 
2308  if (PartEntry->PartitionNumber == PartitionNumber)
2309  {
2310  /* Partition found */
2311  return PartEntry;
2312  }
2313  }
2314 
2315  /* The partition was not found on the disk, stop there */
2316  return NULL;
2317 }
ULONG PartitionNumber
Definition: partlist.h:48
struct _Entry Entry
Definition: kefuncs.h:627
_In_ ULONG _In_ ULONG PartitionNumber
Definition: iofuncs.h:2056
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
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
Definition: typedefs.h:119
base of all file and directory entries
Definition: entries.h:82

Referenced by GetDiskOrPartition(), ResolveArcNameManually(), and SelectPartition().

◆ GetPrevPartition()

PPARTENTRY GetPrevPartition ( IN PPARTLIST  List,
IN PPARTENTRY CurrentPart  OPTIONAL 
)

Definition at line 2476 of file partlist.c.

2479 {
2480  PLIST_ENTRY DiskListEntry;
2481  PLIST_ENTRY PartListEntry;
2483 
2484  /* Fail if no disks are available */
2485  if (IsListEmpty(&List->DiskListHead))
2486  return NULL;
2487 
2488  /* Check for the previous usable entry on the current partition's disk */
2489  if (CurrentPart != NULL)
2490  {
2491  CurrentDisk = CurrentPart->DiskEntry;
2492 
2493  if (CurrentPart->LogicalPartition)
2494  {
2495  /* Logical partition */
2496 
2497  PartListEntry = CurrentPart->ListEntry.Blink;
2498  if (PartListEntry != &CurrentDisk->LogicalPartListHead)
2499  {
2500  /* Previous logical partition */
2501  CurrentPart = CONTAINING_RECORD(PartListEntry, PARTENTRY, ListEntry);
2502  }
2503  else
2504  {
2505  /* Extended partition */
2506  CurrentPart = CurrentDisk->ExtendedPartition;
2507  }
2508  return CurrentPart;
2509  }
2510  else
2511  {
2512  /* Primary or extended partition */
2513 
2514  PartListEntry = CurrentPart->ListEntry.Blink;
2515  if (PartListEntry != &CurrentDisk->PrimaryPartListHead)
2516  {
2517  CurrentPart = CONTAINING_RECORD(PartListEntry, PARTENTRY, ListEntry);
2518 
2519  if (CurrentPart->IsPartitioned &&
2520  IsContainerPartition(CurrentPart->PartitionType))
2521  {
2522  PartListEntry = CurrentDisk->LogicalPartListHead.Blink;
2523  CurrentPart = CONTAINING_RECORD(PartListEntry, PARTENTRY, ListEntry);
2524  }
2525 
2526  return CurrentPart;
2527  }
2528  }
2529  }
2530 
2531  /* Search for the last partition entry on the previous disk */
2532  for (DiskListEntry = (CurrentPart ? CurrentDisk->ListEntry.Blink
2533  : List->DiskListHead.Blink);
2534  DiskListEntry != &List->DiskListHead;
2535  DiskListEntry = DiskListEntry->Blink)
2536  {
2537  CurrentDisk = CONTAINING_RECORD(DiskListEntry, DISKENTRY, ListEntry);
2538 
2540  {
2541  DPRINT("GPT-partitioned disk detected, not currently supported by SETUP!\n");
2542  continue;
2543  }
2544 
2545  PartListEntry = CurrentDisk->PrimaryPartListHead.Blink;
2546  if (PartListEntry != &CurrentDisk->PrimaryPartListHead)
2547  {
2548  CurrentPart = CONTAINING_RECORD(PartListEntry, PARTENTRY, ListEntry);
2549 
2550  if (CurrentPart->IsPartitioned &&
2551  IsContainerPartition(CurrentPart->PartitionType))
2552  {
2553  PartListEntry = CurrentDisk->LogicalPartListHead.Blink;
2554  if (PartListEntry != &CurrentDisk->LogicalPartListHead)
2555  {
2556  CurrentPart = CONTAINING_RECORD(PartListEntry, PARTENTRY, ListEntry);
2557  return CurrentPart;
2558  }
2559  }
2560  else
2561  {
2562  return CurrentPart;
2563  }
2564  }
2565  }
2566 
2567  return NULL;
2568 }
LIST_ENTRY PrimaryPartListHead
Definition: partlist.h:124
PDISKENTRY CurrentDisk
Definition: partlist.c:73
struct _LIST_ENTRY * Blink
Definition: typedefs.h:122
#define IsContainerPartition(PartitionType)
Definition: ntdddisk.h:316
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
PPARTENTRY ExtendedPartition
Definition: partlist.h:128
PARTITION_STYLE DiskStyle
Definition: partlist.h:114
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
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
LIST_ENTRY List
Definition: psmgr.c:57
LIST_ENTRY ListEntry
Definition: partlist.h:76
Definition: typedefs.h:119
LIST_ENTRY LogicalPartListHead
Definition: partlist.h:125

Referenced by ScrollUpPartitionList().

◆ IsPartitionActive()

BOOLEAN IsPartitionActive ( IN PPARTENTRY  PartEntry)

Definition at line 1945 of file partlist.c.

1947 {
1948  // TODO: Support for GPT disks!
1949 
1950  if (IsContainerPartition(PartEntry->PartitionType))
1951  return FALSE;
1952 
1953  /* Check if the partition is partitioned, used and active */
1954  if (PartEntry->IsPartitioned &&
1955  // !IsContainerPartition(PartEntry->PartitionType) &&
1956  PartEntry->BootIndicator)
1957  {
1958  /* Yes it is */
1959  ASSERT(PartEntry->PartitionType != PARTITION_ENTRY_UNUSED);
1960  return TRUE;
1961  }
1962 
1963  return FALSE;
1964 }
#define TRUE
Definition: types.h:120
#define IsContainerPartition(PartitionType)
Definition: ntdddisk.h:316
#define PARTITION_ENTRY_UNUSED
Definition: disk.h:86
#define FALSE
Definition: types.h:117
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)

Referenced by GetActiveDiskPartition(), SelectPartitionPage(), and SetActivePartition().

◆ IsSuperFloppy()

BOOLEAN IsSuperFloppy ( IN PDISKENTRY  DiskEntry)

Definition at line 680 of file partlist.c.

682 {
684  ULONGLONG PartitionLengthEstimate;
685 
686  /* No layout buffer: we cannot say anything yet */
687  if (DiskEntry->LayoutBuffer == NULL)
688  return FALSE;
689 
690  /* We must have only one partition */
691  if (DiskEntry->LayoutBuffer->PartitionCount != 1)
692  return FALSE;
693 
694  /* Get the single partition entry */
695  PartitionInfo = DiskEntry->LayoutBuffer->PartitionEntry;
696 
697  /* The single partition must start at the beginning of the disk */
698  if (!(PartitionInfo->StartingOffset.QuadPart == 0 &&
699  PartitionInfo->HiddenSectors == 0))
700  {
701  return FALSE;
702  }
703 
704  /* The disk signature is usually set to one; warn in case it's not */
705  if (DiskEntry->LayoutBuffer->Signature != 1)
706  {
707  DPRINT1("Super-Floppy disk %lu signature %08x != 1!\n",
708  DiskEntry->DiskNumber, DiskEntry->LayoutBuffer->Signature);
709  }
710 
711  /*
712  * The partition number must be zero or one, be recognized,
713  * have FAT16 type and report as non-bootable.
714  */
715  if ((PartitionInfo->PartitionNumber != 0 &&
716  PartitionInfo->PartitionNumber != 1) ||
717  PartitionInfo->RecognizedPartition != TRUE ||
718  PartitionInfo->PartitionType != PARTITION_FAT_16 ||
719  PartitionInfo->BootIndicator != FALSE)
720  {
721  DPRINT1("Super-Floppy disk %lu does not return default settings!\n"
722  " PartitionNumber = %lu, expected 0\n"
723  " RecognizedPartition = %s, expected TRUE\n"
724  " PartitionType = 0x%02x, expected 0x04 (PARTITION_FAT_16)\n"
725  " BootIndicator = %s, expected FALSE\n",
726  DiskEntry->DiskNumber,
727  PartitionInfo->PartitionNumber,
728  PartitionInfo->RecognizedPartition ? "TRUE" : "FALSE",
729  PartitionInfo->PartitionType,
730  PartitionInfo->BootIndicator ? "TRUE" : "FALSE");
731  }
732 
733  /* The partition lengths should agree */
734  PartitionLengthEstimate = DiskEntry->SectorCount.QuadPart * DiskEntry->BytesPerSector;
735  if (PartitionInfo->PartitionLength.QuadPart != PartitionLengthEstimate)
736  {
737  DPRINT1("PartitionLength = %I64u is different from PartitionLengthEstimate = %I64u\n",
738  PartitionInfo->PartitionLength.QuadPart, PartitionLengthEstimate);
739  }
740 
741  return TRUE;
742 }
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
uint64_t ULONGLONG
Definition: typedefs.h:67
_In_ ULONG _In_ struct _SET_PARTITION_INFORMATION_EX * PartitionInfo
Definition: iofuncs.h:2101
#define PARTITION_FAT_16
Definition: disk.h:90
#define DPRINT1
Definition: precomp.h:8

Referenced by AddDiskToList(), BootLoaderHarddiskMbrPage(), ExtendedPartitionCreationChecks(), LogicalPartitionCreationChecks(), PrimaryPartitionCreationChecks(), and xHalIoWritePartitionTable().

◆ LogicalPartitionCreationChecks()

ERROR_NUMBER LogicalPartitionCreationChecks ( IN PPARTENTRY  PartEntry)

Definition at line 4181 of file partlist.c.

4183 {
4184  PDISKENTRY DiskEntry = PartEntry->DiskEntry;
4185 
4186  if (DiskEntry->DiskStyle == PARTITION_STYLE_GPT)
4187  {
4188  DPRINT1("GPT-partitioned disk detected, not currently supported by SETUP!\n");
4189  return ERROR_WARN_PARTITION;
4190  }
4191 
4192  /* Fail if the partition is already in use */
4193  if (PartEntry->IsPartitioned)
4194  return ERROR_NEW_PARTITION;
4195 
4196  /* Only one primary partition is allowed on super-floppy */
4197  if (IsSuperFloppy(DiskEntry))
4199 
4200  return ERROR_SUCCESS;
4201 }
#define ERROR_SUCCESS
Definition: deptool.c:10
PARTITION_STYLE DiskStyle
Definition: partlist.h:114
BOOLEAN IsSuperFloppy(IN PDISKENTRY DiskEntry)
Definition: partlist.c:680
#define DPRINT1
Definition: precomp.h:8

Referenced by CreateLogicalPartition(), and SelectPartitionPage().

◆ PrimaryPartitionCreationChecks()

ERROR_NUMBER PrimaryPartitionCreationChecks ( IN PPARTENTRY  PartEntry)

Definition at line 4123 of file partlist.c.

4125 {
4126  PDISKENTRY DiskEntry = PartEntry->DiskEntry;
4127 
4128  if (DiskEntry->DiskStyle == PARTITION_STYLE_GPT)
4129  {
4130  DPRINT1("GPT-partitioned disk detected, not currently supported by SETUP!\n");
4131  return ERROR_WARN_PARTITION;
4132  }
4133 
4134  /* Fail if the partition is already in use */
4135  if (PartEntry->IsPartitioned)
4136  return ERROR_NEW_PARTITION;
4137 
4138  /* Only one primary partition is allowed on super-floppy */
4139  if (IsSuperFloppy(DiskEntry))
4141 
4142  /* Fail if there are already 4 primary partitions in the list */
4143  if (GetPrimaryPartitionCount(DiskEntry) >= 4)
4145 
4146  return ERROR_SUCCESS;
4147 }
#define ERROR_SUCCESS
Definition: deptool.c:10
PARTITION_STYLE DiskStyle
Definition: partlist.h:114
static ULONG GetPrimaryPartitionCount(IN PDISKENTRY DiskEntry)
Definition: partlist.c:2605
BOOLEAN IsSuperFloppy(IN PDISKENTRY DiskEntry)
Definition: partlist.c:680
#define DPRINT1
Definition: precomp.h:8

Referenced by CreatePrimaryPartition(), and SelectPartitionPage().

◆ RoundingDivide()

ULONGLONG RoundingDivide ( IN ULONGLONG  Dividend,
IN ULONGLONG  Divisor 
)

Definition at line 274 of file partlist.c.

277 {
278  return (Dividend + Divisor / 2) / Divisor;
279 }
_In_ LARGE_INTEGER Divisor
Definition: rtlfuncs.h:3046

Referenced by PrintDiskData(), and PrintPartitionData().

◆ SelectPartition()

PPARTENTRY SelectPartition ( IN PPARTLIST  List,
IN ULONG  DiskNumber,
IN ULONG  PartitionNumber 
)

Definition at line 2360 of file partlist.c.

2364 {
2365  PDISKENTRY DiskEntry;
2366  PPARTENTRY PartEntry;
2367 
2368  DiskEntry = GetDiskByNumber(List, DiskNumber);
2369  if (!DiskEntry)
2370  return NULL;
2371 
2372  PartEntry = GetPartition(/*List,*/ DiskEntry, PartitionNumber);
2373  if (!PartEntry)
2374  return NULL;
2375 
2376  ASSERT(PartEntry->DiskEntry == DiskEntry);
2377  ASSERT(DiskEntry->DiskNumber == DiskNumber);
2378  ASSERT(PartEntry->PartitionNumber == PartitionNumber);
2379 
2380  return PartEntry;
2381 }
ULONG PartitionNumber
Definition: partlist.h:48
ULONG DiskNumber
Definition: partlist.h:104
_In_ ULONG _In_ ULONG PartitionNumber
Definition: iofuncs.h:2056
PPARTENTRY GetPartition(IN PDISKENTRY DiskEntry, IN ULONG PartitionNumber)
Definition: partlist.c:2273
smooth NULL
Definition: ftsmooth.c:416
PDISKENTRY GetDiskByNumber(IN PPARTLIST List, IN ULONG DiskNumber)
Definition: partlist.c:2191
struct _DISKENTRY * DiskEntry
Definition: partlist.h:39
LIST_ENTRY List
Definition: psmgr.c:57
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)

Referenced by SelectPartitionPage().

◆ SetActivePartition()

BOOLEAN SetActivePartition ( IN PPARTLIST  List,
IN PPARTENTRY  PartEntry,
IN PPARTENTRY OldActivePart  OPTIONAL 
)

Definition at line 3729 of file partlist.c.

3733 {
3734  /* Check for empty disk list */
3735  if (IsListEmpty(&List->DiskListHead))
3736  return FALSE;
3737 
3738  /* Validate the partition entry */
3739  if (!PartEntry)
3740  return FALSE;
3741 
3742  /*
3743  * If the partition entry is already the system partition, or if it is
3744  * the same as the old active partition hint the user provided (and if
3745  * it is already active), just return success.
3746  */
3747  if ((PartEntry == List->SystemPartition) ||
3748  ((PartEntry == OldActivePart) && IsPartitionActive(OldActivePart)))
3749  {
3750  return TRUE;
3751  }
3752 
3753  ASSERT(PartEntry->DiskEntry);
3754 
3755  /* Ensure that the partition's disk is in the list */
3756  ASSERT(PartEntry->DiskEntry->PartList == List);
3757 
3758  /*
3759  * If the user provided an old active partition hint, verify that it is
3760  * indeeed active and belongs to the same disk where the new partition
3761  * belongs. Otherwise determine the current active partition on the disk
3762  * where the new partition belongs.
3763  */
3764  if (!(OldActivePart && IsPartitionActive(OldActivePart) && (OldActivePart->DiskEntry == PartEntry->DiskEntry)))
3765  {
3766  /* It's not, determine the current active partition for the disk */
3767  OldActivePart = GetActiveDiskPartition(PartEntry->DiskEntry);
3768  }
3769 
3770  /* Unset the old active partition if it exists */
3771  if (OldActivePart)
3772  {
3773  OldActivePart->BootIndicator = FALSE;
3774  OldActivePart->DiskEntry->LayoutBuffer->PartitionEntry[OldActivePart->PartitionIndex].BootIndicator = FALSE;
3775  OldActivePart->DiskEntry->LayoutBuffer->PartitionEntry[OldActivePart->PartitionIndex].RewritePartition = TRUE;
3776  OldActivePart->DiskEntry->Dirty = TRUE;
3777  }
3778 
3779  /* Modify the system partition if the new partition is on the system disk */
3780  if (PartEntry->DiskEntry == GetSystemDisk(List))
3781  List->SystemPartition = PartEntry;
3782 
3783  /* Set the new active partition */
3784  PartEntry->BootIndicator = TRUE;
3785  PartEntry->DiskEntry->LayoutBuffer->PartitionEntry[PartEntry->PartitionIndex].BootIndicator = TRUE;
3786  PartEntry->DiskEntry->LayoutBuffer->PartitionEntry[PartEntry->PartitionIndex].RewritePartition = TRUE;
3787  PartEntry->DiskEntry->Dirty = TRUE;
3788 
3789  return TRUE;
3790 }
static PPARTENTRY GetActiveDiskPartition(IN PDISKENTRY DiskEntry)
Definition: partlist.c:1968
#define TRUE
Definition: types.h:120
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
#define FALSE
Definition: types.h:117
LIST_ENTRY List
Definition: psmgr.c:57
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
static PDISKENTRY GetSystemDisk(IN PPARTLIST List)
Definition: partlist.c:1895
BOOLEAN IsPartitionActive(IN PPARTENTRY PartEntry)
Definition: partlist.c:1945

Referenced by SelectFileSystemPage().

◆ SetMountedDeviceValue()

BOOLEAN SetMountedDeviceValue ( IN WCHAR  Letter,
IN ULONG  Signature,
IN LARGE_INTEGER  StartingOffset 
)

Definition at line 3971 of file partlist.c.

3975 {
3976  NTSTATUS Status;
3978  UNICODE_STRING KeyName = RTL_CONSTANT_STRING(L"SYSTEM\\MountedDevices");
3980  WCHAR ValueNameBuffer[16];
3981  HANDLE KeyHandle;
3982  REG_DISK_MOUNT_INFO MountInfo;
3983 
3984  RtlStringCchPrintfW(ValueNameBuffer, ARRAYSIZE(ValueNameBuffer),
3985  L"\\DosDevices\\%c:", Letter);
3986  RtlInitUnicodeString(&ValueName, ValueNameBuffer);
3987 
3989  &KeyName,
3992  NULL);
3993 
3996  &ObjectAttributes);
3997  if (!NT_SUCCESS(Status))
3998  {
4002  0,
4003  NULL,
4005  NULL);
4006  }
4007  if (!NT_SUCCESS(Status))
4008  {
4009  DPRINT1("NtCreateKey() failed (Status %lx)\n", Status);
4010  return FALSE;
4011  }
4012 
4013  MountInfo.Signature = Signature;
4014  MountInfo.StartingOffset = StartingOffset;
4016  &ValueName,
4017  0,
4018  REG_BINARY,
4019  (PVOID)&MountInfo,
4020  sizeof(MountInfo));
4021  NtClose(KeyHandle);
4022  if (!NT_SUCCESS(Status))
4023  {
4024  DPRINT1("NtSetValueKey() failed (Status %lx)\n", Status);
4025  return FALSE;
4026  }
4027 
4028  return TRUE;
4029 }
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING KeyName
Definition: ndis.h:4711
LARGE_INTEGER StartingOffset
Definition: partlist.c:26
NTSTATUS NTAPI NtCreateKey(OUT PHANDLE KeyHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, IN ULONG TitleIndex, IN PUNICODE_STRING Class OPTIONAL, IN ULONG CreateOptions, OUT PULONG Disposition OPTIONAL)
Definition: ntapi.c:240
_In_ PFCB _In_ LONGLONG StartingOffset
Definition: cdprocs.h:290
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4711
#define REG_BINARY
Definition: nt_native.h:1496
#define TRUE
Definition: types.h:120
NTSTRSAFEVAPI RtlStringCchPrintfW(_Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cchDest, _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,...)
Definition: ntstrsafe.h:1110
LONG NTSTATUS
Definition: precomp.h:26
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
_In_ PUNICODE_STRING ValueName
Definition: cmfuncs.h:264
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
Status
Definition: gdiplustypes.h:24
static const WCHAR L[]
Definition: oid.c:1250
WCHAR Letter
HANDLE GetRootKeyByPredefKey(IN HANDLE KeyHandle, OUT PCWSTR *RootKeyMountPoint OPTIONAL)
Definition: registry.c:90
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
NTSYSAPI NTSTATUS NTAPI NtSetValueKey(IN HANDLE KeyHandle, IN PUNICODE_STRING ValueName, IN ULONG TitleIndex OPTIONAL, IN ULONG Type, IN PVOID Data, IN ULONG DataSize)
Definition: ntapi.c:859
#define DPRINT1
Definition: precomp.h:8
NTSYSAPI NTSTATUS NTAPI NtOpenKey(OUT PHANDLE KeyHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: ntapi.c:336
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
static const WCHAR Signature[]
Definition: parser.c:141
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14

Referenced by SetMountedDeviceValues().

◆ SetMountedDeviceValues()

BOOLEAN SetMountedDeviceValues ( IN PPARTLIST  List)

Definition at line 4032 of file partlist.c.

4034 {
4035  PLIST_ENTRY Entry1, Entry2;
4036  PDISKENTRY DiskEntry;
4037  PPARTENTRY PartEntry;
4039 
4040  if (List == NULL)
4041  return FALSE;
4042 
4043  for (Entry1 = List->DiskListHead.Flink;
4044  Entry1 != &List->DiskListHead;
4045  Entry1 = Entry1->Flink)
4046  {
4047  DiskEntry = CONTAINING_RECORD(Entry1,
4048  DISKENTRY,
4049  ListEntry);
4050 
4051  if (DiskEntry->DiskStyle == PARTITION_STYLE_GPT)
4052  {
4053  DPRINT("GPT-partitioned disk detected, not currently supported by SETUP!\n");
4054  continue;
4055  }
4056 
4057  for (Entry2 = DiskEntry->PrimaryPartListHead.Flink;
4058  Entry2 != &DiskEntry->PrimaryPartListHead;
4059  Entry2 = Entry2->Flink)
4060  {
4061  PartEntry = CONTAINING_RECORD(Entry2, PARTENTRY, ListEntry);
4062  if (PartEntry->IsPartitioned) // && !IsContainerPartition(PartEntry->PartitionType)
4063  {
4065 
4066  /* Assign a "\DosDevices\#:" mount point to this partition */
4067  if (PartEntry->DriveLetter)
4068  {
4069  StartingOffset.QuadPart = PartEntry->StartSector.QuadPart * DiskEntry->BytesPerSector;
4070  if (!SetMountedDeviceValue(PartEntry->DriveLetter,
4071  DiskEntry->LayoutBuffer->Signature,
4072  StartingOffset))
4073  {
4074  return FALSE;
4075  }
4076  }
4077  }
4078  }
4079 
4080  for (Entry2 = DiskEntry->LogicalPartListHead.Flink;
4081  Entry2 != &DiskEntry->LogicalPartListHead;
4082  Entry2 = Entry2->Flink)
4083  {
4084  PartEntry = CONTAINING_RECORD(Entry2, PARTENTRY, ListEntry);
4085  if (PartEntry->IsPartitioned) // && !IsContainerPartition(PartEntry->PartitionType)
4086  {
4088 
4089  /* Assign a "\DosDevices\#:" mount point to this partition */
4090  if (PartEntry->DriveLetter)
4091  {
4092  StartingOffset.QuadPart = PartEntry->StartSector.QuadPart * DiskEntry->BytesPerSector;
4093  if (!SetMountedDeviceValue(PartEntry->DriveLetter,
4094  DiskEntry->LayoutBuffer->Signature,
4095  StartingOffset))
4096  {
4097  return FALSE;
4098  }
4099  }
4100  }
4101  }
4102  }
4103 
4104  return TRUE;
4105 }
LIST_ENTRY PrimaryPartListHead
Definition: partlist.h:124
WCHAR DriveLetter
Definition: partlist.h:51
ULARGE_INTEGER StartSector
Definition: partlist.h:42
_In_ PFCB _In_ LONGLONG StartingOffset
Definition: cdprocs.h:290
#define TRUE
Definition: types.h:120
BOOLEAN SetMountedDeviceValue(IN WCHAR Letter, IN ULONG Signature, IN LARGE_INTEGER StartingOffset)
Definition: partlist.c:3971
#define PARTITION_ENTRY_UNUSED
Definition: disk.h:86
PARTITION_STYLE DiskStyle
Definition: partlist.h:114
ULONGLONG QuadPart
Definition: ms-dtyp.idl:185
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
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:121
UCHAR PartitionType
Definition: partlist.h:46
ULONG BytesPerSector
Definition: partlist.h:88
LIST_ENTRY List
Definition: psmgr.c:57
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
Definition: typedefs.h:119
LIST_ENTRY LogicalPartListHead
Definition: partlist.h:125
PDRIVE_LAYOUT_INFORMATION LayoutBuffer
Definition: partlist.h:118
BOOLEAN IsPartitioned
Definition: partlist.h:59

Referenced by UpdateRegistry().

◆ SetPartitionType()

VOID SetPartitionType ( IN PPARTENTRY  PartEntry,
IN UCHAR  PartitionType 
)

Definition at line 4108 of file partlist.c.

4111 {
4112  PDISKENTRY DiskEntry = PartEntry->DiskEntry;
4113 
4114  PartEntry->PartitionType = PartitionType;
4115 
4116  DiskEntry->Dirty = TRUE;
4117  DiskEntry->LayoutBuffer->PartitionEntry[PartEntry->PartitionIndex].PartitionType = PartitionType;
4118  DiskEntry->LayoutBuffer->PartitionEntry[PartEntry->PartitionIndex].RecognizedPartition = IsRecognizedPartition(PartitionType);
4119  DiskEntry->LayoutBuffer->PartitionEntry[PartEntry->PartitionIndex].RewritePartition = TRUE;
4120 }
#define TRUE
Definition: types.h:120
BOOLEAN Dirty
Definition: partlist.h:111
PARTITION_INFORMATION PartitionEntry[1]
Definition: ntdddisk.h:549
#define IsRecognizedPartition(PartitionType)
Definition: ntdddisk.h:342
BOOLEAN RewritePartition
Definition: ntdddisk.h:475
CHAR PartitionType
Definition: part_xbox.c:32
BOOLEAN RecognizedPartition
Definition: ntdddisk.h:474
PDRIVE_LAYOUT_INFORMATION LayoutBuffer
Definition: partlist.h:118

Referenced by PreparePartitionForFormatting().

◆ WritePartitions()

NTSTATUS WritePartitions ( IN PDISKENTRY  DiskEntry)

Definition at line 3793 of file partlist.c.

3795 {
3796  NTSTATUS Status;
3801  ULONG BufferSize;
3803  ULONG PartitionCount;
3804  PLIST_ENTRY ListEntry;
3805  PPARTENTRY PartEntry;
3806  WCHAR DstPath[MAX_PATH];
3807 
3808  DPRINT("WritePartitions() Disk: %lu\n", DiskEntry->DiskNumber);
3809 
3810  /* If the disk is not dirty, there is nothing to do */
3811  if (!DiskEntry->Dirty)
3812  return STATUS_SUCCESS;
3813 
3814  RtlStringCchPrintfW(DstPath, ARRAYSIZE(DstPath),
3815  L"\\Device\\Harddisk%lu\\Partition0",
3816  DiskEntry->DiskNumber);
3817  RtlInitUnicodeString(&Name, DstPath);
3818 
3820  &Name,
3822  NULL,
3823  NULL);
3824 
3828  &Iosb,
3829  0,
3831  if (!NT_SUCCESS(Status))
3832  {
3833  DPRINT1("NtOpenFile() failed (Status %lx)\n", Status);
3834  return Status;
3835  }
3836 
3837 #ifdef DUMP_PARTITION_TABLE
3838  DumpPartitionTable(DiskEntry);
3839 #endif
3840 
3841  //
3842  // FIXME: We first *MUST* use IOCTL_DISK_CREATE_DISK to initialize
3843  // the disk in MBR or GPT format in case the disk was not initialized!!
3844  // For this we must ask the user which format to use.
3845  //
3846 
3847  /* Save the original partition count to be restored later (see comment below) */
3848  PartitionCount = DiskEntry->LayoutBuffer->PartitionCount;
3849 
3850  /* Set the new disk layout and retrieve its updated version with possibly modified partition numbers */
3852  ((PartitionCount - 1) * sizeof(PARTITION_INFORMATION));
3854  NULL,
3855  NULL,
3856  NULL,
3857  &Iosb,
3859  DiskEntry->LayoutBuffer,
3860  BufferSize,
3861  DiskEntry->LayoutBuffer,
3862  BufferSize);
3864 
3865  /*
3866  * IOCTL_DISK_SET_DRIVE_LAYOUT calls IoWritePartitionTable(), which converts
3867  * DiskEntry->LayoutBuffer->PartitionCount into a partition *table* count,
3868  * where such a table is expected to enumerate up to 4 partitions:
3869  * partition *table* count == ROUND_UP(PartitionCount, 4) / 4 .
3870  * Due to this we need to restore the original PartitionCount number.
3871  */
3872  DiskEntry->LayoutBuffer->PartitionCount = PartitionCount;
3873 
3874  /* Check whether the IOCTL_DISK_SET_DRIVE_LAYOUT call succeeded */
3875  if (!NT_SUCCESS(Status))
3876  {
3877  DPRINT1("IOCTL_DISK_SET_DRIVE_LAYOUT failed (Status 0x%08lx)\n", Status);
3878  return Status;
3879  }
3880 
3881 #ifdef DUMP_PARTITION_TABLE
3882  DumpPartitionTable(DiskEntry);
3883 #endif
3884 
3885  /* Update the partition numbers */
3886 
3887  /* Update the primary partition table */
3888  for (ListEntry = DiskEntry->PrimaryPartListHead.Flink;
3889  ListEntry != &DiskEntry->PrimaryPartListHead;
3890  ListEntry = ListEntry->Flink)
3891  {
3892  PartEntry = CONTAINING_RECORD(ListEntry, PARTENTRY, ListEntry);
3893 
3894  if (PartEntry->IsPartitioned)
3895  {
3897  PartitionInfo = &DiskEntry->LayoutBuffer->PartitionEntry[PartEntry->PartitionIndex];
3898  PartEntry->PartitionNumber = PartitionInfo->PartitionNumber;
3899  }
3900  }
3901 
3902  /* Update the logical partition table */
3903  for (ListEntry = DiskEntry->LogicalPartListHead.Flink;
3904  ListEntry != &DiskEntry->LogicalPartListHead;
3905  ListEntry = ListEntry->Flink)
3906  {
3907  PartEntry = CONTAINING_RECORD(ListEntry, PARTENTRY, ListEntry);
3908 
3909  if (PartEntry->IsPartitioned)
3910  {
3912  PartitionInfo = &DiskEntry->LayoutBuffer->PartitionEntry[PartEntry->PartitionIndex];
3913  PartEntry->PartitionNumber = PartitionInfo->PartitionNumber;
3914  }
3915  }
3916 
3917  //
3918  // NOTE: Originally (see r40437), we used to install here also a new MBR
3919  // for this disk (by calling InstallMbrBootCodeToDisk), only if:
3920  // DiskEntry->NewDisk == TRUE and DiskEntry->HwDiskNumber == 0.
3921  // Then after that, both DiskEntry->NewDisk and DiskEntry->NoMbr were set
3922  // to FALSE. In the other place (in usetup.c) where InstallMbrBootCodeToDisk
3923  // was called too, the installation test was modified by checking whether
3924  // DiskEntry->NoMbr was TRUE (instead of NewDisk).
3925  //
3926 
3927  /* The layout has been successfully updated, the disk is not dirty anymore */
3928  DiskEntry->Dirty = FALSE;
3929 
3930  return Status;
3931 }
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
ULONG PartitionNumber
Definition: partlist.h:48
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
NTSTRSAFEVAPI RtlStringCchPrintfW(_Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cchDest, _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,...)
Definition: ntstrsafe.h:1110
LONG NTSTATUS
Definition: precomp.h:26
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
NTSYSAPI NTSTATUS NTAPI NtDeviceIoControlFile(IN HANDLE hFile, IN HANDLE hEvent OPTIONAL, IN PIO_APC_ROUTINE IoApcRoutine OPTIONAL, IN PVOID IoApcContext OPTIONAL, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN ULONG DeviceIoControlCode, IN PVOID InBuffer OPTIONAL, IN ULONG InBufferLength, OUT PVOID OutBuffer OPTIONAL, IN ULONG OutBufferLength)
struct _PARTITION_INFORMATION PARTITION_INFORMATION
#define PARTITION_ENTRY_UNUSED
Definition: disk.h:86
HANDLE FileHandle
Definition: stats.c:38
#define FALSE
Definition: types.h:117
#define GENERIC_WRITE
Definition: nt_native.h:90
struct _DRIVE_LAYOUT_INFORMATION DRIVE_LAYOUT_INFORMATION
struct NameRec_ * Name
Definition: cdprocs.h:459
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
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:121
NTSYSAPI NTSTATUS NTAPI NtOpenFile(OUT PHANDLE phFile, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN ULONG ShareMode, IN ULONG OpenMode)
Definition: file.c:3951
UCHAR PartitionType
Definition: partlist.h:46
__wchar_t WCHAR
Definition: xmlstorage.h:180
return Iosb
Definition: create.c:4402
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define MAX_PATH
Definition: compat.h:34
_In_ ULONG _In_ struct _SET_PARTITION_INFORMATION_EX * PartitionInfo
Definition: iofuncs.h:2101
#define BufferSize
Definition: classpnp.h:436
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
Status
Definition: gdiplustypes.h:24
static const WCHAR L[]
Definition: oid.c:1250
#define GENERIC_READ
Definition: compat.h:135
Definition: typedefs.h:119
#define SYNCHRONIZE
Definition: nt_native.h:61
#define DPRINT1
Definition: precomp.h:8
#define FILE_SYNCHRONOUS_IO_NONALERT
Definition: from_kernel.h:31
unsigned int ULONG
Definition: retypes.h:1
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define IOCTL_DISK_SET_DRIVE_LAYOUT
Definition: ntdddisk.h:205
return STATUS_SUCCESS
Definition: btrfs.c:3014
BOOLEAN IsPartitioned
Definition: partlist.h:59
ULONG PartitionIndex
Definition: partlist.h:49

Referenced by FormatPartitionPage(), and WritePartitionsToDisk().

◆ WritePartitionsToDisk()

BOOLEAN WritePartitionsToDisk ( IN PPARTLIST  List)

Definition at line 3934 of file partlist.c.

3936 {
3937  NTSTATUS Status;
3939  PDISKENTRY DiskEntry;
3940 
3941  if (List == NULL)
3942  return TRUE;
3943 
3944  for (Entry = List->DiskListHead.Flink;
3945  Entry != &List->DiskListHead;
3946  Entry = Entry->Flink)
3947  {
3948  DiskEntry = CONTAINING_RECORD(Entry, DISKENTRY, ListEntry);
3949 
3950  if (DiskEntry->DiskStyle == PARTITION_STYLE_GPT)
3951  {
3952  DPRINT("GPT-partitioned disk detected, not currently supported by SETUP!\n");
3953  continue;
3954  }
3955 
3956  if (DiskEntry->Dirty != FALSE)
3957  {
3958  Status = WritePartitions(DiskEntry);
3959  if (!NT_SUCCESS(Status))
3960  {
3961  DPRINT1("WritePartitionsToDisk() failed to update disk %lu, Status 0x%08lx\n",
3962  DiskEntry->DiskNumber, Status);
3963  }
3964  }
3965  }
3966 
3967  return TRUE;
3968 }
struct _Entry Entry
Definition: kefuncs.h:627
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
ULONG DiskNumber
Definition: partlist.h:104
PARTITION_STYLE DiskStyle
Definition: partlist.h:114
#define FALSE
Definition: types.h:117
BOOLEAN Dirty
Definition: partlist.h:111
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
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:121
LIST_ENTRY List
Definition: psmgr.c:57
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24
Definition: typedefs.h:119
#define DPRINT1
Definition: precomp.h:8
NTSTATUS WritePartitions(IN PDISKENTRY DiskEntry)
Definition: partlist.c:3793
base of all file and directory entries
Definition: entries.h:82

Referenced by SelectFileSystemPage().

Variable Documentation

◆ PartitionTypes

Definition at line 63 of file partlist.c.

Referenced by GetPartTypeStringFromPartitionType().