I'm currently working on a fairly large (and old, nonsense) code base recently upgraded to VS2005 (SP1). My team and I change / update / replace the modules in this code when we go, but sometimes we run into problems when vtables seems broken. I am not an expert on vtables, but they seem to be broken. Errors occur with this error:
Runtime Check Error # 0 - ESP value was not properly stored during function call. This is usually the result of calling a function declared with one call, with a function pointer declared with another calling convention.
Of course, there can be many other reasons for this error, but when debugging (building Debug), I can verify that the vtables for the object I want to use look strange:
The stack and heap that reference each vtable look fine, and the pointers to vtables perfectly match the map file. This indicates that this is not a memory overwrite error or similar, since then it will affect the stack and heap, and not where vtables are stored. (Are they stored in a read-only area?) Anyway, everything seems good so far. But when I look at the vtable memory, I find that all the values, if I interpret them as pointers, although they are in the same range (e.g. 0x00f203db 0x00f0f9be 0x00ecdda7 0x00f171e1) do not correspond to any entry in the map file, and many of them don't even match 4 bytes. I don’t know all the details about how VS2005 creates vtables, but it doesn’t look right for me. If this is the right behavior, can anyone please explain this to me?
, , ? - , ? - - ? , inline ( !), , , .
!
: , , , . -, , ESP, . , vtable. , : , , . , , , , ++ "" . . DLL, :
SHFolder.lib, python25.lib, dxguid.lib, d3d9.lib, d3dx9.lib, dinput8.lib, ddraw.lib, dxerr9.lib, ws2_32.lib, mss32.lib, Winmm.lib, vtuneapi.lib, vttriggers.lib, DbgHelp.lib, kernel32.lib, user32.lib, gdi32.lib, winspool.lib, comdlg32.lib, advapi32.lib, shell32.lib, ole32.lib, oleaut32.lib, uuid.lib, odbc32.lib, odbccp32.lib