I've been trying to determine whether the 3GB switch is on or off on the system my program is running by calling GetSystemInfo() and checking lpMaximumApplicationAddress on the SYSTEM_INFO struct.
No luck. I think I am doing something wrong.
How do you check whether the 3GB switch is on or not on Windows in C? Code is appreciated.
thanks
Assuming your program is compiled as large address aware, you could simply call GlobalMemoryStatusEx
and check the ullTotalVirtual
field. If it's larger than 2GB, and you're running on a 32-bit system, then the 3GB flag must be turned on.
I actually have no idea how to 'properly' tell if Windows is natively 32 or 64 bit, but if you have a 32-bit process you could call IsWow64Process
to see if you're running on a 64-bit OS.
This all seems a bit indirect, I know :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With