#include <freeldr.h>
#include <debug.h>
Go to the source code of this file.
◆ FIRST_BIOS_DISK
◆ FIRST_PARTITION
◆ DISKCONTEXT
◆ DBG_DEFAULT_CHANNEL()
DBG_DEFAULT_CHANNEL |
( |
HWDETECT |
| ) |
|
◆ DiskClose()
Definition at line 56 of file hwdisk.c.
57{
61}
VOID * FsGetDeviceSpecific(ULONG FileId)
FORCEINLINE VOID FrLdrTempFree(PVOID Allocation, ULONG Tag)
#define TAG_HW_DISK_CONTEXT
◆ DiskGetBootPath()
Definition at line 420 of file hwdisk.c.
421{
424
425
426 if (IsPxe)
427 {
429 }
430 else
431
433 {
434
435
437 }
439 {
440
443 }
445 {
446
449 }
450 else
451 {
454
455
457 {
458 ERR(
"Failed to get boot partition entry\n");
460 }
461
463
465 "multi(0)disk(0)rdisk(%u)partition(%lu)",
467 }
468
470}
BOOLEAN DiskGetBootPartitionEntry(IN UCHAR DriveNumber, OUT PPARTITION_TABLE_ENTRY PartitionTableEntry, OUT PULONG BootPartition)
CCHAR FrLdrBootPath[MAX_PATH]
NTSTRSAFEVAPI RtlStringCbPrintfA(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cbDest, _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,...)
NTSTRSAFEAPI RtlStringCbCopyA(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cbDest, _In_ NTSTRSAFE_PCSTR pszSrc)
Referenced by PcInitializeBootDevices().
◆ DiskGetFileInformation()
Definition at line 64 of file hwdisk.c.
65{
67
69
70
71
72
73
74
75
79
81}
#define RtlZeroMemory(Destination, Length)
_In_ WDFREQUEST _In_ NTSTATUS _In_ ULONG_PTR Information
◆ DiskIsDriveRemovable()
◆ DiskOpen()
Definition at line 84 of file hwdisk.c.
85{
92
94 {
95 ERR(
"DiskOpen(): DiskReadBufferSize is 0, something is wrong.\n");
98 }
99
102
103 if (DrivePartition == 0xff)
104 {
105
107 }
108 else
109 {
110
111
112
113
114
115
117 }
118
119 if (DrivePartition != 0xff && DrivePartition != 0)
120 {
123
126 }
127 else
128 {
132
134 {
135 ERR(
"SectorSize (%lu) != Geometry.BytesPerSector (%lu), expect problems!\n",
137 }
138
141 }
142
146
147 Context->DriveNumber = DriveNumber;
153
155}
PRTL_UNICODE_STRING_BUFFER Path
BOOLEAN DissectArcPath(IN PCSTR ArcPath, OUT PCSTR *Path OPTIONAL, OUT PUCHAR DriveNumber, OUT PULONG PartitionNumber)
BOOLEAN DiskGetPartitionEntry(IN UCHAR DriveNumber, IN ULONG PartitionNumber, OUT PPARTITION_TABLE_ENTRY PartitionTableEntry)
VOID FsSetDeviceSpecific(ULONG FileId, VOID *Specific)
#define MachDiskGetDriveGeometry(Drive, Geom)
FORCEINLINE PVOID FrLdrTempAlloc(_In_ SIZE_T Size, _In_ ULONG Tag)
SIZE_T DiskReadBufferSize
ULONG PartitionSectorCount
ULONG SectorCountBeforePartition
◆ DiskRead()
Definition at line 158 of file hwdisk.c.
159{
162 ULONG Length, TotalSectors, MaxSectors, ReadSectors;
165
167
171
172
173
175
177
178 while (TotalSectors)
179 {
180 ReadSectors = TotalSectors;
181 if (ReadSectors > MaxSectors)
182 ReadSectors = MaxSectors;
183
186 ReadSectors,
189 break;
190
194
196
200 TotalSectors -= ReadSectors;
201 }
202
205
207}
#define MachDiskReadLogicalSectors(Drive, Start, Count, Buf)
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
_In_ ULONG _In_ ULONG _In_ ULONG Length
#define RtlCopyMemory(Destination, Source, Length)
◆ DiskSeek()
Definition at line 210 of file hwdisk.c.
211{
214
215 switch (SeekMode)
216 {
218 break;
221 break;
222 default:
225 }
226
229
230
232
233
236
239}
◆ EnumerateHarddisks()
Definition at line 345 of file hwdisk.c.
346{
347 UCHAR DiskCount, DriveNumber;
350
351 *BootDriveReported =
FALSE;
352
353
355 DiskCount = 0;
357
359
360
361
362
363
364
365
366
369 {
372 {
374 }
375 if (!Changed)
376 {
377 TRACE(
"BIOS reports success for disk %d (0x%02X) but data didn't change\n",
378 (int)DiskCount, DriveNumber);
379 break;
380 }
381
382
384
385
387 *BootDriveReported =
TRUE;
388
389 DiskCount++;
390 DriveNumber++;
392 }
394
396 TRACE(
"BIOS reports %d harddisk%s\n",
397 (int)DiskCount, (DiskCount == 1) ? "" : "s");
398
399 return DiskCount;
400}
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
static VOID GetHarddiskInformation(UCHAR DriveNumber)
LONG DiskReportError(BOOLEAN bShowError)
Referenced by PcInitializeBootDevices().
◆ GetHarddiskIdentifier()
Definition at line 252 of file hwdisk.c.
253{
255}
static CHAR PcDiskIdentifier[32][20]
◆ GetHarddiskInformation()
static VOID GetHarddiskInformation |
( |
UCHAR |
DriveNumber | ) |
|
|
static |
Definition at line 258 of file hwdisk.c.
259{
269
270
272
273
275 {
276 ERR(
"Reading MBR failed\n");
277
279 return;
280 }
281
284
287
288
289 Checksum = 0;
290 for (
i = 0;
i < 512 /
sizeof(
ULONG);
i++)
291 {
293 }
294 Checksum = ~Checksum + 1;
295 TRACE(
"Checksum: %x\n", Checksum);
296
298
299
302
305
306
310 {
312 {
315 }
317 }
319
320
339 Identifier[18] = (ValidPartitionTable ?
'A' :
'X');
342}
VOID AddReactOSArcDiskInfo(IN PSTR ArcName, IN ULONG Signature, IN ULONG Checksum, IN BOOLEAN ValidPartitionTable)
VOID DiskDetectPartitionType(IN UCHAR DriveNumber)
#define PARTITION_ENTRY_UNUSED
struct _MASTER_BOOT_RECORD * PMASTER_BOOT_RECORD
VOID FsRegisterDevice(CHAR *Prefix, const DEVVTBL *FuncTable)
static const WCHAR Signature[]
static const DEVVTBL DiskVtbl
#define sprintf(buf, format,...)
USHORT MasterBootRecordMagic
Referenced by EnumerateHarddisks().
◆ PcInitializeBootDevices()
Definition at line 473 of file hwdisk.c.
474{
478
480
481
483
484
487 {
488
489
494
495
497 {
498 ERR(
"Reading MBR failed\n");
500 }
501
504
507
508
509 for (
i = 0;
i < 2048 /
sizeof(
ULONG);
i++)
510 {
512 }
513 Checksum = ~Checksum + 1;
514 TRACE(
"Checksum: %x\n", Checksum);
515
516
518
520 DiskCount++;
522 }
523
524 return (DiskCount != 0);
525}
static BOOLEAN DiskGetBootPath(BOOLEAN IsPxe)
static BOOLEAN DiskIsDriveRemovable(UCHAR DriveNumber)
static UCHAR EnumerateHarddisks(OUT PBOOLEAN BootDriveReported)
Referenced by MachInit(), and Pc98InitializeBootDevices().
◆ DiskReadBuffer
◆ DiskReadBufferSize
◆ DiskVtbl
Initial value:=
{
}
static ARC_STATUS DiskGetFileInformation(ULONG FileId, FILEINFORMATION *Information)
static ARC_STATUS DiskRead(ULONG FileId, VOID *Buffer, ULONG N, ULONG *Count)
static ARC_STATUS DiskOpen(CHAR *Path, OPENMODE OpenMode, ULONG *FileId)
static ARC_STATUS DiskSeek(ULONG FileId, LARGE_INTEGER *Position, SEEKMODE SeekMode)
static ARC_STATUS DiskClose(ULONG FileId)
Definition at line 241 of file hwdisk.c.
Referenced by GetHarddiskInformation(), and PcInitializeBootDevices().
◆ Hex
◆ PcBiosDiskCount
UCHAR PcBiosDiskCount = 0 |
◆ PcDiskIdentifier
CHAR PcDiskIdentifier[32][20] |
|
static |