Search found 166 matches

by Serious Callers Only
Sun Mar 06, 2011 8:56 pm
Forum: The Junkyard
Topic: Some help reverse engennering a piece of code?
Replies: 43
Views: 20308

Did a little "printf tracing" Called simple string: import sys; sys.path.append("Z:\\home\\paulo\\OS Images\\shared\\Vampire the Masquerade - Bloodlines\\Vampire the Masquerade - Bloodlines\\vampire\python") This is ok sys:1: RuntimeWarning: Python C API version mismatch for module vampire: ...
by Serious Callers Only
Sun Mar 06, 2011 8:07 pm
Forum: The Junkyard
Topic: Some help reverse engennering a piece of code?
Replies: 43
Views: 20308

Dunno. It looks to me that the code path that crashes is the success path (returning a valid pointer). Maybe it is just the print i'm doing in the replacement bellow? Damn anti debuggers. The original functions redirected the python stdout and stderr to the console too, so maybe that is all related ...
by Serious Callers Only
Sun Mar 06, 2011 8:50 am
Forum: The Junkyard
Topic: Some help reverse engennering a piece of code?
Replies: 43
Views: 20308

This i think i understand It prints the error if the output of the function is zero (ironically, it actually doesn't print anything if there is no error, so it might be a good idea to return 0 unconditionally to avoid the problem area). 200DAB45 |. FF15 90331720 CALL DWORD PTR DS:[<&vampire_python21...
by Serious Callers Only
Sun Mar 06, 2011 8:13 am
Forum: The Junkyard
Topic: Some help reverse engennering a piece of code?
Replies: 43
Views: 20308

Yeah only printing the success and return 0 (or NULL) on success appears to print the exception outside and do nothing on success.

But who should deallocate the object? If i am supposed to return the PyObject*
, logically it should be they. If it should only be NULL or not, i should be me.
by Serious Callers Only
Sun Mar 06, 2011 8:05 am
Forum: The Junkyard
Topic: Some help reverse engennering a piece of code?
Replies: 43
Views: 20308

Ok there is something pretty strange occurring if i return -1 (failure parsing the python expression). Maybe you can help me, the calling function is up there above. My function now, seems to work ok in the success case, prints and execs the code as long as it is correct. int PyRun_ConsoleString(...
by Serious Callers Only
Sat Mar 05, 2011 4:56 pm
Forum: The Junkyard
Topic: Some help reverse engennering a piece of code?
Replies: 43
Views: 20308

mmm it is still crashing in case it returns -1 (failure). It is because of that PyErrorPrint. http://docs.python.org/c-api/veryhigh.html#PyRun_SimpleStringFlags Python actually crashes if there is no actual error when you check for errors and that function (that i'm using as a kludge to exe the stat...
by Serious Callers Only
Sat Mar 05, 2011 4:41 pm
Forum: The Junkyard
Topic: Some help reverse engennering a piece of code?
Replies: 43
Views: 20308

Just executing my code without crashing on the changed function signature. The dll i was replacing had a function with a signature: PyAPI_FUNC(int) PyRun_ConsoleString(const char *, int, PyObject*); And i was trying various variations of PyAPI_FUNC(int) PyRun_ConsoleString(const char *, int, char*);...
by Serious Callers Only
Sat Mar 05, 2011 3:57 am
Forum: The Junkyard
Topic: Some help reverse engennering a piece of code?
Replies: 43
Views: 20308

YES! That worked.
by Serious Callers Only
Sat Mar 05, 2011 3:44 am
Forum: The Junkyard
Topic: Some help reverse engennering a piece of code?
Replies: 43
Views: 20308

Hmmm the code manipulates ESP by adding 3 dwords + a word. 4+4+4+2 So 3 x 32 bits values + 1 x 16 bits values as arguments? Something is wrong with this argument, since it appears (from printing inside the function) that a third 32 bit argument has trash values. If Py_GetDict works in the usual way,...
by Serious Callers Only
Sat Mar 05, 2011 3:33 am
Forum: The Junkyard
Topic: Some help reverse engennering a piece of code?
Replies: 43
Views: 20308

Ok, this is the code that is calling the function that is crashing the dll (PyRun_ConsoleString to check for the return and arguments) CPU Disasm Address Hex dump Command Comments 200DAB20 /$ 68 D8961A20 PUSH OFFSET 201A96D8 ; ASCII "__main__" 200DAB25 |. FF15 B0331720 CALL DWORD PTR DS:[<&vampire_p...
by Serious Callers Only
Fri Mar 04, 2011 10:21 pm
Forum: The Junkyard
Topic: Some help reverse engennering a piece of code?
Replies: 43
Views: 20308

stackoverflow.com says that c++ function signatures can be reversed with dependencywalker (unfortunately the functions are plain C ). It also says that dlls can be linked when you don't have the source with * open the dll up in depends.exe shipped with (Visual Studio) * verify the signature of the f...
by Serious Callers Only
Fri Mar 04, 2011 9:50 pm
Forum: The Junkyard
Topic: Some help reverse engennering a piece of code?
Replies: 43
Views: 20308

This is how i'm doing it if anyone want to try: install VS (i'm using 2003) get the python sources here: http://www.python.org/ftp/python/2.7.1/Python-2.7.1.tgz extract them, and open up visual studio. The project to open differs depending on the visual studio version you have. PCBuild is 2008, the ...
by Serious Callers Only
Fri Mar 04, 2011 8:09 pm
Forum: The Junkyard
Topic: Some help reverse engennering a piece of code?
Replies: 43
Views: 20308

Sure, but the source engine itself never used python. This is the python dll that troika glued with the engine, and these functions are the ones at the border (inside the python dll). As i said, they probably take a string taken from the console (or a inputsteam), tokenize them, pass it to the pytho...
by Serious Callers Only
Fri Mar 04, 2011 6:37 pm
Forum: The Junkyard
Topic: Some help reverse engennering a piece of code?
Replies: 43
Views: 20308

I don't think it's very related. Troika never used the released sdk and it looks (to me) that the code in that dll is just python + reading the halflife console stream (likely a argument i can't figure out), tokenizing it somehow, sending the commands to python, and sending the response to another d...
by Serious Callers Only
Fri Mar 04, 2011 5:58 pm
Forum: The Junkyard
Topic: Some help reverse engennering a piece of code?
Replies: 43
Views: 20308

No interest at all?