home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1994 #1
/
monster.zip
/
monster
/
PROG_C
/
SNPD9404.ZIP
/
SETVOL.C
< prev
next >
Wrap
C/C++ Source or Header
|
1994-04-03
|
2KB
|
107 lines
.I 10 1
#include <ctype.h>
.I 12 1
#include "portable.h" /* Also in SNIPPETS */
.I 18 1
#include <io.h>
.D 19 3
.I 22 1
#define _far far
.D 23 6
.D 35 8
.I 67 2
** NOTE: The following use functions in four other SNIPPETS files,
** ABSDISK.ASM, ABSDISKC.C, DRVALID.C, and PUSHDIR.C
.D 68 2
.I 73 3
int getdrv(void);
int PushDir(char *);
int PopDir(void);
.D 113 1
.I 114 5
struct xfcb buf;
union REGS regs;
struct SREGS sregs;
const char pattern[] = "????????";
char _far *dta;
.D 115 2
.I 119 3
*/
PushDir("\\");
.D 120 6
.I 128 32
segread(&sregs);
regs.h.ah = 0x2f;
intdosx(®s, ®s, &sregs);
dta = MK_FP(sregs.es, regs.x.bx);
buf.xfcb_flag = 0xff;
buf.xfcb_attr = _A_VOLID;
buf.xfcb_fcb.fcb_drive = 0;
memcpy(buf.xfcb_fcb.fcb_name, pattern, 8);
memcpy(buf.xfcb_fcb.fcb_ext, pattern, 3);
regs.h.ah = 0x11;
regs.x.dx = (unsigned)&buf;
intdos(®s, ®s);
if (0 == regs.h.al)
{
int i;
char oldlabel[13], _far *p, *q;
for (i = 0, p = dta + 8, q =oldlabel; i < 8; ++i, ++p, ++q)
{
*q = *p;
}
*q++ = '.';
for (i = 0, p = dta + 16; i < 3; ++i, ++p, ++q)
{
*q = *p;
}
vol_kill(oldlabel);
}
.D 129 9
.I 144 26
/* Parse the filename into an FCB */
segread(&sregs);
regs.h.ah = 0x29;
regs.h.al = 0;
regs.x.si = (unsigned)new_label;
regs.x.di = (unsigned)&buf.xfcb_fcb;
sregs.es = sregs.ds;
intdosx(®s, ®s, &sregs);
/* Volume labels require extended FCB's */
buf.xfcb_flag = 0xff;
buf.xfcb_attr = _A_VOLID;
/* Create the new label */
regs.h.ah = 0x16;
regs.x.dx = (unsigned)&buf;
intdos(®s, ®s);
/* Close the new label */
regs.h.ah = 0x10;
regs.x.dx = (unsigned)&buf;
intdos(®s, ®s);
.D 145 2
.I 153 1
int index, drive = getdrv();
.D 154 1
.I 156 1
AbsDiskRead(drive, 1, 0, &boot_record);
.D 157 1
.I 167 1
AbsDiskWrite(drive, 1, 0, &boot_record);
.D 168 1
.I 170 1
PopDir();
.D 171 3