How does IMAGE_FILE_NET_RUN_FROM_SWAP in an EXE file affect runtime libraries

大城市里の小女人 提交于 2021-02-07 12:21:13

问题


My application is sometimes started from an network share and some customers reported an External exception C0000006 when running the application. According to my Google research this "may" be related to the image getting paged out and the failing to reload from the network. A workaround for this is telling Windows to load the complete image file into the swap and run it from there by setting the IMAGE_FILE_NET_RUN_FROM_SWAP flag

My application also depends on various .bpl and .dll libraries that are loaded at runtime. Only some of those can be changed by me, some are supplied by other vendors. What happens to this libraries if the exe has this flag set? Are the also loaded into the swap file or are they still paged out and reloaded when needed? Would I need to include this flag in the libraries too?


回答1:


The flag applies only to the PE module which sets it. So, setting the flag in an EXE does not mean that modules loaded by that EXE are affected by the flag. Each module (DLL, package etc.) that is loaded by your EXE will be treated by the loader according to the PE options specified in that module.

So, you'll need to set the PE flag on each module that resides on a network share.

For what it's worth, I'd recommend adding IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP as well.



来源:https://stackoverflow.com/questions/13588057/how-does-image-file-net-run-from-swap-in-an-exe-file-affect-runtime-libraries

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