BBS: Inland Empire Archive Date: 04-18-92 (23:31) Number: 101 From: DAVID BLISS Refer#: NONE To: ALL Recvd: NO Subj: Serial Number Conf: (2) Quik_Bas
Someone suggested using the disk's serial number as a copy protect/timelock. However, this code will allow you to change the serial number of any dos4+ disk to anything you want... 'ChngSer - Changes disk serial number 'You may use this code for anything except profit. 'Compile with QB.LIB... DECLARE FUNCTION unhex! (x$) '$INCLUDE: 'qb.bi' This loads the REGTYPEX type... DIM inregs AS RegTypeX, outregs AS RegTypeX PRINT INPUT "Modify which disk? (A-Z) ", disc$ disc = ASC(UCASE$(disc$)) - 64 inregs.ax = &H6900 inregs.bx = disc DIM diskinfo AS STRING * 26 inregs.ds = VARSEG(diskinfo) inregs.dx = VARPTR(diskinfo) CALL interruptx(&H21, inregs, outregs) di$ = diskinfo PRINT PRINT "Current serial number: "; FOR x = 4 TO 1 STEP -1 PRINT HEX$(ASC(MID$(diskinfo, x + 2, 1))); NEXT x PRINT INPUT "New serial number? (8 hex digits) ", b$ b$ = UCASE$(b$) a = unhex(LEFT$(b$, 2)) b = unhex(MID$(b$, 3, 2)) c = unhex(MID$(b$, 5, 2)) d = unhex(MID$(b$, 7, 2)) newser$ = CHR$(d) + CHR$(c) + CHR$(b) + CHR$(a) MID$(diskinfo, 3, 4) = newser$ inregs.ax = &H6901 inregs.bx = disc inregs.ds = VARSEG(diskinfo) inregs.dx = VARPTR(diskinfo) CALL interruptx(&H21, inregs, outregs) FUNCTION unhex! (x$) FOR x = LEN(x$) TO 1 STEP -1 a$ = MID$(x$, LEN(x$) - x + 1, 1) IF a$ <= "9" THEN a = VAL(a$) ELSE IF a$ = "F" THEN a = 15 IF a$ = "E" THEN a = 14 IF a$ = "D" THEN a = 13 IF a$ = "C" THEN a = 12 IF a$ = "B" THEN a = 11 IF a$ = "A" THEN a = 10 END IF tempvar = tempvar + (a * 16 ^ (x - 1)) NEXT x unhex! = tempvar END FUNCTION Dave --- * Origin: The Aliens BBS, Simpsonville SC, 8032347195 (1:3639/4)
Books at Amazon:
Back to BASIC: The History, Corruption, and Future of the Language
Hackers: Heroes of the Computer Revolution (including Tiny BASIC)
Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution
The Advent of the Algorithm: The Idea that Rules the World
Moths in the Machine: The Power and Perils of Programming
Mastering Visual Basic .NET