In Visual Studio I created a C# executable that loads a clr library which then calls loadlibrary on a 64bit native dll an internal exception message box is shown. If I change the executable to be clr and set advanced option Randomized Base Address to No (/DynamicBase:NO) on the exe project, it loads fine. How to I get a native .net exe to not use ASLR?? Furthermore, how do I get this scenario working under IIS? -Thanks
Asked
Active
Viewed 526 times
1
-
What is the result of GetLastError() after it fails? – paulm Dec 12 '12 at 19:44
-
The call to LoadLibrary never returns. – Cod Monkey Dec 12 '12 at 19:44
-
Then there is something wrong with the DLL, deadlocking in DllMain() or some such – paulm Dec 12 '12 at 19:46
-
It definitely doesn't like getting loaded with DynamicBase enabled, but it's a third party dll and scenario 2 works (clr exe) – Cod Monkey Dec 12 '12 at 19:49
-
I'd try this: http://stackoverflow.com/questions/3172710/how-do-i-enable-dep-or-aslr-for-my-net-application – paulm Dec 12 '12 at 19:52
-
I tried that, but it didn't work. Is there a way to tell ngen to disable DynamicBase? This still wouldn't fix the problem when hosting under IIS. – Cod Monkey Dec 12 '12 at 20:11
1 Answers
0
Found it. /HIGHENTROPYVA is enabled on native .net exes by default. using link -edit /HIGHENTROPYVA:no test.exe removed it and fixed the problem.

Cod Monkey
- 11
- 1