home *** CD-ROM | disk | FTP | other *** search
- /**
- *
- * Name FLREMVOL -- Remove the volume label (if any) from a given
- * disk drive.
- *
- * Synopsis ercode = flremvol (drive);
- *
- * int ercode 1 if error, 0 if okay.
- * int drive Disk drive (0 = default, 1 = A:, etc.)
- *
- * Description This function removes the volume label from a given disk
- * drive (if one is present). No error occurs if none is
- * present.
- *
- * Returns ercode 1 if error, 0 if okay.
- *
- * Version 6.00 (C)Copyright Blaise Computing Inc. 1986, 1987, 1989
- *
- **/
-
- #include <dos.h>
-
- #include <bfiles.h>
-
- #define fcb (xfcb + 7)
-
- int flremvol (drive)
- int drive;
- {
- union REGS regs;
- struct SREGS sregs;
- unsigned char local_dta[44], xfcb[44];
- void far *pold_dta;
- int i, result;
-
- /* Save pointer to old DTA. */
- pold_dta = flgetdta ();
- /* Set new DTA. */
- flputdta ((void far *) local_dta);
-
- /* Zero entire extended FCB. */
- for (i = 0; i < 44; i++)
- xfcb[i] = 0;
-
- /* Mark this as an Extended FCB. */
- fcb[-7] = 0xff;
- /* Select volume attribute. */
- fcb[-1] = AT_VOLUME;
- fcb[0] = (char) drive;
-
- /* Search for "????????.???" */
- for (i = 1; i <= 11; i++)
- fcb[i] = '?';
-
- /* Set up for DOS function 0x11: search directory. */
- regs.x.ax = 0x1100;
- sregs.ds = utseg (xfcb);
- regs.x.dx = utoff (xfcb);
-
- /* Do the search. */
- int86x (FL_DOS_INT, ®s, ®s, &sregs);
-
- if (regs.h.al == 0)
- { /* Found a volume label, so delete it. */
- regs.x.ax = 0x1300;
- sregs.ds = utseg (local_dta);
- regs.x.dx = utoff (local_dta);
- int86x (FL_DOS_INT, ®s, ®s, &sregs);
-
- result = (regs.h.al != 0);
- }
-
- else /* No volume label found, so quit. */
- result = 0;
-
- /* Restore former DTA. */
- flputdta (pold_dta);
-
- return (result);
- }