Search code examples
visual-c++atldepthunk

Is the ATL incompatibility with DEP fixable?


ATL uses thunks to manage callbacks for windows, and apparently it needs to allow for data execution.

Microsoft says:

Note that system DEP policy can override, and having DEP AlwaysOn will disable ATL thunk emulation, regardless of the attribute.

Am I correct in translating this quote to (more or less) "ATL applications can crash due to system policies"?

Is there a way to make a pre-ATL-8.0 application work correctly on any system, hopefully while still turning on DEP for everything other than the thunk?


Solution

  • DEP is enabled per process, so you cannot disable DEP for the buggy fragment only. The options are either to rebuild a binary with fixed ATL to make the binary DEP-compatible, or disable DEP for the whole process where the binary is used.

    Earlier ATL versions indeed had this problem and it was fixed at some point.

    DEP exceptions are under My Computer, Advanced tab, Performance Settings, Data Execution Prevention.