22.02.2014 Views

with DOS/4GW? - Open Watcom

with DOS/4GW? - Open Watcom

with DOS/4GW? - Open Watcom

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>DOS</strong> Programming Guide<br />

/*<br />

MEMWIN.C - This example shows how to get information<br />

about free memory <strong>with</strong> DPMI call 0x0500 using Windows<br />

as a DPMI host. Note that only the first field of the<br />

structure is guaranteed to contain a valid value; any<br />

field that is not returned by the DPMI implementation<br />

is set to -1 (0FFFFFFFFh).<br />

Compile & Link: wcl386 /l=win386 /zw memwin<br />

Bind: wbind -n memwin<br />

*/<br />

#include <br />

#include <br />

#include <br />

#include <br />

struct meminfo {<br />

unsigned LargestBlockAvail;<br />

unsigned MaxUnlockedPage;<br />

unsigned LargestLockablePage;<br />

unsigned LinAddrSpace;<br />

unsigned NumFreePagesAvail;<br />

unsigned NumPhysicalPagesFree;<br />

unsigned TotalPhysicalPages;<br />

unsigned FreeLinAddrSpace;<br />

unsigned SizeOfPageFile;<br />

unsigned Reserved[3];<br />

} MemInfo;<br />

#define DPMI INT 0x31<br />

void main()<br />

{<br />

union REGS regs;<br />

struct SREGS sregs;<br />

DWORD mi 16;<br />

regs.w.ax = 0x0500;<br />

mi 16 = AllocAlias16( &MemInfo );<br />

sregs.es = HIWORD( mi 16 );<br />

regs.x.di = LOWORD( mi 16 );<br />

26 How do I get information about free memory in the 32-bit environment?

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!