PRODUCT : Borland C++ NUMBER : 1034 VERSION : 3.1 OS : DOS DATE : October 19, 1993 PAGE : 1/2 TITLE : Listing Device Drivers under DOS // This program walks the device driver chain, showing all the // devices that are present. To get the start of the chain, int // 21,52 (the undocumented 'Get List of Lists' function) is // used. For more information, see 'Undocumented DOS' by Andrew // Schulman. #include #include #include #include struct driver_hdr { struct driver_hdr far * next; unsigned device_attrib; unsigned DSEP; unsigned DIEP; char devname[8]; // If this is a block device, the first byte is the number // of subunits (drives) supported by this driver. unsigned reserved; // (CD-ROM) must be 0000h char drive_letter; // (CD-ROM) initially 0. char num_units; // (CD-ROM) char signature[6]; // (CD-ROM) }; typedef struct driver_hdr driver_hdr; char blkdev[] = "Block: "; char blkcnt[] = "Unit(s)"; unsigned i, j, k; driver_hdr far * dheader; char far * name; int devices(void) { name = (char far *)malloc(10); asm mov ah, 52h geninterrupt(0x21); asm add bx, 22h dheader = (driver_hdr far *)MK_FP(_ES, _BX); PRODUCT : Borland C++ NUMBER : 1034 VERSION : 3.1 OS : DOS DATE : October 19, 1993 PAGE : 2/2 TITLE : Listing Device Drivers under DOS. _fstrncpy(name, dheader->devname, 8); name[8] = 0; printf("%Fp %s\n", dheader, name); while(FP_OFF(dheader) != 0xffff) { i = dheader->device_attrib; if ((i && 0x8000) != 0) printf("%Fp %s\n", dheader, name); else printf("%Fp Block: %u Unit(s)\n", dheader, (unsigned)dheader->devname[0]); dheader = dheader->next; _fstrncpy(name, dheader->devname, 8); name[8] = 0; } return 0; } int main( void ) { devices(); return 0; } DISCLAIMER: You have the right to use this technical information subject to the terms of the No-Nonsense License Statement that you received with the Borland product to which this information pertains.