NCBI C++ ToolKit
Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes
NWinHook::CHookedFunction Class Reference

Search Toolkit Book for NWinHook::CHookedFunction

class CHookedFunction More...

+ Inheritance diagram for NWinHook::CHookedFunction:
+ Collaboration diagram for NWinHook::CHookedFunction:

List of all members.

Public Member Functions

 CHookedFunction (PCSTR pszCalleeModName, PCSTR pszFuncName, PROC pfnOrig, PROC pfnHook)
 ~CHookedFunction (void)
HMODULE GetCalleeModHandle (void) const
PCSTR GetCalleeModName (void) const
PCSTR GetFuncName (void) const
PROC GetPfnHook (void) const
PROC GetPfnOrig (void) const
BOOL HookImport (void)
 Set up a new hook function.
BOOL UnHookImport (void)
 Restore the original API handler.
BOOL ReplaceInOneModule (bool bHookOrRestore, PCSTR pszCalleeModName, PROC pfnCurrent, PROC pfnNew, HMODULE hmodCaller)
 Replace the address of the function in the IAT of a specific module.
BOOL IsMandatory (void)
 Indicates whether the hooked function is mandatory one.

Private Types

typedef set< HMODULE > TModuleSet

Private Member Functions

BOOL DoHook (bool bHookOrRestore, PROC pfnCurrent, PROC pfnNew)
 Perform actual replacing of function pointers.
BOOL ReplaceInAllModules (bool bHookOrRestore, PCSTR pszCalleeModName, PROC pfnCurrent, PROC pfnNew)
 Replace the address of a imported function entry in all modules.

Private Attributes

BOOL m_bHooked
HMODULE m_CalleeModHandle
char m_szCalleeModName [MAX_PATH]
char m_szFuncName [MAX_PATH]
PROC m_pfnOrig
PROC m_pfnHook
TModuleSet m_HookedModuleSet
 Set of hoocked modules.

Static Private Attributes

static PVOID sm_pvMaxAppAddr = NULL
 Maximum private memory address.

Detailed Description

class CHookedFunction

Definition at line 236 of file ncbi_win_hook.cpp.


Member Typedef Documentation

typedef set<HMODULE> NWinHook::CHookedFunction::TModuleSet [private]

Definition at line 267 of file ncbi_win_hook.cpp.


Constructor & Destructor Documentation

NWinHook::CHookedFunction::CHookedFunction ( PCSTR  pszCalleeModName,
PCSTR  pszFuncName,
PROC  pfnOrig,
PROC  pfnHook 
)

Member Function Documentation

BOOL NWinHook::CHookedFunction::DoHook ( bool  bHookOrRestore,
PROC  pfnCurrent,
PROC  pfnNew 
) [private]

Perform actual replacing of function pointers.

Definition at line 1525 of file ncbi_win_hook.cpp.

References m_szCalleeModName, and ReplaceInAllModules().

Referenced by HookImport(), and UnHookImport().

Definition at line 1313 of file ncbi_win_hook.cpp.

References m_CalleeModHandle.

Definition at line 1318 of file ncbi_win_hook.cpp.

References m_szCalleeModName.

Definition at line 1323 of file ncbi_win_hook.cpp.

References m_szFuncName.

Definition at line 1328 of file ncbi_win_hook.cpp.

References m_pfnHook.

Definition at line 1333 of file ncbi_win_hook.cpp.

References m_pfnOrig.

Set up a new hook function.

Definition at line 1338 of file ncbi_win_hook.cpp.

References DoHook(), m_bHooked, m_pfnHook, m_pfnOrig, and TRUE.

BOOL NWinHook::CHookedFunction::ReplaceInAllModules ( bool  bHookOrRestore,
PCSTR  pszCalleeModName,
PROC  pfnCurrent,
PROC  pfnNew 
) [private]
BOOL NWinHook::CHookedFunction::ReplaceInOneModule ( bool  bHookOrRestore,
PCSTR  pszCalleeModName,
PROC  pfnCurrent,
PROC  pfnNew,
HMODULE  hmodCaller 
)

Restore the original API handler.

Definition at line 1345 of file ncbi_win_hook.cpp.

References DoHook(), FALSE, m_bHooked, m_pfnHook, and m_pfnOrig.

Referenced by ~CHookedFunction().


Member Data Documentation

Definition at line 269 of file ncbi_win_hook.cpp.

Referenced by HookImport(), and UnHookImport().

Definition at line 270 of file ncbi_win_hook.cpp.

Referenced by CHookedFunction(), and GetCalleeModHandle().

Set of hoocked modules.

Definition at line 278 of file ncbi_win_hook.cpp.

Referenced by ReplaceInOneModule().

Definition at line 274 of file ncbi_win_hook.cpp.

Referenced by GetPfnHook(), HookImport(), and UnHookImport().

Definition at line 273 of file ncbi_win_hook.cpp.

Referenced by CHookedFunction(), GetPfnOrig(), HookImport(), and UnHookImport().

Definition at line 271 of file ncbi_win_hook.cpp.

Referenced by CHookedFunction(), DoHook(), GetCalleeModName(), and IsMandatory().

char NWinHook::CHookedFunction::m_szFuncName[MAX_PATH] [private]

Definition at line 272 of file ncbi_win_hook.cpp.

Referenced by CHookedFunction(), GetFuncName(), and IsMandatory().

PVOID NWinHook::CHookedFunction::sm_pvMaxAppAddr = NULL [static, private]

Maximum private memory address.

Definition at line 276 of file ncbi_win_hook.cpp.

Referenced by CHookedFunction(), and ReplaceInOneModule().


The documentation for this class was generated from the following file:
Modified on Sat Jul 12 17:03:18 2014 by modify_doxy.py rev. 426318