home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C!T ROM 2
/
ctrom_ii_b.zip
/
ctrom_ii_b
/
PROGRAM
/
PASCAL
/
PARADIS1
/
FAT.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1992-03-09
|
2KB
|
82 lines
(9937) Fri 6 Mar 92 15:41
By: Robert Jenkins
To: Rod Kinnison
Re: Another "Help me"
St:
---------------------------------------------------------------------------
@EID:1185 0052ae70
@MSGID: 1:389/5@FidoNet 210f7a66
@REPLY: 2:345/602 4f52b016
> Once again, I'm new to this Pascal programming and I'm in need of advice
> from the experts. I'm trying to read the disk label from A or B drive.
> Is there anyone who can tell me how to get a disk label into a pascal
> string variable without using the DOS Label command.
> ---
Here is a program I wrote using a dos interrupt to get the label information.
You can also get the serial number. I recently got another DOS Programmers
Guied. This is a book by MircoSoft on DOS 5.0. I do not know if this inturrpt
is supported on other versions of DOS.
Uses DOS, CRT;
Type MIDRecord = Record {MID = Media ID}
InfoLevel : Word;
SerialNum : LongInt;
VolLabel : Array[1..11] of Char;
FatType : Array[1..8] of Char;
End;
Function Label_Fat(Var Mid : MidRecord; Drive : Word) : Boolean;
Var Result : Word;
Var Regs : Registers;
Begin
FillChar(Mid,SizeOf(Mid),0);
FillChar(Regs,SizeOf(Regs),0);
With Regs DO
Begin
AX := $440D;
BX := Drive; {0=current drive, 1=A, 2=B, etc..}
CX := $0866;
DS := Seg(Mid);
DX := Ofs(Mid);
Intr($21,Regs);
Case AX of
$01 : Label_Fat := False;
$02 : Label_Fat := False;
$05 : Label_Fat := False;
Else Label_Fat := True;
End;
End;
End;
Var Mid : MidRecord;
Begin
ClrScr;
If Label_Fat(Mid,0) Then
With Mid DO
Begin
Writeln(SerialNum);
Writeln(VolLabel);
Writeln(FatType); {Fat Type will be either 'FAT16' or 'FAT12'}
End
Else Writeln('Error Occured');
End.
I tried to write this using basm but ran into some trouble. It would not work
as a function. (I don't know asm very well)...
Hope this helps!
Robert
--- TosScan(q) 1.00
* Origin: ROBBS......................................? (1:389/5)
@PATH: 389/5 2 170/400 512/0 1007