RPCTableManager Class Reference

Performs patching of GuestRPC mechanism handler table. More...

#include <tablemgr.h>

Collaboration diagram for RPCTableManager:

List of all members.

Classes

struct  AddressRange
 Represents an arbitrary address range. More...
struct  RefGroupDescriptor
 Contains information about a set of pointers to strings that can potentially be a GuestRPC mechanism handler table. More...
struct  RPCHandlerRecord
 Represents a GuestRPC mechanism handler entry used by VMWARE-VMX.EXE. More...
struct  RPCTableInfo
 Contains information about a GuestRPC mechanism handler table. More...
struct  StringPointer
 Represents a pointer to an ASCIIZ string with a cached size. More...
struct  StringReferenceDescriptor
 Represents a pointer to a string pointer. Used to locate GuestRPC mechanism handler table with pointers to command names. More...

Public Member Functions

 RPCTableManager (HINSTANCE hThisDLL)
bool InstallHandler (const char *pszPrefix, size_t prefixLen, GRPCHANDLER pHandler, void *pContext, bool ForceReinstall)
void RestoreOriginalHandler ()
bool IsEntryModified ()

Private Types

enum  { VerifMaxStringLength = 100 }
typedef bool(* GRPCHANDLER )(void *pContext, int ChannelNumber, char *pCommandBody, unsigned CommandBodyLength, char **ppReply, unsigned *pReplyLen)

Private Member Functions

bool FindHandlerTable (bool FullMode=false)
 Tries to load handler table information from PatchInfoDatabase, and, if not found, scans for it.
void DoPatch (RPCHandlerRecord *pEntry, const char *pszPrefix, size_t prefixLen, GRPCHANDLER pHandler, void *pContext)

Static Private Member Functions

static bool PtrInRange (const std::list< AddressRange > &list, void *ptr)
static bool islen (const char *pStr, size_t expected)
 Returns whether pStr points to an ASCIIZ string with length of exact expected bytes.
static bool VerifyEntry (RPCHandlerRecord *pRec, std::list< AddressRange > &dataRanges, std::list< AddressRange > &codeRanges)
 Returns whether a potential GuestRPC mechanism handler entry is correct and contains no inconsisancies.
static void FindSections (char *lpMainExe, std::list< AddressRange > &dataRanges, std::list< AddressRange > &codeRanges)
static void MakeListOfStrings (const std::list< AddressRange > &dataRanges, BazisLib::SingleMallocVector< StringPointer > &strings, bool FullMode)
static void FindStringRefs (const std::list< AddressRange > &dataRanges, const BazisLib::SingleMallocVector< StringPointer > &strings, BazisLib::SingleMallocVector< StringReferenceDescriptor > &stringRefs)
static void GroupStringRefs (BazisLib::SingleMallocVector< StringReferenceDescriptor > &stringRefs, BazisLib::SingleMallocVector< RefGroupDescriptor > &groups)
static bool ScanPotentialRPCTable (void *pAddr, std::list< AddressRange > &dataRanges, std::list< AddressRange > &codeRanges, RPCTableInfo &info)

Private Attributes

PatchInfoDatabase m_Database
PatchingParams m_Params
RPCHandlerRecord m_OriginalHandler
RPCHandlerRecord m_PatchedEntryCopy
RPCHandlerRecordm_pPatchedEntry


Detailed Description

Performs patching of GuestRPC mechanism handler table.

VMWare main process (vmware-vmx.exe) contains a table of RPC dispatchers. The RPCTableManager finds this table by building a list of all strings in the original EXE module and finding a structure containing links to the matching strings.

Definition at line 65 of file tablemgr.h.


Member Typedef Documentation

typedef bool(* RPCTableManager::GRPCHANDLER)(void *pContext, int ChannelNumber, char *pCommandBody, unsigned CommandBodyLength, char **ppReply, unsigned *pReplyLen) [private]


Member Enumeration Documentation

anonymous enum [private]

Enumerator:
VerifMaxStringLength 

Definition at line 163 of file tablemgr.h.


Constructor & Destructor Documentation

RPCTableManager::RPCTableManager ( HINSTANCE  hThisDLL  ) 

Definition at line 416 of file tablemgr.cpp.


Member Function Documentation

void RPCTableManager::DoPatch ( RPCHandlerRecord pEntry,
const char *  pszPrefix,
size_t  prefixLen,
GRPCHANDLER  pHandler,
void *  pContext 
) [inline, private]

Definition at line 226 of file tablemgr.h.

bool RPCTableManager::FindHandlerTable ( bool  FullMode = false  )  [private]

Tries to load handler table information from PatchInfoDatabase, and, if not found, scans for it.

Definition at line 347 of file tablemgr.cpp.

Here is the call graph for this function:

void RPCTableManager::FindSections ( char *  lpMainExe,
std::list< AddressRange > &  dataRanges,
std::list< AddressRange > &  codeRanges 
) [static, private]

Definition at line 142 of file tablemgr.cpp.

Here is the call graph for this function:

void RPCTableManager::FindStringRefs ( const std::list< AddressRange > &  dataRanges,
const BazisLib::SingleMallocVector< StringPointer > &  strings,
BazisLib::SingleMallocVector< StringReferenceDescriptor > &  stringRefs 
) [static, private]

Definition at line 218 of file tablemgr.cpp.

Here is the call graph for this function:

void RPCTableManager::GroupStringRefs ( BazisLib::SingleMallocVector< StringReferenceDescriptor > &  stringRefs,
BazisLib::SingleMallocVector< RefGroupDescriptor > &  groups 
) [static, private]

Definition at line 255 of file tablemgr.cpp.

Here is the call graph for this function:

bool RPCTableManager::InstallHandler ( const char *  pszPrefix,
size_t  prefixLen,
RPCTableManager::GRPCHANDLER  pHandler,
void *  pContext,
bool  ForceReinstall 
)

Definition at line 426 of file tablemgr.cpp.

Here is the call graph for this function:

bool RPCTableManager::IsEntryModified (  )  [inline]

Definition at line 243 of file tablemgr.h.

static bool RPCTableManager::islen ( const char *  pStr,
size_t  expected 
) [inline, static, private]

Returns whether pStr points to an ASCIIZ string with length of exact expected bytes.

Definition at line 177 of file tablemgr.h.

void RPCTableManager::MakeListOfStrings ( const std::list< AddressRange > &  dataRanges,
BazisLib::SingleMallocVector< StringPointer > &  strings,
bool  FullMode 
) [static, private]

Definition at line 175 of file tablemgr.cpp.

Here is the call graph for this function:

static bool RPCTableManager::PtrInRange ( const std::list< AddressRange > &  list,
void *  ptr 
) [inline, static, private]

Definition at line 168 of file tablemgr.h.

void RPCTableManager::RestoreOriginalHandler (  ) 

Definition at line 563 of file tablemgr.cpp.

bool RPCTableManager::ScanPotentialRPCTable ( void *  pAddr,
std::list< AddressRange > &  dataRanges,
std::list< AddressRange > &  codeRanges,
RPCTableInfo info 
) [static, private]

Definition at line 308 of file tablemgr.cpp.

Here is the call graph for this function:

static bool RPCTableManager::VerifyEntry ( RPCHandlerRecord pRec,
std::list< AddressRange > &  dataRanges,
std::list< AddressRange > &  codeRanges 
) [inline, static, private]

Returns whether a potential GuestRPC mechanism handler entry is correct and contains no inconsisancies.

Definition at line 186 of file tablemgr.h.

Here is the call graph for this function:


Member Data Documentation

Definition at line 155 of file tablemgr.h.

Definition at line 158 of file tablemgr.h.

PatchingParams RPCTableManager::m_Params [private]

Definition at line 156 of file tablemgr.h.

Definition at line 158 of file tablemgr.h.

Definition at line 159 of file tablemgr.h.


The documentation for this class was generated from the following files: