Use the installer to prevent software from illegal copying
Each user does not want its own software to be used by others, naturally, caudential to encrypt the software. This article mainly introduces a method of copying software through the installer, Kundu to prevent software illegal copying. Practical proves this method is ideal for situations where you need to install software Kun on your hard drive. First, the working principle is set by setting a special unit in the encrypted software, which will be loaded by the Software (C, D, E, etc.) partitions in the specified hard disk (C, D, E, etc.). In the process of copying the hard drive, the encrypted software is filled in the first clustered number in the hard disk to its specified unit. At the same time, in the software being encrypted, the inspection process is embedded. When the encrypted software is running on the hard disk, the test program first judges the encrypted software on the hard disk's first cluster number and its own program specified in its own program. . If it is different, it is considered to be that the software is illegally copied, and the operation of the software is terminated. If Kun is equal, it is considered that the software is installed normally through the installer, allowing the software to continue to run. This method uses some deep knowledge of the DOS interrupt to operate the file, such as 11h, 1AH, 3CH, 3DH, 3EH, 3FH, 40H, 3DH, 3EH, 3FH, 40H, 42H function call and file control of the Cukk block (FCB) data format, etc.. In this way, please refer to Kundu information in more detail.
1, INT 21H Interrupt Function Call 1Int 21 Interrupt 11H function Role: Find matching file name call in the current directory of the specified disk: AH = 11HDS: DS = file control block: displacement return: Al = 00, success, find Matching file name AL = 0ffh, failure, no matching file name 2InT 21 interrupt 1AH function: AH = 1AHDS: DX = disk transfer section: Displacement Return: no 3int 21 interrupt 3ch Number function: Create file call: AH = 3chcx = file properties, 00h: standard, 01h: read-only, 02h: Include, 04h: System DS: DX = file Description: Displacement Return: Successful carry flag = clear AX = Document Description Failed Run Sign = Set AX = Error Code, 3: The path is not found, 4: No description word available, 5: Refuse to access 4INT 21 interrupt 3DH function effect: Open file call: AH = 3dhal = Access mode, 000: Read, 001: Write, 010: Read / Write DS: DX = File Description: Displacement Return: Successful Return Sign = Clear AX = File Description Failed Run Sign = Set AX = Error Code, 1: Features Intact, 2: Document is not found, 3: The path is not found, 4: No description word available, 5: Refusal to access the 5int 21 interrupt 3EH function effect: turn the file call: AH = 3EHBX = file description word return: successful carry flag = clear failure Ground sign = set AX = error code, 6: Description word invalid 6INT 21h interrupt 3FH number function: read file call: AH = 3FHBX = file description word cx = read byte DS: DX = Segment: Buffer displacement Return : Successful carry sign = clear AX = actual reading number, 0: file end failed in the carry mark = set AX = error code, 5: Refusal to access, 6: None description word available 7INT 21H interrupt 40H function: write file call : Ah = 40HBX = file description word cx = write byte number DS: DX = buffer segment: displacement return: successful carry sign = clear AX = actual writing number, 0: disk full failure flag = set AX = Error code, 5: Refusal to access, 6: No description word can be used 8int 21h interrupt 42H function effect: mobile file pointer call: AH = 42HAL = Mode, 0: Start the absolute byte displacement from the file 1: Words from the current location Split 2: Byte displacement bx from the file BX = file description word CX = most effective half-shift (high character) DX = time effective half displacement (low words) Return: successful carry flag = clear DX = most effective half shift ( High words) AX = time-efficient half-shift (low words) failed to carry mark = set AX =
Error code, 1: Function number invalid, 6: Description word invalid 2, file control block (FCB) data format drive letter, "File name extension" For the drive letter, 1: A drive, 2: B drive, 3 : C partition, 4: D partition, etc. I can push it. For file names and extensions, construct files in the 8.3 format, a total of 11 characters, and the literary name is not enough for 8 characters to use spaces. For example, DB 4, 'my_run com', 21 DUP (?) Defines a file control block named my_run.com on a DUP. The implementation method gives two programs below, one is the installer, the other is the test program. Working process Kun simply: hard disk memory floppy - ─ ─ ┐ ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ─ ─ ─ ─ ─────────── ││ ─ ─ ─ ─ ─ ─ ┐─────────── ─ │Una installer │├─────────────────────────────────── ├────── ─ ┤│Dontrol │ │ │ ← ─ ┤ ┤ 加 ┤ 文件 文件 ││ 被 加 文件 文件 │ ← ─ ┤ ┤ 加 文件 文件 文件 │ │ (including inspection procedures) ││ (including test Program) │ 4 │ (including inspection procedures) │ ├──────────────────────────────────────────────────────────────── ┘ └ - ─ ─ ┘ └───── ┘1 The software is copied to the hard disk by the installer, which can generate a directory entry in the directory area of the hard-working disk, and give This file determines a first cluster number. 2 Put the encrypted file on the floppy disk into the memory buffer. 3 Send the first cluster number of the encrypted file on the hard disk to the designated unit in the memory buffer encrypted file Kun. 4 Save the contents of the encrypted file in the memory buffer to the encrypted file in the hard disk.
Third, a demonstration example; **** my_inst.asm **** Code segmentassume cs: code, ds: code, es: codeorg 100hbegin: MOV DX, OFFSET DIME_2; Open a disk MY_Run.com file MOV Al, 2MOV AH, 3DHINT 21HPUSH AX; Save File Handle MOV BX, AXMOV CX, 0FFF0HMOV DX, OFFSET DIME_0; reads a disk my_run.com to memory MOV AH, 3FHINT 21hPOP BXPUSH AX; save file handle MOV AH, 3EH; shut down file INT 21HMOV DX, OFFSET DIME_1; Established MY_Run.com files on D DV CX, 20HMOV AH, 3CHINT 21HPUSH AX; Save File Handle MOV DX, OFFSET DIME_0POP BXPOP CXPUSH BXMOV AH, 40H; write MY_Run.com content in memory D disk my_rum.comint 21hpop bxmov AH, 3EINT 21h; Close File MOV DX, OFFSET DIME_3MOV AH, 1AH; Set Disk Transfer Address INT 21HMOV DX, OFFSET DIME_4MOV AH, 11H; Find Directory INT 21HMOV DX, OFFSET DIME_1MOV AH, 3DHMOV Al , 02HINT 21h; Open file Push AX; save file handle MOV BX, AXMOV AX, 4200HMOV CX, 0MOV DX, WORD PTR DIME_5; mobile file pointer to my_run.com specified unit INT 21hpop Bxmov AH, 40HMOV DX, OFFSET DIME_3 1BH The 26th, 27th bytes of the buffer are the first cluster number MOV CX, 2INT 21H of the file; write the first clustered number of my_run.com to MOV AH, 3EINT 21h; turn off file MOV AX, 4C00HINT 21h; return DOSDIME_0 DB 7000H DUP (?); Open up a data area, store the encrypted file DIME_1 DB "D: my_run.com", 0DIME_2 DB "A: /MY_Run.com", 0DIME_3 DB 40H DUP (?); 40H byte memory buffer DIME_4 DB 4, " MY_Run COM, 21 DUP (?); File control block data form DIME_5 DW 0064HCode endsend begin; **** my_run.asm **** code segmentassume cs: code, ds: code, es: codeorg 100hbegin: JMP StartDime_1 DB 40H DUP (0); Retain 40H byte buffer DIME_2 DB 4, "My_Run COM", 21 DUP (0); file control block data format DIME_3 DB 0, 0Start: MOV AH, 1AHMOV DX, OFFSET DIME_1; Setting Data Transmission address INT 21HMOV AH, 11HMOV DX, OFFSET DIME_2; Find Directory INT 21HMOV DI, OFFSET DIME_3MOV SI, OFFSET DIME_3MOV SI, OFFSET DIME_1 1BH; Directory item 26,27 bytes to the first cluster number MOV CX, 2CLDREPZ CMPSB; Compare it The file actually first clustered in the D disk is equal to whether the value of the file DIME_3 unit is equal, and the MOV AH, 09H; does not equal MOV DX, OFFSET MSG2; the alarm tips INT 21HMOV AX, 4C00H; Termination program operation, Return to Dosint 21HEXIT1: MOV AH, 09HMOV DX, OFFSET MSG1; Display the correct information, continue to run the program int 21HMOV AX, 4C00HINT 21HMSG1 DB "Copyright is good", 0DH, 0AH, '$'