Article

No, really, you need to pass all unhandled messages to DefWindowProc, part 2

The Old New Thing ·The Old New Thing ·Published 2026-09-24 ·5 min read

This article discusses a reported memory leak in Windows related to the RegisterDragDrop and RevokeDragDrop calls. It emphasizes the importance of passing unhandled messages to DefWindowProc to ensure proper cleanup.

From the article

A customer reported a memory leak in Windows that occurred when they called Register­Drag­Drop followed by Revoke­Drag­Drop . They included a time travel trace of a sample program that demonstrated the problem. (Though for some reason, they didn’t include the program itself; just the time travel trace.)

Now, it is strange that there would be a memory leak if you call Register­Drag­Drop followed by Revoke­Drag­Drop , seeing as this pattern is used heavily by thousands of applications, including many parts of Windows itself, so if there were a memory leak inherent in the pattern, you’d think it’d have been reported by now.

I suspected that there was something special about their sample program.


Share this resource


Discovered 2026-09-25 Source The Old New Thing Archive 2026-09 →