PngImageList Fix for DEP and Update for D2009


probably you already encountered the problem that your Delphi IDE crashes instantly when using the TPngImageList Thany made available years ago. This happens if you use the TPngImageList Designtime Package under systems with activated Data Execution Prevention (DEP).

Despite the fact that this problem existed for some years now Christian of the JEDI Windows API Team was the first to write about it in his blog recently.

Mitja P. added a comment which provides the source and a solution for the bug:

There 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.

I’ve verified that this fix solves the issue for Delphi 2006 up to Delphi 2009. Thank you Mitja!

Additionally there is an updated version of the TPngImageList (created by Uwe Raabe) available at the CodeGear Repository:

PngComponents for Delphi 2009

As Delphi 2009 only integrates the PNG support into native ImageLists this updated component allows for using your already existing PngImageLists from projects prior to Delphi 2009 without any change to the images!

Please be aware that this version needs the mentioned fix as well, so update the source before installing the package.


4 thoughts on “PngImageList Fix for DEP and Update for D2009

  1. I installed it successfully in Delphi 2009, but whenever I tried to add a png picture to a TPngSpeedbutton, or TPngBitBtn, I received an error saying the image format is invalid! I tried the supplied test images, and a few other PNG files I had used in a Delphi 7 project and had no problem with PngComponents in there.

  2. Hi Ali,

    I just re-verified that PngComponents is working fine under Delphi 2009. I tried several test images and they all worked without problems, for PngImageList for the PngSpeedButton and the PngBitBtn. Probably there is a problem with the pictures or some other component?


  3. Hi,

    Indeed that’s a great news for those who use Thany’s components under D2007 and plan to migrate to D2009. In my particular case, I was afraid of loosing all my PNGs under Tiburon, and being able to migrate seamlessly my projets is a very good think. Many thanks to you.

  4. Hi Adrien,

    you’re welcome! Yes, without it there would have been a lot of work when migrating existing projects. Especially if you’re using something like SpTBXLib like me.

    Cheers Arvid

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s