Is there some way to detect file handle leaks at program termination?
In particular I would like to make sure that all of my handles that get created are being freed in code.
For example, I may have a CreateFile() somewhere, and at program termination I want to detect and ensure that all of them are closed.
I have used !htrace command of windbg.
Allow you to compare the handle situation of two execution point and help you the locate the point where the leaked handle have been allocated.
It worked well for me.