Advanced Discussion

Upon the return for interrupt 13h, if the carry flag is set, that means that the program could not read the sector, and therefore the disk is valid. If the carry flag is clear, that meant that INT 13h could read the sector properly and so the disk would be bad in the eyes of the program, thinking it was a copied disk.

Before creating your disk protection system, we should be aware of the difference between debug's "T" and "P". "T" is the trace instruction, which tells it to follow instructions step by step. That also means that in LOOP or REP instruction, the trace will patiently go through the loop until finished. Also, during CALL instructions, trace will go into the call and execute the instructions pointed to by the call instruction. The "P" command is similar to the "T" but with the difference in that it traces over instructions. That means that if it use a LOOP or REP, it will quickly finish up the loop and point to the next instruction. With a CALL, the "P" (proceed) will not go into the subroutine. Instead, it will just execute the procedure, then point to the next instruction.

But where should you place your protection within an executable? Run your careful note of when things happen. You should notice (if you have used) an intro screen, then the music pops up, then the menu comes out. Decide with extreme caution where to put your protection. Use the most peculiar part of your application to do this.

Notice this so you will know where you are in your program using the unassembler. Once you have done that, you can begin debugging your program. When you are just about to execute the step, try to remember the segment and offset of the instruction. The segment is the number to the left of the colon while the offset is the number to the right. There are basically two different methods to engage your protection system:

Method 1: Exit from copy protected CALL

You should decide how your code would access the drive A: for example. Assuming that it is done with a CALL instruction you should be aware that someone may try skipping the CALL instruction.

It is not tough to accomplish this using even Debug. For example type in "RIP {enter}". Then type in the address of the next instruction. Then execute the do or die instruction, "G". If you fail, you could try using the "T" command once and start using "P" again.

Method 2: Return from copy protected CALL

There is another way to create a disk protection (or better to call your disk protection). To use an instruction that causes the program to jump because of a carry flag. This could be acieved through a JMP command.

Is it safe? No. You could easily fool it around with this carry. INT 13h copy protections are usually simple enough for you to just change the carry flag to allow the program to bypass the copy protection.

Conclusion

So it is not wise to use disk protection anymore. People with a minimum of assembly knowledge could easily mess around with your protection and have your program cracked. But it still remains a good idea for small programs that you just donÆt want everybody to copy them freely.

Return