views:

69

answers:

1

I have a serious problem with my .Net program. It calls a native dll, and then crashes instantly because it can't find a native method. This is behaviour we have seen before, whereby the C# compiler, in its infinite wisdom, sets the flag that the program is DEP compatible, even if it calls a native dll which patently is not.

We have the standard workaround for this, where the flag is set to Not DEP Compatible in a post-build step, and this works fine. Everywhere except on my machine. I have Windows 7 32bit, and the program works fine on the Win 7 64bit machines that we have, as well as on Vista and XP.

However, on my machine the DataExecutionPolicy_SupportPolicy is 0, i.e. we have successfully switched DEP off. Does anyone know whether there is some situation in which it can still act? Or any other mechanism which could have the same effect?

We have now also checked on another newly installed Win7 32bit machine (also a Thinkpad like mine), and it also works there. We have compared all the bios settings, and they are similar (mine is a T61, the other an R60).

The dll in question also works fine on my machine when called from a native program. We are running out of ideas... any help would be much appreciated!

A: 

OK, the problem was after all something completely different. My machine was the only one where the path for the native dlls was not set correctly; this led to an instant crash in Win7, while in XP there used to be a message box giving a (highly cryptic) idea of what had happened.

So we can absolve DEP of any blame. I am leaving it in the title so that other people who have the same suspicion remember to check their file paths!

Joel in Gö