years ago i stumbled in the C0000006 external exception
when running a large (100+MB) exe from a shared folder on some particular LANs. So I started using the compiler flags described in this question.
After years of succesful "execution of exe" on hundreds of customers in hundreds of networks i started having problems with the PE flags (somehow the exe was crashing at startup on same pcs and excluding one cause at a time i empirically found that commenting those flags was working).
Somehow the workaround i found is to build my exe twice (and let the customer choose which one to deploy), the first with these:
{$SetPEFlags IMAGE_FILE_NET_RUN_FROM_SWAP}
{$SetPEFlags IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP}
and the second commenting those.
This building overhead is annoying and I would like to avoid it. I do not think there is a way, but i ask for expert advice: is there a way to "activate those flags at runtime?" for example passing a command line parameter?
Another workaround i thought of is to copy locally the exe as the exe starts, so that it is always executed from the local machine, but I fear the scenarios i need to face, even if technically it is simple.
Thanks.