AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Coding MM:S Plugins & SM Extensions (https://forums.alliedmods.net/forumdisplay.php?f=75)
-   -   Signature Request Thread (https://forums.alliedmods.net/showthread.php?t=78309)

robot 10-04-2008 23:21

Re: Signature Request Thread
 
Thanks for the fast response there! Unfortunately, for whatever reason - that sig is not working for me.

The plugin certainly finds it, but after loading, the server dies and goes into loop (although I probably need to debug a bit more to confirm exactly what is happening). I will try to debug it further on my end - but was wondering if you have confirmed that this is indeed the correct function and it is callable...?

Basically to explain a bit more, the last Valve update killed my plugin. The sig I was using was:

Code:

\x83\xEC\x10\x56\x57\x8B\x7C\x24\x1C\x57\x8B\xF1\xE8\xDF\x4D\xF9
However now I cannot find the correct one. I should also mention my code is quite old (http://zombiehorde.svn.sourceforge.n...nk/zhplug-1.1/) and may have other issues - although it did was working up until last update :/

robot

your-name-here 10-05-2008 10:05

Re: Signature Request Thread
 
Quote:

Originally Posted by robot (Post 695221)
Thanks for the fast response there! Unfortunately, for whatever reason - that sig is not working for me.

The plugin certainly finds it, but after loading, the server dies and goes into loop (although I probably need to debug a bit more to confirm exactly what is happening). I will try to debug it further on my end - but was wondering if you have confirmed that this is indeed the correct function and it is callable...?

Basically to explain a bit more, the last Valve update killed my plugin. The sig I was using was:

Code:

\x83\xEC\x10\x56\x57\x8B\x7C\x24\x1C\x57\x8B\xF1\xE8\xDF\x4D\xF9
However now I cannot find the correct one. I should also mention my code is quite old (http://zombiehorde.svn.sourceforge.n...nk/zhplug-1.1/) and may have other issues - although it did was working up until last update :/

robot

EDIT: This is a windows signature, not a Linux one :)

Yes. I test every single signature I create. That signature worked for me when I used it (which was right before submitting my post), so I'm sure it's the way you are using the signature. Remember that this signature is a __thiscall, which means you need to pass in a this-pointer as the first parameter in the function. Then, inside the function, you need to do the following with the __asm keyword if you are using windows (if you are using c++):

Code:

__asm {
                push ecx;
                mov ecx, thisptr;
                push iTeamIndex;
                call thesignaturefunction;
                pop ecx;
        };

To use signatures, I use something LDuke taught me, which he was shown by Cybermind.

Essentially, take a look at the declaration of the function. In this case, it has one parameter, int iTeamIndex. It's also a __thiscall which means that you need a pointer to an instance of CCSPlayer. If you take a look at the class heirarchy, CCSPlayer is also an instance of CBaseEntity. So from an edict_t* you do ->GetUnknown()->GetBaseEntity(); Use that as your this-pointer.

Now, create a typedef for the function, inside your code. The syntax works like this:

Code:

typedef <return-type> (<callingconvention> *<SomeName>) (<param1 type>, <param2 type>, ..etc..)
With the above, if your calling convention is anything other than a __fastcall, you do not need to put a calling convention there :).

So with CCSPlayer::SwitchTeam:
Code:

typedef void (*SwitchTeam)(CBaseEntity*, int);
Next, what I do in my code is I have a class which manages my signatures. Inside it, I create an instance of the typedef in my class's private member variables section:

Code:

private:
SwitchTeam m_SwitchTeam;

.

Finally, I have a global instance of the signature scanner (I use BAILOPAN's). I have a function called Initialize() in my manager class, which I call when metamod loads. I then do the following for each "function type members" that I showed you above:

Code:

m_SwitchTeam = (SwitchTeam)g_SigMngr.ResolveSig(laddr, Signature, Signature_Length);
Finally, you need to call your newfound function! In my manager class, I have callable functions for each signature. In this case, since we have a __thiscall, you need to move the this pointer into the ecx register, and push all the parameters into the stack left to right. This is why I put the thispointer (the CBaseEntity* instance) first :D. So the code:

Code:

void S_SwitchTeam(CBaseEntity* thisptr, int iTeamIndex)
{
      if(!m_SwitchTeam)
      {
            g_pGlobals->m_engine->Con_NPrintf(0, "m_SwitchTeam failed!");
            return;
      }

      void* func = (void*)m_SwitchTeam;

      #ifdef _WIN32
            __asm {
                push ecx;
                mov ecx, thisptr;
                push iTeamIndex;
                call func;
                pop ecx;
            };
      #else
            (m_SwitchTeam)(thisptr, iTeamIndex);
      #endif
}

And that's it! You can apply the same principles for pretty much any other thiscall (I haven't run into any exceptions. Also, on a side note, I am signature scanning for classes in CS:S. I have written up a page on CCSPlayer if you want to take a look:

http://wiki.alliedmods.net/CCSPlayer

I hope this helped! :D

L. Duke 10-08-2008 13:15

Re: Signature Request Thread
 
CTFPlayer::TeamFortress_SetSpeed(void)

:)

see you in #sigs on IRC

your-name-here 10-08-2008 19:56

Re: Signature Request Thread
 
Quote:

Originally Posted by L. Duke (Post 696951)
CTFPlayer::TeamFortress_SetSpeed(void)

:)

see you in #sigs on IRC

Lol, I had a really hard time with this one. I haven't tested this because I can't run TF2 on this box, so =/, but you can :D

Prototype:
Code:

void CTFPlayer::TeamFortress_SetSpeed(void)
Calling Convention: __fastcall
Signature:
Code:

\x51\x56\x8B\xF1\x2A\x2A\x2A\x2A\x2A\x2A\xC1\xE8\x03\xA8\x01\x57\x2A\x2A\x2A\x2A\x2A\x2A\x74\x3E\x8B\x16\x2A\x2A\x2A\x2A\x2A\x2A
Length: 32

The above is untested so don't blame me if something goes wrong :D. I need LDuke to report back.

raydan 10-16-2008 06:08

Re: Signature Request Thread
 
i found this, then use detours. but how to set the speed next?
Code:

\x51\x56\x8B\xF1\x2A\x2A\x2A\x2A\x2A\x2A\x85\xC9\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\xC1\xE8\x03\xA8\x01\x57\x2A\x2A\x2A\x2A\x2A\x2A\x74\x40\x8B\x16\x2A\x2A\x2A\x2A\x2A\x2A

AnAkIn 01-21-2009 10:57

Re: Signature Request Thread
 
Could anyone find me the sig for this:

CBaseEntityList * g_pEntityList

(TF2)

Thanks :)

CrimsonGT 01-21-2009 12:09

Re: Signature Request Thread
 
The entitylist is an offset, not a pointer, and you can find it in sdktools extention or lduke's extention.

CrimsonGT 02-03-2009 02:00

Re: Signature Request Thread
 
I know youve been busy lately, but heres one if you get time :)

CTFPlayer::CanAttack(void)

your-name-here 02-07-2009 10:24

Re: Signature Request Thread
 
Quote:

Originally Posted by raydan (Post 700644)
i found this, then use detours. but how to set the speed next?
Code:

\x51\x56\x8B\xF1\x2A\x2A\x2A\x2A\x2A\x2A\x85\xC9\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\xC1\xE8\x03\xA8\x01\x57\x2A\x2A\x2A\x2A\x2A\x2A\x74\x40\x8B\x16\x2A\x2A\x2A\x2A\x2A\x2A

EDIT: Disregard that function :S Dunno what I was thinking there lol.
What did you want to do?

Secondly, I don't think you can search for signatures in other binaries outside of server.dll / server_i486.so because you need to have a pointer that's stored internally in those (to get the membase of the DLL). Try using a CS function for what you want.

Ninja Edit: I'm searching for your signature Crimson :D

EDIT2: I think I found it, but you'll need to test it (I wasn't able to, so no guarantees lol):
Code:

\xA1\x2A\x2A\x2A\x2A\xD9\x2A\x2A\x56\x8B\xF1\xD8\x2A\x2A\x2A\x2A\x2A\x8B\x2A\x2A\x2A\x2A\x2A\xDF\xE0\xF6\xC4\x05
EDIT3: The above is TESTED and working as of 2/7/09! The above is CTFPlayer::CanAttack(void).

CrimsonGT 02-08-2009 21:19

Re: Signature Request Thread
 
Just to throw it out there, even though I cant get it to work (it just doesnt seem to be called) heres the sig for CBaseCombatWeapon::UsesPrimaryAmmo()

Code:

\x83\xB9\x54\x12\x00\x00\x00\x0F\x9D\xC0\xC3
your-name-here: I was actually able to find a few with the method you showed me last night :) However, theres one that I cant find a string in anywhere. If you get a chance to take a look, its CBaseEntity::CreatePredictedEntityByName(char const*, char const *, int, bool). I did see that CreateEntityByName was called inside of it, and has a string in it, but was not able to find it based off that.


All times are GMT -4. The time now is 17:46.

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