@@ -107,39 +107,45 @@ Module HexViews
107107 Dim BootStrapLength = BootSectorOffsets.BootStrapSignature - BootStrapStart
108108
109109 Dim ForeColor As Color
110- If Disk.BootSector.HasValidJumpInstruction ( False ) Then
110+ If Disk.BootSector.CheckJumpInstruction ( False , True ) Then
111111 ForeColor = Color.Green
112112 Else
113113 ForeColor = Color.Black
114114 End If
115115
116116 HighlightedRegions.AddBootSectorOffset(BootSectorOffsets.JmpBoot, ForeColor)
117117 If Disk.IsValidImage Then
118- HighlightedRegions.AddBootSectorOffset(BootSectorOffsets.OEMName, Color.Red)
119- HighlightedRegions.AddBPBoffset(BPBOoffsets.BytesPerSector, Color.Blue)
120- HighlightedRegions.AddBPBoffset(BPBOoffsets.SectorsPerCluster, Color.Blue)
121- HighlightedRegions.AddBPBoffset(BPBOoffsets.ReservedSectorCount, Color.Blue)
122- HighlightedRegions.AddBPBoffset(BPBOoffsets.NumberOfFATs, Color.Blue)
123- HighlightedRegions.AddBPBoffset(BPBOoffsets.RootEntryCount, Color.Blue)
124- HighlightedRegions.AddBPBoffset(BPBOoffsets.SectorCountSmall, Color.Blue)
125- HighlightedRegions.AddBPBoffset(BPBOoffsets.MediaDescriptor, Color.Blue)
126- HighlightedRegions.AddBPBoffset(BPBOoffsets.SectorsPerFAT, Color.Blue)
127- HighlightedRegions.AddBPBoffset(BPBOoffsets.SectorsPerTrack, Color.Blue)
128- HighlightedRegions.AddBPBoffset(BPBOoffsets.NumberOfHeads, Color.Blue)
129- HighlightedRegions.AddBPBoffset(BPBOoffsets.HiddenSectors, Color.Blue)
130-
131- If Disk.BootSector.HasValidExtendedBootSignature And BootStrapStart >= BootSectorOffsets.FileSystemType + BootSectorSizes.FileSystemType Then
132- HighlightedRegions.AddBootSectorOffset(BootSectorOffsets.DriveNumber, Color.Purple)
133- HighlightedRegions.AddBootSectorOffset(BootSectorOffsets.Reserved, Color.Purple)
134- HighlightedRegions.AddBootSectorOffset(BootSectorOffsets.ExtendedBootSignature, Color.Purple)
135- HighlightedRegions.AddBootSectorOffset(BootSectorOffsets.VolumeSerialNumber, Color.Purple)
136- HighlightedRegions.AddBootSectorOffset(BootSectorOffsets.VolumeLabel, Color.Purple)
137- HighlightedRegions.AddBootSectorOffset(BootSectorOffsets.FileSystemType, Color.Purple)
118+ If Disk.BootSector.CheckJumpInstruction( False ) AndAlso Disk.BootSector.BPB.IsValid Then
119+ If BootStrapStart < 3 Or BootStrapStart >= BootSectorOffsets.OEMName + BootSectorSizes.OEMName Then
120+ HighlightedRegions.AddBootSectorOffset(BootSectorOffsets.OEMName, Color.Red)
121+ End If
122+ If BootStrapStart < 3 Or BootStrapStart >= BPBOoffsets.HiddenSectors + BPBSizes.HiddenSectors Then
123+ HighlightedRegions.AddBPBoffset(BPBOoffsets.BytesPerSector, Color.Blue)
124+ HighlightedRegions.AddBPBoffset(BPBOoffsets.SectorsPerCluster, Color.Blue)
125+ HighlightedRegions.AddBPBoffset(BPBOoffsets.ReservedSectorCount, Color.Blue)
126+ HighlightedRegions.AddBPBoffset(BPBOoffsets.NumberOfFATs, Color.Blue)
127+ HighlightedRegions.AddBPBoffset(BPBOoffsets.RootEntryCount, Color.Blue)
128+ HighlightedRegions.AddBPBoffset(BPBOoffsets.SectorCountSmall, Color.Blue)
129+ HighlightedRegions.AddBPBoffset(BPBOoffsets.MediaDescriptor, Color.Blue)
130+ HighlightedRegions.AddBPBoffset(BPBOoffsets.SectorsPerFAT, Color.Blue)
131+ HighlightedRegions.AddBPBoffset(BPBOoffsets.SectorsPerTrack, Color.Blue)
132+ HighlightedRegions.AddBPBoffset(BPBOoffsets.NumberOfHeads, Color.Blue)
133+ HighlightedRegions.AddBPBoffset(BPBOoffsets.HiddenSectors, Color.Blue)
134+ End If
135+
136+ If Disk.BootSector.HasValidExtendedBootSignature And BootStrapStart >= BootSectorOffsets.FileSystemType + BootSectorSizes.FileSystemType Then
137+ HighlightedRegions.AddBootSectorOffset(BootSectorOffsets.DriveNumber, Color.Purple)
138+ HighlightedRegions.AddBootSectorOffset(BootSectorOffsets.Reserved, Color.Purple)
139+ HighlightedRegions.AddBootSectorOffset(BootSectorOffsets.ExtendedBootSignature, Color.Purple)
140+ HighlightedRegions.AddBootSectorOffset(BootSectorOffsets.VolumeSerialNumber, Color.Purple)
141+ HighlightedRegions.AddBootSectorOffset(BootSectorOffsets.VolumeLabel, Color.Purple)
142+ HighlightedRegions.AddBootSectorOffset(BootSectorOffsets.FileSystemType, Color.Purple)
143+ End If
138144 End If
139145 End If
140146
141147 If BootStrapStart > 2 And BootStrapLength > 1 Then
142- If Disk.BootSector.HasValidJumpInstruction ( False ) Then
148+ If Disk.BootSector.CheckJumpInstruction ( False , True ) Then
143149 HighlightedRegions.AddItem(BootStrapStart, BootStrapLength, ForeColor, "Boot Strap Code" )
144150 Else
145151 HighlightedRegions.AddItem(BootStrapStart, BootStrapLength, ForeColor)
0 commit comments