Page 1 of 1

Binutils.FindVirtualFunction()

Posted: Tue Dec 18, 2012 9:33 am
by Ayuto
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

Posted: Tue Dec 18, 2012 9:37 am
by satoon101
We are already working on these issues, but thank you for noticing them. I only added the code because it needed added. I am certainly not a C++ programmer, as the first time I wrote anything in C++ was for this project just a couple months ago, so I figured there would be some minor issues.

Satoon

Posted: Tue Dec 18, 2012 9:47 am
by Ayuto
I'm new to C++ as well (I started at the end of my summer holidays), but that's what I noticed when using SPE in combination with my C++ - Python library. This is not a reproach!

Posted: Tue Dec 18, 2012 1:25 pm
by Mahi
Since I'm somewhat more advanced C++ programmer (been doing it for ~4 years, not a professional yet tho) and my father is one of the world's finest programmers so I can ask him for help at anything, I would love to help a little with this project. Problem is, I've got barely any knowledge of source engine — How much exactly do I need to know of the source stuff, and where could I learn it if I wanted to help, or is it even possible for someone who doens't know much about source engine to help? :P

Posted: Tue Dec 18, 2012 5:05 pm
by satoon101
Well, we already have 3 very good C++ programmers, but they have just been fairly busy lately. I mostly have been adding stuff to try to help me get into C++ and actually start learning it. And, the things I have added is functionality that I know people have been waiting for to be added to the plugin. That is not to say that if you posted something, we wouldn't look into it and see about adding it.

Satoon

Posted: Fri Dec 21, 2012 4:18 am
by L'In20Cible
Hey Ayuto,

Interesting. First time I hear that virtual offsets are so far away from each other on different platforms. I think that the best way to do is adding a second parameter (defaulted to false) to ignore platform checks.

Thanks for the head up,

L'In20Cible

Posted: Fri Dec 21, 2012 11:09 am
by Ayuto
Heh yes, that gave me a headache and took me some time to find that out.

Posted: Fri Dec 21, 2012 2:10 pm
by L'In20Cible
Hey,

Just to let you know, FindVirtualFunction now accepts a third parameter (optional, defaulted to False) to disable platform check if set to True.

L'In20Cible

Posted: Fri Dec 21, 2012 4:51 pm
by Ayuto
Looks fine now! :)