RichMasm users can insert OPT_Debug 1 somewhere in their source to run the executable via \Masm32\MasmBasic\Res\DebugHeap.exe
If you have a suspicion that your proggie does not respect the rules, DebugHeap.exe will detect it, and show you where it happens. It's one of the most useful tools in my repertoire, I use it a lot.
Attached a new version, with one minor change. The old version did create a console if an error occurred and there was no console present (which is the case for most GUI programs). However, I had a case (SSD saver (http://masm32.com/board/index.php?topic=9704.0)) where a console was present but hidden. The new version detects that and restores the console to make sure the output becomes visible. Example:
## HEAP[DebugHeapTest.exe]:
## Heap block at 00286AE0 modified at 00286B22 past requested size of 39
*
## HEAP[DebugHeapTest.exe]:
## Invalid address specified to RtlFreeHeap( 00280000, 00286AE8 )
*
** DebugHeap found errors **
To avoid misunderstandings: you don't need RichMasm (http://masm32.com/board/index.php?topic=5314.0) or MasmBasic (http://masm32.com/board/index.php?action=unread) to use this tool. Just drag any suspicious executable over DebugHeap.exe to find out where it corrupts the heap. Source is included btw :cool: