Dunno if this helps:
A cleanup API for Windows