ReactOS  0.4.14-dev-552-g2fad488
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 245 of file partlist.c.

248 {
249  ULONGLONG Temp;
250 
251  Temp = Value / Alignment;
252 
253  return Temp * Alignment;
254 }
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2343
union Alignment_ Alignment
uint64_t ULONGLONG
Definition: typedefs.h:65

Referenced by InitializePartitionEntry(), and ScanForUnpartitionedDiskSpace().

◆ AlignUp()

ULONGLONG AlignUp ( IN ULONGLONG  Value,
IN ULONG  Alignment 
)

Definition at line 257 of file partlist.c.

260 {
261  ULONGLONG Temp, Result;
262 
263  Temp = Value / Alignment;
264 
265  Result = Temp * Alignment;
266  if (Value % Alignment)
267  Result += Alignment;
268 
269  return Result;
270 }
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2343
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:65

Referenced by PeFmtCreateSection().

◆ CreateExtendedPartition()

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

Definition at line 3023 of file partlist.c.

3027 {
3029 
3030  DPRINT1("CreateExtendedPartition(%I64u)\n", SectorCount);
3031 
3032  if (List == NULL || PartEntry == NULL ||
3033  PartEntry->DiskEntry == NULL || PartEntry->IsPartitioned)
3034  {
3035  return FALSE;
3036  }
3037 
3039  if (Error != NOT_AN_ERROR)
3040  {
3041  DPRINT1("ExtendedPartitionCreationChecks() failed with error %lu\n", Error);
3042  return FALSE;
3043  }
3044 
3045  /* Initialize the partition entry, inserting a new blank region if needed */
3046  if (!InitializePartitionEntry(PartEntry, SectorCount, FALSE))
3047  return FALSE;
3048 
3049  ASSERT(PartEntry->LogicalPartition == FALSE);
3050 
3051  if (PartEntry->StartSector.QuadPart < 1450560)
3052  {
3053  /* Partition starts below the 8.4GB boundary ==> CHS partition */
3054  PartEntry->PartitionType = PARTITION_EXTENDED;
3055  }
3056  else
3057  {
3058  /* Partition starts above the 8.4GB boundary ==> LBA partition */
3059  PartEntry->PartitionType = PARTITION_XINT13_EXTENDED;
3060  }
3061 
3062  // FIXME? Possibly to make GetNextUnformattedPartition work (i.e. skip the extended partition container)
3063  PartEntry->New = FALSE;
3064  PartEntry->FormatState = Formatted;
3065 
3066  PartEntry->DiskEntry->ExtendedPartition = PartEntry;
3067 
3068  AddLogicalDiskSpace(PartEntry->DiskEntry);
3069 
3070  UpdateDiskLayout(PartEntry->DiskEntry);
3072 
3073  return TRUE;
3074 }
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:856
smooth NULL
Definition: ftsmooth.c:416
static VOID UpdateDiskLayout(IN PDISKENTRY DiskEntry)
Definition: partlist.c:2710
#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:32
#define PARTITION_XINT13_EXTENDED
Definition: disk.h:98
#define DPRINT1
Definition: precomp.h:8
static VOID AddLogicalDiskSpace(IN PDISKENTRY DiskEntry)
Definition: partlist.c:2996
static VOID AssignDriveLetters(IN PPARTLIST List)
Definition: partlist.c:316

Referenced by CreateExtendedPartitionPage().

◆ CreateLogicalPartition()

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

Definition at line 3077 of file partlist.c.

3082 {
3084 
3085  DPRINT1("CreateLogicalPartition(%I64u)\n", SectorCount);
3086 
3087  if (List == NULL || PartEntry == NULL ||
3088  PartEntry->DiskEntry == NULL || PartEntry->IsPartitioned)
3089  {
3090  return FALSE;
3091  }
3092 
3094  if (Error != NOT_AN_ERROR)
3095  {
3096  DPRINT1("LogicalPartitionCreationChecks() failed with error %lu\n", Error);
3097  return FALSE;
3098  }
3099 
3100  /* Initialize the partition entry, inserting a new blank region if needed */
3101  if (!InitializePartitionEntry(PartEntry, SectorCount, AutoCreate))
3102  return FALSE;
3103 
3104  ASSERT(PartEntry->LogicalPartition == TRUE);
3105 
3106  UpdateDiskLayout(PartEntry->DiskEntry);
3108 
3109  return TRUE;
3110 }
#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:856
smooth NULL
Definition: ftsmooth.c:416
static VOID UpdateDiskLayout(IN PDISKENTRY DiskEntry)
Definition: partlist.c:2710
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:32
#define DPRINT1
Definition: precomp.h:8
static VOID AssignDriveLetters(IN PPARTLIST List)
Definition: partlist.c:316

Referenced by CreateLogicalPartitionPage(), and SelectPartitionPage().

◆ CreatePartitionList()

PPARTLIST CreatePartitionList ( VOID  )

Definition at line 2023 of file partlist.c.

2024 {
2025  PPARTLIST List;
2026  PDISKENTRY SystemDisk;
2030  ULONG ReturnSize;
2031  NTSTATUS Status;
2032  ULONG DiskNumber;
2036 
2038  0,
2039  sizeof(PARTLIST));
2040  if (List == NULL)
2041  return NULL;
2042 
2043  List->SystemPartition = NULL;
2044 
2045  InitializeListHead(&List->DiskListHead);
2046  InitializeListHead(&List->BiosDiskListHead);
2047 
2048  /*
2049  * Enumerate the disks seen by the BIOS; this will be used later
2050  * to map drives seen by NTOS with their corresponding BIOS names.
2051  */
2053 
2054  /* Enumerate disks seen by NTOS */
2056  &Sdi,
2057  sizeof(Sdi),
2058  &ReturnSize);
2059  if (!NT_SUCCESS(Status))
2060  {
2061  DPRINT1("NtQuerySystemInformation() failed, Status 0x%08lx", Status);
2063  return NULL;
2064  }
2065 
2066  for (DiskNumber = 0; DiskNumber < Sdi.NumberOfDisks; DiskNumber++)
2067  {
2069  L"\\Device\\Harddisk%lu\\Partition0",
2070  DiskNumber);
2072 
2074  &Name,
2076  NULL,
2077  NULL);
2078 
2082  &Iosb,
2085  if (NT_SUCCESS(Status))
2086  {
2087  AddDiskToList(FileHandle, DiskNumber, List);
2089  }
2090  }
2091 
2095 
2096  /*
2097  * Retrieve the system partition: the active partition on the system
2098  * disk (the one that will be booted by default by the hardware).
2099  */
2100  SystemDisk = GetSystemDisk(List);
2101  List->SystemPartition = (SystemDisk ? GetActiveDiskPartition(SystemDisk) : NULL);
2102 
2103  return List;
2104 }
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
static PPARTENTRY GetActiveDiskPartition(IN PDISKENTRY DiskEntry)
Definition: partlist.c:1967
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:1391
#define FILE_SHARE_READ
Definition: compat.h:125
HANDLE FileHandle
Definition: stats.c:38
#define FILE_READ_DATA
Definition: nt_native.h:628
struct NameRec_ * Name
Definition: cdprocs.h:464
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:4426
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
static VOID UpdateHwDiskNumbers(IN PPARTLIST List)
Definition: partlist.c:1421
#define MAX_PATH
Definition: compat.h:26
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define FILE_READ_ATTRIBUTES
Definition: nt_native.h:647
static PDISKENTRY GetSystemDisk(IN PPARTLIST List)
Definition: partlist.c:1894
static const WCHAR L[]
Definition: oid.c:1250
#define SYNCHRONIZE
Definition: nt_native.h:61
HANDLE ProcessHeap
Definition: servman.c:15
Status
Definition: gdiplustypes.h:24
static VOID EnumerateBiosDiskEntries(IN PPARTLIST PartList)
Definition: partlist.c:515
static VOID AddDiskToList(IN HANDLE FileHandle, IN ULONG DiskNumber, IN PPARTLIST List)
Definition: partlist.c:1482
#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:316

◆ CreatePrimaryPartition()

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

Definition at line 2959 of file partlist.c.

2964 {
2966 
2967  DPRINT1("CreatePrimaryPartition(%I64u)\n", SectorCount);
2968 
2969  if (List == NULL || PartEntry == NULL ||
2970  PartEntry->DiskEntry == NULL || PartEntry->IsPartitioned)
2971  {
2972  return FALSE;
2973  }
2974 
2976  if (Error != NOT_AN_ERROR)
2977  {
2978  DPRINT1("PrimaryPartitionCreationChecks() failed with error %lu\n", Error);
2979  return FALSE;
2980  }
2981 
2982  /* Initialize the partition entry, inserting a new blank region if needed */
2983  if (!InitializePartitionEntry(PartEntry, SectorCount, AutoCreate))
2984  return FALSE;
2985 
2986  ASSERT(PartEntry->LogicalPartition == FALSE);
2987 
2988  UpdateDiskLayout(PartEntry->DiskEntry);
2990 
2991  return TRUE;
2992 }
#define TRUE
Definition: types.h:120
static BOOLEAN InitializePartitionEntry(IN OUT PPARTENTRY PartEntry, IN ULONGLONG SectorCount, IN BOOLEAN AutoCreate)
Definition: partlist.c:856
smooth NULL
Definition: ftsmooth.c:416
static VOID UpdateDiskLayout(IN PDISKENTRY DiskEntry)
Definition: partlist.c:2710
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:32
#define DPRINT1
Definition: precomp.h:8
static VOID AssignDriveLetters(IN PPARTLIST List)
Definition: partlist.c:316

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

◆ DeletePartition()

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

Definition at line 3220 of file partlist.c.

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

Referenced by DeletePartitionPage().

◆ DestroyPartitionList()

VOID DestroyPartitionList ( IN PPARTLIST  List)

Definition at line 2107 of file partlist.c.

2109 {
2110  PDISKENTRY DiskEntry;
2111  PBIOSDISKENTRY BiosDiskEntry;
2112  PPARTENTRY PartEntry;
2114 
2115  /* Release disk and partition info */
2116  while (!IsListEmpty(&List->DiskListHead))
2117  {
2118  Entry = RemoveHeadList(&List->DiskListHead);
2119  DiskEntry = CONTAINING_RECORD(Entry, DISKENTRY, ListEntry);
2120 
2121  /* Release driver name */
2122  RtlFreeUnicodeString(&DiskEntry->DriverName);
2123 
2124  /* Release primary partition list */
2125  while (!IsListEmpty(&DiskEntry->PrimaryPartListHead))
2126  {
2127  Entry = RemoveHeadList(&DiskEntry->PrimaryPartListHead);
2128  PartEntry = CONTAINING_RECORD(Entry, PARTENTRY, ListEntry);
2129 
2130  RtlFreeHeap(ProcessHeap, 0, PartEntry);
2131  }
2132 
2133  /* Release logical partition list */
2134  while (!IsListEmpty(&DiskEntry->LogicalPartListHead))
2135  {
2136  Entry = RemoveHeadList(&DiskEntry->LogicalPartListHead);
2137  PartEntry = CONTAINING_RECORD(Entry, PARTENTRY, ListEntry);
2138 
2139  RtlFreeHeap(ProcessHeap, 0, PartEntry);
2140  }
2141 
2142  /* Release layout buffer */
2143  if (DiskEntry->LayoutBuffer != NULL)
2144  RtlFreeHeap(ProcessHeap, 0, DiskEntry->LayoutBuffer);
2145 
2146  /* Release disk entry */
2147  RtlFreeHeap(ProcessHeap, 0, DiskEntry);
2148  }
2149 
2150  /* Release the bios disk info */
2151  while (!IsListEmpty(&List->BiosDiskListHead))
2152  {
2153  Entry = RemoveHeadList(&List->BiosDiskListHead);
2154  BiosDiskEntry = CONTAINING_RECORD(Entry, BIOSDISKENTRY, ListEntry);
2155 
2156  RtlFreeHeap(ProcessHeap, 0, BiosDiskEntry);
2157  }
2158 
2159  /* Release list head */
2161 }
LIST_ENTRY PrimaryPartListHead
Definition: partlist.h:124
struct _Entry Entry
Definition: kefuncs.h:640
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:117
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 3113 of file partlist.c.

3115 {
3116  NTSTATUS Status;
3117  NTSTATUS LockStatus;
3121  HANDLE PartitionHandle;
3123 
3124  /* Check whether the partition is valid and was mounted by the system */
3125  if (!PartEntry->IsPartitioned ||
3126  IsContainerPartition(PartEntry->PartitionType) ||
3127  !IsRecognizedPartition(PartEntry->PartitionType) ||
3128  PartEntry->FormatState == UnknownFormat ||
3129  // NOTE: If FormatState == Unformatted but *FileSystem != 0 this means
3130  // it has been usually mounted with RawFS and thus needs to be dismounted.
3131  !*PartEntry->FileSystem ||
3132  PartEntry->PartitionNumber == 0)
3133  {
3134  /* The partition is not mounted, so just return success */
3135  return STATUS_SUCCESS;
3136  }
3137 
3138  ASSERT(PartEntry->PartitionType != PARTITION_ENTRY_UNUSED);
3139 
3140  /* Open the volume */
3142  L"\\Device\\Harddisk%lu\\Partition%lu",
3143  PartEntry->DiskEntry->DiskNumber,
3144  PartEntry->PartitionNumber);
3146 
3148  &Name,
3150  NULL,
3151  NULL);
3152 
3153  Status = NtOpenFile(&PartitionHandle,
3156  &IoStatusBlock,
3159  if (!NT_SUCCESS(Status))
3160  {
3161  DPRINT1("ERROR: Cannot open volume %wZ for dismounting! (Status 0x%lx)\n", &Name, Status);
3162  return Status;
3163  }
3164 
3165  /* Lock the volume */
3166  LockStatus = NtFsControlFile(PartitionHandle,
3167  NULL,
3168  NULL,
3169  NULL,
3170  &IoStatusBlock,
3172  NULL,
3173  0,
3174  NULL,
3175  0);
3176  if (!NT_SUCCESS(LockStatus))
3177  {
3178  DPRINT1("WARNING: Failed to lock volume! Operations may fail! (Status 0x%lx)\n", LockStatus);
3179  }
3180 
3181  /* Dismount the volume */
3182  Status = NtFsControlFile(PartitionHandle,
3183  NULL,
3184  NULL,
3185  NULL,
3186  &IoStatusBlock,
3188  NULL,
3189  0,
3190  NULL,
3191  0);
3192  if (!NT_SUCCESS(Status))
3193  {
3194  DPRINT1("Failed to unmount volume (Status 0x%lx)\n", Status);
3195  }
3196 
3197  /* Unlock the volume */
3198  LockStatus = NtFsControlFile(PartitionHandle,
3199  NULL,
3200  NULL,
3201  NULL,
3202  &IoStatusBlock,
3204  NULL,
3205  0,
3206  NULL,
3207  0);
3208  if (!NT_SUCCESS(LockStatus))
3209  {
3210  DPRINT1("Failed to unlock volume (Status 0x%lx)\n", LockStatus);
3211  }
3212 
3213  /* Close the volume */
3214  NtClose(PartitionHandle);
3215 
3216  return Status;
3217 }
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
#define FSCTL_UNLOCK_VOLUME
Definition: nt_native.h:833
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:250
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:125
#define PARTITION_ENTRY_UNUSED
Definition: disk.h:86
#define GENERIC_WRITE
Definition: nt_native.h:90
struct NameRec_ * Name
Definition: cdprocs.h:464
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:276
#define MAX_PATH
Definition: compat.h:26
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
static const WCHAR L[]
Definition: oid.c:1250
#define GENERIC_READ
Definition: compat.h:124
#define SYNCHRONIZE
Definition: nt_native.h:61
Status
Definition: gdiplustypes.h:24
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:2938

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:2604
BOOLEAN IsSuperFloppy(IN PDISKENTRY DiskEntry)
Definition: partlist.c:679
#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 3433 of file partlist.c.

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

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

◆ GetDiskByNumber()

PDISKENTRY GetDiskByNumber ( IN PPARTLIST  List,
IN ULONG  DiskNumber 
)

Definition at line 2190 of file partlist.c.

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

Referenced by GetDiskOrPartition(), and SelectPartition().

◆ GetDiskBySCSI()

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

Definition at line 2216 of file partlist.c.

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

2249 {
2250  PDISKENTRY DiskEntry;
2252 
2253  /* Loop over the disks and find the correct one */
2254  for (Entry = List->DiskListHead.Flink;
2255  Entry != &List->DiskListHead;
2256  Entry = Entry->Flink)
2257  {
2258  DiskEntry = CONTAINING_RECORD(Entry, DISKENTRY, ListEntry);
2259 
2260  if (DiskEntry->LayoutBuffer->Signature == Signature)
2261  {
2262  /* Disk found */
2263  return DiskEntry;
2264  }
2265  }
2266 
2267  /* Disk not found, stop there */
2268  return NULL;
2269 }
struct _Entry Entry
Definition: kefuncs.h:640
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:119
LIST_ENTRY List
Definition: psmgr.c:57
Definition: typedefs.h:117
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 2319 of file partlist.c.

2325 {
2326  PDISKENTRY DiskEntry;
2327  PPARTENTRY PartEntry = NULL;
2328 
2329  /* Find the disk */
2330  DiskEntry = GetDiskByNumber(List, DiskNumber);
2331  if (!DiskEntry)
2332  return FALSE;
2333 
2334  /* If we have a partition (PartitionNumber != 0), find it */
2335  if (PartitionNumber != 0)
2336  {
2337  if (DiskEntry->DiskStyle == PARTITION_STYLE_GPT)
2338  {
2339  DPRINT("GPT-partitioned disk detected, not currently supported by SETUP!\n");
2340  return FALSE;
2341  }
2342 
2343  PartEntry = GetPartition(/*List,*/ DiskEntry, PartitionNumber);
2344  if (!PartEntry)
2345  return FALSE;
2346  ASSERT(PartEntry->DiskEntry == DiskEntry);
2347  }
2348 
2349  /* Return the disk (and optionally the partition) */
2350  *pDiskEntry = DiskEntry;
2351  if (pPartEntry) *pPartEntry = PartEntry;
2352  return TRUE;
2353 }
#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:2272
PARTITION_STYLE DiskStyle
Definition: partlist.h:114
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
PDISKENTRY GetDiskByNumber(IN PPARTLIST List, IN ULONG DiskNumber)
Definition: partlist.c:2190
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 2383 of file partlist.c.

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

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

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

Referenced by ScrollUpPartitionList().

◆ IsPartitionActive()

BOOLEAN IsPartitionActive ( IN PPARTENTRY  PartEntry)

Definition at line 1944 of file partlist.c.

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

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

◆ IsSuperFloppy()

BOOLEAN IsSuperFloppy ( IN PDISKENTRY  DiskEntry)

Definition at line 679 of file partlist.c.

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

Referenced by CreatePrimaryPartition(), and SelectPartitionPage().

◆ RoundingDivide()

ULONGLONG RoundingDivide ( IN ULONGLONG  Dividend,
IN ULONGLONG  Divisor 
)

Definition at line 273 of file partlist.c.

276 {
277  return (Dividend + Divisor / 2) / Divisor;
278 }
_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 2359 of file partlist.c.

2363 {
2364  PDISKENTRY DiskEntry;
2365  PPARTENTRY PartEntry;
2366 
2367  DiskEntry = GetDiskByNumber(List, DiskNumber);
2368  if (!DiskEntry)
2369  return NULL;
2370 
2371  PartEntry = GetPartition(/*List,*/ DiskEntry, PartitionNumber);
2372  if (!PartEntry)
2373  return NULL;
2374 
2375  ASSERT(PartEntry->DiskEntry == DiskEntry);
2376  ASSERT(DiskEntry->DiskNumber == DiskNumber);
2377  ASSERT(PartEntry->PartitionNumber == PartitionNumber);
2378 
2379  return PartEntry;
2380 }
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:2272
smooth NULL
Definition: ftsmooth.c:416
PDISKENTRY GetDiskByNumber(IN PPARTLIST List, IN ULONG DiskNumber)
Definition: partlist.c:2190
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 3728 of file partlist.c.

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

Referenced by SelectFileSystemPage().

◆ SetMountedDeviceValue()

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

Definition at line 3970 of file partlist.c.

3974 {
3976  WCHAR ValueNameBuffer[16];
3977  UNICODE_STRING KeyName = RTL_CONSTANT_STRING(L"\\Registry\\Machine\\SYSTEM\\MountedDevices");
3979  REG_DISK_MOUNT_INFO MountInfo;
3980  NTSTATUS Status;
3981  HANDLE KeyHandle;
3982 
3983  RtlStringCchPrintfW(ValueNameBuffer, ARRAYSIZE(ValueNameBuffer),
3984  L"\\DosDevices\\%c:", Letter);
3985  RtlInitUnicodeString(&ValueName, ValueNameBuffer);
3986 
3988  &KeyName,
3990  NULL,
3991  NULL);
3992 
3995  &ObjectAttributes);
3996  if (!NT_SUCCESS(Status))
3997  {
4001  0,
4002  NULL,
4004  NULL);
4005  }
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
#define TRUE
Definition: types.h:120
LARGE_INTEGER StartingOffset
Definition: partlist.c:25
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:282
_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
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
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
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
static const WCHAR L[]
Definition: oid.c:1250
WCHAR Letter
Status
Definition: gdiplustypes.h:24
#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 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
#define TRUE
Definition: types.h:120
_In_ PFCB _In_ LONGLONG StartingOffset
Definition: cdprocs.h:282
BOOLEAN SetMountedDeviceValue(IN WCHAR Letter, IN ULONG Signature, IN LARGE_INTEGER StartingOffset)
Definition: partlist.c:3970
#define PARTITION_ENTRY_UNUSED
Definition: disk.h:86
PARTITION_STYLE DiskStyle
Definition: partlist.h:114
ULONGLONG QuadPart
Definition: ms-dtyp.idl:185
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:119
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:117
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:476
#define IsRecognizedPartition(PartitionType)
Definition: ntdddisk.h:276
BOOLEAN RewritePartition
Definition: ntdddisk.h:405
CHAR PartitionType
Definition: part_xbox.c:33
BOOLEAN RecognizedPartition
Definition: ntdddisk.h:404
PDRIVE_LAYOUT_INFORMATION LayoutBuffer
Definition: partlist.h:118

Referenced by PreparePartitionForFormatting().

◆ WritePartitions()

NTSTATUS WritePartitions ( IN PDISKENTRY  DiskEntry)

Definition at line 3792 of file partlist.c.

3794 {
3795  NTSTATUS Status;
3800  ULONG BufferSize;
3802  ULONG PartitionCount;
3803  PLIST_ENTRY ListEntry;
3804  PPARTENTRY PartEntry;
3805  WCHAR DstPath[MAX_PATH];
3806 
3807  DPRINT("WritePartitions() Disk: %lu\n", DiskEntry->DiskNumber);
3808 
3809  /* If the disk is not dirty, there is nothing to do */
3810  if (!DiskEntry->Dirty)
3811  return STATUS_SUCCESS;
3812 
3813  RtlStringCchPrintfW(DstPath, ARRAYSIZE(DstPath),
3814  L"\\Device\\Harddisk%lu\\Partition0",
3815  DiskEntry->DiskNumber);
3816  RtlInitUnicodeString(&Name, DstPath);
3817 
3819  &Name,
3821  NULL,
3822  NULL);
3823 
3827  &Iosb,
3828  0,
3830  if (!NT_SUCCESS(Status))
3831  {
3832  DPRINT1("NtOpenFile() failed (Status %lx)\n", Status);
3833  return Status;
3834  }
3835 
3836 #ifdef DUMP_PARTITION_TABLE
3837  DumpPartitionTable(DiskEntry);
3838 #endif
3839 
3840  //
3841  // FIXME: We first *MUST* use IOCTL_DISK_CREATE_DISK to initialize
3842  // the disk in MBR or GPT format in case the disk was not initialized!!
3843  // For this we must ask the user which format to use.
3844  //
3845 
3846  /* Save the original partition count to be restored later (see comment below) */
3847  PartitionCount = DiskEntry->LayoutBuffer->PartitionCount;
3848 
3849  /* Set the new disk layout and retrieve its updated version with possibly modified partition numbers */
3851  ((PartitionCount - 1) * sizeof(PARTITION_INFORMATION));
3853  NULL,
3854  NULL,
3855  NULL,
3856  &Iosb,
3858  DiskEntry->LayoutBuffer,
3859  BufferSize,
3860  DiskEntry->LayoutBuffer,
3861  BufferSize);
3863 
3864  /*
3865  * IOCTL_DISK_SET_DRIVE_LAYOUT calls IoWritePartitionTable(), which converts
3866  * DiskEntry->LayoutBuffer->PartitionCount into a partition *table* count,
3867  * where such a table is expected to enumerate up to 4 partitions:
3868  * partition *table* count == ROUND_UP(PartitionCount, 4) / 4 .
3869  * Due to this we need to restore the original PartitionCount number.
3870  */
3871  DiskEntry->LayoutBuffer->PartitionCount = PartitionCount;
3872 
3873  /* Check whether the IOCTL_DISK_SET_DRIVE_LAYOUT call succeeded */
3874  if (!NT_SUCCESS(Status))
3875  {
3876  DPRINT1("IOCTL_DISK_SET_DRIVE_LAYOUT failed (Status 0x%08lx)\n", Status);
3877  return Status;
3878  }
3879 
3880 #ifdef DUMP_PARTITION_TABLE
3881  DumpPartitionTable(DiskEntry);
3882 #endif
3883 
3884  /* Update the partition numbers */
3885 
3886  /* Update the primary partition table */
3887  for (ListEntry = DiskEntry->PrimaryPartListHead.Flink;
3888  ListEntry != &DiskEntry->PrimaryPartListHead;
3889  ListEntry = ListEntry->Flink)
3890  {
3891  PartEntry = CONTAINING_RECORD(ListEntry, PARTENTRY, ListEntry);
3892 
3893  if (PartEntry->IsPartitioned)
3894  {
3896  PartitionInfo = &DiskEntry->LayoutBuffer->PartitionEntry[PartEntry->PartitionIndex];
3897  PartEntry->PartitionNumber = PartitionInfo->PartitionNumber;
3898  }
3899  }
3900 
3901  /* Update the logical partition table */
3902  for (ListEntry = DiskEntry->LogicalPartListHead.Flink;
3903  ListEntry != &DiskEntry->LogicalPartListHead;
3904  ListEntry = ListEntry->Flink)
3905  {
3906  PartEntry = CONTAINING_RECORD(ListEntry, PARTENTRY, ListEntry);
3907 
3908  if (PartEntry->IsPartitioned)
3909  {
3911  PartitionInfo = &DiskEntry->LayoutBuffer->PartitionEntry[PartEntry->PartitionIndex];
3912  PartEntry->PartitionNumber = PartitionInfo->PartitionNumber;
3913  }
3914  }
3915 
3916  //
3917  // NOTE: Originally (see r40437), we used to install here also a new MBR
3918  // for this disk (by calling InstallMbrBootCodeToDisk), only if:
3919  // DiskEntry->NewDisk == TRUE and DiskEntry->HwDiskNumber == 0.
3920  // Then after that, both DiskEntry->NewDisk and DiskEntry->NoMbr were set
3921  // to FALSE. In the other place (in usetup.c) where InstallMbrBootCodeToDisk
3922  // was called too, the installation test was modified by checking whether
3923  // DiskEntry->NoMbr was TRUE (instead of NewDisk).
3924  //
3925 
3926  /* The layout has been successfully updated, the disk is not dirty anymore */
3927  DiskEntry->Dirty = FALSE;
3928 
3929  return Status;
3930 }
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
ULONG PartitionNumber
Definition: partlist.h:48
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 GENERIC_WRITE
Definition: nt_native.h:90
struct _DRIVE_LAYOUT_INFORMATION DRIVE_LAYOUT_INFORMATION
struct NameRec_ * Name
Definition: cdprocs.h:464
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:119
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:4426
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define MAX_PATH
Definition: compat.h:26
_In_ ULONG _In_ struct _SET_PARTITION_INFORMATION_EX * PartitionInfo
Definition: iofuncs.h:2101
#define BufferSize
Definition: classpnp.h:419
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
static const WCHAR L[]
Definition: oid.c:1250
#define GENERIC_READ
Definition: compat.h:124
Definition: typedefs.h:117
#define SYNCHRONIZE
Definition: nt_native.h:61
Status
Definition: gdiplustypes.h:24
#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:170
return STATUS_SUCCESS
Definition: btrfs.c:2938
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 3933 of file partlist.c.

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

Referenced by SelectFileSystemPage().

Variable Documentation

◆ PartitionTypes

Definition at line 62 of file partlist.c.

Referenced by GetPartTypeStringFromPartitionType().