ReactOS 0.4.16-dev-1946-g52006dd
disk.h
Go to the documentation of this file.
1/*
2 * FreeLoader
3 * Copyright (C) 1998-2003 Brian Palmer <brianp@sginet.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20#pragma once
21
22#include <reactos/rosioctl.h>
23
24/* FreeLoader-specific disk geometry structure */
25typedef struct _GEOMETRY
26{
33
34#include <pshpack1.h>
35
36/*
37 * Define the structure of a partition table entry
38 */
40{
41 UCHAR BootIndicator; // 0x00 - non-bootable partition,
42 // 0x80 - bootable partition (one partition only)
43 UCHAR StartHead; // Beginning head number
44 UCHAR StartSector; // Beginning sector (2 high bits of cylinder #)
45 UCHAR StartCylinder; // Beginning cylinder# (low order bits of cylinder #)
46 UCHAR SystemIndicator; // System indicator
47 UCHAR EndHead; // Ending head number
48 UCHAR EndSector; // Ending sector (2 high bits of cylinder #)
49 UCHAR EndCylinder; // Ending cylinder# (low order bits of cylinder #)
50 ULONG SectorCountBeforePartition; // Number of sectors preceding the partition
51 ULONG PartitionSectorCount; // Number of sectors in the partition
53
54/*
55 * Define the structure of the master boot record
56 */
57typedef struct _MASTER_BOOT_RECORD
58{
60 ULONG Signature; /* 0x1B8 */
61 USHORT Reserved; /* 0x1BC */
65
66#include <poppack.h>
67
68/*
69 * Partition type defines (of PSDK)
70 */
71#define PARTITION_ENTRY_UNUSED 0x00 // Entry unused
72#define PARTITION_FAT_12 0x01 // 12-bit FAT entries
73#define PARTITION_XENIX_1 0x02 // Xenix
74#define PARTITION_XENIX_2 0x03 // Xenix
75#define PARTITION_FAT_16 0x04 // 16-bit FAT entries
76#define PARTITION_EXTENDED 0x05 // Extended partition entry
77#define PARTITION_HUGE 0x06 // Huge partition MS-DOS V4
78#define PARTITION_IFS 0x07 // IFS Partition
79#define PARTITION_OS2BOOTMGR 0x0A // OS/2 Boot Manager/OPUS/Coherent swap
80#define PARTITION_FAT32 0x0B // FAT32
81#define PARTITION_FAT32_XINT13 0x0C // FAT32 using extended int13 services
82#define PARTITION_XINT13 0x0E // Win95 partition using extended int13 services
83#define PARTITION_XINT13_EXTENDED 0x0F // Same as type 5 but uses extended int13 services
84#define PARTITION_NTFS 0x17 // NTFS
85#define PARTITION_PREP 0x41 // PowerPC Reference Platform (PReP) Boot Partition
86#define PARTITION_LDM 0x42 // Logical Disk Manager partition
87#define PARTITION_UNIX 0x63 // Unix
88#define VALID_NTFT 0xC0 // NTFT uses high order bits
89#define PARTITION_NTFT 0x80 // NTFT partition
90#define PARTITION_GPT 0xEE // GPT protective partition
91#ifdef __REACTOS__
92#define PARTITION_OLD_LINUX 0x43
93#define PARTITION_LINUX 0x83
94#endif
95
97//
98// PC x86/64 BIOS Disk Functions (pcdisk.c)
99//
101#if defined(__i386__) || defined(_M_AMD64)
103#endif // defined __i386__ || defined(_M_AMD64)
104
105/* Buffer for disk reads (hwdisk.c) */
106extern PVOID DiskReadBuffer;
108
109
110/* ARC path of the boot drive and partition */
112
113
115//
116// Fixed Disk Partition Management Functions
117//
119
120VOID
122 IN UCHAR DriveNumber);
123
126 IN UCHAR DriveNumber,
127 OUT PPARTITION_TABLE_ENTRY PartitionTableEntry,
128 OUT PULONG BootPartition);
129
132 IN UCHAR DriveNumber,
134 OUT PPARTITION_TABLE_ENTRY PartitionTableEntry);
135
136/*
137 * SCSI support (disk/scsiport.c)
138 */
140
141PCCHAR FrLdrGetBootPath(VOID);
unsigned char BOOLEAN
#define __cdecl
Definition: accygwin.h:79
ULONG FrldrGetBootPartition(VOID)
Definition: freeldr.c:206
struct _PARTITION_TABLE_ENTRY PARTITION_TABLE_ENTRY
CCHAR FrLdrBootPath[MAX_PATH]
Definition: freeldr.c:29
PCCHAR FrLdrGetBootPath(VOID)
Definition: freeldr.c:196
PVOID DiskReadBuffer
Definition: hwdisk.c:50
struct _PARTITION_TABLE_ENTRY * PPARTITION_TABLE_ENTRY
struct _MASTER_BOOT_RECORD * PMASTER_BOOT_RECORD
ULONG LoadBootDeviceDriver(VOID)
Definition: scsiport.c:1656
BOOLEAN DiskGetPartitionEntry(IN UCHAR DriveNumber, IN ULONG PartitionNumber, OUT PPARTITION_TABLE_ENTRY PartitionTableEntry)
Definition: partition.c:407
UCHAR FrldrGetBootDrive(VOID)
Definition: freeldr.c:201
struct _MASTER_BOOT_RECORD MASTER_BOOT_RECORD
struct _GEOMETRY * PGEOMETRY
struct _GEOMETRY GEOMETRY
BOOLEAN DiskGetBootPartitionEntry(IN UCHAR DriveNumber, OUT PPARTITION_TABLE_ENTRY PartitionTableEntry, OUT PULONG BootPartition)
Definition: partition.c:367
SIZE_T DiskReadBufferSize
Definition: hwdisk.c:51
VOID DiskDetectPartitionType(IN UCHAR DriveNumber)
Definition: partition.c:314
#define MAX_PATH
Definition: compat.h:34
VOID __cdecl DiskStopFloppyMotor(VOID)
Definition: pc98hw.c:1235
unsigned short USHORT
Definition: pedump.c:61
Definition: disk.h:26
ULONG BytesPerSector
Number of bytes per sector.
Definition: disk.h:30
ULONG Cylinders
Number of cylinders on the disk.
Definition: disk.h:27
ULONGLONG Sectors
Total number of disk sectors/LBA blocks.
Definition: disk.h:31
ULONG SectorsPerTrack
Number of sectors per track.
Definition: disk.h:29
ULONG Heads
Number of heads on the disk.
Definition: disk.h:28
UCHAR MasterBootRecordCodeAndData[0x1b8]
Definition: disk.h:59
USHORT MasterBootRecordMagic
Definition: disk.h:63
PARTITION_TABLE_ENTRY PartitionTable[4]
Definition: disk.h:62
USHORT Reserved
Definition: disk.h:61
ULONG Signature
Definition: disk.h:60
Definition: disk.h:40
ULONG SectorCountBeforePartition
Definition: disk.h:50
ULONG PartitionSectorCount
Definition: disk.h:51
UCHAR BootIndicator
Definition: disk.h:41
UCHAR StartCylinder
Definition: disk.h:45
UCHAR StartSector
Definition: disk.h:44
UCHAR SystemIndicator
Definition: disk.h:46
UCHAR EndHead
Definition: disk.h:47
UCHAR EndSector
Definition: disk.h:48
UCHAR EndCylinder
Definition: disk.h:49
UCHAR StartHead
Definition: disk.h:43
uint32_t * PULONG
Definition: typedefs.h:59
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59
uint64_t ULONGLONG
Definition: typedefs.h:67
#define OUT
Definition: typedefs.h:40
char CCHAR
Definition: typedefs.h:51
_In_ ULONG _In_ ULONG PartitionNumber
Definition: iofuncs.h:2061
unsigned char UCHAR
Definition: xmlstorage.h:181