[FREELDR] Trivial improvements (#1757)

* [FREELDR] Fix uninitialized string in DiskGetBootPath()

CORE-16216 CORE-16248

* [FREELDR] xboxdisk: Add comment and fix code style
This commit is contained in:
Stanislav Motylkov 2019-07-28 19:20:53 +03:00 committed by Hermès BÉLUSCA - MAÏTO
parent b6135732d4
commit 8f25e464c2
2 changed files with 5 additions and 1 deletions

View file

@ -30,6 +30,7 @@ DBG_DEFAULT_CHANNEL(DISK);
#define XBOX_IDE_COMMAND_PORT 0x1f0
#define XBOX_IDE_CONTROL_PORT 0x170
/* BRFR signature at disk offset 0x600 */
#define XBOX_SIGNATURE_SECTOR 3
#define XBOX_SIGNATURE ('B' | ('R' << 8) | ('F' << 16) | ('R' << 24))
@ -479,7 +480,7 @@ XboxDiskGetPartitionEntry(UCHAR DriveNumber, ULONG PartitionNumber, PPARTITION_T
* This is the Xbox, chances are that there is a Xbox-standard
* partitionless disk in it so let's check that first.
*/
if (1 <= PartitionNumber && PartitionNumber <= sizeof(XboxPartitions) / sizeof(XboxPartitions[0]) &&
if (PartitionNumber >= 1 && PartitionNumber <= sizeof(XboxPartitions) / sizeof(XboxPartitions[0]) &&
MachDiskReadLogicalSectors(DriveNumber, XBOX_SIGNATURE_SECTOR, 1, SectorData))
{
if (*((PULONG) SectorData) == XBOX_SIGNATURE)

View file

@ -104,6 +104,9 @@ BOOLEAN DiskGetBootPath(OUT PCHAR BootPath, IN ULONG Size)
if (*FrldrBootPath)
goto Done;
if (Size)
BootPath[0] = ANSI_NULL;
/* 0x49 is our magic ramdisk drive, so try to detect it first */
if (FrldrBootDrive == 0x49)
{