🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #1751

Re: Identifying the max. number of drives.

#1751
From: Thomas Dwyer III
Date: Wed, 01 Aug 1990 13:52
24 lines
1042 bytes
You can get gobs of neat information from INT 21, AH=52.  To find the
number of block devices (drives) in a system, look at offset 20h from
the pointer returned by ES:BX.

Example:

#include <dos.h>

main()
{
        union REGS regs;
        struct SREGS sregs;
        unsigned char far *ptr;

        regs.h.ah = 0x52;
        intdosx(&regs, &regs, &sregs);

        ptr = (unsigned char far *) (((unsigned long) sregs.es<<16)+regs.x.bx);

        printf("Number of block devices: %d\n", (int) *(ptr+0x20));
        printf("Value of LASTDRIVE: %d\n", (int) *(ptr+0x21));

        return(0);
}
Technical Details
Message-ID: <90213.085250TOMIII@MTUS5.BITNET>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!samsung!emory!mephisto!psuvax1!psuvm!cunyvm!mtus5!tomiii
References: <3102@murtoa.cs.mu.oz.au>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!samsung!emory!mephisto!psuvax1!psuvm!cunyvm!mtus5!tomiii
From: TOMIII@MTUS5.BITNET (Thomas Dwyer III)
Newsgroups: comp.os.msdos.programmer
Subject: Re: Identifying the max. number of drives.
Message-ID: <90213.085250TOMIII@MTUS5.BITNET>
Date: 1 Aug 90 13:52:50 GMT
References: <3102@murtoa.cs.mu.oz.au>
Organization: Computing Technology Services, Michigan Technological Univ.
Lines: 24