31#define FIRST_BIOS_DISK 0x80
32#define FIRST_PARTITION 1
43static const CHAR Hex[] =
"0123456789abcdef";
95 ERR(
"DiskOpen(): DiskReadBufferSize is 0, something is wrong.\n");
103 if (DrivePartition == 0xff)
119 if (DrivePartition != 0xff && DrivePartition != 0)
135 ERR(
"SectorSize (%lu) != Geometry.BytesPerSector (%lu), expect problems!\n",
147 Context->DriveNumber = DriveNumber;
162 ULONG Length, TotalSectors, MaxSectors, ReadSectors;
180 ReadSectors = TotalSectors;
181 if (ReadSectors > MaxSectors)
182 ReadSectors = MaxSectors;
200 TotalSectors -= ReadSectors;
276 ERR(
"Reading MBR failed\n");
290 for (
i = 0;
i < 512 /
sizeof(
ULONG);
i++)
294 Checksum = ~Checksum + 1;
295 TRACE(
"Checksum: %x\n", Checksum);
339 Identifier[18] = (ValidPartitionTable ?
'A' :
'X');
347 UCHAR DiskCount, DriveNumber;
351 *BootDriveReported =
FALSE;
377 TRACE(
"BIOS reports success for disk %d (0x%02X) but data didn't change\n",
378 (
int)DiskCount, DriveNumber);
387 *BootDriveReported =
TRUE;
396 TRACE(
"BIOS reports %d harddisk%s\n",
397 (
int)DiskCount, (DiskCount == 1) ?
"" :
"s");
412 if ((DriveNumber >= 0x80) || (DriveNumber == 0x49))
458 ERR(
"Failed to get boot partition entry\n");
465 "multi(0)disk(0)rdisk(%u)partition(%lu)",
498 ERR(
"Reading MBR failed\n");
509 for (
i = 0;
i < 2048 /
sizeof(
ULONG);
i++)
513 Checksum = ~Checksum + 1;
514 TRACE(
"Checksum: %x\n", Checksum);
524 return (DiskCount != 0);
PRTL_UNICODE_STRING_BUFFER Path
VOID AddReactOSArcDiskInfo(IN PSTR ArcName, IN ULONG Signature, IN ULONG Checksum, IN BOOLEAN ValidPartitionTable)
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)
BOOLEAN DiskGetBootPartitionEntry(IN UCHAR DriveNumber, OUT PPARTITION_TABLE_ENTRY PartitionTableEntry, OUT PULONG BootPartition)
VOID DiskDetectPartitionType(IN UCHAR DriveNumber)
#define DBG_DEFAULT_CHANNEL(ch)
#define PARTITION_ENTRY_UNUSED
struct _MASTER_BOOT_RECORD * PMASTER_BOOT_RECORD
VOID * FsGetDeviceSpecific(ULONG FileId)
VOID FsSetDeviceSpecific(ULONG FileId, VOID *Specific)
VOID FsRegisterDevice(CHAR *Prefix, const DEVVTBL *FuncTable)
#define MachDiskGetDriveGeometry(Drive, Geom)
#define MachDiskReadLogicalSectors(Drive, Start, Count, Buf)
FORCEINLINE PVOID FrLdrTempAlloc(_In_ SIZE_T Size, _In_ ULONG Tag)
FORCEINLINE VOID FrLdrTempFree(PVOID Allocation, ULONG Tag)
static const WCHAR Signature[]
CCHAR FrLdrBootPath[MAX_PATH]
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
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 const DEVVTBL DiskVtbl
static BOOLEAN DiskGetBootPath(BOOLEAN IsPxe)
static BOOLEAN DiskIsDriveRemovable(UCHAR DriveNumber)
struct tagDISKCONTEXT DISKCONTEXT
static ARC_STATUS DiskGetFileInformation(ULONG FileId, FILEINFORMATION *Information)
static CHAR PcDiskIdentifier[32][20]
static ARC_STATUS DiskRead(ULONG FileId, VOID *Buffer, ULONG N, ULONG *Count)
BOOLEAN PcInitializeBootDevices(VOID)
static ARC_STATUS DiskOpen(CHAR *Path, OPENMODE OpenMode, ULONG *FileId)
static ARC_STATUS DiskSeek(ULONG FileId, LARGE_INTEGER *Position, SEEKMODE SeekMode)
static VOID GetHarddiskInformation(UCHAR DriveNumber)
PCHAR GetHarddiskIdentifier(UCHAR DriveNumber)
static ARC_STATUS DiskClose(ULONG FileId)
static UCHAR EnumerateHarddisks(OUT PBOOLEAN BootDriveReported)
SIZE_T DiskReadBufferSize
#define sprintf(buf, format,...)
_In_ ULONG _In_ ULONG _In_ ULONG Length
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)
LONG DiskReportError(BOOLEAN bShowError)
ULONG PartitionSectorCount
ULONG SectorCountBeforePartition
USHORT MasterBootRecordMagic
#define RtlCopyMemory(Destination, Source, Length)
#define RtlZeroMemory(Destination, Length)
#define TAG_HW_DISK_CONTEXT
_In_ WDFREQUEST _In_ NTSTATUS _In_ ULONG_PTR Information