This bug was re-introduced into SP2. I first reported this to Microoft on or about 29 August. I was finally sent a fix few weeks later, that did appear to resolve my GDI leak. I asked the MS representative dealing with this case if he could ensure that the KB was updated (or a new KB article issued) and I was told that he was not able to do it. It was suggested that I could post a suggestion to MS via the web site. I even offered to write the KB article, but this offer was declined, so I left it at that.
The issue might have just been forgotten, except that there was a little problem. It turns out that the fix, while getting rid of the GDI handle leak, had the side effect of killing the theme service. For me this was not an issue as I had turned the theme service off. But for those who wanted to use the service, and wanted to use long-running MFC applications, the only solution was to remove SP2.
I reported this through every channel I could think of, and thus far, I've had no formal reply, or a formal fix to this problem. The good news is that someone else I know has also reported this and has been sent a working hot fix. Interestingly, when he first called, Microsoft apparently were unable to trace my earlier problem report. But whatever, I now have this and it does indeed solve the issue!
The hot fix comes in a file called WindowsXP-KB319740-x86-enu.exe. You might think that this fix related to the KB article 319740 - MFC Applications Leak GDI Objects on Windows XP and it does. At present, the KB article refers to the original bug and it's original fix (rolled into SP1). There is an updated version of the fix that applies to SP2 - but the KB article has not been amended to reflect the issue. I assume that MS will be updating this KB at some point.
This whole incident leaves me less than delighted. It also raises some questions. First, how could a bug fixed in SP1 be re-introduced, and not be caught? Was this just a source code management issue (and if so, how many more errors are there lurking)? Or was it due to other changes made at SP2 and if so, why did MS not catch it during routine testing? Doesn't MS re-test earlier bug fixes to ensure they are rolled up in later SPs? And finally, what does a customer have to do to ensure that bug fixes actually result in proper documented fixes?