[fpc-pascal]Reading and writing volume IDs

XHajT03 at mbox.vol.cz XHajT03 at mbox.vol.cz
Thu Oct 4 22:55:17 CEST 2001


Date sent:      	Tue,  2 Oct 2001 10:37:26 +0200
Subject:        	Re: [fpc-pascal]Reading and writing volume IDs
From:           	"Aitor SantamarĂ­a"<aitor.sm at wanadoo.es>
To:             	fpc-pascal at deadlock.et.tudelft.nl
Send reply to:  	fpc-pascal at deadlock.et.tudelft.nl

> Ooops!! You're right, sorry.

 In fact, you should use:

FindFirst ('c:\*.*', VolumeID, SR);
while (DosError = 0) and SR.Attr and VolumeID <> VolumeID do
   FindNext (SR);

 This is because you can get ordinary files (with no attributes set 
at all) with this mask as well.

> Well, what about writing labels?

 In theory you could create a zero-length file in the root directory 
and call SetFAttr afterwards. I haven't checked it, so I don't know, 
whether it really works. Anyway, there are at least two problems with 
this solution. First, you should make sure no other item with this 
attribute exists there (and delete it first otherwise). Second, the 
preferred (more universal - can be used on non-FAT volumes as well) 
way of setting volume labeles is using the BPB (i.e. in the boot 
sector). However, you can't avoid calling DOS or BIOS function calls 
for this.

Tomas





More information about the fpc-pascal mailing list