A SHAREWARE TIMELOCK

 BBS: Inland Empire Archive
Date: 04-07-92 (09:32)             Number: 94
From: MATT HART                    Refer#: NONE
  To: RICHARD VANNOY                Recvd: NO  
Subj: A  SHAREWARE TIMELOCK          Conf: (2) Quik_Bas
 RV> EXTERNAL: Methods that depend on something external to the
 RV>          program to set or determine the key.

 RV>    - Hidden files in the same, root, or some other
 RV>      directory.
 RV>    - Programs that read characteristics (BIOS info, video
 RV>      type, etc.) of the hardware to develop a fingerprint
 RV>      that is unique to one machine, or a very small
 RV>      percentage of existing machines.

This routine will allow you to easily read the contents of memory:

; PRINTMEM.ASM  Matt Hart
;
; Place the contents of memory into a string.
; DECLARE SUB PrintMem(Strg$, BYVAL Segment%, BYVAL Offset%)
;
; Set Strg$ = SPACE$(NumBytesToRead)

.MODEL MEDIUM,BASIC
.CODE

PrintMem PROC USES DS ES SI DI, Strg:Word, SegNum:Word, OffNum:Word
    MOV     AX,SegNum       ; Segment into AX
    MOV     SI,OffNum       ; Offset into SI

    MOV     BX,Strg         ; Addr of Strg Descriptor into BX
    MOV     DI,[BX+2]       ; Addr of Strg's first byte into DI
    MOV     CX,[BX]         ; Length of Strg into CX

    MOV     DX,DS           ; DS into DX - can't do MOV ES,DS directly
    MOV     ES,DX           ; ES:DI is now destination
    MOV     DS,AX           ; DS:SI is now source, CX has num bytes

    REP     MOVSB           ; Move DS:SI into ES:DI for CX times

    RET                     ; Back to BASIC
PrintMem ENDP
END

Now, to develop a fingerprint of the machine, read in
information from upper memory:

     Strg$   = SPACE$(16384)
     Segment = 64        ' experiment with this number
     Offset  = 0
     CALL PrintMem(Strg$,BYVAL Segment,BYVAL Offset)
     OPEN "B",1,"VERIFY.FIL"
     PUT 1,,Strg$

     To verify, read it back in, then:
     OPEN "B",1,"VERIFY.FIL"
     OldStrg$ = SPACE$(16384)
     GET 1,,OldStrg$
     CLOSE 1

     IF OldStrg$ <> NewStrg$ THEN PRINT "Not the same machine!!!"

     Strg$ = "" : OdlStrg$ = ""  ' got to clear that memory back!


---
 * Origin: Midnight Micro!  V.32/REL  (918)451-3306 (1:170/600)
Outer Court
Echo Basic Postings

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