home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DP Tool Club 8
/
CDASC08.ISO
/
NEWS
/
554
/
MAI
/
DISKID.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1993-10-07
|
2KB
|
64 lines
{─ Fido Pascal Conference ────────────────────────────────────────────── PASCAL ─
Msg : 219 of 292
From : PETER KLAPPROTH 2:242/56.9 14 May 93 18:27
To : Jud Mccranie 1:3645/20.0
Subj : Re^2: diskette Serial Numbe
────────────────────────────────────────────────────────────────────────────────
Jud Mccranie@1:3645/20.0 wrote 26.04.93
about "Re: diskette Serial Numbe":
> MG> If anyone happens to know how to find the serial number
> MG> of a diskette, please let me know, code is nice :)
>
> It is stored in byte 42, 41, 40, and 39 (counting the first one as
> 0) of ths first sector of the disk. The code I have for it uses the
> TPro package to read the sector.
>
Hi Jud,
annother way to read/write the diskId is the following small peace of
code.}
Unit DiskId;
interface
type TInfoBuffer = record
InfoLevel : word; {may be 0}
Serial : longInt;
VolLabel : array [0..10] of char;
FileSystem: array [0..7] of char;
end;
function GetSerial(DiskNum: Byte; var I:TInfoBuffer):word;
function SetSerial(DiskNum: Byte; var I:TInfoBuffer):word;
implementation
function GetSerial(DiskNum : Byte; var I:TInfoBuffer):word; assembler;
asm
mov ah,69h
mov al,00h
mov bl, DiskNum
push ds
lds dx,I
int 21h
pop ds
jc @bad
Xor ax,ax
@bad:
end;
function SetSerial(DiskNum : Byte; var I:TInfoBuffer):word; assembler;
asm
mov ah,69h
mov al,01h
mov bl, DiskNum
push ds
lds dx,I
int 21h
pop ds
jc @bad
xor ax,ax
@bad:
end;
end.