This project has moved and is read-only. For the latest updates, please go here.

Getting CRT functions pointer

Mar 29, 2011 at 11:05 PM

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: 

// asm
    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?

Mar 31, 2011 at 1:09 PM

No, it's only work with current version libraries. VLD should work with any version