Помогите разобраться с boot-record и mbr (формат)!
![]() |
Наши проекты:
Журнал · Discuz!ML · Wiki · DRKB · Помощь проекту |
|
| ПРАВИЛА | FAQ | Помощь | Поиск | Участники | Календарь | Избранное | RSS |
| [216.73.216.43] |
|
|
правила раздела Алгоритмы

Помогите разобраться с boot-record и mbr (формат)!
|
Сообщ.
#1
,
|
|
|
|
Пожалуйста, помогите разобраться с boot-record, я имею ввиду с форматом: какой байт за что отвечает, что будет если его поменять... ну и т.д., т.е. все что с ним связано
можно семплы на turbo-asm. всем заранее прзнателен!! ??? |
|
Сообщ.
#2
,
|
|
|
|
есть исходник от *, куда мылить?
|
|
Сообщ.
#3
,
|
|
|
|
Format of hard disk master boot sector:
Offset Size Description (Table 00650) 00h 446 BYTEs Master bootstrap loader code 1BEh 16 BYTEs partition record for partition 1 (see #00651) 1CEh 16 BYTEs partition record for partition 2 1DEh 16 BYTEs partition record for partition 3 1EEh 16 BYTEs partition record for partition 4 1FEh WORD signature, AA55h indicates valid boot block Format of partition record: Offset Size Description (Table 00651) 00h BYTE boot indicator (80h = active partition) 01h BYTE partition start head 02h BYTE partition start sector (bits 0-5) 03h BYTE partition start track (bits 8,9 in bits 6,7 of sector) 04h BYTE operating system indicator (see #00652) 05h BYTE partition end head 06h BYTE partition end sector (bits 0-5) 07h BYTE partition end track (bits 8,9 in bits 6,7 of sector) 08h DWORD sectors preceding partition 0Ch DWORD length of partition in sectors SeeAlso: #00650 (Table 00652) Values for operating system indicator: 00h empty partition-table entry 01h DOS 12-bit FAT 02h XENIX root file system 03h XENIX /usr file system (obsolete) 04h DOS 16-bit FAT (up to 32M) 05h DOS 3.3+ extended partition 06h DOS 3.31+ Large File System (16-bit FAT, over 32M) 07h QNX 07h OS/2 HPFS 07h Windows NT NTFS 07h Advanced Unix 07h see partition boot record; could be any of the above or others 08h OS/2 (v1.0-1.3 only) 08h AIX bootable partition, SplitDrive 08h Commodore DOS 08h DELL partition spanning multiple drives 09h AIX data partition 09h Coherent filesystem 0Ah OS/2 Boot Manager 0Ah OPUS 0Ah Coherent swap partition 0Bh Windows95 with 32-bit FAT 0Ch Windows95 with 32-bit FAT (using LBA-mode INT 13 extensions) 0Eh logical-block-addressable VFAT (same as 06h but using LBA-mode INT 13) 0Fh logical-block-addressable VFAT (same as 05h but using LBA-mode INT 13) 10h OPUS 11h OS/2 Boot Manager hidden 12-bit FAT partition 12h Compaq Diagnostics partition 14h (resulted from using Novell DOS 7.0 FDISK to delete Linux Native part) 14h OS/2 Boot Manager hidden sub-32M 16-bit FAT partition 16h OS/2 Boot Manager hidden over-32M 16-bit FAT partition 17h OS/2 Boot Manager hidden HPFS partition 17h hidden NTFS partition 18h AST special Windows swap file ("Zero-Volt Suspend" partition) 19h Willowtech Photon coS 1Bh hidden Windows95 FAT32 partition 1Ch hidden Windows95 FAT32 partition (using LBA-mode INT 13 extensions) 1Eh hidden LBA VFAT partition 20h Willowsoft Overture File System (OFS1) 21h officially listed as reserved 21h FSo2 23h officially listed as reserved 24h NEC MS-DOS 3.x 26h officially listed as reserved 31h officially listed as reserved 33h officially listed as reserved 34h officially listed as reserved 36h officially listed as reserved 38h Theos 3Ch PowerQuest PartitionMagic recovery partition 40h VENIX 80286 41h Personal RISC Boot 41h PowerPC boot partition 42h SFS (Secure File System) by Peter Gutmann 45h EUMEL/Elan 46h EUMEL/Elan 47h EUMEL/Elan 48h EUMEL/Elan 4Fh Oberon boot/data partition 50h OnTrack Disk Manager, read-only partition 51h OnTrack Disk Manager, read/write partition 51h NOVELL 52h CP/M 52h Microport System V/386 53h OnTrack Disk Manager, write-only partition??? 54h OnTrack Disk Manager (DDO) 55h EZ-Drive (see also INT 13/AH=FFh"EZ-Drive") 56h GoldenBow VFeature 5Ch Priam EDISK 61h SpeedStor 63h Unix SysV/386, 386/ix 63h Mach, MtXinu BSD 4.3 on Mach 63h GNU HURD 64h Novell NetWare 286 64h SpeedStore 65h Novell NetWare (3.11) 67h Novell 68h Novell 69h Novell 70h DiskSecure Multi-Boot 71h officially listed as reserved 73h officially listed as reserved 74h officially listed as reserved 75h PC/IX 76h officially listed as reserved 7Eh F.I.X. 80h Minix v1.1 - 1.4a 81h Minix v1.4b+ 81h Linux 81h Mitac Advanced Disk Manager 82h Linux Swap partition 82h Prime 82h Solaris (Unix) 83h Linux native file system (ext2fs/xiafs) 84h OS/2-renumbered type 04h partition (related to hiding DOS C: drive) 85h Linux EXT 86h FAT16 volume/stripe set (Windows NT) 87h HPFS Fault-Tolerant mirrored partition 87h NTFS volume/stripe set 93h Amoeba file system 94h Amoeba bad block table 98h Datalight ROM-DOS SuperBoot 99h Mylex EISA SCSI A0h Phoenix NoteBIOS Power Management "Save-to-Disk" partition A1h officially listed as reserved A3h officially listed as reserved A4h officially listed as reserved A5h FreeBSD, BSD/386 A6h OpenBSD A9h NetBSD (http://www.netbsd.org/) B1h officially listed as reserved B3h officially listed as reserved B4h officially listed as reserved B6h officially listed as reserved B6h Windows NT mirror set (master), FAT16 file system B7h BSDI file system (secondarily swap) B7h Windows NT mirror set (master), NTFS file system B8h BSDI swap partition (secondarily file system) BEh Solaris boot partition C0h DR DOS/DR-DOS/Novell DOS secured partition C0h CTOS C1h DR DOS 6.0 LOGIN.EXE-secured 12-bit FAT partition C4h DR DOS 6.0 LOGIN.EXE-secured 16-bit FAT partition C6h DR DOS 6.0 LOGIN.EXE-secured Huge partition C6h corrupted FAT16 volume/stripe set (Windows NT) C6h Windows NT mirror set (slave), FAT16 file system C7h Syrinx Boot C7h corrupted NTFS volume/stripe set C7h Windows NT mirror set (slave), NTFS file system CBh Reserved for DR DOS/DR-DOS/OpenDOS secured FAT32 CCh Reserved for DR DOS/DR-DOS secured FAT32 (LBA) CEh Reserved for DR DOS/DR-DOS secured FAT16 (LBA) D0h Multiuser DOS secured FAT12 D1h Old Multiuser DOS secured FAT12 D4h Old Multiuser DOS secured FAT16 (<= 32M) D5h Old Multiuser DOS secured extended partition D6h Old Multiuser DOS secured FAT16 (> 32M) D8h CP/M-86 DBh CP/M, Concurrent CP/M, Concurrent DOS DBh CTOS (Convergent Technologies OS) E1h SpeedStor 12-bit FAT extended partition E2h DOS read-only (Florian Painke's XFDISK 1.0.4) E3h DOS read-only E3h Storage Dimensions E4h SpeedStor 16-bit FAT extended partition E5h officially listed as reserved E6h officially listed as reserved EBh BeOS BFS (BFS1) F1h Storage Dimensions F2h DOS 3.3+ secondary partition F3h officially listed as reserved F4h SpeedStor F4h Storage Dimensions F5h Prologue F6h officially listed as reserved FEh LANstep FEh IBM PS/2 IML (Initial Microcode Load) partition FFh Xenix bad block table Note: for partition type 07h, one should inspect the partition boot record for the actual file system type SeeAlso: #00651 |
|
Сообщ.
#4
,
|
|
|
|
2ZZZaraza
Можно на cr@nk.inbox.as или на IIPUtBOPIIIuK@inbox.ru |
|
Сообщ.
#5
,
|
|
|
|
2z:
Спаcибо, только она не работает и я не понимаю что вообще должна, т.к. написана не на Asm... ??? |
|
Сообщ.
#6
,
|
|
|
|
2 7in
Очень помогло! Теперь не мог бы ответить о формате просто boot-record'a логического диска (не mbr!)? Заранее признателен! |
|
Сообщ.
#7
,
|
|
|
|
Это из TechHelp'а.....
The DOS boot sector of a floppy disk or a hard disk partition is expected to be in this format. Prior to DOS 4.0, a smaller structure was used (see notes, below). BootSectorRec Offset Size Contents ------ ---- ----------------------------------------------------- +0 3 abJmpCode JMP opcode to start of boot code +3 8 abOem e.g., "MSDOS6.0" or "IBM 4.0" +0bH 2 wSectSize bytes per sector (usually 512; 200H) +0dH 1 bClustSects sectors per allocation unit (cluster) +0eH 2 wResSects boot and reserved sectors +10H 1 bFatCnt number of File Allocation Tables. See FAT. +11H 2 wRootEntries max number of 32-byte DirEntryRecs in root +13H 2 wTotSects total number of sectors in media 0000H means >32 MB, so use lBigTotSects +15H 1 bMedia media descriptor (same as 1st byte in FAT) +16H 2 wFatSects number of sectors in one FAT +18H 2 wSectsPerTrk sectors per track +1aH 2 wHeads number of read/write heads +1cH 4 lHidSects hidden sectors (ignore hiword in pre-DOS 4.0) +20H 4 lBigTotSects 32-bit TotSects in volume (partitions > 32M) +24H 1 bDrvNo 80H=first hard disk (used internally by DOS) +25H 1 res1 (reserved) +26H 1 bExtBootSig Extended boot record signature (always 29H) +27H 4 lSerNo Volume Serial Number (based on when formatted) +2bH 11 abVolLabel Volume Label (11-character, blank padded) +36H 8 abFileSysID contains 'FAT12 ' or 'FAT16 ') 62 length of formatted portion of BootSectorRec +3eH ? abBootCode code and data that performs disk bootstrap +2ffH end of boot sector See BPBRec for a description of most of these fields. Fields unique to the BootSectorRec include: abJmpCode Since the Boot Sector is used as program code during system startup, the first bytes in the sector are a JMP opcode to get past the data area. It usually jumps to abBootCode. abOem This is an 8-character text field that is supposed to contain the signature of the version of DOS which formatted the disk (or otherwise laid down the boot sector). It is not used by DOS. bDrvNo On the first hard disk in a system, this field contains 80H. Otherwise it should be 00H. Used internally by DOS. bExtBootSig Prior to DOS 4.0, the formatted portion of the Boot Sector ended at offset 1eH and that variation is still supported. Boot Sectors which contain 29H in this field (offset 26H) are expected to contain the entire 3eH-byte record. lSerNo a 32-bit volume serial number. It is based on the time and date when formatted, making the disk unique for the system which formatted it. This field is used by block device drivers which support Removable Media and Change Line functions (see Device Requests and fn 44H). On disks formatted by DOS versions prior to 4.0, there is no lSerNo or abVolLabel fields. On pre-formatted diskettes, these fields are often non-unique. In either case, DOS might not be able to detect a disk swap. abVolLabel the 11-character, blank-padded, volume label. DOS lays this down when the disk is formatted AND DOS updates it (along with the volume label entry in the root directory) when you use the Label command. abFileSysID this 8-character, blank-padded text field identifies the file system. It can be 'FAT12 ' (12-bit FAT entries) or 'FAT16 ' (16-bit FAT entries). See File Allocation Table. abBootCode this is the start of the unformatted portion of the boot sector. It contains data and code that is executed when the disk is booted. Versions: * DOS 2.x: the formatted part of the record ended at offset 18H. * DOS 3.x: the formatted part of the record ended at offset 1eH. * DOS 4.0+: bExtBootSig contains 29H and all fields through offset 3eH are used. Notes: * Use absolute disk read INT 25H (DX=0) to read this sector OR - floppy disks: The boot sector is at BIOS INT 13H head 0, track 0, sector 1 - hard disks: read the Partition Table to determine BIOS Head, Track, Sector to seek before using INT 13H. * To convert a cluster number (as read from the wClustNo field of a Directory Entry or a FAT chain) into a absolute sector number (as used in INT 25H/26H calls), you may use DOS Fn 32H or read the Boot Sector and apply the formulae: wRootSects = (wRootEntries * 32) / wSectSize wFirstData = wResSects + (wFatSects * bFatCnt) + wRootSects lAbsSector = wFirstData + ((lAnyClusterNo - 2) * bClustects) Use the calculated value (lAbsSector) in INT 25H or INT 26H calls. * Very old hard disks which require an installed device driver (non-bootable hard disks) may contain garbage in the boot sector. When possible, use DOS fns such as 32H to obtain information about the device. А это немного об отличиях FAT32 от FAT16 (Boot-сектор тоже меняется).... из документации к прграмме Presizer (www.zeleps.com)..... 3.3 The Windows FAT32 filesystem structure The FAT32 filesystem is quite similar to the FAT16 filesystem. The following differences exist: -FAT entries are now 32bit wide, allowing for a maximum of approximately 200 milion clusters in a single partition (actually, each FAT entry is 28bit wide, the upper 4 bits are reserved for future use and must always be 0). -The boot sector's information has been changed (see the table below) -The root directory does not necessarily reside in the beginning of the drive and it can grow to any size desirable. -FAT mirroring can be disabled In details, the boot sector entries are the following: Offset Description 0x03-0x0A OEM ID: This is a small string written by the formatter. 0x0B-0x0C Bytes per sector: This is always 512 (it depends on the physical disks characteristics). If you have a disk with a different value, please don't hesitate to inform me. Partition Resizer WON'T WORK FOR DISKS WITH SECTOR SIZE OTHER THAN 512! 0x0D Sectors per Cluster: The cluster is the basic block of information on a FAT drive. A FAT drive cannot have more than 65527 clusters. This size can limit the maximum size a partition can reach after resizing. 0x0E-0x0F Reserved sectors at beginning: first FAT sector number (0 based) 0x10 FAT copies: Number of FAT copies. Normally there are two copies of FAT. 0x11-0x14 Reserved, must be 0. 0x15 Media descriptor byte: This byte is always F8 for hard disks. 0x16-0x17 Reserved, must be 0 0x18-0x19 Sectors per track: Same as the physical disk's sectors per track value. 0x1A-0x1B Sides: Same as the physical disk's head number. 0x1C-0x1F Special hidden sectors: This is how many sectors exist between the partition's description sector and the boot sector. Usually one track. 0x20-0x23 Big total number of sectors: If we have more than 65536 sectors in the partition, their number is written here. 0x24-0x27 Big Sectors per FAT value (old SPF value is now reserved). 0x28-0x29 Flags used for specifying FAT mirroring properties. 0x2A-0x2B Major and minor version of the file system. 0x2C-0x2F Root start: The first cluster (start) of the root directory. 0x30-0x31 File System sector number: offset of the file system sector (see below). 0x32-0x33 Backup Boot Sector: offset of the backup copy of this sector. 0x34-0x3F Reserved. 0x40 Physical drive number: This is the physical drive number (c:0x80, d:0x81 etc.). 0x41 Reserved. 0x42 Extended boot record signature: This marks an extended boot record. If it is 29, the disk was formatted by DOS 4.0 or later. 0x43-0x46 Volume serial number: This is the partition's serial number. 0x47-0x51 Volume label: This is the partition's label string. 0x52-0x59 FS ID: This is a string that identifies a partition as FAT32. After this boot sector, the File System Sector exists, containing the following information: 0x1E8-0x1EB Free cluster count: contains the number of free clusters in the drive (used to speed up free space calculation). If it is -1 the value is recalculated. 0x1EC-0x1EF First free cluster: number of the first available cluster in the partition. I will not go into more detailed explaination of the FAT32 file system. For more information, please visit the Microsoft Developers Library at http://www.microsoft.com/msdn and go to SDK Documentation - Platform SDK - Windows Base Services - Windows 95 Features - Windows 95 Reference - FAT32 API Reference - Structures. |
|
Сообщ.
#8
,
|
|
|
|
2 7in огромное спасибо! очень помогло при написании куровой!
|