MHS 5.9.0.0 CallRemoteFunction Problem/Bug

Find a Bug? Have a Problem? Like to Suggest a Feature? Do it Here

Moderators: g3nuin3, SpeedWing, WhiteHat, mezzo

MHS 5.9.0.0 CallRemoteFunction Problem/Bug

Postby daenerys » Mon Nov 02, 2009 2:09 am

Hello L.Spiro,
first of all I want to thank you for the marvellous work you are doing with MHS here.
Now to the problem. In the following snippet:
Code: Select all
bool result;
REMOTE_CALL_RETURN ret;
LPVOID FuncAddr=0x00abcdef; //all real addresses are masked
DWORD Extra=RCE_NOTHING; //RCE_STDCALL also not working
int fparms=1;
int plindex=0xff;
UINT register [MHS_EDI+1];
register [MHS_EAX]=0xff;
register [MHS_EBX]=0x123456;
register [MHS_ECX]=0x654321;
register [MHS_EDX]=0x234567;
register [MHS_ESI]=0x345678;
register [MHS_EDI]=0x456789;
PrintF("&ret:[%p], FuncAddr:[%p], Extra:[%p], register:[%p], fparms:[%p], plindex:[%p]",&ret, FuncAddr, Extra, register, fparms, plindex);
result = CallRemoteFunction(&ret, FuncAddr, Extra, register, fparms, plindex);
PrintF("Result:%d Ret:%p", result, ret.uiPtr);

Immediately after the code is compiled with F5 in the Script Editor, the function on the adress FuncAddr is correctly called and everything is working fine, "result" is 1 and "ret" is populated. But after exiting MHS and renewed entering, attaching to the process and starting the script (without recompiling again), the function on FuncAddr is not called anymore ("result" is 0, "ret" is of course not populated). I have checked this with OllyDbg by setting a breakpoint on the address FuncAddr, no call is made from MHS (as opposed to the first case when everything is working fine a breakpoint is executed and can be traced). Only when I again compile the script with F5, the function call is working again....
It seems for me that not everything is saved in the script by exiting MHS Application which is relevant for supplying and executing the CallRemoteFunction.

Best regards,
danny
daenerys
Hackleberry Fin
 
Posts: 25
Joined: Wed Jul 26, 2006 6:21 pm

Postby L. Spiro » Mon Nov 02, 2009 7:04 am

Everything is saved in the script correctly for performing any task.
Your problem is most likely related to a global extern somewhere.
Since they are global, their addresses (in the target process) are determined at compile-time. When MHS starts it is not attached to any processes, and thus if a global extern includes a module name in its address it will be resolved to NULL, making the final address of the extern variable equal to the offset part of its declared address.

Your script works when compiled while attached to a process. Find and fix any global extern variables.


L. Spiro
Our songs remind you of songs you’ve never heard.
User avatar
L. Spiro
L. Spiro
 
Posts: 3129
Joined: Mon Jul 17, 2006 10:14 pm
Location: Tokyo, Japan

Postby daenerys » Mon Nov 02, 2009 4:31 pm

L. Spiro wrote:...Your problem is most likely related to a global extern somewhere...
L. Spiro


hmmm. The snippet above is located in a function which is called via a hotkey, after MHS is attached to the target process (this I do manually). I am using no other global extern variables in this case.
hmmm :?:
daenerys
Hackleberry Fin
 
Posts: 25
Joined: Wed Jul 26, 2006 6:21 pm

Postby L. Spiro » Tue Nov 03, 2009 7:01 am

I can not look into it without having the script and the game.


L. Spiro
Our songs remind you of songs you’ve never heard.
User avatar
L. Spiro
L. Spiro
 
Posts: 3129
Joined: Mon Jul 17, 2006 10:14 pm
Location: Tokyo, Japan

Re: MHS 5.9.0.0 CallRemoteFunction Problem/Bug

Postby daenerys » Wed Nov 18, 2009 2:17 am

Hello L. Spiro,
did you have time to a look at the problem?
Thanks and sorry for bothering,
danny
daenerys
Hackleberry Fin
 
Posts: 25
Joined: Wed Jul 26, 2006 6:21 pm

Re: MHS 5.9.0.0 CallRemoteFunction Problem/Bug

Postby L. Spiro » Wed Nov 18, 2009 6:50 am

I will have some time later today.


L. Spiro
Our songs remind you of songs you’ve never heard.
User avatar
L. Spiro
L. Spiro
 
Posts: 3129
Joined: Mon Jul 17, 2006 10:14 pm
Location: Tokyo, Japan

Re: MHS 5.9.0.0 CallRemoteFunction Problem/Bug

Postby L. Spiro » Wed Nov 18, 2009 10:36 am

Our songs remind you of songs you’ve never heard.
User avatar
L. Spiro
L. Spiro
 
Posts: 3129
Joined: Mon Jul 17, 2006 10:14 pm
Location: Tokyo, Japan

Re: MHS 5.9.0.0 CallRemoteFunction Problem/Bug

Postby daenerys » Thu Nov 19, 2009 1:56 am

L. Spiro wrote:http://mhs.mpcforum.com/MHS6.0.rar


L. Spiro


Great fix, thanks a lot! :D
danny
daenerys
Hackleberry Fin
 
Posts: 25
Joined: Wed Jul 26, 2006 6:21 pm


Return to Bugs/Problems/Suggestions

Who is online

Users browsing this forum: No registered users and 0 guests

cron