Determining if the running executable has IMAGE_FILE_LARGE_ADDRESS_AWARE?

952 views Asked by At

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.

1

There are 1 answers

9
Jonathan Potter On

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 the LARGE_ADDRESS_AWARE flag is set.