Article View: comp.lang.pascal.borland
Article #433Re: Copy protection schemes
From: Richard Pennington
Date: Wed, 30 Sep 1998 00:00
Date: Wed, 30 Sep 1998 00:00
94 lines
3702 bytes
3702 bytes
Hello All.
John Skilbeck wrote:
>> I have an idea of how to implement a copy protection scheme into my
>> program. My idea is to store the serial number of the installation
>> floppy disk in a hidden file on the disk.
Why not hard code it into the program and set the serial number to whatever you
want?
DiskDupe or something similar will then copy the disk exactly (ie same serial
number etc).
>> Does anyone know an easy way to read the serial number of a floppy
>> disk into a string in Turbo Pascal 7?
From SWAG:
=== Cut ===
{
Get the serial number of a disk
+========================================+
| |#
| AVONTURE CHRISTOPHE |#
| AVC SOFTWARE |#
| BOULEVARD EDMOND MACHTENS 157/53 |#
| B-1080 BRUXELLES |#
| BELGIQUE |#
| |#
+========================================+#
###########################################
}
Const
Hexa : Array [0..15] of Char =
('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
Type DiskInfo = Record { Work area }
Info_Level : Word; { Always zero }
Serial_Num : LongInt; { Serial number of the specified disk }
Volume_Name : String[11]; { 'NO_NAME' or volume name }
File_Sys : String[8]; { 'FAT12' or 'FAT16' }
End;
Var
Ch1 , Ch2 : Byte;
Ch3 , Ch4 : Byte;
DInfo : DiskInfo;
First, Second : Word;
Function Word2Hex(Number: Word) : String;
Begin
Ch1 := (Number SHR 8) SHR 4;
Ch2 := (Number SHR 8) - (Ch1 SHL 4);
Ch3 := (Number AND $FF) SHR 4;
Ch4 := (Number AND $FF) - (Ch3 SHL 4);
Word2Hex := Hexa[Ch1]+Hexa[Ch2]+Hexa[Ch3]+Hexa[Ch4];
End;
Begin
Asm
Mov Ax, Seg DInfo
Mov Ds, Ax
Mov Dx, Offset DInfo { Load Adress of my target table }
Mov Ax, 6900h { Get Serial Number }
Mov Bl, 0 { Drive : 0 default, 1 A:, 2 B:, ... }
Xor Bh, Bh { Always 0 under DOS }
Int 21h { Only if you have DOS 4.0+ }
Mov Ax, Word Ptr [DInfo.Serial_Num + 2]
Mov First, Ax { First word of the serial number }
Mov Ax, Word Ptr DInfo.Serial_Num
Mov Second, Ax { Second word of the serial number }
End;
Writeln('Serial number of this disk :
',Word2Hex(First),'-',Word2Hex(Second));
End.
=== Cut ===
Hope This Helps,
Richard.
... Programmers don't get sniffles, they get a CODE.
--
Technical Details
Message-ID:
<0c0_9809301901@craybbs.co.uk>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<6urf11$1j1$1@news3.cableinet.co.uk> <361140D6.D5E234E3@primus-online.de>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10c950,b60f5ffb1998934d X-Google-Attributes: gid10c950,public X-Google-Thread: 111659,b60f5ffb1998934d X-Google-Attributes: gid111659,public X-Google-Thread: 10cc59,b60f5ffb1998934d X-Google-Attributes: gid10cc59,public X-Google-Thread: 108ebd,b60f5ffb1998934d X-Google-Attributes: gid108ebd,public From: Richard.Pennington@dodgy-dik.craybbs.co.uk (Richard Pennington) Subject: Re: Copy protection schemes Date: 1998/09/30 Message-ID: <0c0_9809301901@craybbs.co.uk> X-Deja-AN: 396494646 References: <6urf11$1j1$1@news3.cableinet.co.uk> <361140D6.D5E234E3@primus-online.de> Organization: The Cray BBS <-> Internet Gateway Newsgroups: comp.lang.pascal.borland,comp.lang.pascal.ansi-iso,borland.public.turbopascal,comp.lang.pascal