ReactOS 0.4.17-dev-470-gf9e3448
hwdisk.c File Reference
#include <freeldr.h>
#include <debug.h>
Include dependency graph for hwdisk.c:

Go to the source code of this file.

Classes

struct  tagDISKCONTEXT
 

Macros

#define FIRST_BIOS_DISK   0x80
 

Typedefs

typedef struct tagDISKCONTEXT DISKCONTEXT
 

Functions

 DBG_DEFAULT_CHANNEL (DISK)
 
static ARC_STATUS DiskClose (ULONG FileId)
 
static ARC_STATUS DiskGetFileInformation (ULONG FileId, FILEINFORMATION *Information)
 
static ARC_STATUS DiskOpen (CHAR *Path, OPENMODE OpenMode, ULONG *FileId)
 
static ARC_STATUS DiskRead (ULONG FileId, VOID *Buffer, ULONG N, ULONG *Count)
 
static ARC_STATUS DiskSeek (ULONG FileId, LARGE_INTEGER *Position, SEEKMODE SeekMode)
 
PCHAR GetHarddiskIdentifier (UCHAR DriveNumber)
 
static VOID GetHarddiskInformation (_In_ UCHAR DriveNumber)
 
static UCHAR EnumerateHarddisks (OUT PBOOLEAN BootDriveReported)
 
static BOOLEAN DiskGetBootPath (_In_ BOOLEAN IsPxe, _Out_ PCONFIGURATION_TYPE DeviceType)
 
BOOLEAN PcInitializeBootDevices (VOID)
 

Variables

UCHAR PcBiosDiskCount = 0
 
static CHAR PcDiskIdentifier [32][20]
 
PVOID DiskReadBuffer
 
SIZE_T DiskReadBufferSize
 
static const DEVVTBL DiskVtbl
 

Macro Definition Documentation

◆ FIRST_BIOS_DISK

#define FIRST_BIOS_DISK   0x80

Definition at line 31 of file hwdisk.c.

Typedef Documentation

◆ DISKCONTEXT

Function Documentation

◆ DBG_DEFAULT_CHANNEL()

DBG_DEFAULT_CHANNEL ( DISK  )

◆ DiskClose()

static ARC_STATUS DiskClose ( ULONG  FileId)
static

Definition at line 54 of file hwdisk.c.

55{
58 return ESUCCESS;
59}
PVOID FsGetDeviceSpecific(ULONG FileId)
Definition: fs.c:711
VOID FrLdrTempFree(PVOID Allocation, ULONG Tag)
Definition: heap.c:553
@ ESUCCESS
Definition: arc.h:32
_In_ PVOID Context
Definition: storport.h:2269
#define TAG_HW_DISK_CONTEXT
Definition: uefidisk.c:16

◆ DiskGetBootPath()

static BOOLEAN DiskGetBootPath ( _In_ BOOLEAN  IsPxe,
_Out_ PCONFIGURATION_TYPE  DeviceType 
)
static

Definition at line 377 of file hwdisk.c.

380{
381 // *DeviceType = DiskGetConfigType(FrldrBootDrive);
382 if (*FrLdrBootPath)
383 return TRUE;
384
385 *DeviceType = 0;
386
387 // FIXME: Do this in some drive recognition procedure!
388 if (IsPxe)
389 {
390 RtlStringCbCopyA(FrLdrBootPath, sizeof(FrLdrBootPath), "net(0)");
392 }
393 else
394 /* 0x49 is our magic ramdisk drive, so try to detect it first */
395 if (FrldrBootDrive == 0x49)
396 {
397 /* This is the ramdisk. See ArmInitializeBootDevices() too... */
398 // RtlStringCbPrintfA(FrLdrBootPath, sizeof(FrLdrBootPath), "ramdisk(%u)", 0);
399 RtlStringCbCopyA(FrLdrBootPath, sizeof(FrLdrBootPath), "ramdisk(0)");
401 }
402 else if (FrldrBootDrive < FIRST_BIOS_DISK) // (DiskGetConfigType(FrldrBootDrive) == FloppyDiskPeripheral)
403 {
404 /* This is a floppy */
406 "multi(0)disk(0)fdisk(%u)", FrldrBootDrive);
408 }
409 else if (FrldrBootPartition == 0xFF)
410 {
411 /* Boot Partition 0xFF is the magic value that indicates booting from CD-ROM (see isoboot.S) */
412 // TODO: Check if it's really a CD-ROM drive
414 "multi(0)disk(0)cdrom(%u)", FrldrBootDrive - FIRST_BIOS_DISK);
416 }
417 else
418 {
419 /* This is a hard disk, find the boot partition */
420 ULONG BootPartition;
421 if (!DiskGetBootPartitionEntry(FrldrBootDrive, NULL, &BootPartition))
422 {
423 ERR("Failed to get boot partition entry\n");
424 return FALSE;
425 }
426 FrldrBootPartition = BootPartition;
427
429 "multi(0)disk(0)rdisk(%u)partition(%lu)",
432 }
433
434 return TRUE;
435}
#define ERR(fmt,...)
Definition: precomp.h:57
BOOLEAN DiskGetBootPartitionEntry(_In_ UCHAR DriveNumber, _Out_opt_ PPARTITION_INFORMATION PartitionEntry, _Out_ PULONG BootPartition)
Definition: partition.c:123
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
CCHAR FrLdrBootPath[MAX_PATH]
Definition: freeldr.c:29
#define FIRST_BIOS_DISK
Definition: hwdisk.c:31
DeviceType
Definition: mmdrv.h:42
NTSTRSAFEVAPI RtlStringCbPrintfA(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cbDest, _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,...)
Definition: ntstrsafe.h:1148
NTSTRSAFEAPI RtlStringCbCopyA(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cbDest, _In_ NTSTRSAFE_PCSTR pszSrc)
Definition: ntstrsafe.h:156
@ DiskPeripheral
Definition: arc.h:138
@ FloppyDiskPeripheral
Definition: arc.h:139
@ NetworkPeripheral
Definition: arc.h:149
@ CdromController
Definition: arc.h:128
uint32_t ULONG
Definition: typedefs.h:59
UCHAR FrldrBootDrive
Definition: uefidisk.c:57
ULONG FrldrBootPartition
Definition: uefidisk.c:58

Referenced by PcInitializeBootDevices().

◆ DiskGetFileInformation()

static ARC_STATUS DiskGetFileInformation ( ULONG  FileId,
FILEINFORMATION Information 
)
static

Definition at line 62 of file hwdisk.c.

63{
65
67
68 /*
69 * The ARC specification mentions that for partitions, StartingAddress and
70 * EndingAddress are the start and end positions of the partition in terms
71 * of byte offsets from the start of the disk.
72 * CurrentAddress is the current offset into (i.e. relative to) the partition.
73 */
74 Information->StartingAddress.QuadPart = Context->SectorOffset * Context->SectorSize;
75 Information->EndingAddress.QuadPart = (Context->SectorOffset + Context->SectorCount) * Context->SectorSize;
76 Information->CurrentAddress.QuadPart = Context->SectorNumber * Context->SectorSize;
77
79
80 return ESUCCESS;
81}
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
_In_ WDFREQUEST _In_ NTSTATUS _In_ ULONG_PTR Information
Definition: wdfrequest.h:1049

◆ DiskOpen()

static ARC_STATUS DiskOpen ( CHAR Path,
OPENMODE  OpenMode,
ULONG FileId 
)
static

Definition at line 84 of file hwdisk.c.

85{
88 UCHAR DriveNumber;
89 ULONG DrivePartition, SectorSize;
90 GEOMETRY Geometry;
93 static BOOLEAN PrintForce = FALSE;
94
95 if (DiskReadBufferSize == 0)
96 {
97 ERR("DiskOpen(): DiskReadBufferSize is 0, something is wrong.\n");
99 return ENOMEM;
100 }
101
102 if (!DissectArcPath(Path, NULL, &DriveNumber, &DrivePartition))
103 return EINVAL;
104
105 DriveType = DiskGetConfigType(DriveNumber);
106
107 if (!MachDiskGetDriveGeometry(DriveNumber, &Geometry))
108 return EIO;
109 if (Geometry.BytesPerSector == 0)
110 {
111 WARN("MachDiskGetDriveGeometry(0x%x) failed, fall back to hardcoded values\n", DriveNumber);
113 {
114 /* This is a CD-ROM device */
115 Geometry.BytesPerSector = 2048;
116 }
117 else
118 {
119 /* This is either a floppy disk or a hard disk device, but it doesn't
120 * matter which one because they both have 512 bytes per sector */
121 Geometry.BytesPerSector = 512;
122 }
123 }
124 SectorSize = Geometry.BytesPerSector;
125
126 if (DrivePartition != 0xff && DrivePartition != 0)
127 {
128 PARTITION_INFORMATION PartitionEntry;
129 if (!DiskGetPartitionEntry(DriveNumber, SectorSize, DrivePartition, &PartitionEntry))
130 return EIO;
131
134 }
135 else
136 {
137 SectorOffset = 0;
138 SectorCount = Geometry.Sectors;
139 }
140
142 if (!Context)
143 return ENOMEM;
144
145 if (DriveType == CdromController && SectorSize != 2048)
146 {
147 /* Workaround for CORE-20640 */
148 if (!PrintForce)
149 {
150 ERR("BIOS reports BytesPerSector = %d for CD-ROM, forcing 2048\n", SectorSize);
151 PrintForce = TRUE;
152 }
153 SectorSize = 2048;
154 }
155 Context->DriveNumber = DriveNumber;
156 Context->IsFloppy = (DriveType == FloppyDiskPeripheral);
157 Context->SectorSize = SectorSize;
158 Context->SectorOffset = SectorOffset;
159 Context->SectorCount = SectorCount;
160 Context->SectorNumber = 0;
162
163 return ESUCCESS;
164}
UINT DriveType
PRTL_UNICODE_STRING_BUFFER Path
unsigned char BOOLEAN
Definition: actypes.h:127
#define WARN(fmt,...)
Definition: precomp.h:61
BOOLEAN DissectArcPath(IN PCSTR ArcPath, OUT PCSTR *Path OPTIONAL, OUT PUCHAR DriveNumber, OUT PULONG PartitionNumber)
Definition: arcname.c:25
BOOLEAN DiskGetPartitionEntry(_In_ UCHAR DriveNumber, _In_opt_ ULONG SectorSize, _In_ ULONG PartitionNumber, _Out_ PPARTITION_INFORMATION PartitionEntry)
Definition: partition.c:178
VOID FsSetDeviceSpecific(ULONG FileId, PVOID Specific)
Definition: fs.c:704
#define MachDiskGetDriveGeometry(Drive, Geom)
Definition: machine.h:122
PVOID FrLdrTempAlloc(_In_ SIZE_T Size, _In_ ULONG Tag)
Definition: heap.c:545
#define SectorOffset(L)
Definition: cdprocs.h:1622
#define EINVAL
Definition: errno.h:44
#define ENOMEM
Definition: errno.h:35
#define EIO
Definition: errno.h:28
SIZE_T DiskReadBufferSize
Definition: hwdisk.c:48
#define ASSERT(a)
Definition: mode.c:44
ULONG SectorCount
Definition: part_brfr.c:22
CONFIGURATION_TYPE DiskGetConfigType(_In_ UCHAR DriveNumber)
Definition: pcdisk.c:381
enum _CONFIGURATION_TYPE CONFIGURATION_TYPE
Definition: disk.h:24
ULONG BytesPerSector
Number of bytes per sector.
Definition: disk.h:28
ULONGLONG Sectors
Total number of disk sectors/LBA blocks.
Definition: disk.h:29
LARGE_INTEGER StartingOffset
Definition: ntdddisk.h:408
LARGE_INTEGER PartitionLength
Definition: ntdddisk.h:409
unsigned char UCHAR
Definition: typedefs.h:53
uint64_t ULONGLONG
Definition: typedefs.h:67
LONGLONG QuadPart
Definition: typedefs.h:114
_In_ ULONG SectorSize
Definition: halfuncs.h:291

◆ DiskRead()

static ARC_STATUS DiskRead ( ULONG  FileId,
VOID Buffer,
ULONG  N,
ULONG Count 
)
static

Definition at line 167 of file hwdisk.c.

168{
170 UCHAR* Ptr = (UCHAR*)Buffer;
171 ULONG Length, TotalSectors, MaxSectors, ReadSectors;
173 BOOLEAN ret;
174
176
177 TotalSectors = (N + Context->SectorSize - 1) / Context->SectorSize;
178 MaxSectors = DiskReadBufferSize / Context->SectorSize;
179 SectorOffset = Context->SectorOffset + Context->SectorNumber;
180
181 // If MaxSectors is 0, this will lead to infinite loop.
182 // In release builds assertions are disabled, however we also have sanity checks in DiskOpen()
183 ASSERT(MaxSectors > 0);
184
185 ret = TRUE;
186
187 while (TotalSectors)
188 {
189 ReadSectors = TotalSectors;
190 if (ReadSectors > MaxSectors)
191 ReadSectors = MaxSectors;
192
195 ReadSectors,
197 if (!ret)
198 break;
199
200 Length = ReadSectors * Context->SectorSize;
201 if (Length > N)
202 Length = N;
203
205
206 Ptr += Length;
207 N -= Length;
208 SectorOffset += ReadSectors;
209 TotalSectors -= ReadSectors;
210 }
211
213 Context->SectorNumber = SectorOffset - Context->SectorOffset;
214
215 return (ret ? ESUCCESS : EIO);
216}
#define N
Definition: crc32.c:57
#define MachDiskReadLogicalSectors(Drive, Start, Count, Buf)
Definition: machine.h:120
Definition: bufpool.h:45
return ret
Definition: mutex.c:146
#define ULONG_PTR
Definition: config.h:101
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
PVOID DiskReadBuffer
Definition: hwdisk.c:47
int Count
Definition: noreturn.cpp:7
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
uint32_t ULONG_PTR
Definition: typedefs.h:65

◆ DiskSeek()

static ARC_STATUS DiskSeek ( ULONG  FileId,
LARGE_INTEGER Position,
SEEKMODE  SeekMode 
)
static

Definition at line 219 of file hwdisk.c.

220{
222 LARGE_INTEGER NewPosition = *Position;
223
224 switch (SeekMode)
225 {
226 case SeekAbsolute:
227 break;
228 case SeekRelative:
229 NewPosition.QuadPart += (Context->SectorNumber * Context->SectorSize);
230 break;
231 default:
232 ASSERT(FALSE);
233 return EINVAL;
234 }
235
236 if (NewPosition.QuadPart & (Context->SectorSize - 1))
237 return EINVAL;
238
239 /* Convert in number of sectors */
240 NewPosition.QuadPart /= Context->SectorSize;
241
242 /* HACK: CDROMs may have a SectorCount of 0 */
243 if (Context->SectorCount != 0 && NewPosition.QuadPart >= Context->SectorCount)
244 return EINVAL;
245
246 Context->SectorNumber = NewPosition.QuadPart;
247 return ESUCCESS;
248}
@ SeekRelative
Definition: arc.h:60
@ SeekAbsolute
Definition: arc.h:59
static COORD Position
Definition: mouse.c:34

◆ EnumerateHarddisks()

static UCHAR EnumerateHarddisks ( OUT PBOOLEAN  BootDriveReported)
static

Definition at line 319 of file hwdisk.c.

320{
321 UCHAR DiskCount, DriveNumber;
322 ULONG i;
323 BOOLEAN Changed;
324
325 *BootDriveReported = FALSE;
326
327 /* Count the number of visible harddisk drives */
329 DiskCount = 0;
330 DriveNumber = FIRST_BIOS_DISK;
331
333
334 /*
335 * There are some really broken BIOSes out there. There are even BIOSes
336 * that happily report success when you ask them to read from non-existent
337 * harddisks. So, we set the buffer to known contents first, then try to
338 * read. If the BIOS reports success but the buffer contents haven't
339 * changed then we fail anyway.
340 */
342 while (MachDiskReadLogicalSectors(DriveNumber, 0ULL, 1, DiskReadBuffer))
343 {
344 Changed = FALSE;
345 for (i = 0; !Changed && i < DiskReadBufferSize; i++)
346 {
347 Changed = ((PUCHAR)DiskReadBuffer)[i] != 0xcd;
348 }
349 if (!Changed)
350 {
351 TRACE("BIOS reports success for disk %d (0x%02X) but data didn't change\n",
352 (int)DiskCount, DriveNumber);
353 break;
354 }
355
356 /* Register and cache the BIOS hard disk information for later use */
357 GetHarddiskInformation(DriveNumber);
358
359 /* Check if we have seen the boot drive */
360 if (FrldrBootDrive == DriveNumber)
361 *BootDriveReported = TRUE;
362
363 DiskCount++;
364 DriveNumber++;
366 }
368
369 PcBiosDiskCount = DiskCount;
370 TRACE("BIOS reports %d harddisk%s\n",
371 (int)DiskCount, (DiskCount == 1) ? "" : "s");
372
373 return DiskCount;
374}
LONG DiskReportError(_In_ BOOLEAN bShowError)
Definition: disk.c:38
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static VOID GetHarddiskInformation(_In_ UCHAR DriveNumber)
Definition: hwdisk.c:267
UCHAR PcBiosDiskCount
Definition: hwdisk.c:44
#define ULL(a, b)
Definition: format_msg.c:27
#define memset(x, y, z)
Definition: compat.h:39
#define TRACE(s)
Definition: solgame.cpp:4
unsigned char * PUCHAR
Definition: typedefs.h:53

Referenced by PcInitializeBootDevices().

◆ GetHarddiskIdentifier()

PCHAR GetHarddiskIdentifier ( UCHAR  DriveNumber)

Definition at line 261 of file hwdisk.c.

262{
263 return PcDiskIdentifier[DriveNumber - FIRST_BIOS_DISK];
264}
static CHAR PcDiskIdentifier[32][20]
Definition: hwdisk.c:45

Referenced by DetectBiosDisks().

◆ GetHarddiskInformation()

static VOID GetHarddiskInformation ( _In_ UCHAR  DriveNumber)
static

Definition at line 267 of file hwdisk.c.

269{
270 static const CHAR Hex[] = "0123456789abcdef";
271
274 ULONG Checksum, Signature;
275 BOOLEAN ValidPartitionTable;
276 CHAR DiskName[64];
277
278 RtlStringCbPrintfA(DiskName, sizeof(DiskName),
279 "multi(0)disk(0)rdisk(%u)",
280 DriveNumber - FIRST_BIOS_DISK);
281
283 Status = DiskInitialize(DriveNumber, DiskName, DiskPeripheral, &DiskVtbl,
284 &Checksum, &Signature, &ValidPartitionTable);
286
287 if (Status != ESUCCESS)
288 {
289 /* The disk failed to be initialized, use a default identifier */
290 RtlStringCbPrintfA(Identifier, 20, "BIOSDISK%u", DriveNumber - FIRST_BIOS_DISK + 1);
291 return;
292 }
293
294 /* Convert checksum and signature to identifier string */
295 Identifier[0] = Hex[(Checksum >> 28) & 0x0F];
296 Identifier[1] = Hex[(Checksum >> 24) & 0x0F];
297 Identifier[2] = Hex[(Checksum >> 20) & 0x0F];
298 Identifier[3] = Hex[(Checksum >> 16) & 0x0F];
299 Identifier[4] = Hex[(Checksum >> 12) & 0x0F];
300 Identifier[5] = Hex[(Checksum >> 8) & 0x0F];
301 Identifier[6] = Hex[(Checksum >> 4) & 0x0F];
302 Identifier[7] = Hex[Checksum & 0x0F];
303 Identifier[8] = '-';
304 Identifier[9] = Hex[(Signature >> 28) & 0x0F];
305 Identifier[10] = Hex[(Signature >> 24) & 0x0F];
306 Identifier[11] = Hex[(Signature >> 20) & 0x0F];
307 Identifier[12] = Hex[(Signature >> 16) & 0x0F];
308 Identifier[13] = Hex[(Signature >> 12) & 0x0F];
309 Identifier[14] = Hex[(Signature >> 8) & 0x0F];
310 Identifier[15] = Hex[(Signature >> 4) & 0x0F];
311 Identifier[16] = Hex[Signature & 0x0F];
312 Identifier[17] = '-';
313 Identifier[18] = (ValidPartitionTable ? 'A' : 'X');
314 Identifier[19] = ANSI_NULL;
315 TRACE("Identifier: %s\n", Identifier);
316}
@ Identifier
Definition: asmpp.cpp:95
ARC_STATUS DiskInitialize(_In_ UCHAR DriveNumber, _In_ PCSTR DeviceName, _In_ CONFIGURATION_TYPE DeviceType, _In_ const DEVVTBL *FuncTable, _Out_opt_ PULONG pChecksum, _Out_opt_ PULONG pSignature, _Out_opt_ PBOOLEAN pValidPartitionTable)
Definition: disk.c:78
static const WCHAR Signature[]
Definition: parser.c:141
Status
Definition: gdiplustypes.h:24
static const DEVVTBL DiskVtbl
Definition: hwdisk.c:250
#define ANSI_NULL
char CHAR
Definition: pedump.c:57
static char Hex[]
Definition: pnpdump.c:50
ULONG ARC_STATUS
Definition: arc.h:4
char * PCHAR
Definition: typedefs.h:51

Referenced by EnumerateHarddisks().

◆ PcInitializeBootDevices()

BOOLEAN PcInitializeBootDevices ( VOID  )

Definition at line 438 of file hwdisk.c.

439{
440 UCHAR DiskCount;
441 BOOLEAN BootDriveReported = FALSE;
443
444 DiskCount = EnumerateHarddisks(&BootDriveReported);
445
446 /* Initialize FrLdrBootPath, the path FreeLoader starts from */
448
449 /* Add it, if it's a floppy or CD-ROM */
450 if ((FrldrBootDrive >= FIRST_BIOS_DISK && !BootDriveReported) ||
452 {
454
457 &DiskVtbl, NULL, NULL, NULL);
459
460 if (Status == ESUCCESS)
461 {
462 DiskCount++; // This is not accounted for in the number of pre-enumerated BIOS drives!
463 TRACE("Additional boot drive detected: 0x%02X\n", FrldrBootDrive);
464 }
465 else
466 {
467 ERR("Additional boot drive 0x%02X failed\n", FrldrBootDrive);
468 }
469 }
470
471 return (DiskCount != 0);
472}
BOOLEAN PxeInit(VOID)
Definition: pxe.c:376
static BOOLEAN DiskGetBootPath(_In_ BOOLEAN IsPxe, _Out_ PCONFIGURATION_TYPE DeviceType)
Definition: hwdisk.c:377
static UCHAR EnumerateHarddisks(OUT PBOOLEAN BootDriveReported)
Definition: hwdisk.c:319

Referenced by MachInit(), and Pc98InitializeBootDevices().

Variable Documentation

◆ DiskReadBuffer

PVOID DiskReadBuffer

Definition at line 47 of file hwdisk.c.

Referenced by DiskRead(), and EnumerateHarddisks().

◆ DiskReadBufferSize

SIZE_T DiskReadBufferSize

Definition at line 48 of file hwdisk.c.

Referenced by DiskOpen(), DiskRead(), EnumerateHarddisks(), and PcMemFinalizeMemoryMap().

◆ DiskVtbl

const DEVVTBL DiskVtbl
static
Initial value:
=
{
}
static ARC_STATUS DiskGetFileInformation(ULONG FileId, FILEINFORMATION *Information)
Definition: hwdisk.c:62
static ARC_STATUS DiskRead(ULONG FileId, VOID *Buffer, ULONG N, ULONG *Count)
Definition: hwdisk.c:167
static ARC_STATUS DiskOpen(CHAR *Path, OPENMODE OpenMode, ULONG *FileId)
Definition: hwdisk.c:84
static ARC_STATUS DiskSeek(ULONG FileId, LARGE_INTEGER *Position, SEEKMODE SeekMode)
Definition: hwdisk.c:219
static ARC_STATUS DiskClose(ULONG FileId)
Definition: hwdisk.c:54

Definition at line 250 of file hwdisk.c.

Referenced by GetHarddiskInformation(), and PcInitializeBootDevices().

◆ PcBiosDiskCount

UCHAR PcBiosDiskCount = 0

Definition at line 44 of file hwdisk.c.

Referenced by DetectBiosDisks(), and EnumerateHarddisks().

◆ PcDiskIdentifier

CHAR PcDiskIdentifier[32][20]
static

Definition at line 45 of file hwdisk.c.

Referenced by GetHarddiskIdentifier(), and GetHarddiskInformation().