[FREELDR]: Report the correct number of BIOS (hard) disk drives detected, that is, without any possible extra boot drive that went enumerated afterwards.

This fixes the list of disks enumerated in HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\MultifunctionAdapter\0\DiskController\0\DiskPeripheral\
and we now behave in this regards similarly to Windows 2003 & co.
I thank Lesan Ilie for reporting & testing, and Serge Gautherie and Peter Hater for reviewing.
This fixes a bug introduced in commit r59079.
CORE-13131

svn path=/trunk/; revision=74515
This commit is contained in:
Hermès Bélusca-Maïto 2017-05-09 19:33:46 +00:00
parent 423102807d
commit af645ee7a2
2 changed files with 9 additions and 7 deletions

View file

@ -35,6 +35,8 @@ DBG_DEFAULT_CHANNEL(HWDETECT);
#define LATCH (CLOCK_TICK_RATE / HZ)
static unsigned int delay_count = 1;
/* Used for BIOS disks pre-enumeration performed when detecting the boot devices in InitializeBootDevices() */
extern UCHAR PcBiosDiskCount;
/* This function is slightly different in its PC and XBOX versions */

View file

@ -44,6 +44,7 @@ extern ARC_DISK_SIGNATURE_EX reactos_arc_disk_info[];
static CHAR Hex[] = "0123456789abcdef";
/* Data cache for BIOS disks pre-enumeration */
UCHAR PcBiosDiskCount = 0;
static CHAR PcDiskIdentifier[32][20];
@ -323,8 +324,8 @@ PcInitializeBootDevices(VOID)
}
if (!Changed)
{
TRACE("BIOS reports success for disk %d but data didn't change\n",
(int)DiskCount);
TRACE("BIOS reports success for disk %d (0x%02X) but data didn't change\n",
(int)DiskCount, DriveNumber);
break;
}
@ -340,6 +341,8 @@ PcInitializeBootDevices(VOID)
memset(DiskReadBuffer, 0xcd, DiskReadBufferSize);
}
DiskReportError(TRUE);
PcBiosDiskCount = DiskCount;
TRACE("BIOS reports %d harddisk%s\n",
(int)DiskCount, (DiskCount == 1) ? "" : "s");
@ -384,12 +387,9 @@ PcInitializeBootDevices(VOID)
reactos_disk_count++;
FsRegisterDevice(BootPath, &DiskVtbl);
DiskCount++;
DiskCount++; // This is not accounted for in the number of pre-enumerated BIOS drives!
TRACE("Additional boot drive detected: 0x%02X\n", (int)FrldrBootDrive);
}
PcBiosDiskCount = DiskCount;
TRACE("BIOS reports %d harddisk%s\n",
(int)DiskCount, (DiskCount == 1) ? "": "s");
return (DiskCount != 0);
}