Background:
I have been calling the GetDiskFreeSpace() API on Win95 (pre-OSR2) to get the free disk space, but it contains an intentional bug (installed by Microsoft) that causes it to return unreliable data.

Solution (or so I thought):
I attempted to use the old DOS interrupt 21h, subfunction 36h (free disk space) using the inline assembler that is part of Visual Studio 7 (.net).

Code:
__asm
{
// (prologue code)

MOV AH, 36h // Get disk free space
MOV DL, 03h // DiskNum: 1 for A: 2 for B:...

INT 21h

// AX = sectors per cluster
// BX = number of free clusters
// CX = bytes per sector
// DX = total clusters on drive

// (eplogue code)
}


Question:
Is there some kind of special procedure for being able to call the old DOS interrupts in Win32 (perhaps a "WIN interrupt"?
Posted on 2002-11-13 10:36:47 by Randalism
Well... I'm not sure, but I think I have seen something which you might find interesting in Iczelion's tuts about VxD programming.
Posted on 2002-11-13 14:20:31 by slonik
Randalism,

In old win95 versions there were a few of the dos interrupts still available but later versions have completely squeezed them out so your only choice is to use the APIs to do the same stuff at normal application level.

The alternative is to write version specific device drivers to access the capacity you are after. The specific packages to do this come from Microsoft as DDKs. (Device Driver Kits)

Regards,

hutch@movsd.com
Posted on 2002-11-13 16:26:18 by hutch--
in Win9x systems you can use VWIN32/DeviceIoControl to call dos interrupts. But I assume you should better use GetDiskFreeSpaceEx function instead.
Posted on 2002-11-14 02:17:57 by japheth