// The following procedures apply to WIN98 / WINME, WIN2000 or later, does not support direct reading and writing of the hard disk. We all know that the partition table of the hard disk is located in the 0-column 0 surface 1 sector. At the offset address 1be to 1fd is the partition table content of the hard disk, usually we look at the hard disk partition table, just use Debug, ie, said: C: /> Debug-a100 MOV AX, 0201 MOV BX, 0200 MOV CX, 0001 MOV DX, 0080 INT 13 INT 20-g = 100-D3BE 3FF // Save Partition Data INTO File Aking.dat-n Aking.dat- RCX: 200-W200 performs the above instructions, we will see 66 bytes, where the last two bytes must be 55AA, which is the main boot flag of the hard disk (also known as the boot mark), if these two words The section is not 55AA, then your hard disk will not be able to start because the computer does not recognize the hard disk. Moreover, it is necessary to be 80h at the offset address 1BE, otherwise it will be prompted when the operating system is lost. Remove the boot mark of the hard disk, there is a total of 64 bytes. Each hard disk takes up 16 bytes. The IDE port or EIDe port on the host can hang 4 hard drives (outside the plug-in), usually for security You can save 512 bytes of information or more than 512 bytes of hard drives to a file. The 16 bytes of each hard disk partition table have their corresponding meaning: The first byte: If it is a boot partition, it is 80h, if not, it is 00h second byte to the fourth byte: Yes The start sector number of the partition is the fifth byte: flag byte, such as 05 means the expansion partition six bytes to the eighth byte: the termination sector number of the partition is ninth byte to the twelfth word. Section: The number of sectors used by the partition to the 16th byte: The total number of sectors occupied by the partition After understanding the above architecture, it is very simple, such as Say that I made a different or xor operation for the hard drive. The hard disk is locked when the program is executed, and the hard disk is unlocked in the second execution, and the hard disk is locked in the third time. . . . In addition to the boot mark, I can also do or operate other important signs, such as changing the sign byte 80 of the guidance partition, such as hiding an extension, etc., can be implemented. Here I use Debug to write the assembler, here I write the program with lock / unlock the boot mark. The above I have declared if you want to use my program, please pay attention to a label, save the hard disk partition table to FLOPPY DISK in the form of a file, to prevent everyone, please see the program: c: /> DEBUG-A100MOV AX, 0201MOV BX, 0200MOV CX, 0001MOV DX, 0080INT 13JB ERRORMOV SI, 03FEMOV BP, AA55XOR [SI], BPMOV AX, 0301MOV BX, 0200MOV CX, 0001MOV DX, 0080INT 13JB ERRORCMP [SI], BPJNZ LOCKMOV DX, 0150Mov AH, 9INT 21JMP Endlock: MOV DX, 0165 MOV AH, 9 INT 21 JMP Enderror: MOV DX, 0180 MOV AH, 9 INT 21END: MOV AH, 4CH INT 21H
- E150 "Unlock Success FuL" - E165 "Lock SuccessFully! $" - E180 "Harddisk I / O Error! $" - n aking.com-rcx: 200-W100-Q
At this point, we have filed the above code to file aking.com. You can use the file copy to the floppy disk, start the computer from the floppy disk, the first time the AKING.COM hard drive is locked, and then execute the hard disk unlock again. I was very interested in compilation and how to use compilation, and I accidentally heard my friend asked about how to encrypt hard drives before, I think this is a simpler method, and NT and 2000 and XP are not To support direct read and write operations for the hard disk, in this case, if you want to read and write a sector of the hard disk, you need to use the API to program, such as the API function such as CreateFile, ReadFile, Writefile. One point I want to declare: The above code is written, where Lock, Error, End should be replaced in the actual application, here for easy use of Label.