There are some great free tools over at http://www.sysinternals.com/.
Get them now before someone like Computer Associates buys the company and starts charging for them.
Personally, one tool in particular called ‘FileMon’ helped solve a tricky file locking problem on a recent project. FileMon showed the massive amount of files opened/closed by our software. A little analysis identified the few files that were not being closed. Stepping through code using debug mode and watching FileMon made it easy to see which chunk of code was opening the file. Five more minutes of work rewrote the complex file opening/closing code and the bug has not been seen again. Before using FileMon I had wasted a full working day try to track down the rogue code.
Thanks to ‘Writing Secure Code’ for mentioning these tools. Michael Howard recommends them for discovering why applications fail to run as non-admin users.
FileMon In Use:
RegMon is very similar, but watches registry access: