FunctionPatch Class Reference

Simplifies inserting JMP commands in the beginning of functions. More...

List of all members.

Classes

class  MemoryLocker
 Allows retreiving read/write access to read-only kernel memory. More...

Public Member Functions

 FunctionPatch ()
 ~FunctionPatch ()
bool Patch (void *pFunc, void *pNewFunc)
 Inserts the JMP instruction in the beginning of a function and stores the bytes being overwritten.

Static Private Member Functions

static void _PatchFunction (void *pFunc, void *pDest)
 Replaces the first 5 bytes of a function by a JMP instruction.

Private Attributes

char m_PreviousBytes [5]
void * m_pAddress


Detailed Description

Simplifies inserting JMP commands in the beginning of functions.

This class represents a single patched function (with a JMP instruction inserted in the beginning). Typically, after creation the FunctionPatch::Patch() method should be called to patch a function. During patching, the class instance stores the data that was replaced by inserting a JMP and restores this data back when the object is deleted. That way, each patched function should have a corresponding FunctionPatch instance.


Constructor & Destructor Documentation

FunctionPatch::FunctionPatch (  )  [inline]

FunctionPatch::~FunctionPatch (  )  [inline]

Here is the call graph for this function:


Member Function Documentation

static void FunctionPatch::_PatchFunction ( void *  pFunc,
void *  pDest 
) [inline, static, private]

Replaces the first 5 bytes of a function by a JMP instruction.

This method performs the actual patching and is internally used by Patch() method.

Parameters:
pFunc Specifies the address of a function to be patched
pDest Specifies the target address of the JMP instruction

Here is the call graph for this function:

bool FunctionPatch::Patch ( void *  pFunc,
void *  pNewFunc 
) [inline]

Inserts the JMP instruction in the beginning of a function and stores the bytes being overwritten.

Parameters:
pFunc Specifies the address of a function to be patched
pNewFunc Specifies the target address of the JMP instruction

Here is the call graph for this function:


Member Data Documentation

void* FunctionPatch::m_pAddress [private]

char FunctionPatch::m_PreviousBytes[5] [private]


The documentation for this class was generated from the following file:
SourceForge.net Logo