Getting a disk label. 
Author Message
 Getting a disk label.

I need help to get the label from a floppy or hard disk. Just a simple
procedure or function if there is one.

Thanks.
--

Page: http://www.*-*-*.com/ ~catfish/index.htm



Wed, 18 Jun 1902 08:00:00 GMT  
 Getting a disk label.
Try to search a volume name descriptor in the root directory ('C:\' for
example).
In MS DOS (I think only there?!) exists a "file" with the attribute VOLUMEID
or faVOLUMEID.
So search it with FINDFIRST. The Name+Ext is the label of the Disk.
But that "file" does not exist everytime. I don't know when or when not :-(
Another possibility is to get the label from harddisk directly, but at the
moment, I don't know
how to do this...
bye, tobi


Quote:
>I need help to get the label from a floppy or hard disk. Just a simple
>procedure or function if there is one.

>Thanks.
>--

>Page: http://www.crosswinds.net/brisbane/~catfish/index.htm



Wed, 18 Jun 1902 08:00:00 GMT  
 Getting a disk label.
Try

Var Answer : String;

procedure haaldisknaam;

var
  extfcb  : array[-7..36] of char;
  buffer  : array[1..64] of byte;
  ds,
  dx,
  dsb,
  dxb     : word;
  regs    : registers;
  i       : integer;

begin;
  for i:=1 to 64 do buffer[i]:=0;
  extfcb[-7]:=#255;{255 = Extended FCB}
  for i:=-6 to -2 do extfcb[i]:=#0;
  extfcb[-1]:=#8; {zet attribute op volume}
  extfcb[0]:=chr(ord(sourcedrive[1])-64); {0=default 1=A drive etc.}
  for i:=1 to 11 do extfcb[i]:='?'; {searchstring *.*}
  for i:=12 to 36 do extfcb[i]:=#0; {Extfcb fill with zero}
  regs.ah:=$1a; { 1AH = set DTA spec SEGMENT,OFFSET}
  dxb:=ofs(buffer);
  dsb:=seg(buffer);
  regs.dx:=dxb;
  regs.ds:=dsb;
  intr($21,regs);
  ds:=seg(extfcb);
  dx:=ofs(extfcb); {set EXTFCB spec Segment, Offset}
  regs.ah:=$11;  {11H = Findfirst}
  regs.ds:=ds;regs.dx:=dx;
  intr($21,regs);
  answer:='';
  if regs.al=00 then
    for i:= 9 to 19 do answer:=answer+chr(buffer[i]);
end;

All the best !!!

Paul



Wed, 18 Jun 1902 08:00:00 GMT  
 Getting a disk label.
Hi "Catfish"<g>
You don't specify 16- or 32-bit. If 32-bit, use the
api call GetVolumeInformation().
Regards,
Louis.
Quote:

>I need help to get the label from a floppy or hard disk. Just a simple
>procedure or function if there is one.

>Thanks.
>--

>Page: http://www.crosswinds.net/brisbane/~catfish/index.htm



Wed, 18 Jun 1902 08:00:00 GMT  
 Getting a disk label.
Quote:

> I need help to get the label from a floppy or hard disk. Just a simple
> procedure or function if there is one.

FindFirst('A:\*.*',VolumeID,SrchRec);

for the disk number (MSDOS 5.x and later):
1QA in the FAQ page of the TP-links

Franz Glaser



Wed, 18 Jun 1902 08:00:00 GMT  
 Getting a disk label.

--- snip ---
Quote:
> In MS DOS (I think only there?!) exists a "file" with the attribute
VOLUMEID
> or faVOLUMEID.
--- snip ---
> But that "file" does not exist everytime. I don't know when or when not

:-(
--- snip ---

But I think I know.

From DOS 3.3 up (or 4.1?) that file exists in the root dir. But I sometimes
get disks without such a label (dir shows "NO NAME"). You have to check if
doserror is 18, then the name is "NO NAME"!



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. disk label and disk number

2. Finding the Label of a disk

3. Reading Disk Label

4. Disk label: how can i change it?

5. Setting Disk Volume Labels

6. How do you rename disk volume labels?

7. Q: How to label disks

8. How do you rename disk volume label in Pascal

9. Disk Label Identify:

10. Getting/setting volume label

11. Getting/setting volume label

12. Getting disk information

 

 
Powered by phpBB® Forum Software