- /* Check the instruction; we use a ULONG to read three bytes */
- Instruction = (*(PULONG)BootSector) & 0x00FFFFFF;
- IsValid = (Instruction != 0x00000000);
-
- /* Check the bootsector signature */
- IsValid &= (*(PUSHORT)(BootSector + 0x1fe) == 0xaa55);
+ /* Check for the existence of the bootsector signature */
+ IsValid = (*(PUSHORT)(BootSector + 0x1FE) == 0xAA55);
+ if (IsValid)
+ {
+ /* Check for the first instruction encoded on three bytes */
+ IsValid = (((*(PULONG)BootSector) & 0x00FFFFFF) != 0x00000000);
+ }