Home > Delphi > PngImageList Fix for DEP and Update for D2009

PngImageList Fix for DEP and Update for D2009

October 26th, 2008

Hi,

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.

Arvid Delphi , , ,

  1. Ali
    October 26th, 2008 at 23:50 | #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. Arvid
    October 27th, 2008 at 10:04 | #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?

    Regards
    Arvid

  3. Adrien
    October 27th, 2008 at 21:30 | #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. October 27th, 2008 at 23:01 | #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

  1. No trackbacks yet.