[comp.sys.ibm.pc] Need Help With Modifying Existing Volume Label

barry@micomvax.UUCP (Barry Kimelman) (07/06/88)

I would like to know how to modify an already existing volume label. I have
tried the method stated in "ADVANCED MSDOS PROGRAMMING" by Ray Duncan
with no success. The method is as follows:

  1. Set the DTA to a 64-byte scratch buffer (my DTA buffer was larger
	than 64 bytes, actually it was 512)
  2. Using an extended FCB, perform INT21h function 11h (Search for
	first match). If register AL is 0ffH then go add a new volume
  3. If AL was returned as 00H, the DTA buffer now contains a simulated
	extended FCB with the volume name stored in bytes 08H through
	12H. Move new volume name (11 characters) to DTA buffer + 19H
  4. Passing address of DTA buffer in DS:DX , request INT21h function
	17H (rename file). If AL is not returned as 00H then you have
	serious problems.


I traced the action of my code using PFIXPLUS interactive debugger and
it is setup exactly correct according to the above stated instructions
from Ray Duncan's book.

So the question remains:  What am i not doing correctcly ??

I traced the actions of a utility called LABEL which i use from time
to time and found it to be using RESERVED INT21h function calls !!!!

Any help anyone out there can give me would be greatly appreciated.
Please e-mail responses to me (if at all possible) to
	...!philabs!micomvax!barry
-- 
Barry Kimelman:	 ...!philabs!micomvax!barry  phone: (514) 744-8200

Nothing is impossible if you do not have to do it yourself !!
It is not enough that i succeed , everyone else must fail !!

dixon@zephyrus.steinmetz (Walter V. Dixon) (07/09/88)

It is relatively easy to read and modify volume labels.  I suspect
that the root of your problem is that you were not using an extended
FCB.  To find a volume label,  an extended fcb is required.  You
must set the attributes field to 08h;  otherwise labels will be
ignored.  Existing labels can be deleted with a fcb delete file
(ah=13h?) again using an extended fcb.  On a file create function
you specify directory attributes in cx.  Placing a value of 08h
in cx when you create a file will write a label to disk.

The PC-DOS label utility (at least as of dos 3.10) does nothing
undocumented.  It checks the dos version,  sets a dta, (the default
dta is used for the command line and stack),  looks for an existing
label with a fcb find first (using an EXTENDED fcb),  validates
the new label/confirms that you want to erase the existing label,
deletes the label with a fcb delete again using an extended fcb,
and then writes a new label using int 21h ah=5bh which conditionally
creates a label (cx is set to 08h before int 21),  and then closes
the file.  Nothing mysterious or undocumented happens.

I hope this helps.

Walt Dixon		{ARPA		: dixon@ge-crd.com	}
			{US Mail	: GE CRD		}
			{		  PO Box 8		}
			{		  Schenectady, NY 12345 }
			{Phone		: 518-387-5798		}