#include <tablemgr.h>
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 |
RPCHandlerRecord * | m_pPatchedEntry |
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.
typedef bool(* RPCTableManager::GRPCHANDLER)(void *pContext, int ChannelNumber, char *pCommandBody, unsigned CommandBodyLength, char **ppReply, unsigned *pReplyLen) [private] |
anonymous enum [private] |
RPCTableManager::RPCTableManager | ( | HINSTANCE | hThisDLL | ) |
Definition at line 416 of file tablemgr.cpp.
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.
void RPCTableManager::FindSections | ( | char * | lpMainExe, | |
std::list< AddressRange > & | dataRanges, | |||
std::list< AddressRange > & | codeRanges | |||
) | [static, private] |
void RPCTableManager::FindStringRefs | ( | const std::list< AddressRange > & | dataRanges, | |
const BazisLib::SingleMallocVector< StringPointer > & | strings, | |||
BazisLib::SingleMallocVector< StringReferenceDescriptor > & | stringRefs | |||
) | [static, private] |
void RPCTableManager::GroupStringRefs | ( | BazisLib::SingleMallocVector< StringReferenceDescriptor > & | stringRefs, | |
BazisLib::SingleMallocVector< RefGroupDescriptor > & | groups | |||
) | [static, private] |
bool RPCTableManager::InstallHandler | ( | const char * | pszPrefix, | |
size_t | prefixLen, | |||
RPCTableManager::GRPCHANDLER | pHandler, | |||
void * | pContext, | |||
bool | ForceReinstall | |||
) |
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] |
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] |
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.
PatchInfoDatabase RPCTableManager::m_Database [private] |
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.
RPCHandlerRecord* RPCTableManager::m_pPatchedEntry [private] |
Definition at line 159 of file tablemgr.h.