Robert Shearman wrote:
Create a new heap when the debugger is started in case the heap has been corrupted.
I don't think the fix is completly correct... in all cases, we need to keep the current heap... if the debugger continues the execution, then the old heap is needed (for example, HeapFree/HeapValidate will no longer work...)
so, a proper fix (to deal with this situation) would be to: - set a new heap (as you did) - create the process for the debugger, but suspended - put back the old heap in the pdb - fire the debugger (ResumeThread)
note anyway that the fix isn't perfect. for example, if an execption results from a corrupted heap, we may still use heap related functions in the exception handling code (the debugger startup is one of example, but is far from being the only one). For example, running with -debugmsg +seh is another one :-/
A+
Eric Pouech pouech-eric@wanadoo.fr writes:
note anyway that the fix isn't perfect. for example, if an execption results from a corrupted heap, we may still use heap related functions in the exception handling code (the debugger startup is one of example, but is far from being the only one). For example, running with -debugmsg +seh is another one :-/
Yes, and of course creating a new heap is going to rely on the virtual memory functions, which can introduce new problems. There is simply no way to make the in-process debugger startup fool proof, and IMO the best approach is to keep it as simple as possible. For things like heap corruption, you should run the process under the debugger from the beginning.