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 >
Pascal/Delphi Source File  |  1992-03-09  |  2KB  |  82 lines

  1. (9937)  Fri 6 Mar 92 15:41
  2. By: Robert Jenkins
  3. To: Rod Kinnison
  4. Re: Another "Help me"
  5. St:
  6. ---------------------------------------------------------------------------
  7. @EID:1185 0052ae70
  8. @MSGID: 1:389/5@FidoNet 210f7a66
  9. @REPLY: 2:345/602 4f52b016
  10.  > Once again, I'm new to this Pascal programming and I'm in need of advice
  11.  > from the experts.  I'm trying to read the disk label from A or B drive.
  12.  > Is there anyone who can tell me how to get a disk label into a pascal
  13.  > string variable without using the DOS Label command.
  14.  > ---
  15.  
  16. Here is a program I wrote using a dos interrupt to get the label information.
  17. You can also get the serial number.  I recently got another DOS Programmers
  18. Guied.  This is a book by MircoSoft on DOS 5.0.  I do not know if this inturrpt
  19. is supported on other versions of DOS.
  20.  
  21.  
  22. Uses DOS, CRT;
  23.  
  24. Type MIDRecord = Record      {MID = Media ID}
  25.      InfoLevel : Word;
  26.      SerialNum : LongInt;
  27.      VolLabel  : Array[1..11] of Char;
  28.      FatType   : Array[1..8] of Char;
  29.      End;
  30.  
  31. Function Label_Fat(Var Mid : MidRecord; Drive : Word) : Boolean;
  32.  
  33. Var Result : Word;
  34. Var Regs   : Registers;
  35. Begin
  36.      FillChar(Mid,SizeOf(Mid),0);
  37.      FillChar(Regs,SizeOf(Regs),0);
  38.      With Regs DO
  39.      Begin
  40.           AX := $440D;
  41.           BX := Drive;    {0=current drive, 1=A, 2=B, etc..}
  42.           CX := $0866;
  43.           DS := Seg(Mid);
  44.           DX := Ofs(Mid);
  45.           Intr($21,Regs);
  46.           Case AX of
  47.                $01 : Label_Fat := False;
  48.                $02 : Label_Fat := False;
  49.                $05 : Label_Fat := False;
  50.                Else Label_Fat := True;
  51.           End;
  52.      End;
  53. End;
  54.  
  55. Var Mid : MidRecord;
  56. Begin
  57.      ClrScr;
  58.      If Label_Fat(Mid,0) Then
  59.      With Mid DO
  60.      Begin
  61.           Writeln(SerialNum);
  62.           Writeln(VolLabel);
  63.           Writeln(FatType);   {Fat Type will be either 'FAT16' or 'FAT12'}
  64.      End
  65.      Else Writeln('Error Occured');
  66. End.
  67.  
  68.  
  69.  
  70. I tried to write this using basm but ran into some trouble.  It would not work
  71. as a function. (I don't know asm very well)...
  72.  
  73. Hope this helps!
  74.  
  75. Robert
  76.  
  77.  
  78. --- TosScan(q) 1.00
  79.  * Origin: ROBBS......................................? (1:389/5)
  80.  
  81. @PATH: 389/5 2 170/400 512/0 1007 
  82.