Raised This Month: $ Target: $400
 0% 

Questions about signature scanning


Post New Thread Reply   
 
Thread Tools Display Modes
joaquimandrade
Veteran Member
Join Date: Dec 2008
Location: Portugal
Old 09-14-2009 , 23:54   Re: Questions about signature scanning
Reply With Quote #21

Quote:
Originally Posted by jim_yang View Post
after, you push a param stack -= 4, so you should add esp, 4 after call it

by the way
do you use void **pPlayerPointer, it should be void *pPlayerPointer = ent->pvPrivateDate;
Yes, I do understand that I need to add 4 to esp but it still crashes

I think i'm correct because insine assembly excepts me to give it a pointer to the data that I need to pass it. So I give it a pointer to (CBasePlayer *). That's why it is void **. Because it needs a pointer to the data that I want to pass.
__________________
joaquimandrade is offline
joaquimandrade
Veteran Member
Join Date: Dec 2008
Location: Portugal
Old 09-15-2009 , 02:53   Re: Questions about signature scanning
Reply With Quote #22

I reached this code:

PHP Code:
typedef void (*RoundRespawn)();
    
RoundRespawn roundRespawn = (RoundRespawnResolveSig((void *)MDLL_Spawn,"Observer_SetMode__11CBasePlayeri");

    
void *pPlayer = (void *) INDEXENT(params[1])->pvPrivateData;
    
void **pPlayerPointer = &pPlayer;    
            
    
int x;
    
void *y;
    
3;
    
= &x;

    
printf(" ");

    
asm __volatile__("add $0x8, %esp");

    
asm __volatile__("push %0"::"m"(y));
    
asm __volatile__("push %0"::"m"(pPlayerPointer));

    
asm __volatile__("call %0"::"m"(roundRespawn)); 
It's not roundRespawn anymore (it makes a player go to First Person View) but the point is that I have now a way of calling the function with any number of arguments. The problem is, i can't remove the annoying printf(" "). It crashes without it. Any idea of how to replace it with real code is appreciated. I'm guessing it performs some operation that corrects something that the code below destroys.
__________________
joaquimandrade is offline
jim_yang
Veteran Member
Join Date: Aug 2006
Old 09-15-2009 , 20:52   Re: Questions about signature scanning
Reply With Quote #23

player's edict's pvPrivateData itself is already a pointer, which point to the CBasePlayer's object, same as "this", so you don't need to get its address, if you do that, you just make a pointer which point to the pointer, is that what you want?
__________________
Project : CSDM all in one - 99%
<team balancer#no round end#entity remover#quake sounds#fake full#maps management menu#players punishment menu#no team flash#colored flashbang#grenade trails#HE effect#spawn protection#weapon arena#weapon upgrade#auto join#no weapon drop#one name>
jim_yang is offline
joaquimandrade
Veteran Member
Join Date: Dec 2008
Location: Portugal
Old 09-15-2009 , 23:00   Re: Questions about signature scanning
Reply With Quote #24

Quote:
Originally Posted by jim_yang View Post
player's edict's pvPrivateData itself is already a pointer, which point to the CBasePlayer's object, same as "this", so you don't need to get its address, if you do that, you just make a pointer which point to the pointer, is that what you want?
It was what I wanted but now I've changed the code and it works other way. I fixed the code and I'm making a module out of it.

By the way if you can tell me how to convert a float to a (void *) or vice-versa share with me

Edit: I mean "to cast".
__________________

Last edited by joaquimandrade; 09-15-2009 at 23:03.
joaquimandrade is offline
jim_yang
Veteran Member
Join Date: Aug 2006
Old 09-15-2009 , 23:36   Re: Questions about signature scanning
Reply With Quote #25

Code:
float a = 1.f;
void *pa = &a;
why you need cast a float to a pointer?
Code:
void foo(void *a, int b, int c)
{
    float x = *(float *)a;
    printf("%f %d %d\n", x, b, c);
}
 
int _tmain(int argc, _TCHAR* argv[])
{
    void (*func)(void *, int, int) = foo;
    float a = 1.f;
    int b = 2;
    int c = 3;
    func(&a, b, c);
    system("pause");
    return 0;
}
__________________
Project : CSDM all in one - 99%
<team balancer#no round end#entity remover#quake sounds#fake full#maps management menu#players punishment menu#no team flash#colored flashbang#grenade trails#HE effect#spawn protection#weapon arena#weapon upgrade#auto join#no weapon drop#one name>
jim_yang is offline
joaquimandrade
Veteran Member
Join Date: Dec 2008
Location: Portugal
Old 09-15-2009 , 23:49   Re: Questions about signature scanning
Reply With Quote #26

Quote:
Originally Posted by jim_yang View Post
Code:
float a = 1.f;
void *pa = &a;
why you need cast a float to a pointer?
Code:
void foo(void *a, int b, int c)
{
    float x = *(float *)a;
    printf("%f %d %d\n", x, b, c);
}
 
int _tmain(int argc, _TCHAR* argv[])
{
    void (*func)(void *, int, int) = foo;
    float a = 1.f;
    int b = 2;
    int c = 3;
    func(&a, b, c);
    system("pause");
    return 0;
}
I don't know exactly if i need it but i'm using (void *) as the generic type to pass arguments and retrieve returns from functions.

PHP Code:
class TypeHandler
{
    public:
        
virtual voidconvertArgument(cell arg);
        
virtual cell convertReturn(void *);
}; 
This worked:

PHP Code:
class FloatHandler : public TypeHandler
{
    public:
        
void *convertArgument(cell arg)
        {
            
long fixed = (longamx_ctof(arg);
            return (
void*) fixed;
        }
        
cell convertReturn(void ret)
        {
            
long fixed = (longret;
            return 
amx_ftoc((float) fixed);
        }    
}; 
I think that tomorrow I'll have the module ready and then I would like tips from you to optimize it and it will be easy to show you what i'm doing.

And big thanks for spending time in this thread.
__________________
joaquimandrade is offline
jim_yang
Veteran Member
Join Date: Aug 2006
Old 09-15-2009 , 23:53   Re: Questions about signature scanning
Reply With Quote #27

I guess you are working on a universal function invoker or something
__________________
Project : CSDM all in one - 99%
<team balancer#no round end#entity remover#quake sounds#fake full#maps management menu#players punishment menu#no team flash#colored flashbang#grenade trails#HE effect#spawn protection#weapon arena#weapon upgrade#auto join#no weapon drop#one name>
jim_yang is offline
joaquimandrade
Veteran Member
Join Date: Dec 2008
Location: Portugal
Old 09-15-2009 , 23:59   Re: Questions about signature scanning
Reply With Quote #28

Quote:
Originally Posted by jim_yang View Post
I guess you are working on a universal function invoker or something
Yes. And it is already working I just need to make a file parser and to implement more data types (I think). It will parse functions details in files like:

PHP Code:
"AddPlayerItem"
{
    
arguments 
    
{
         
"CBasePlayer *" "CBasePlayerItem *"
    
}
    
signature "AddPlayerItem__11CBasePlayerP15CBasePlayerItem"

And then in a plugin one would do

PHP Code:
AddPlayerItemPointer getSiggedFuncPointer("AddPlayerItem");
...
ExecuteSiggedFunc(AddPlayerItemPointer,id,weaponID); 
But since it is my first real project using Assembly and C++ i'm taking some time do to it.

I was afraid that it was not possible but now I think it is. I will try to make it also hook but I need to spend some days learning that.
__________________

Last edited by joaquimandrade; 09-16-2009 at 00:02.
joaquimandrade is offline
jim_yang
Veteran Member
Join Date: Aug 2006
Old 09-16-2009 , 00:09   Re: Questions about signature scanning
Reply With Quote #29

definately useful ! nice to see u working on this project
__________________
Project : CSDM all in one - 99%
<team balancer#no round end#entity remover#quake sounds#fake full#maps management menu#players punishment menu#no team flash#colored flashbang#grenade trails#HE effect#spawn protection#weapon arena#weapon upgrade#auto join#no weapon drop#one name>
jim_yang is offline
joaquimandrade
Veteran Member
Join Date: Dec 2008
Location: Portugal
Old 09-16-2009 , 00:11   Re: Questions about signature scanning
Reply With Quote #30

Quote:
Originally Posted by jim_yang View Post
definately useful ! nice to see u working on this project
Thanks
__________________
joaquimandrade is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:21.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode