Is there some sort of Windows API or other reasonably straightforward way to determine whether or not the currently running program has IMAGE_FILE_LARGE_ADDRESS_AWARE enabled? I know that I can open up the process's exe as a file, read its header information, and parse it somewhere out of there, but if there's some cleaner way to do it, I'd like to know.
To be clear: I am talking about the currently executing process - i.e. I want to write code that detects this flag (or lack thereof) for its own executable, not for some entirely different executable.
Use the
GlobalMemoryStatusEx
function to query the amount of virtual memory available to your process.If
ullTotalVirtual
returns more than 2GB in a 32-bit process you know theLARGE_ADDRESS_AWARE
flag is set.