Unfortunately it detects it during free. In order to detect it when the buffer overruns happens you need to play tricks with how the blocks are laid out in memory (each in a different page) and then play tricks with the protection of the following page. There is actually something that does this called page heap which is part of Application Verifier and you can download it from here: http://www.microsoft.com/DownLoads/details.aspx?familyid=C4A25AB9-649D-4A1B-B4A7-C9D8B095DF18&displaylang=en 

 

This however has drastic performance implications and therefore is used only in testing environments. So the deal with FTH is just to shave some of these issues and try to detect as much as possible. It is still better then crashing with an innocent victim on the stack because now at least you know the entity freeing the block had some issue in the code paths manipulating that block. Essentially it is not different from the approach you used in your project. Just generalizes it for everybody. And debugging still requires lots of thinking but less than before.