There are many ways to limit the number of software trials, and the key is to store the number of times that value. This article describes a method that restricts the trial of software by changing the time of the file to store the number of trials.
To limit the number of software trials by changing the file time
In MS-DOS, the time of the file is saved by a 16-bit value, the bit 15~11 is used to save the number of hours, the bit 10~5 is used to hold the minutes, and the bit 4~0 is used to hold the number of seconds. This 16-bit value is exactly what we can use to save the trial count. For example, in the following sample program, the author uses a bit to save the number of minutes to save the trial count. Run the sample program, we can see that only the number of minutes of file time added 1, the average person is difficult to detect, this method has a better concealment.
Ii. interrupts involved in the sample program
1. Interrupt 21H function 3DH
Purpose: Open file for reading. Write or supplement.
Call Register: ah=3dh,al=00h,ds:dx= filename;
Return Register: CF Reset--Successful, ax= file handle.
CF Position-Error, ax= error code.
2. Interrupt 21H function 3EH
Purpose: Forcibly clears all buffers, updates the directory, and invalidates the file handle.
Call Register: ah=3eh,bx= file handle;
Return Register: CF Reset--successful, Ax destroyed,
CF Position-Error, ax= error code.
3. Interrupt 21H function 57H, sub function 00H
Purpose: read out the date and time the file was last modified.
Call Register: ax=5700h,bx= file handle;
Return registers: CF Reset--Successful, cx= file time, dx= file date,
CF Position-Error, ax= error code.
4. Interrupt 21H function 57H, sub function 01H
Purpose: Changes the date and time information that the file was last modified to the specified value.
Call Register: ax=5701h,bx= file handle, cx= new time, dx= new date;
Return Register: CF Reset--Successful,
CF Position-Error, ax= error code.