Skip to content

Commit

Permalink
**** Move stuff around for future WIP drive letters assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
HBelusca committed Oct 24, 2024
1 parent bf71f9e commit c7dfe28
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 36 deletions.
82 changes: 50 additions & 32 deletions base/setup/lib/utils/partlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,11 @@
#include "volutil.h"
#include "fsrec.h" // For FileSystemToMBRPartitionType()

#include "registry.h"

#define NDEBUG
#include <debug.h>

// #define DUMP_PARTITION_TABLE

#include <pshpack1.h>
typedef struct _REG_DISK_MOUNT_INFO
{
ULONG Signature;
ULONGLONG StartingOffset;
} REG_DISK_MOUNT_INFO, *PREG_DISK_MOUNT_INFO;
#include <poppack.h>


/* FUNCTIONS ****************************************************************/

Expand Down Expand Up @@ -3130,6 +3120,11 @@ DeletePartition(
return TRUE;
}


/*****************************************************************************\
* SETUP-specific support functions
*/

static
BOOLEAN
IsSupportedActivePartition(
Expand Down Expand Up @@ -3519,6 +3514,11 @@ FindSupportedSystemPartition(
return CandidatePartition;
}

/*
* End of SETUP-specific support functions
*****************************************************************************/


BOOLEAN
SetActivePartition(
IN PPARTLIST List,
Expand Down Expand Up @@ -3797,6 +3797,43 @@ WritePartitionsToDisk(
return TRUE;
}

VOID
SetMBRPartitionType(
IN PPARTENTRY PartEntry,
IN UCHAR PartitionType)
{
PDISKENTRY DiskEntry = PartEntry->DiskEntry;

ASSERT(DiskEntry->DiskStyle == PARTITION_STYLE_MBR);

/* Nothing to do if we assign the same type */
if (PartitionType == PartEntry->PartitionType)
return;

// TODO: We might need to remount the associated basic volume...

PartEntry->PartitionType = PartitionType;

DiskEntry->Dirty = TRUE;
DiskEntry->LayoutBuffer->PartitionEntry[PartEntry->PartitionIndex].PartitionType = PartitionType;
DiskEntry->LayoutBuffer->PartitionEntry[PartEntry->PartitionIndex].RecognizedPartition = IsRecognizedPartition(PartitionType);
DiskEntry->LayoutBuffer->PartitionEntry[PartEntry->PartitionIndex].RewritePartition = TRUE;
}


/*****************************************************************************\
* SETUP-specific support functions
*/

#include "registry.h" // For GetRootKeyByPredefKey()

#include <pshpack1.h>
typedef struct _REG_DISK_MOUNT_INFO
{
ULONG Signature;
ULONGLONG StartingOffset;
} REG_DISK_MOUNT_INFO, *PREG_DISK_MOUNT_INFO;
#include <poppack.h>

/**
* @brief
Expand Down Expand Up @@ -3892,27 +3929,8 @@ SetMountedDeviceValues(
return TRUE;
}

VOID
SetMBRPartitionType(
IN PPARTENTRY PartEntry,
IN UCHAR PartitionType)
{
PDISKENTRY DiskEntry = PartEntry->DiskEntry;

ASSERT(DiskEntry->DiskStyle == PARTITION_STYLE_MBR);

/* Nothing to do if we assign the same type */
if (PartitionType == PartEntry->PartitionType)
return;

// TODO: We might need to remount the associated basic volume...

PartEntry->PartitionType = PartitionType;

DiskEntry->Dirty = TRUE;
DiskEntry->LayoutBuffer->PartitionEntry[PartEntry->PartitionIndex].PartitionType = PartitionType;
DiskEntry->LayoutBuffer->PartitionEntry[PartEntry->PartitionIndex].RecognizedPartition = IsRecognizedPartition(PartitionType);
DiskEntry->LayoutBuffer->PartitionEntry[PartEntry->PartitionIndex].RewritePartition = TRUE;
}
/*
* End of SETUP-specific support functions
*****************************************************************************/

/* EOF */
8 changes: 4 additions & 4 deletions base/setup/lib/utils/partlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -379,13 +379,13 @@ BOOLEAN
WritePartitionsToDisk(
IN PPARTLIST List);

BOOLEAN
SetMountedDeviceValues(
_In_ PPARTLIST List);

VOID
SetMBRPartitionType(
IN PPARTENTRY PartEntry,
IN UCHAR PartitionType);

BOOLEAN
SetMountedDeviceValues(
_In_ PPARTLIST List);

/* EOF */

0 comments on commit c7dfe28

Please sign in to comment.