I’ve just had an awful bug search on a machine of a fellow programmer. He wanted to use the PNGComponents in Delphi2007 and just installed it as usual. (He’s running Vista SP1 by the way.) After a successul installation he tried to put a TPngImageList on the form. In the same moment the whole Delphi IDE froze and then was closed by Windows forcefully. He demonstrated it several times to me and I could not understand why this happened.
So I hooked up WinDbg to get more information. But even the exception and call stack of WinDbg were not sufficient (to me) because the exception location just contained the class name and some numbers. I blamed the property editor which shows the PNG images in a list. So I removed the whole code and it worked without the editor – a not so good ending.
A long time later, I was frustrated and thought about giving up. In a final effort I run another test. You should know that while I was trying to bust the bug, WinDbg watched the process in the background – to catch exceptions. In my last test, however, it did not! And there I saw it: It was the first time that I could see a balloon pop up from the taskbar notification area (next to the clock). It told me that the application was closed due to DEP : Data Execution Prevention.
I know that this notification should pop up every time : but it did not! I confirm on oath! Recall: The first demonstrations were made without WinDbg! On my PC DEP is turned off because many applications wouldn’t work and even some games would be closed randomly in the middle of the game .
In the end it helped to add Delphi to the exception list or to turn off DEP completely(*). Decide yourself which way you choose. In the good ending I hope you remember this article next time you run into such a problem.
(*) Services cannot be removed from DEP protection.
If you have installed a specific Logitech (Quick)WebCam Driver, the DEP also strikes back if you try to run your app on newer Delphi (tested on D2007 and D2009).
Marco Cantu had this experience a while ago and we experienced it again.
7 Responses
Lars Fosdal
14|Oct|2008 1My question is: Was the data execution intentionally done in the source code, or was it automatically generated by the Delphi compiler?
I.e. Is or is not Delphi by default, safe for DEP ?
Christian Wimmer
14|Oct|2008 2It is very hard to answer (at least for me) your questions.
Further investigations are necessary. However in my opinion the problem is PNGComponents because the fellow programmer used many other components without problem.
Mitja P.
15|Oct|2008 3There is a function PatchPtr used in PngComponents unit PngImageList that needs a change of VirtualProtect to PAGE_EXECUTE_READWRITE instead of only PAGE_READWRITE if I remember correctly. I am also not sure if I reported this to the author at the time I was playing around with this components or not.
Arvid Winkelsdorf
16|Oct|2008 4I was aware of this issue since Delphi 2006 and I have always been able to circumvent the given DEP & IDE issue by using a combined design and runtime package.
@Mitja: Thank you for pointing out the right solution! I just confirmed this to be working for Delphi 2006 and 2009. Without both IDEs crash when DEP is turned on and a TPNGImageList is used.
PngImageList Fix for DEP and Update for D2009 - Arvid’s Blog @ digivendo
26|Oct|2008 5[...] for some years now Christian of the JEDI Windows API Team was the first to write about it in his blog [...]
Sam Johnson
28|Apr|2009 6How do you compile in Delphi so that DEP is enabled in your exe ?
This is getting pretty important….
Christian Wimmer
28|Apr|2009 7A user can activate DEP for services or all processes in System control panel.
How is DEP getting important?
Leave a reply
Search
Paypal donation (EUR)
Categories
Archives
Tags
Recent Posts
Recent Comments
Blogroll
JEDI Sites
Pages
A design creation of Design Disease
Copyright © 2007 - JEDI Windows API - is proudly powered by WordPress
InSense 1.0 Theme by Design Disease brought to you by HostGator Web Hosting.