Difference between revisions of "User:Mrmagu"

From AlliedModders Wiki
Jump to: navigation, search
(About)
 
Line 1: Line 1:
 
is a nub :]
 
is a nub :]
 +
 +
C++ Highlighted test..<br />
 +
 +
<font color="#a020f0">#ifndef SIGSCAN_H</font>
 +
<font color="#a020f0">#define SIGSCAN_H</font>
 +
 +
<font color="#2e8b57"><b>class</b></font> CSigScan {
 +
<font color="#804040"><b>private</b></font>:
 +
        <font color="#0000ff">/*</font><font color="#0000ff"> Private Variables </font><font color="#0000ff">*/</font>
 +
        <font color="#0000ff">/*</font><font color="#0000ff"> Base Address of the server module in memory </font><font color="#0000ff">*/</font>
 +
        <font color="#2e8b57"><b>static</b></font> <font color="#2e8b57"><b>unsigned</b></font> <font color="#2e8b57"><b>char</b></font> *base_addr;
 +
        <font color="#0000ff">/*</font><font color="#0000ff"> The length to the module's ending address </font><font color="#0000ff">*/</font>
 +
        <font color="#2e8b57"><b>static</b></font> <font color="#2e8b57"><b>size_t</b></font> base_len;
 +
 +
        <font color="#0000ff">/*</font><font color="#0000ff"> The signature to scan for </font><font color="#0000ff">*/</font>
 +
        <font color="#2e8b57"><b>unsigned</b></font> <font color="#2e8b57"><b>char</b></font> *sig_str;
 +
        <font color="#0000ff">/*</font><font color="#0000ff"> A mask to ignore certain bytes in the signature such as addresses</font>
 +
<font color="#0000ff">          The mask should be as long as all the bytes in the signature string</font>
 +
<font color="#0000ff">          Use '?' to ignore a byte and 'x' to check it</font>
 +
<font color="#0000ff">          Example&quot;xxx????xx&quot; - The first 3 bytes are checked, then the next 4 are</font>
 +
<font color="#0000ff">          ignored, then the last 2 are checked </font><font color="#0000ff">*/</font>
 +
        <font color="#2e8b57"><b>char</b></font> *sig_mask;
 +
        <font color="#0000ff">/*</font><font color="#0000ff"> The length of sig_str and sig_mask (not including a terminating null for sig_mask) </font><font color="#0000ff">*/</font>
 +
        <font color="#2e8b57"><b>size_t</b></font> sig_len;
 +
 +
        <font color="#0000ff">/*</font><font color="#0000ff"> Private Functions </font><font color="#0000ff">*/</font>
 +
        <font color="#2e8b57"><b>void</b></font>* FindSignature(<font color="#2e8b57"><b>void</b></font>);
 +
 +
<font color="#804040"><b>public</b></font>:
 +
        <font color="#0000ff">/*</font><font color="#0000ff"> Public Variables </font><font color="#0000ff">*/</font>
 +
 +
        <font color="#0000ff">/*</font><font color="#0000ff"> sigscan_dllfunc is a pointer of something that resides inside the gamedll so we can get</font>
 +
<font color="#0000ff">          the base address of it. From a SourceMM plugin, just set this to ismm-&gt;serverFactory(0)</font>
 +
<font color="#0000ff">          in Load(). From a Valve Server Plugin, you must set this to an actual factory returned</font>
 +
<font color="#0000ff">          from gameServerFactory and hope that a SourceMM plugin did not override it. </font><font color="#0000ff">*/</font>
 +
        <font color="#2e8b57"><b>static</b></font> <font color="#2e8b57"><b>void</b></font> *(*sigscan_dllfunc)(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *pName, <font color="#2e8b57"><b>int</b></font> *pReturnCode);
 +
 +
        <font color="#0000ff">/*</font><font color="#0000ff"> If the scan was successful or not </font><font color="#0000ff">*/</font>
 +
        <font color="#2e8b57"><b>char</b></font> is_set;
 +
        <font color="#0000ff">/*</font><font color="#0000ff"> Starting address of the found function </font><font color="#0000ff">*/</font>
 +
        <font color="#2e8b57"><b>void</b></font> *sig_addr;
 +
 +
        <font color="#0000ff">/*</font><font color="#0000ff"> Public Functions </font><font color="#0000ff">*/</font>
 +
        CSigScan(<font color="#2e8b57"><b>void</b></font>)sig_str(<font color="#ff00ff">NULL</font>), sig_mask(<font color="#ff00ff">NULL</font>), sig_len(<font color="#ff00ff">0</font>), sig_addr(<font color="#ff00ff">NULL</font>) {}
 +
        ~CSigScan(<font color="#2e8b57"><b>void</b></font>);
 +
 +
        <font color="#2e8b57"><b>static</b></font> <font color="#2e8b57"><b>bool</b></font> GetDllMemInfo(<font color="#2e8b57"><b>void</b></font>);
 +
        <font color="#2e8b57"><b>void</b></font> Init(<font color="#2e8b57"><b>unsigned</b></font> <font color="#2e8b57"><b>char</b></font> *sig, <font color="#2e8b57"><b>char</b></font> *mask, <font color="#2e8b57"><b>size_t</b></font> len);
 +
};
 +
 +
<font color="#2e8b57"><b>void</b></font> InitSigs(<font color="#2e8b57"><b>void</b></font>);
 +
 +
<font color="#0000ff">/*</font><font color="#0000ff"> Sig Functions </font><font color="#0000ff">*/</font>
 +
<font color="#2e8b57"><b>class</b></font> CBaseAnimating;
 +
<font color="#2e8b57"><b>void</b></font> CBaseAnimating_Ignite(CBaseAnimating *cba, <font color="#2e8b57"><b>float</b></font> flFlameLifetime);
 +
 +
<font color="#a020f0">#endif</font>

Revision as of 00:13, 16 January 2006

is a nub :]

C++ Highlighted test..

#ifndef SIGSCAN_H #define SIGSCAN_H

class CSigScan { private:

       /* Private Variables */
       /* Base Address of the server module in memory */
       static unsigned char *base_addr;
       /* The length to the module's ending address */
       static size_t base_len;
       /* The signature to scan for */
       unsigned char *sig_str;
       /* A mask to ignore certain bytes in the signature such as addresses

The mask should be as long as all the bytes in the signature string Use '?' to ignore a byte and 'x' to check it Example"xxx????xx" - The first 3 bytes are checked, then the next 4 are ignored, then the last 2 are checked */

       char *sig_mask;
       /* The length of sig_str and sig_mask (not including a terminating null for sig_mask) */
       size_t sig_len;
       /* Private Functions */
       void* FindSignature(void);

public:

       /* Public Variables */
       /* sigscan_dllfunc is a pointer of something that resides inside the gamedll so we can get

the base address of it. From a SourceMM plugin, just set this to ismm->serverFactory(0) in Load(). From a Valve Server Plugin, you must set this to an actual factory returned from gameServerFactory and hope that a SourceMM plugin did not override it. */

       static void *(*sigscan_dllfunc)(const char *pName, int *pReturnCode);
       /* If the scan was successful or not */
       char is_set;
       /* Starting address of the found function */
       void *sig_addr;
       /* Public Functions */
       CSigScan(void)sig_str(NULL), sig_mask(NULL), sig_len(0), sig_addr(NULL) {}
       ~CSigScan(void);
       static bool GetDllMemInfo(void);
       void Init(unsigned char *sig, char *mask, size_t len);

};

void InitSigs(void);

/* Sig Functions */ class CBaseAnimating; void CBaseAnimating_Ignite(CBaseAnimating *cba, float flFlameLifetime);

#endif