[NTOS:IO] Minor code style fixes (typos; improve comments/DPRINT; IN vs. OUT parameter).

This commit is contained in:
Hermès Bélusca-Maïto 2021-06-10 19:24:04 +02:00
parent afd349a93e
commit 6e65e6b28d
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
2 changed files with 24 additions and 26 deletions

View file

@ -1852,7 +1852,7 @@ IoGetBootDiskInformation(IN OUT PBOOTDISK_INFORMATION BootDiskInformation,
PAGED_CODE(); PAGED_CODE();
/* Get loader block. If it's null, we come to late */ /* Get loader block. If it's null, we come too late */
if (!IopLoaderBlock) if (!IopLoaderBlock)
{ {
return STATUS_TOO_LATE; return STATUS_TOO_LATE;
@ -1865,7 +1865,7 @@ IoGetBootDiskInformation(IN OUT PBOOTDISK_INFORMATION BootDiskInformation,
} }
/* Init some useful stuff: /* Init some useful stuff:
* Get arc disks information * Get ARC disks information
* Check whether we have a single disk * Check whether we have a single disk
* Check received structure size (extended or not?) * Check received structure size (extended or not?)
* Init boot strings (system/boot) * Init boot strings (system/boot)
@ -1955,7 +1955,7 @@ IoGetBootDiskInformation(IN OUT PBOOTDISK_INFORMATION BootDiskInformation,
DiskGeometry.BytesPerSector = 512; DiskGeometry.BytesPerSector = 512;
} }
/* Now, for each arc disk, try to find the matching */ /* Now, for each ARC disk, try to find the matching */
for (NextEntry = ArcDiskInformation->DiskSignatureListHead.Flink; for (NextEntry = ArcDiskInformation->DiskSignatureListHead.Flink;
NextEntry != &ArcDiskInformation->DiskSignatureListHead; NextEntry != &ArcDiskInformation->DiskSignatureListHead;
NextEntry = NextEntry->Flink) NextEntry = NextEntry->Flink)
@ -1963,7 +1963,7 @@ IoGetBootDiskInformation(IN OUT PBOOTDISK_INFORMATION BootDiskInformation,
ArcDiskSignature = CONTAINING_RECORD(NextEntry, ArcDiskSignature = CONTAINING_RECORD(NextEntry,
ARC_DISK_SIGNATURE, ARC_DISK_SIGNATURE,
ListEntry); ListEntry);
/* If they matches, ie /* If they match, i.e.
* - There's only one disk for both BIOS and detected * - There's only one disk for both BIOS and detected
* - Signatures are matching * - Signatures are matching
* - This is MBR * - This is MBR
@ -1973,7 +1973,7 @@ IoGetBootDiskInformation(IN OUT PBOOTDISK_INFORMATION BootDiskInformation,
(IopVerifyDiskSignature(DriveLayout, ArcDiskSignature, &Signature))) && (IopVerifyDiskSignature(DriveLayout, ArcDiskSignature, &Signature))) &&
(DriveLayout->PartitionStyle == PARTITION_STYLE_MBR)) (DriveLayout->PartitionStyle == PARTITION_STYLE_MBR))
{ {
/* Create arc name */ /* Create ARC name */
sprintf(ArcBuffer, "\\ArcName\\%s", ArcDiskSignature->ArcName); sprintf(ArcBuffer, "\\ArcName\\%s", ArcDiskSignature->ArcName);
RtlInitAnsiString(&ArcNameStringA, ArcBuffer); RtlInitAnsiString(&ArcNameStringA, ArcBuffer);
@ -1995,7 +1995,7 @@ IoGetBootDiskInformation(IN OUT PBOOTDISK_INFORMATION BootDiskInformation,
Signature = DriveLayout->Mbr.Signature; Signature = DriveLayout->Mbr.Signature;
} }
/* Create partial arc name */ /* Create partial ARC name */
sprintf(ArcBuffer, "%spartition(%lu)", ArcDiskSignature->ArcName, PartitionNumber); sprintf(ArcBuffer, "%spartition(%lu)", ArcDiskSignature->ArcName, PartitionNumber);
RtlInitAnsiString(&ArcNameStringA, ArcBuffer); RtlInitAnsiString(&ArcNameStringA, ArcBuffer);
@ -2524,7 +2524,7 @@ IoWritePartitionTableEx(IN PDEVICE_OBJECT DeviceObject,
FALSE, FALSE,
DriveLayout->PartitionCount, DriveLayout->PartitionCount,
DriveLayout->PartitionEntry); DriveLayout->PartitionEntry);
/* If it succeed, also update backup table */ /* If it succeeded, also update backup table */
if (NT_SUCCESS(Status)) if (NT_SUCCESS(Status))
{ {
Status = FstubWritePartitionTableEFI(Disk, Status = FstubWritePartitionTableEFI(Disk,

View file

@ -24,16 +24,14 @@ PCHAR IoLoaderArcBootDeviceName;
CODE_SEG("INIT") CODE_SEG("INIT")
NTSTATUS NTSTATUS
NTAPI NTAPI
IopCreateArcNamesCd(IN PLOADER_PARAMETER_BLOCK LoaderBlock IopCreateArcNamesCd(IN PLOADER_PARAMETER_BLOCK LoaderBlock);
);
CODE_SEG("INIT") CODE_SEG("INIT")
NTSTATUS NTSTATUS
NTAPI NTAPI
IopCreateArcNamesDisk(IN PLOADER_PARAMETER_BLOCK LoaderBlock, IopCreateArcNamesDisk(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
IN BOOLEAN SingleDisk, IN BOOLEAN SingleDisk,
IN PBOOLEAN FoundBoot OUT PBOOLEAN FoundBoot);
);
CODE_SEG("INIT") CODE_SEG("INIT")
NTSTATUS NTSTATUS
@ -136,7 +134,7 @@ IopCreateArcNames(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
/* Loop every disk and try to find boot disk */ /* Loop every disk and try to find boot disk */
Status = IopCreateArcNamesDisk(LoaderBlock, SingleDisk, &FoundBoot); Status = IopCreateArcNamesDisk(LoaderBlock, SingleDisk, &FoundBoot);
/* If it succeed but we didn't find boot device, try to browse Cds */ /* If it succeeded but we didn't find boot device, try to browse Cds */
if (NT_SUCCESS(Status) && !FoundBoot) if (NT_SUCCESS(Status) && !FoundBoot)
{ {
Status = IopCreateArcNamesCd(LoaderBlock); Status = IopCreateArcNamesCd(LoaderBlock);
@ -178,7 +176,7 @@ IopCreateArcNamesCd(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
* that have been successfully handled by MountMgr driver * that have been successfully handled by MountMgr driver
* and that already own their device name. This is the "new" way * and that already own their device name. This is the "new" way
* to handle them, that came with NT5. * to handle them, that came with NT5.
* Currently, Windows 2003 provides an arc names creation based * Currently, Windows 2003 provides an ARC names creation based
* on both enabled drives and not enabled drives (lack from * on both enabled drives and not enabled drives (lack from
* the driver). * the driver).
* Given the current ReactOS state, that's good for us. * Given the current ReactOS state, that's good for us.
@ -357,7 +355,7 @@ IopCreateArcNamesCd(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Status = IoStatusBlock.Status; Status = IoStatusBlock.Status;
} }
/* Reading succeed, compute checksum by adding data, 2048 bytes checksum */ /* If reading succeeded, compute checksum by adding data, 2048 bytes checksum */
if (NT_SUCCESS(Status)) if (NT_SUCCESS(Status))
{ {
for (i = 0; i < 2048 / sizeof(ULONG); i++) for (i = 0; i < 2048 / sizeof(ULONG); i++)
@ -413,7 +411,7 @@ NTSTATUS
NTAPI NTAPI
IopCreateArcNamesDisk(IN PLOADER_PARAMETER_BLOCK LoaderBlock, IopCreateArcNamesDisk(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
IN BOOLEAN SingleDisk, IN BOOLEAN SingleDisk,
IN PBOOLEAN FoundBoot) OUT PBOOLEAN FoundBoot)
{ {
PIRP Irp; PIRP Irp;
PVOID Data; PVOID Data;
@ -644,7 +642,7 @@ IopCreateArcNamesDisk(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
goto Cleanup; goto Cleanup;
} }
/* Read a sector for computing checksum */ /* Read the first sector for computing checksum */
Irp = IoBuildSynchronousFsdRequest(IRP_MJ_READ, Irp = IoBuildSynchronousFsdRequest(IRP_MJ_READ,
DeviceObject, DeviceObject,
PartitionBuffer, PartitionBuffer,
@ -677,7 +675,7 @@ IopCreateArcNamesDisk(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
ObDereferenceObject(FileObject); ObDereferenceObject(FileObject);
/* Calculate checksum, that's an easy computation, just adds read data */ /* Calculate checksum by adding data */
for (i = 0, CheckSum = 0; i < 512 / sizeof(ULONG) ; i++) for (i = 0, CheckSum = 0; i < 512 / sizeof(ULONG) ; i++)
{ {
CheckSum += PartitionBuffer[i]; CheckSum += PartitionBuffer[i];
@ -692,7 +690,7 @@ IopCreateArcNamesDisk(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
ARC_DISK_SIGNATURE, ARC_DISK_SIGNATURE,
ListEntry); ListEntry);
/* If they matches, ie /* If they match, i.e.
* - There's only one disk for both BIOS and detected/enabled * - There's only one disk for both BIOS and detected/enabled
* - Signatures are matching * - Signatures are matching
* - Checksums are matching * - Checksums are matching
@ -789,15 +787,15 @@ IopCreateArcNamesDisk(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
} }
else else
{ {
/* In case there's a valid partition, a matching signature, /* Debugging feedback: Warn in case there's a valid partition,
BUT a none matching checksum, or there's a duplicate * a matching signature, BUT a non-matching checksum: this can
signature, or even worse a virus played with partition * be the sign of a duplicate signature, or even worse a virus
table */ * played with the partition table. */
if (ArcDiskSignature->Signature == Signature && if (ArcDiskSignature->ValidPartitionTable &&
(ArcDiskSignature->CheckSum + CheckSum != 0) && (ArcDiskSignature->Signature == Signature) &&
ArcDiskSignature->ValidPartitionTable) (ArcDiskSignature->CheckSum + CheckSum != 0))
{ {
DPRINT("Be careful, or you have a duplicate disk signature, or a virus altered your MBR!\n"); DPRINT("Be careful, you have a duplicate disk signature, or a virus altered your MBR!\n");
} }
} }
} }