🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.ms.programmer
Article #2443

GetFreeSpace in Enhanced Mode

#2443
From: Norbert Unterberg
Date: Fri, 03 May 1991 10:01
29 lines
1896 bytes
 > Essentially, I'm looking for the following two pieces of information:
 > 1) Amount of physical RAM installed
 > 2) Size of the current Swapfile.
 >
 > Windows obviously knows this info - does anybody know how I can get it?

There is a DPMI call to obtain that piece of information. DPMI call 0500h with 
ES:DI pointing to a 30h byte buffer returns the `Free Memory Information':

Offset      Description
 00h        Largest available free block in bytes
 04h        Maximum unlocked page allocation
 08h        Maximum locked page allocation
 0Ch        Linear address space size in pages
 10h        Total number of unlocked pages
 14h        Number of free pages
 18h        Total number of physical pages           <----- !!!
 1Ch        Free linear address space in pages
 20h        Size of paging file/partition in pages   <----- !!!
 24h-2Fh    Reserved

The size of one page in bytes can be determined by function 0604h. It returns 
the page size in bytes in BX:CX.
To call a DPMI function, invoce an interrupt 31h. Carry clear id call was 
successful.

The complete DPMI 0.9 specification is available free(!) at Intel Literature 
JP26, Santa Clara.
Technical Details
Message-ID: <1368064208@p4.f36.n245.z2.fidonet.org>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!caen!ox.com!math.fu-berlin.de!ira.uka.de!unido!rwthinf!slcdec!hippo!f1.n6000.z2.fidonet.org!p4.f36.n245.z2.fidonet.org!Norbert_Unterberg
References: <13790003@hp-vcd.HP.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!caen!ox.com!math.fu-berlin.de!ira.uka.de!unido!rwthinf!slcdec!hippo!f1.n6000.z2.fidonet.org!p4.f36.n245.z2.fidonet.org!Norbert_Unterberg
From: Norbert_Unterberg@p4.f36.n245.z2.fidonet.org (Norbert Unterberg)
Newsgroups: comp.windows.ms.programmer
Subject: GetFreeSpace in Enhanced Mode
Message-ID: <1368064208@p4.f36.n245.z2.fidonet.org>
Date: 3 May 91 10:01:00 GMT
References: <13790003@hp-vcd.HP.COM>
Reply-To: Norbert_Unterberg%p4.f36.n245.z2@hippo.dfv.rwth-aachen.de (Norbert Unterberg)
Organization: Point of SoftStream, Dortmund, Germany
Lines: 30
Comment-To: Bob_Taylor@f1.n6000.z2.fidonet.org (Bob Taylor)