Determining if the running executable has IMAGE_FILE_LARGE_ADDRESS_AWARE?

狂风中的少年 提交于 2021-02-11 13:54:30

问题


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:


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.



来源:https://stackoverflow.com/questions/27137118/determining-if-the-running-executable-has-image-file-large-address-aware

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!