I have posted an issue about using vld in a program with an external dll injected.
(See https://vld.codeplex.com/workitem/10572)
There is again another issue happening when a program with an external dll injected.
When the program terminates, it crashes.
//--------------------------------
//call stack when crashing:
//--------------------------------
ntdll.dll!000000007705e4e4()
[Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll]
ntdll.dll!000000007705e40b()
vld_x64.dll!CriticalSection::Enter() Line 21 C++
vld_x64.dll!CriticalSectionLocker::CriticalSectionLocker(CriticalSection & cs={...}) Line 54 C++
vld_x64.dll!VisualLeakDetector::unmapBlock(void * heap=0x0000000007c50000, const void * mem=0x00000000080ba880, const context_t & context={...}) Line 1181 + 0x1b bytes C++
vld_x64.dll!VisualLeakDetector::_HeapFree(void * heap=0x0000000007c50000, unsigned long flags=0, void * mem=0x00000000080ba880) Line 1704 C++
dbghelp.dll!00000000587eb057()
//--------------------------------
There are two cases depening on the availability of the external dll's source code.
[case 1] external dll's source available
Adding the following line into the external dll's source file will solve this issue. I don't know why, though.
include <vld.h>
But, isn't there any way to avoid this issue without adding vld.h to the external dll's source file?
[case 2] external dll's source not available
How can this issue be resolved?
Overall, vld does not terminate gracefully when a program is injected with an external dll.
(See https://vld.codeplex.com/workitem/10572)
There is again another issue happening when a program with an external dll injected.
When the program terminates, it crashes.
//--------------------------------
//call stack when crashing:
//--------------------------------
ntdll.dll!000000007705e4e4()
[Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll]
ntdll.dll!000000007705e40b()
vld_x64.dll!CriticalSection::Enter() Line 21 C++
vld_x64.dll!CriticalSectionLocker::CriticalSectionLocker(CriticalSection & cs={...}) Line 54 C++
vld_x64.dll!VisualLeakDetector::unmapBlock(void * heap=0x0000000007c50000, const void * mem=0x00000000080ba880, const context_t & context={...}) Line 1181 + 0x1b bytes C++
vld_x64.dll!VisualLeakDetector::_HeapFree(void * heap=0x0000000007c50000, unsigned long flags=0, void * mem=0x00000000080ba880) Line 1704 C++
dbghelp.dll!00000000587eb057()
//--------------------------------
There are two cases depening on the availability of the external dll's source code.
[case 1] external dll's source available
Adding the following line into the external dll's source file will solve this issue. I don't know why, though.
include <vld.h>
But, isn't there any way to avoid this issue without adding vld.h to the external dll's source file?
[case 2] external dll's source not available
How can this issue be resolved?
Overall, vld does not terminate gracefully when a program is injected with an external dll.