Jump to content

how return by (void) in string


Go to solution Solved by castix,

11 posts in this topic

Recommended Posts

Posted

hi gays :p  how return by (void)

 

                  ; Quest::mpNumber::setmpNumber(void)
 __ZN5Quest8mpNumber11setmpNumberEv

 

 

 

Is this correct way

 

int (*old__ZN5Quest8mpNumber11setmpNumberEv)();

int $__ZN5Quest8mpNumber11setmpNumberEv()
{
   return 99999;
}

%ctor {

    MSHookFunction(((int*)MSFindSymbol(NULL, "__ZN5Quest8mpNumber11setmpNumberEv")),(int*)$__ZN5Quest8mpNumber11setmpNumberEv,(void**)&old__ZN5Quest8mpNumber11setmpNumberEv);
 }

Posted

This is how I would call a void argument in ms hook. Someone with more experience can correct me if I'm wrong

 

int $__ZN5Quest8mpNumber11setmpNumberEv()
{
   %orig(99999);
}

 

Always remember that void functions don't "return" anything. You have to call the original argument with %orig

Posted (edited)

No just treat the void as what it would be if it was not a void. That symbol would be an int, so just put
 

int $__ZN5Quest8mpNumber11setmpNumberEv{
return 9999;
}

Actually you are correct, I didn't read your first post fully :p yeah you're good to go :thumbsup:

Updated by Guest
Posted

No just treat the void as what it would be if it was not a void. That symbol would be an int, so just put

 

int $__ZN5Quest8mpNumber11setmpNumberEv{
return 9999;
}

Actually you are correct, I didn't read your first post fully :p yeah you're good to go :thumbsup:

int (*old__ZN5Quest8mpNumber11setmpNumberEv)();

 

int $__ZN5Quest8mpNumber11setmpNumberEv   /-------- if not use "()" stile ger errors

 

{

   return 99999;

}

 

%ctor {

 

    MSHookFunction(((int*)MSFindSymbol(NULL, "__ZN5Quest8mpNumber11setmpNumberEv")),(int*)$__ZN5Quest8mpNumber11setmpNumberEv,(void**)&old__ZN5Quest8mpNumber11setmpNumberEv);

 }

 

get errors

Posted (edited)

try this

 

int (*old__ZN5Quest8mpNumber11setmpNumberEv)();

int $__ZN5Quest8mpNumber11setmpNumberEv()
{   
return 99999;
}

%ctor{    
MSHookFunction(((int*)MSFindSymbol(NULL, "__ZN5Quest8mpNumber11setmpNumberEv")),(int*)$__ZN5Quest8mpNumber11setmpNumberEv,(int**)&old__ZN5Quest8mpNumber11setmpNumberEv); 
}
copy and paste it Updated by Guest
  • Solution
Posted

Actually what he supposed to have correct in the first post was indeed. There is no reason to edit it

Posted (edited)

@@shmoo the third is always (void**) ;)

Oh when I did that method a couple times I would always change the third method to whatever the first and second methods were and it would work... O.o

Updated by Guest

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...

Important Information

We would like to place cookies on your device to help make this website better. The website cannot give you the best user experience without cookies. You can accept or decline our cookies. You may also adjust your cookie settings. Privacy Policy - Guidelines