[FREELDR:ARCH] Modularize the disk registration code (#8736)

This commit is contained in:
Hermès Bélusca-Maïto
2026-04-02 17:36:10 +02:00
parent d2cbec0b5f
commit 56481e1b8d
9 changed files with 222 additions and 211 deletions
+1 -1
View File
@@ -75,7 +75,7 @@ ARC_DISK_SIGNATURE_EX reactos_arc_disk_info[32];
VOID
AddReactOSArcDiskInfo(
IN PSTR ArcName,
IN PCSTR ArcName,
IN ULONG Signature,
IN ULONG Checksum,
IN BOOLEAN ValidPartitionTable)
+49 -97
View File
@@ -22,14 +22,13 @@
#include <freeldr.h>
#include <debug.h>
DBG_DEFAULT_CHANNEL(HWDETECT);
DBG_DEFAULT_CHANNEL(DISK);
/*
* This is the common code for harddisk for both the PC and the XBOX.
*/
#define FIRST_BIOS_DISK 0x80
#define FIRST_PARTITION 1
typedef struct tagDISKCONTEXT
{
@@ -41,8 +40,6 @@ typedef struct tagDISKCONTEXT
ULONGLONG SectorNumber;
} DISKCONTEXT;
static const CHAR Hex[] = "0123456789abcdef";
/* Data cache for BIOS disks pre-enumeration */
UCHAR PcBiosDiskCount = 0;
static CHAR PcDiskIdentifier[32][20];
@@ -257,68 +254,33 @@ GetHarddiskIdentifier(UCHAR DriveNumber)
}
static VOID
GetHarddiskInformation(UCHAR DriveNumber)
GetHarddiskInformation(
_In_ UCHAR DriveNumber)
{
PMASTER_BOOT_RECORD Mbr;
PULONG Buffer;
ULONG i;
ULONG Checksum;
ULONG Signature;
BOOLEAN ValidPartitionTable;
CHAR ArcName[MAX_PATH];
PARTITION_TABLE_ENTRY PartitionTableEntry;
static const CHAR Hex[] = "0123456789abcdef";
PCHAR Identifier = PcDiskIdentifier[DriveNumber - FIRST_BIOS_DISK];
ARC_STATUS Status;
ULONG Checksum, Signature;
BOOLEAN ValidPartitionTable;
CHAR DiskName[64];
/* Detect disk partition type */
DiskDetectPartitionType(DriveNumber);
RtlStringCbPrintfA(DiskName, sizeof(DiskName),
"multi(0)disk(0)rdisk(%u)",
DriveNumber - FIRST_BIOS_DISK);
/* Read the MBR */
if (!MachDiskReadLogicalSectors(DriveNumber, 0ULL, 1, DiskReadBuffer))
DiskReportError(FALSE);
Status = DiskInitialize(DriveNumber, DiskName, DiskPeripheral, &DiskVtbl,
&Checksum, &Signature, &ValidPartitionTable);
DiskReportError(TRUE);
if (Status != ESUCCESS)
{
ERR("Reading MBR failed\n");
/* We failed, use a default identifier */
sprintf(Identifier, "BIOSDISK%d", DriveNumber - FIRST_BIOS_DISK + 1);
/* The disk failed to be initialized, use a default identifier */
RtlStringCbPrintfA(Identifier, 20, "BIOSDISK%u", DriveNumber - FIRST_BIOS_DISK + 1);
return;
}
Buffer = (ULONG*)DiskReadBuffer;
Mbr = (PMASTER_BOOT_RECORD)DiskReadBuffer;
Signature = Mbr->Signature;
TRACE("Signature: %x\n", Signature);
/* Calculate the MBR checksum */
Checksum = 0;
for (i = 0; i < 512 / sizeof(ULONG); i++)
{
Checksum += Buffer[i];
}
Checksum = ~Checksum + 1;
TRACE("Checksum: %x\n", Checksum);
ValidPartitionTable = (Mbr->MasterBootRecordMagic == 0xAA55);
/* Fill out the ARC disk block */
sprintf(ArcName, "multi(0)disk(0)rdisk(%u)", DriveNumber - FIRST_BIOS_DISK);
AddReactOSArcDiskInfo(ArcName, Signature, Checksum, ValidPartitionTable);
sprintf(ArcName, "multi(0)disk(0)rdisk(%u)partition(0)", DriveNumber - FIRST_BIOS_DISK);
FsRegisterDevice(ArcName, &DiskVtbl);
/* Add partitions */
i = FIRST_PARTITION;
DiskReportError(FALSE);
while (DiskGetPartitionEntry(DriveNumber, i, &PartitionTableEntry))
{
if (PartitionTableEntry.SystemIndicator != PARTITION_ENTRY_UNUSED)
{
sprintf(ArcName, "multi(0)disk(0)rdisk(%u)partition(%lu)", DriveNumber - FIRST_BIOS_DISK, i);
FsRegisterDevice(ArcName, &DiskVtbl);
}
i++;
}
DiskReportError(TRUE);
/* Convert checksum and signature to identifier string */
Identifier[0] = Hex[(Checksum >> 28) & 0x0F];
Identifier[1] = Hex[(Checksum >> 24) & 0x0F];
@@ -339,7 +301,7 @@ GetHarddiskInformation(UCHAR DriveNumber)
Identifier[16] = Hex[Signature & 0x0F];
Identifier[17] = '-';
Identifier[18] = (ValidPartitionTable ? 'A' : 'X');
Identifier[19] = 0;
Identifier[19] = ANSI_NULL;
TRACE("Identifier: %s\n", Identifier);
}
@@ -381,7 +343,7 @@ EnumerateHarddisks(OUT PBOOLEAN BootDriveReported)
break;
}
/* Cache the BIOS hard disk information for later use */
/* Register and cache the BIOS hard disk information for later use */
GetHarddiskInformation(DriveNumber);
/* Check if we have seen the boot drive */
@@ -402,15 +364,21 @@ EnumerateHarddisks(OUT PBOOLEAN BootDriveReported)
}
static BOOLEAN
DiskGetBootPath(BOOLEAN IsPxe)
DiskGetBootPath(
_In_ BOOLEAN IsPxe,
_Out_ PCONFIGURATION_TYPE DeviceType)
{
// *DeviceType = DiskGetConfigType(FrldrBootDrive);
if (*FrLdrBootPath)
return TRUE;
// FIXME! FIXME! Do this in some drive recognition procedure!!!!
*DeviceType = 0;
// FIXME: Do this in some drive recognition procedure!
if (IsPxe)
{
RtlStringCbCopyA(FrLdrBootPath, sizeof(FrLdrBootPath), "net(0)");
*DeviceType = NetworkPeripheral;
}
else
/* 0x49 is our magic ramdisk drive, so try to detect it first */
@@ -419,36 +387,40 @@ DiskGetBootPath(BOOLEAN IsPxe)
/* This is the ramdisk. See ArmInitializeBootDevices() too... */
// RtlStringCbPrintfA(FrLdrBootPath, sizeof(FrLdrBootPath), "ramdisk(%u)", 0);
RtlStringCbCopyA(FrLdrBootPath, sizeof(FrLdrBootPath), "ramdisk(0)");
*DeviceType = DiskPeripheral;
}
else if (FrldrBootDrive < FIRST_BIOS_DISK)
else if (FrldrBootDrive < FIRST_BIOS_DISK) // (DiskGetConfigType(FrldrBootDrive) == FloppyDiskPeripheral)
{
/* This is a floppy */
RtlStringCbPrintfA(FrLdrBootPath, sizeof(FrLdrBootPath),
"multi(0)disk(0)fdisk(%u)", FrldrBootDrive);
*DeviceType = FloppyDiskPeripheral;
}
else if (FrldrBootPartition == 0xFF)
{
/* Boot Partition 0xFF is the magic value that indicates booting from CD-ROM (see isoboot.S) */
// TODO: Check if it's really a CD-ROM drive
RtlStringCbPrintfA(FrLdrBootPath, sizeof(FrLdrBootPath),
"multi(0)disk(0)cdrom(%u)", FrldrBootDrive - FIRST_BIOS_DISK);
*DeviceType = CdromController;
}
else
{
ULONG BootPartition;
PARTITION_TABLE_ENTRY PartitionEntry;
/* This is a hard disk */
/* This is a hard disk, find the boot partition */
if (!DiskGetBootPartitionEntry(FrldrBootDrive, &PartitionEntry, &BootPartition))
{
ERR("Failed to get boot partition entry\n");
return FALSE;
}
FrldrBootPartition = BootPartition;
RtlStringCbPrintfA(FrLdrBootPath, sizeof(FrLdrBootPath),
"multi(0)disk(0)rdisk(%u)partition(%lu)",
FrldrBootDrive - FIRST_BIOS_DISK, FrldrBootPartition);
*DeviceType = DiskPeripheral;
}
return TRUE;
@@ -463,49 +435,29 @@ PcInitializeBootDevices(VOID)
DiskCount = EnumerateHarddisks(&BootDriveReported);
/* Initialize FrLdrBootPath, the boot path we're booting from (the "SystemPartition") */
DiskGetBootPath(PxeInit());
/* Initialize FrLdrBootPath, the path FreeLoader starts from */
DiskGetBootPath(PxeInit(), &DriveType);
/* Add it, if it's a floppy or CD-ROM */
DriveType = DiskGetConfigType(FrldrBootDrive);
if ((FrldrBootDrive >= FIRST_BIOS_DISK && !BootDriveReported) ||
(DriveType == FloppyDiskPeripheral || DriveType == CdromController))
{
/* TODO: Check if it's really a CD-ROM drive */
ARC_STATUS Status;
PMASTER_BOOT_RECORD Mbr;
PULONG Buffer;
ULONG Checksum = 0;
ULONG Signature;
ULONG i;
DiskReportError(FALSE);
Status = DiskInitialize(FrldrBootDrive, FrLdrBootPath, DriveType,
&DiskVtbl, NULL, NULL, NULL);
DiskReportError(TRUE);
/* Read the MBR */
if (!MachDiskReadLogicalSectors(FrldrBootDrive, 16ULL, 1, DiskReadBuffer))
if (Status == ESUCCESS)
{
ERR("Reading MBR failed\n");
return FALSE;
DiskCount++; // This is not accounted for in the number of pre-enumerated BIOS drives!
TRACE("Additional boot drive detected: 0x%02X\n", FrldrBootDrive);
}
Buffer = (ULONG*)DiskReadBuffer;
Mbr = (PMASTER_BOOT_RECORD)DiskReadBuffer;
Signature = Mbr->Signature;
TRACE("Signature: %x\n", Signature);
/* Calculate the MBR checksum */
for (i = 0; i < 2048 / sizeof(ULONG); i++)
else
{
Checksum += Buffer[i];
ERR("Additional boot drive 0x%02X failed\n", FrldrBootDrive);
}
Checksum = ~Checksum + 1;
TRACE("Checksum: %x\n", Checksum);
/* Fill out the ARC disk block */
AddReactOSArcDiskInfo(FrLdrBootPath, Signature, Checksum, TRUE);
FsRegisterDevice(FrLdrBootPath, &DiskVtbl);
DiskCount++; // This is not accounted for in the number of pre-enumerated BIOS drives!
TRACE("Additional boot drive detected: 0x%02X\n", (int)FrldrBootDrive);
}
return (DiskCount != 0);
+34 -106
View File
@@ -81,11 +81,11 @@ typedef struct tagDISKCONTEXT
typedef struct _INTERNAL_UEFI_DISK
{
UCHAR ArcDriveNumber;
UCHAR NumOfPartitions;
ULONG UefiHandleIndex;
BOOLEAN IsThisTheBootDrive;
EFI_HANDLE Handle;
ULONG UefiHandleIndex;
UCHAR ArcDriveNumber;
BOOLEAN IsThisTheBootDrive;
CHAR DiskIdentifier[20];
} INTERNAL_UEFI_DISK, *PINTERNAL_UEFI_DISK;
/* GLOBALS *******************************************************************/
@@ -100,16 +100,13 @@ static PVOID DiskReadBufferRaw;
static ULONG DiskReadBufferAlignment;
static BOOLEAN DiskReadBufferFromPool;
static BOOLEAN DiskReadBufferFallbackPool = FALSE;
UCHAR PcBiosDiskCount;
static UCHAR PcBiosDiskCount;
UCHAR FrldrBootDrive;
ULONG FrldrBootPartition;
SIZE_T DiskReadBufferSize;
PVOID Buffer;
static const CHAR Hex[] = "0123456789abcdef";
static CHAR PcDiskIdentifier[32][20];
/* UEFI-specific */
static ULONG UefiBootRootIndex = 0;
static ULONG PublicBootArcDisk = 0;
@@ -839,90 +836,41 @@ static const DEVVTBL UefiDiskVtbl =
UefiDiskSeek,
};
PCHAR
GetHarddiskIdentifier(UCHAR DriveNumber)
static VOID
GetHarddiskInformation(
_In_ UCHAR DriveNumber)
{
TRACE("GetHarddiskIdentifier: DriveNumber: %d\n", DriveNumber);
if (DriveNumber < FIRST_BIOS_DISK)
return NULL;
return PcDiskIdentifier[DriveNumber - FIRST_BIOS_DISK];
}
static const CHAR Hex[] = "0123456789abcdef";
static
VOID
GetHarddiskInformation(UCHAR DriveNumber)
{
PMASTER_BOOT_RECORD Mbr;
PULONG Buffer;
ULONG i;
ULONG Checksum;
ULONG Signature;
ARC_STATUS Status;
ULONG Checksum, Signature;
BOOLEAN ValidPartitionTable;
CHAR ArcName[MAX_PATH];
PARTITION_TABLE_ENTRY PartitionTableEntry;
ULONG ArcDriveIndex;
PCHAR Identifier;
CHAR DiskName[64];
ASSERT(InternalUefiDisk);
ArcDriveIndex = DriveNumber - FIRST_BIOS_DISK;
if (ArcDriveIndex >= 32)
return;
Identifier = PcDiskIdentifier[ArcDriveIndex];
Identifier = InternalUefiDisk[ArcDriveIndex].DiskIdentifier;
/* Detect disk partition type */
DiskDetectPartitionType(DriveNumber);
RtlStringCbPrintfA(DiskName, sizeof(DiskName),
"multi(0)disk(0)rdisk(%u)",
ArcDriveIndex);
/* Read the MBR */
if (!MachDiskReadLogicalSectors(DriveNumber, 0ULL, 1, DiskReadBuffer))
{
ERR("Reading MBR failed\n");
/* We failed, use a default identifier */
sprintf(Identifier, "BIOSDISK%d", ArcDriveIndex);
return;
}
Buffer = (ULONG*)DiskReadBuffer;
Mbr = (PMASTER_BOOT_RECORD)DiskReadBuffer;
Signature = Mbr->Signature;
TRACE("Signature: %x\n", Signature);
/* Calculate the MBR checksum */
Checksum = 0;
for (i = 0; i < 512 / sizeof(ULONG); i++)
{
Checksum += Buffer[i];
}
Checksum = ~Checksum + 1;
TRACE("Checksum: %x\n", Checksum);
ValidPartitionTable = (Mbr->MasterBootRecordMagic == 0xAA55);
/* Fill out the ARC disk block */
sprintf(ArcName, "multi(0)disk(0)rdisk(%u)", ArcDriveIndex);
AddReactOSArcDiskInfo(ArcName, Signature, Checksum, ValidPartitionTable);
sprintf(ArcName, "multi(0)disk(0)rdisk(%u)partition(0)", ArcDriveIndex);
FsRegisterDevice(ArcName, &UefiDiskVtbl);
/* Add partitions */
i = FIRST_PARTITION;
DiskReportError(FALSE);
while (DiskGetPartitionEntry(DriveNumber, i, &PartitionTableEntry))
{
if (PartitionTableEntry.SystemIndicator != PARTITION_ENTRY_UNUSED)
{
sprintf(ArcName, "multi(0)disk(0)rdisk(%u)partition(%lu)", ArcDriveIndex, i);
FsRegisterDevice(ArcName, &UefiDiskVtbl);
}
i++;
}
Status = DiskInitialize(DriveNumber, DiskName, DiskPeripheral, &UefiDiskVtbl,
&Checksum, &Signature, &ValidPartitionTable);
DiskReportError(TRUE);
if (ArcDriveIndex < PcBiosDiskCount && InternalUefiDisk != NULL)
if (Status != ESUCCESS)
{
InternalUefiDisk[ArcDriveIndex].NumOfPartitions = i;
/* The disk failed to be initialized, use a default identifier */
RtlStringCbPrintfA(Identifier, 20, "BIOSDISK%u", ArcDriveIndex + 1);
return;
}
/* Convert checksum and signature to identifier string */
@@ -945,7 +893,7 @@ GetHarddiskInformation(UCHAR DriveNumber)
Identifier[16] = Hex[Signature & 0x0F];
Identifier[17] = '-';
Identifier[18] = (ValidPartitionTable ? 'A' : 'X');
Identifier[19] = 0;
Identifier[19] = ANSI_NULL;
TRACE("Identifier: %s\n", Identifier);
}
@@ -1303,11 +1251,6 @@ UefiInitializeBootDevices(VOID)
EFI_BLOCK_IO* BlockIo;
EFI_STATUS Status;
ULONG ArcDriveIndex;
PMASTER_BOOT_RECORD Mbr;
PULONG Buffer;
ULONG Checksum = 0;
ULONG Signature;
ULONG i;
DiskReadBufferSize = EFI_PAGE_SIZE;
DiskReadBuffer = NULL;
@@ -1355,32 +1298,17 @@ UefiInitializeBootDevices(VOID)
if (BlockIo->Media->RemovableMedia == TRUE && BlockIo->Media->BlockSize == 2048)
{
/* Read the MBR from CD-ROM (sector 16) */
if (!MachDiskReadLogicalSectors(FrldrBootDrive, 16ULL, 1, DiskReadBuffer))
{
ERR("Reading MBR from CD-ROM failed\n");
return FALSE;
}
ARC_STATUS Status;
Buffer = (ULONG*)DiskReadBuffer;
Mbr = (PMASTER_BOOT_RECORD)DiskReadBuffer;
DiskReportError(FALSE);
Status = DiskInitialize(FrldrBootDrive, FrLdrBootPath, CdromController,
&UefiDiskVtbl, NULL, NULL, NULL);
DiskReportError(TRUE);
Signature = Mbr->Signature;
TRACE("CD-ROM Signature: %x\n", Signature);
/* Calculate the MBR checksum */
for (i = 0; i < 2048 / sizeof(ULONG); i++)
{
Checksum += Buffer[i];
}
Checksum = ~Checksum + 1;
TRACE("CD-ROM Checksum: %x\n", Checksum);
/* Fill out the ARC disk block */
AddReactOSArcDiskInfo(FrLdrBootPath, Signature, Checksum, TRUE);
FsRegisterDevice(FrLdrBootPath, &UefiDiskVtbl);
TRACE("Registered CD-ROM boot device: 0x%02X\n", (int)FrldrBootDrive);
if (Status == ESUCCESS)
TRACE("Registered CD-ROM boot device: 0x%02X\n", FrldrBootDrive);
else
ERR("CD-ROM boot device 0x%02X failed\n", FrldrBootDrive);
}
return TRUE;
+1 -2
View File
@@ -11,13 +11,12 @@
#include "../vidfb.h"
#include <debug.h>
DBG_DEFAULT_CHANNEL(WARNING);
DBG_DEFAULT_CHANNEL(HWDETECT);
/* GLOBALS *******************************************************************/
extern EFI_SYSTEM_TABLE * GlobalSystemTable;
extern EFI_HANDLE GlobalImageHandle;
extern UCHAR PcBiosDiskCount;
/* From uefivid.c */
extern ULONG_PTR VramAddress;
+117
View File
@@ -13,6 +13,8 @@
#include <debug.h>
DBG_DEFAULT_CHANNEL(DISK);
#define FIRST_PARTITION 1
/* DISK IO ERROR SUPPORT *****************************************************/
static LONG lReportError = 0; // >= 0: display errors; < 0: hide errors.
@@ -53,3 +55,118 @@ DiskError(
ERR("%s\n", ErrorCodeString);
UiMessageBox(ErrorCodeString);
}
/* FUNCTIONS *****************************************************************/
ARC_STATUS
DiskInitialize(
_In_ UCHAR DriveNumber, // FIXME: Arch-specific
_In_ PCSTR DeviceName,
_In_ CONFIGURATION_TYPE DeviceType,
_In_ const DEVVTBL* FuncTable,
_Out_opt_ PULONG pChecksum,
_Out_opt_ PULONG pSignature,
_Out_opt_ PBOOLEAN pValidPartitionTable)
{
PMASTER_BOOT_RECORD Mbr;
PULONG Buffer;
ULONGLONG SectorStart;
ULONG SectorSize;
ULONG i;
ULONG Checksum, Signature;
BOOLEAN ValidPartitionTable;
BOOLEAN IsCdRom;
PARTITION_TABLE_ENTRY PartitionTableEntry;
CHAR ArcName[MAX_PATH];
NTSTATUS NtStatus;
IsCdRom = (DeviceType == CdromController);
if (IsCdRom)
{
SectorStart = 16ULL;
SectorSize = 2048;
}
else // (DeviceType == FloppyDiskPeripheral || DiskPeripheral)
{
SectorStart = 0ULL;
SectorSize = 512;
}
/* Read the MBR */
if (!MachDiskReadLogicalSectors(DriveNumber, SectorStart, 1, DiskReadBuffer))
{
ERR("Reading MBR failed\n");
return EIO;
}
Buffer = (PULONG)DiskReadBuffer;
Mbr = (PMASTER_BOOT_RECORD)DiskReadBuffer;
Signature = Mbr->Signature;
TRACE("Signature: %x\n", Signature);
/* Calculate the MBR checksum */
Checksum = 0;
for (i = 0; i < SectorSize / sizeof(ULONG); i++)
{
Checksum += Buffer[i];
}
Checksum = ~Checksum + 1;
TRACE("Checksum: %x\n", Checksum);
ValidPartitionTable = (IsCdRom || (Mbr->MasterBootRecordMagic == 0xAA55));
TRACE("IsPartitionValid: %s\n", ValidPartitionTable ? "TRUE" : "FALSE");
/* Register the device */
// NOTE: For now, only register the direct device if it's not a
// "rigid" disk, i.e. peripherals not of the form 'xxx(y)rdisk(z)'.
// Rigid disks are registered with the 'partition(0)' suffix below.
if (DeviceType != DiskPeripheral)
{
if (!FsRegisterDevice(DeviceName, FuncTable))
return ENOMEM;
}
/* Fill out the ARC disk block */
AddReactOSArcDiskInfo(DeviceName, Signature, Checksum, ValidPartitionTable);
if (pChecksum)
*pChecksum = Checksum;
if (pSignature)
*pSignature = Signature;
if (pValidPartitionTable)
*pValidPartitionTable = ValidPartitionTable;
/* Don't search for partitions in non-"rigid" disks (floppies, CD-ROMs) */
if (DeviceType != DiskPeripheral)
return ESUCCESS;
/* Register the device with the 'partition(0)' suffix */
NtStatus = RtlStringCbPrintfA(ArcName, sizeof(ArcName), "%spartition(0)", DeviceName);
if (!NT_SUCCESS(NtStatus))
return ENAMETOOLONG;
if (!FsRegisterDevice(ArcName, FuncTable))
return ENOMEM;
/* Detect disk partition type */
DiskDetectPartitionType(DriveNumber);
/* Add partitions */
i = FIRST_PARTITION;
while (DiskGetPartitionEntry(DriveNumber, i, &PartitionTableEntry))
{
if (PartitionTableEntry.SystemIndicator != PARTITION_ENTRY_UNUSED)
{
NtStatus = RtlStringCbPrintfA(ArcName, sizeof(ArcName),
"%spartition(%lu)", DeviceName, i);
if (!NT_SUCCESS(NtStatus))
return ENAMETOOLONG;
if (!FsRegisterDevice(ArcName, FuncTable))
return ENOMEM;
}
i++;
}
return ESUCCESS;
}
+1 -1
View File
@@ -24,7 +24,7 @@
VOID
AddReactOSArcDiskInfo(
IN PSTR ArcName,
IN PCSTR ArcName,
IN ULONG Signature,
IN ULONG Checksum,
IN BOOLEAN ValidPartitionTable);
+13
View File
@@ -134,6 +134,19 @@ extern PCSTR
DiskGetErrorCodeString(
_In_ ULONG ErrorCode);
/* See fs.h */
struct tagDEVVTBL;
ARC_STATUS
DiskInitialize(
_In_ UCHAR DriveNumber, // FIXME: Arch-specific
_In_ PCSTR DeviceName,
_In_ CONFIGURATION_TYPE DeviceType,
_In_ const struct tagDEVVTBL* FuncTable,
_Out_opt_ PULONG pChecksum,
_Out_opt_ PULONG pSignature,
_Out_opt_ PBOOLEAN pValidPartitionTable);
/*
* Fixed Disk Partition Management Functions (partition.c)
+1 -1
View File
@@ -61,7 +61,7 @@ FsGetVolumeSize(
ULONG FsGetNumPathParts(PCSTR Path);
VOID FsGetFirstNameFromPath(PCHAR Buffer, PCSTR Path);
VOID
BOOLEAN
FsRegisterDevice(
_In_ PCSTR DeviceName,
_In_ const DEVVTBL* FuncTable);
+5 -3
View File
@@ -669,7 +669,7 @@ VOID FsGetFirstNameFromPath(PCHAR Buffer, PCSTR Path)
TRACE("FsGetFirstNameFromPath() Path = %s FirstName = %s\n", Path, Buffer);
}
VOID
BOOLEAN
FsRegisterDevice(
_In_ PCSTR DeviceName,
_In_ const DEVVTBL* FuncTable)
@@ -680,9 +680,10 @@ FsRegisterDevice(
TRACE("FsRegisterDevice(%s)\n", DeviceName);
Length = strlen(DeviceName) + 1;
pNewEntry = FrLdrTempAlloc(sizeof(DEVICE) + Length, TAG_DEVICE);
pNewEntry = FrLdrTempAlloc(sizeof(*pNewEntry) + Length, TAG_DEVICE);
if (!pNewEntry)
return;
return FALSE;
RtlZeroMemory(pNewEntry, sizeof(*pNewEntry));
pNewEntry->FuncTable = FuncTable;
pNewEntry->DeviceId = INVALID_FILE_ID;
pNewEntry->ReferenceCount = 0;
@@ -690,6 +691,7 @@ FsRegisterDevice(
RtlCopyMemory(pNewEntry->DeviceName, DeviceName, Length);
InsertHeadList(&DeviceListHead, &pNewEntry->ListEntry);
return TRUE;
}
PCWSTR FsGetServiceName(ULONG FileId)