标签归档:DBR

如何使用WinHex脚本自动修复FAT32文件系统DBR

        此脚本不是去复制备份的DBR,而是通过文件系统计算BPB参数,来达到修复文件系统的目的,下面是脚本:

 

Assign ParSize GetSize
Assign SecSize 512

Goto 0x000
Write 0xEB5890
Write 0x4D53444F53352E30
Write SecSize
Write 0x00
Write 0x0000
Write 0x02
Write 0x0000
Write 0x0000
Write 0xF8
Write 0x0000
Write 0x3F00
Write 0xFF00
Write 0x00000000
Write 0x0000000000000000
Write 0x0000
Write 0x0000
Write 0x02000000
Write 0x0100
Write 0x0600
Write 0x000000000000000000000000
Write 0x80
Write 0x00
Write 0x29
Write 0x9E3A76F0
Write 0x48424E2052657061697220
Write 0x4641543332202020
{
Write 0x00
}[420]
Write 0x55AA

Goto 0x020
Write (ParSize/SecSize)

Goto 0x000
Find 0xF8FFFF0FFFFFFF Down
IfFound
Assign FAT1 CurrentPos
Move SecSize
EndIF

Find 0xF8FFFF0FFFFFFF Down
IfFound
Assign FAT2 CurrentPos
Move SecSize
EndIF

Goto 0x024
Write ((FAT2/SecSize)-(FAT1/SecSize))

Goto 0x00E
Write (FAT1/SecSize)

Goto ((FAT2-FAT1)+FAT2)
Find 0x2E20202020202020202020 Down
IfFound
Assign SEC1 CurrentPos
Move 26
Read CDX1 2
EndIF

Find 0x2E20202020202020202020 Down
IfFound
Assign SEC2 CurrentPos
Move 26
Read CDX2 2
EndIF

Goto 0x00D
Write (((SEC1/SecSize)-(SEC2/SecSize))/((CDX1)-(CDX2)))

MessageBox "DBR修复完成!"

如何使用WinHex脚本自动修复NTFS文件系统DBR

        DBR(DOS BOOT RECORD,DOS引导记录),位于柱面0,磁头1,扇区1,即逻辑扇区0。DBR分为两部分:DOS引导程序和BPB(BIOS参数块)。其中DOS引导程序完成DOS系统文件(IO.SYS,MSDOS.SYS)的定位与装载,而BPB用来描述本DOS分区的磁盘信息,BPB位于DBR偏移0BH处,共13字节。 它包含逻辑格式化时使用的参数,可供DOS计算磁盘上的文件分配表,目录区和数据区的起始地址,BPB之后三个字提供物理格式化(低格)时采用的一些参数。引导程序或设备驱动程序根据这些信息将磁盘逻辑地址(DOS扇区号)转换成物理地址(绝对扇区号)。

 

Assign Mouse CurrentPos
Assign ParSize GetSize
Assign SecSize 512
Goto 0x000
Write 0xEB52904E54465320202020
Write SecSize
Write 0x00
Write 0x0000
Write 0x000000
Write 0x0000
Write 0xF8
Write 0x0000
Write 0x3F00
Write 0xFF00
Write 0x00000000
Write 0x00000000
Write 0x80008000
Write 0x0000000000000000
Write 0x0000000000000000
Write 0x0000000000000000
Write 0xF6
Write 0x000000
Write 0x01
Write 0x000000a
Write 0x1C5B596481596420
Write 0x0000
{
Write 0x00
}[428]
Write 0x55AA

//Goto Mouse //移动到光标点击位置,提高搜索效率。
Goto 0x200 //从头扫描。
Find 0x100000006000000000001800000000004800000018000000 Down
IfFound
Move -56
Assign MFT CurrentPos
Move 272
Read QSVCN 8
Read JSVCN 8
Move 8
Read FileSize 8
EndIF
Goto 0x00D
Write ((FileSize/(JSVCN-QSVCN+1))/SecSize)
Goto 0x00D
Read CDX 1
Goto 0x030
Write (MFT/SecSize/CDX)
Goto (MFT+1354)
Read MFTMirr 6
Goto 0x038
Write MFTMirr
Goto 0x028
Write ((ParSize/SecSize)-1)
MessageBox "DBR修复完成!"