Use the installer to prevent software from illegal copying

xiaoxiao2021-03-06  53

Using the installer to prevent software from copying each user, you don't want your own software to be used by others, naturally, I naturally remember to encrypt the software. This article mainly introduces a method of copying software through the installer to prevent illegal copying. Practical proves that this method is ideal for situations where you need to install software to your hard drive. First, the working principle is provided by setting a special unit in the encrypted software, and the encrypted software will be encrypted on the specified hard disk (C, D, E, etc.) partition. During the copy is loaded into the hard disk, the encrypted software is filled in the first clustered number in the hard disk to its specified unit. At the same time, in the encrypted software, the inspection program is embedded. When the encrypted software runs on the hard disk, the inspection process first determines whether the encrypted software is the same in the first cluster number of the hard disk and 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 equally, the software is considered to be properly installed by the installer, allowing the software to continue to run. This method uses some DOS interrupt calling to the deep knowledge of the file, such as 11h, 1AH, 3CH, 3DH, 3EH, 3FH, 40H, 3DH, 3EH, 3FH, 40H, 42H function call and file control block (FCB) data format, etc., and the file control block (FCB) data format, such as INT21H interrupt. In this way, please refer to the information more detailed.

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 Value, 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.. For filenames and extensions, construct files in the 8.3 format, a total of 11 characters, and the file 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. The simplicity of the working process is as follows:

Hard disk memory floppy - ─ ─ ─ ─────────────────────────────────────────────────────────────────────────────────────────────────── ───── ┤ ││ │ 号 号 号 ├───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── < ┤│ Data Zone │ │ │ ← ─ ┤ Encrypted File ││ Encrypted File │ ← ─ ┤ Encrypted File │ │ (including Inspection Procedure) ││ │ 4 │ (including inspection procedures) │ 4 │ Inspection procedures) │ ├─── ┤┤───── ┤ ├──── ┤ │ ││ │ │ │ │ └────────────── ─ ┘ └───── ┘1 Copy the software on the floppy disk to the hard disk by the installer, which can generate a directory entry in the directory area of ​​the hard disk and determine a first cluster number. 2 Put the encrypted file on the floppy disk into the memory buffer. 3 Send the preemptive number of the encrypted file on the hard disk to the specified unit in the memory buffer encrypted file. 4 Save the content of the encrypted file in the memory buffer to the encrypted file on 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

转载请注明原文地址:https://www.9cbs.com/read-116982.html

New Post(0)