views:

95

answers:

1

I'm writing a diagnostic app which needs to log what the user has set as his user-mode space a.k.a. user-mode virtual address space a.k.a. the /3GB switch in WinXP or the increaseuserva switch in bcdedit on Vista/Win7.

Either of C++ or C++/CLI will do.

Any ideas ?

A: 

GlobalMemoryStatusEx will give you a MEMORYSTATUSEX struct with ullTotalVirtual:

The size of the user-mode portion of the virtual address space of the calling process, in bytes. This value depends on the type of process, the type of processor, and the configuration of the operating system. For example, this value is approximately 2 GB for most 32-bit processes on an x86 processor and approximately 3 GB for 32-bit processes that are large address aware running on a system with 4-gigabyte tuning enabled.

Note that you'd have to mark your EXE as LARGEADDRESSAWARE in order to see 3GB in your process.

I think there's another function that also returns this info (no - not GlobalMemoryStatus which is deprecated) along with processor info - but I can't recall it ATM.

Mark Brackett