I got stuck when tried to analyze with VLD code, statically linked with CRT. (MSVC->C++->Code Generation -> Multithreaded Debug (non-dll) ). This caused by absence corresponding CRT DLL (linked into executable statically).
A GetProcAddress() API is used to get pointer to functions like malloc/free.
Sorry, if I'm misunderstanding, but I think we don't need to call a GetProcAddress() for malloc, free, etc. If CRT is linked statically we just can write somethin like:
ptr_t mallocPtr = &malloc;
When we linking dynamically, all CRT functions called though Import Table like API and code provided above should also work. As far as I can remember, compiler will generate a stub like:
call [0xsomeaddr] // filled by Windows DLL loader
I think I can investigate this closer and simplify getting address of CRT functions. It also will help to work fine when CRT is linked statically into executable.
Am I right?