Binutils.FindVirtualFunction()
Posted: Tue Dec 18, 2012 9:33 am
Hi,
I just noticed the latest revision and there might be two problems.
1. Linux offsets are not always one greater than Windows offsets. You can see an example here: http://forums.eventscripts.com/viewtopic.php?f=25&t=46254&start=6
The offset on Windows for CBaseClient::SetName() is 17, but on Linux it's 57 (at least in CS:S).
2. You should stick with one representation of pointers. For FindVirtualFunction() you used int, but for the rest you are using unsigned long (e.g. http://code.google.com/p/source-python/source/browse/src/core/modules/binutils/binutils_scanner.cpp#297 or http://code.google.com/p/source-python/source/browse/src/thirdparty/dyncall/include/dyncall_config.h?spec=svnb2ee4d7d859ef8e4236356117815c4cba729fabc&r=b2ee4d7d859ef8e4236356117815c4cba729fabc#43). You are going to crash if you try to call a function retrieved by FindVirtualFunction()!
Ayuto
I just noticed the latest revision and there might be two problems.
1. Linux offsets are not always one greater than Windows offsets. You can see an example here: http://forums.eventscripts.com/viewtopic.php?f=25&t=46254&start=6
The offset on Windows for CBaseClient::SetName() is 17, but on Linux it's 57 (at least in CS:S).
2. You should stick with one representation of pointers. For FindVirtualFunction() you used int, but for the rest you are using unsigned long (e.g. http://code.google.com/p/source-python/source/browse/src/core/modules/binutils/binutils_scanner.cpp#297 or http://code.google.com/p/source-python/source/browse/src/thirdparty/dyncall/include/dyncall_config.h?spec=svnb2ee4d7d859ef8e4236356117815c4cba729fabc&r=b2ee4d7d859ef8e4236356117815c4cba729fabc#43). You are going to crash if you try to call a function retrieved by FindVirtualFunction()!
Ayuto