)
46 #pragma warning( push ) 47 #pragma warning( disable : 4191 ) 49 #define NCBI_USE_ERRCODE_X Dbapi_DrvrWinHook 258PCSTR pszCalleeModName,
288PCSTR pszCalleeModName,
314(::GetProcAddress(::GetModuleHandleA(
"kernel32.dll"),
"GetProcAddress"));
317(::GetProcAddress(::GetModuleHandleA(
"kernel32.dll"),
"LoadLibraryA"));
351HMODULE hmodOriginal,
524PVOID
GetIAT(HMODULE base,
intsection)
const;
529BOOLEAN MappedAsImage,
569HMODULE hModToolHelp;
570PROC pfnCreateToolhelp32Snapshot;
574 if(hModToolHelp !=
NULL) {
575pfnCreateToolhelp32Snapshot = ::GetProcAddress(
577 "CreateToolhelp32Snapshot" 580bResult = (pfnCreateToolhelp32Snapshot !=
NULL);
582::FreeLibrary(hModToolHelp);
592HMODULE hModPSAPI =
NULL;
595bResult = (hModPSAPI !=
NULL);
597::FreeLibrary(hModPSAPI);
605MEMORY_BASIC_INFORMATION mbi;
607 return((::VirtualQuery(pv, &mbi,
sizeof(mbi)) != 0)
608? (HMODULE) mbi.AllocationBase :
NULL);
614HMODULE hmodOriginal,
621PIMAGE_EXPORT_DIRECTORY pExportDir =
622 static_cast<PIMAGE_EXPORT_DIRECTORY
> 624IMAGE_DIRECTORY_ENTRY_EXPORT));
627 if(pExportDir ==
NULL) {
632PSTR pszDllName =
reinterpret_cast<PSTR
>(
633 static_cast<uintptr_t>(pExportDir->Name) +
634 reinterpret_cast<uintptr_t>(hmodOriginal)
638 DWORDdwFuncNumber = pExportDir->Base;
640 size_tdwNumberOfExported = pExportDir->NumberOfFunctions;
642PDWORD pdwFunctions =
643 reinterpret_cast<PDWORD
>(
644 static_cast<uintptr_t>(pExportDir->AddressOfFunctions) +
645 reinterpret_cast<uintptr_t>(hmodOriginal));
649 reinterpret_cast<PWORD
>(
650 static_cast<uintptr_t>(pExportDir->AddressOfNameOrdinals) +
651 reinterpret_cast<uintptr_t>(hmodOriginal));
654PDWORD pszFuncNames =
655 reinterpret_cast<PDWORD
>(
656 static_cast<uintptr_t>(pExportDir->AddressOfNames) +
657 reinterpret_cast<uintptr_t>(hmodOriginal));
663 for(
size_t i= 0;
i< dwNumberOfExported; ++
i, ++pdwFunctions) {
664 DWORDentryPointRVA = *pdwFunctions;
665 if(entryPointRVA == 0) {
673 for(
unsignedj = 0; j < pExportDir->NumberOfNames; ++j) {
675 if(pwOrdinals[j] ==
i) {
676pszExpFunName =
reinterpret_cast<PSTR
>(
677 static_cast<uintptr_t>(pszFuncNames[j]) +
678 reinterpret_cast<uintptr_t>(hmodOriginal));
682 if((pszExpFunName !=
NULL) &&
683(
strcmp(pszExpFunName, pszFuncName) == 0)
699 charszCalleeModName[MAX_PATH];
700 charszFuncName[MAX_PATH];
705{
"Kernel32.dll",
"LoadLibraryA"},
706{
"Kernel32.dll",
"LoadLibraryW"},
707{
"Kernel32.dll",
"LoadLibraryExA"},
708{
"Kernel32.dll",
"LoadLibraryExW"},
709{
"Kernel32.dll",
"GetProcAddress"}
713 #define NUMBER_OF_MANDATORY_API_FUNCS (sizeof(MANDATORY_API_FUNCS) / \ 714 sizeof(MANDATORY_API_FUNCS[0])) 728m_ModuleHandle(hModule)
768 if(pdest !=
NULL) {
780 if((pszName !=
NULL) && (strlen(pszName))) {
781 m_pszName=
new char[strlen(pszName) + 1];
785 m_pszName=
new char[strlen(
"\0") + 1];
809m_pLibHandler(pLibHandler),
810m_dwProcessId(dwProcessId)
849m_pfnEnumProcesses(
NULL),
850m_pfnEnumProcessModules(
NULL),
851m_pfnGetModuleFileNameExA(
NULL)
914 DWORDpidArray[1024];
920nProcesses = cbNeeded /
sizeof(
DWORD);
924 for(
DWORD i= 0;
i< nProcesses;
i++) {
925HMODULE hModuleArray[1024];
927 DWORDpid = pidArray[
i];
930hProcess = ::OpenProcess(PROCESS_QUERY_INFORMATION |
939::CloseHandle(hProcess);
947 sizeof(hModuleArray),
949::CloseHandle(hProcess);
954nModules = cbNeeded /
sizeof(hModuleArray[0]);
956 for(
DWORDj = 0; j < nModules; j++) {
957HMODULE hModule = hModuleArray[j];
958 charszModuleName[MAX_PATH];
963 sizeof(szModuleName)
974pProcess->
AddModule(pDllModuleInstance);
977::CloseHandle(hProcess);
993 BOOLbPopulateModules)
999HMODULE hModuleArray[1024];
1003hProcess = ::OpenProcess(PROCESS_QUERY_INFORMATION |
1011 sizeof(hModuleArray),
1014::CloseHandle(hProcess);
1018nModules = cbNeeded /
sizeof(hModuleArray[0]);
1020 for(
DWORDj = 0; j < nModules; j++) {
1021HMODULE hModule = hModuleArray[j];
1022 charszModuleName[MAX_PATH];
1027 sizeof(szModuleName)
1038 if(bPopulateModules) {
1045::CloseHandle(hProcess);
1071 if(hInstLib !=
NULL) {
1077::GetProcAddress(hInstLib,
"CreateToolhelp32Snapshot");
1079::GetProcAddress(hInstLib,
"Process32First");
1081::GetProcAddress(hInstLib,
"Process32Next");
1083::GetProcAddress(hInstLib,
"Module32First");
1085::GetProcAddress(hInstLib,
"Module32Next");
1087::FreeLibrary( hInstLib );
1116pProcess->
AddModule(pDllModuleInstance);
1127::CloseHandle(hSnapshot);
1167 if((dwProcessId !=
NULL) && (dwProcessId != pe32.th32ProcessID)) {
1178 if(bPopulateModules) {
1182 if(dwProcessId !=
NULL) {
1188::CloseHandle(hSnapshot);
1199m_pLibHandler(
NULL)
1219 BOOLbPopulateModules)
const 1271m_CalleeModHandle(
NULL),
1284GetSystemInfo(&
si);
1293PVOID pv = * (PVOID*) &
pb[1];
1355PCSTR pszCalleeModName,
1362 if((pfnCurrent !=
NULL) && (pfnNew !=
NULL)) {
1373 if(pProcess !=
NULL) {
1406PCSTR pszCalleeModName,
1414 if(bHookOrRestore ==
false) {
1426PIMAGE_IMPORT_DESCRIPTOR pImportDesc =
1427 static_cast<PIMAGE_IMPORT_DESCRIPTOR
> 1429IMAGE_DIRECTORY_ENTRY_IMPORT));
1432 if(pImportDesc ==
NULL) {
1441 while(pImportDesc->Name) {
1442PSTR pszModName = (PSTR)((PBYTE) hmodCaller + pImportDesc->Name);
1443 if(
my_stricmp(pszModName, pszCalleeModName) == 0) {
1450 if(pImportDesc->Name == 0) {
1462PIMAGE_THUNK_DATA pThunk =
1463(PIMAGE_THUNK_DATA)( (PBYTE) hmodCaller + pImportDesc->FirstThunk );
1466 while(pThunk->u1.Function) {
1468PROC* ppfn = (PROC*) &pThunk->u1.Function;
1471 BOOLbFound = (*ppfn == pfnCurrent);
1474PBYTE pbInFunc = (PBYTE) *ppfn;
1478ppfn = (PROC*) &pbInFunc[1];
1480bFound = (*ppfn == pfnCurrent);
1488 if(::VirtualProtect(ppfn,
1491&dwOldProtect) ==
FALSE 1501::VirtualProtect(ppfn,
1509 if(bHookOrRestore) {
1569 if(::IsBadReadPtr(pszFullFileName, MAX_PATH) !=
TRUE) {
1574pdest = strrchr(pszFullFileName, ch);
1576strcpy(pszFullFileName, &pdest[1]);
1586HMODULE hmodOriginal,
1587 DWORDdwFuncOrdinalNum,
1593strcpy(pszFuncName,
"\0");
1596PIMAGE_EXPORT_DIRECTORY pExportDir =
1597 static_cast<PIMAGE_EXPORT_DIRECTORY
> 1599IMAGE_DIRECTORY_ENTRY_EXPORT));
1602 if(pExportDir ==
NULL) {
1607PSTR pszDllName =
reinterpret_cast<PSTR
>(
1608 static_cast<uintptr_t>(pExportDir->Name) +
1609 reinterpret_cast<uintptr_t>(hmodOriginal)
1613 DWORDdwFuncNumber = pExportDir->Base;
1615 size_tdwNumberOfExported = pExportDir->NumberOfFunctions;
1617PDWORD pdwFunctions =
1618 reinterpret_cast<PDWORD
>(
1619 static_cast<uintptr_t>(pExportDir->AddressOfFunctions) +
1620 reinterpret_cast<uintptr_t>(hmodOriginal));
1623 reinterpret_cast<PWORD
>(
1624 static_cast<uintptr_t>(pExportDir->AddressOfNameOrdinals) +
1625 reinterpret_cast<uintptr_t>(hmodOriginal));
1627PDWORD pszFuncNames =
1628 reinterpret_cast<PDWORD
>(
1629 static_cast<uintptr_t>(pExportDir->AddressOfNames) +
1630 reinterpret_cast<uintptr_t>(hmodOriginal));
1636 for(
size_t i= 0;
i< dwNumberOfExported; ++
i, ++pdwFunctions) {
1637 DWORDentryPointRVA = *pdwFunctions;
1638 if(entryPointRVA == 0) {
1646 for(
unsignedj = 0; j < pExportDir->NumberOfNames; ++j) {
1648 if(pwOrdinals[j] ==
i) {
1649pszExpFunName =
reinterpret_cast<PSTR
>(
1650 static_cast<uintptr_t>(pszFuncNames[j]) +
1651 reinterpret_cast<uintptr_t>(hmodOriginal));
1655 if(dwFuncOrdinalNum == pwOrdinals[j] + 1) {
1656 if((pszExpFunName !=
NULL) && (strlen(pszExpFunName) > 0)) {
1657strcpy(pszFuncName, pszExpFunName);
1671PCSTR pszCalleeModName,
1672 DWORDdwFuncOrdinalNum,
1676HMODULE hmodOriginal = ::GetModuleHandleA(pszCalleeModName);
1687HMODULE hmodOriginal,
1688 DWORDdwFuncOrdinalNum,
1703PCSTR pszFuncName)
const 1706 charszFuncName[MAX_PATH];
1710 if((pszFuncName) &&
1711(
reinterpret_cast<uintptr_t>(pszFuncName) > 0xFFFF) &&
1712strlen(pszFuncName)) {
1713strcpy(szFuncName, pszFuncName);
1720 static_cast<DWORD>(
1721 reinterpret_cast<uintptr_t>(pszFuncName)),
1728 if(strlen(szFuncName) > 0) {
1738 if(fn_it != fn_list.
end()) {
1739pHook = fn_it->second;
1750PCSTR pszFuncName)
const 1753 charszFuncName[MAX_PATH];
1757 if((pszFuncName) &&
1758(
reinterpret_cast<uintptr_t>(pszFuncName) > 0xFFFF) &&
1759strlen(pszFuncName)) {
1760strcpy(szFuncName, pszFuncName);
1767 static_cast<DWORD>(
1768 reinterpret_cast<uintptr_t>(pszFuncName)),
1775 if(strlen(szFuncName) > 0) {
1787 if(fn_it != fn_list.
end()) {
1788pHook = fn_it->second;
1800 if(pHook !=
NULL) {
1803 m_ModuleList[pHook->GetCalleeModHandle()][pHook->GetFuncName()] =
1815 if(pHook !=
NULL) {
1823fn_list.
find(pHook->GetFuncName());
1825 if(fn_it != fn_list.
end()) {
1826fn_list.
erase(fn_it);
1837fn_list.
find(pHook->GetFuncName());
1839 if(fn_it != fn_list.
end()) {
1841fn_list.
erase(fn_it);
1857m_bSystemFuncsHooked(
FALSE)
1861 static boolenabled_from_registry =
true;
1870enabled_from_registry =
false;
1873 "Windows API hooking is disabled from registry.");
1876enabled_from_registry =
true;
1878}
else if(!enabled_from_registry) {
1881 "Windows API hooking is disabled from registry.");
1905 return(instance.
Get());
1919 if(bResult ==
FALSE) {
1921<<
"LoadLibraryA is not hooked in " 1933 if(bResult ==
FALSE) {
1935<<
"LoadLibraryW is not hooked in " 1947 if(bResult ==
FALSE) {
1949<<
"LoadLibraryExA is not hooked in " 1961 if(bResult ==
FALSE) {
1963<<
"LoadLibraryExW is not hooked in " 1975 if(bResult ==
FALSE) {
1977<<
"GetProcAddress is not hooked in" 2024PROC pfnOrig =
NULL;
2032::GetModuleHandleA(pszCalleeModName),
2038 if(pfnOrig ==
NULL) {
2041 if(
NULL!= hmod) {
2043::GetModuleHandleA(pszCalleeModName),
2049 if(pfnOrig !=
NULL) {
2104<<
" is not hooked in " 2126 if(pHook !=
NULL) {
2127bResult = pHook->UnHookImport();
2141 if((hmod !=
NULL) && ((dwFlags & LOAD_LIBRARY_AS_DATAFILE) == 0))
2161pHook->ReplaceInOneModule(
2163pHook->GetCalleeModName(),
2164pHook->GetPfnOrig(),
2165pHook->GetPfnHook(),
2175HMODULE hmod =
NULL;
2189HMODULE hmod =
NULL;
2205HMODULE hmod =
NULL;
2223HMODULE hmod =
NULL;
2240FARPROC pfn =
NULL;
2249 if(pFuncHook !=
NULL) {
2252pfn = pFuncHook->GetPfnHook();
2275m_ModDbghelp(
NULL),
2276m_ImageDirectoryEntryToData(
NULL)
2284 "ImageDirectoryEntryToData" 2289 "Dbghelp.dll does not have " 2290 "ImageDirectoryEntryToData symbol");
2295 "Dbghelp.dll not found");
2303::FreeLibrary(m_ModDbghelp);
2314 return(instance.
Get());
2349<<
"ExitProcess is not hooked in " 2370 returninstance.
Get();
2380TRegistry::iterator it = find(
2401TRegistry::iterator it = find(
2439 for(; *left != 0 && *right != 0; ++left, ++right) {
2442 if(cl >=
'A'&& cl <=
'Z')
2444 if(cr >=
'A'&& cr <=
'Z')
2464 #pragma warning( pop )static CNcbiApplication * Instance(void)
Singleton method.
Helper class for object allocation/deallocation.
T & Get(void)
Create the variable if not created yet, return the reference.
~CExeModuleInstance(void)
CExeModuleInstance(CLibHandler *pLibHandler, char *pszName, HMODULE hModule, DWORD dwProcessId)
size_t GetModuleCount(void) const
CModuleInstance * GetModuleByIndex(size_t dwIndex) const
DWORD GetProcessId(void) const
Returns process id.
BOOL PopulateModules(void)
CLibHandler * m_pLibHandler
PROC GetPfnHook(void) const
PROC GetPfnOrig(void) const
BOOL IsMandatory(void)
Indicates whether the hooked function is mandatory one.
HMODULE GetCalleeModHandle(void) const
set< HMODULE > TModuleSet
CHookedFunction(PCSTR pszCalleeModName, PCSTR pszFuncName, PROC pfnOrig, PROC pfnHook)
char m_szCalleeModName[MAX_PATH]
PCSTR GetCalleeModName(void) const
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.
TModuleSet m_HookedModuleSet
Set of hoocked modules.
char m_szFuncName[MAX_PATH]
BOOL HookImport(void)
Set up a new hook function.
BOOL ReplaceInAllModules(bool bHookOrRestore, PCSTR pszCalleeModName, PROC pfnCurrent, PROC pfnNew)
Replace the address of a imported function entry in all modules.
static PVOID sm_pvMaxAppAddr
Maximum private memory address.
PCSTR GetFuncName(void) const
BOOL UnHookImport(void)
Restore the original API handler.
BOOL DoHook(bool bHookOrRestore, PROC pfnCurrent, PROC pfnNew)
Perform actual replacing of function pointers.
HMODULE m_CalleeModHandle
static HMODULE WINAPI LoadLibraryExA(LPCSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)
static HMODULE WINAPI LoadLibraryA(LPCSTR lpLibFileName)
static FLoadLibraryExA sm_FLoadLibraryExA
unsigned long long m_ImageEnd
static FLoadLibraryW sm_FLoadLibraryW
static HMODULE WINAPI LoadLibraryExW(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)
static HMODULE WINAPI LoadLibraryW(LPCWSTR lpLibFileName)
static FLoadLibraryExW sm_FLoadLibraryExW
DWORD GetRVAFromExportSection(HMODULE hmodOriginal, PCSTR pszFuncName)
static FExitProcess sm_FExitProcess
static FARPROC WINAPI GetProcAddress(HMODULE hModule, LPCSTR lpProcName)
static FGetProcAddress sm_FGetProcAddress
static VOID WINAPI ExitProcess(UINT uExitCode)
unsigned long long m_ImageStart
PIMAGE_NT_HEADERS m_nt_header
bool IsPatched(const void *addr)
static FLoadLibraryA sm_FLoadLibraryA
unique_ptr< CExeModuleInstance > m_pProcess
virtual BOOL PopulateModules(CModuleInstance *pProcess)=0
CExeModuleInstance * GetExeModuleInstance(void) const
virtual BOOL PopulateProcess(DWORD dwProcessId, BOOL bPopulateModules)=0
virtual ~CLibHandler(void)
char * GetBaseName(void) const
Returns only the filename of the executable file for the process or DLL.
char * GetName(void) const
Returns Full path and filename of the executable file for the process or DLL.
HMODULE GetHandle(void) const
Returns module handle.
TInternalList m_pInternalList
void SetName(char *pszName)
Sets Full path and filename of the executable file for the process or DLL.
void ReleaseModules(void)
void AddModule(CModuleInstance *pModuleInstance)
CModuleInstance(char *pszName, HMODULE hModule)
void SetHandle(HMODULE handle)
vector< CModuleInstance * > TInternalList
static CPEi386 & GetInstance(void)
PVOID(WINAPI * FImageDirectoryEntryToData)(PVOID Base, BOOLEAN MappedAsImage, USHORT DirectoryEntry, PULONG Size)
FImageDirectoryEntryToData m_ImageDirectoryEntryToData
PVOID GetIAT(HMODULE base, int section) const
virtual ~CPsapiHandler(void)
FGetModuleFileNameExA m_pfnGetModuleFileNameExA
FEnumProcesses m_pfnEnumProcesses
virtual BOOL PopulateModules(CModuleInstance *pProcess)
virtual BOOL PopulateProcess(DWORD dwProcessId, BOOL bPopulateModules)
FEnumProcessModules m_pfnEnumProcessModules
The taskManager dynamically decides whether to use ToolHelp library or PSAPI This is a proxy class to...
CExeModuleInstance * GetProcess(void) const
CLibHandler * m_pLibHandler
BOOL PopulateProcess(DWORD dwProcessId, BOOL bPopulateModules) const
container_type::const_iterator const_iterator
container_type::iterator iterator
const_iterator end() const
const_iterator find(const key_type &key) const
iterator_bool insert(const value_type &val)
const_iterator find(const key_type &key) const
const_iterator end() const
parent_type::const_iterator const_iterator
static const char si[8][64]
struct parameters_t * pb[]
const CNcbiRegistry & GetConfig(void) const
Get the application's cached configuration parameters (read-only).
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
@ eRetriable_No
It makes no sense to retry the action.
#define NCBI_CURRENT_FUNCTION
Get current function name.
#define ERR_POST_X(err_subcode, message)
Error posting with default error code and given error subcode.
#define NCBI_CATCH_ALL_X(err_subcode, message)
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
void Warning(CExceptionArgs_Base &args)
TErrCode GetErrCode(void) const
virtual const char * GetErrCodeString(void) const
Get error code interpreted as text.
virtual bool GetBool(const string §ion, const string &name, bool default_value, TFlags flags=0, EErrAction err_action=eThrow) const
Get boolean value of specified parameter name.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
BOOL UnHookImport(PCSTR pszCalleeModName, PCSTR pszFuncName)
Restore hooked up API function.
void WINAPI HackModuleOnLoad(HMODULE hmod, DWORD dwFlags)
Used when a DLL is newly loaded after hooking a function.
BOOL m_bSystemFuncsHooked
Determines whether all system functions has been successfuly hacked.
void UnHookAllFuncs(void)
void operator=(const CApiHookMgr &)
int my_stricmp(const char *left, const char *right)
vector< TFunct > TRegistry
static FARPROC WINAPI xs_GetProcAddressWindows(HMODULE hmod, PCSTR pszProcName)
Returns original address of the API function.
CHookedFunctions m_pHookedFunctions
Container keeps track of all hacked functions.
virtual const char * GetErrCodeString(void) const
Translate from the error code value to its string representation.
void x_GetFunctionNameByOrdinal(PCSTR pszCalleeModName, DWORD dwFuncOrdinalNum, PSTR pszFuncName) const
Return the name of the function by its ordinal value.
CRef< CHookedFunction > GetHookedFunction(HMODULE hmod, PCSTR pszFuncName) const
Return the address of an CHookedFunction object Protected version.
BOOL HookImport(PCSTR pszCalleeModName, PCSTR pszFuncName, PROC pfnHook)
Hook up an API.
static HMODULE WINAPI MyLoadLibraryExW(PCWSTR pszModuleName, HANDLE hFile, DWORD dwFlags)
Used to trap events when DLLs are loaded.
bool HaveHookedFunctions(void) const
Indicates whether there is hooked function.
static HMODULE WINAPI MyLoadLibraryW(PCWSTR pszModuleName)
Used to trap events when DLLs are loaded.
static COnExitProcess & Instance(void)
static FARPROC WINAPI MyGetProcAddress(HMODULE hmod, PCSTR pszProcName)
Returns address of replacement function if hooked function is requested.
void x_UnHookAllFuncs(void)
Unhook all functions and restore original ones.
void Remove(TFunct funct)
TModuleNameList m_ModuleNameList
CRef< CHookedFunction > GetHookedFunction(PCSTR pszCalleeModName, PCSTR pszFuncName) const
Return the address of an CHookedFunction object.
static HMODULE WINAPI MyLoadLibraryExA(PCSTR pszModuleName, HANDLE hFile, DWORD dwFlags)
Used to trap events when DLLs are loaded.
BOOL RemoveHook(const CRef< CHookedFunction > pHook)
Remove exising object pointer from the container.
BOOL x_RemoveHook(PCSTR pszCalleeModName, PCSTR pszFuncName)
Remove intercepted function from the container.
BOOL x_GetFunctionNameFromExportSection(HMODULE hmodOriginal, DWORD dwFuncOrdinalNum, PSTR pszFuncName) const
Return the name of the function from EAT by its ordinal value.
bool HaveHookedFunctions(void) const
BOOL x_HookSystemFuncs(void)
Hook all needed system functions in order to trap loading libraries.
static void WINAPI xs_ExitProcess(UINT uExitCode)
static CApiHookMgr & GetInstance(void)
static HMODULE WINAPI MyLoadLibraryA(PCSTR pszModuleName)
Used to trap events when DLLs are loaded.
BOOL AddHook(const CRef< CHookedFunction > pHook)
Add a new object to the container.
BOOL x_AddHook(PCSTR pszCalleeModName, PCSTR pszFuncName, PROC pfnOrig, PROC pfnHook)
Add a newly intercepted function to the container.
#define INVALID_HANDLE_VALUE
A value for an invalid file handle.
#define HANDLE
An abstraction for a file handle.
Definition of all error codes used in dbapi libraries (dbapi_driver.lib and others).
static BOOL ExtractModuleFileName(char *pszFullFileName)
BOOL(WINAPI * FProcess32Next)(HANDLE hSnapshot, LPPROCESSENTRY32_A lppe)
static HMODULE ModuleFromAddress(PVOID pv)
BOOL(WINAPI * FModule32Next)(HANDLE hSnapshot, LPMODULEENTRY32_A lpme)
HMODULE(WINAPI * FLoadLibraryExA)(LPCSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)
HANDLE(WINAPI * FCreateToolHelp32Snapshot)(DWORD dwFlags, DWORD th32ProcessID)
static FLoadLibraryA g_LoadLibraryA
BOOL(WINAPI * FEnumProcessModules)(HANDLE hProcess, HMODULE *lphModule, DWORD cb, LPDWORD lpcbNeeded)
HMODULE(WINAPI * FLoadLibraryA)(LPCSTR lpLibFileName)
BOOL(WINAPI * FProcess32First)(HANDLE hSnapshot, LPPROCESSENTRY32_A lppe)
static FGetProcAddress g_FGetProcAddress
HMODULE(WINAPI * FLoadLibraryW)(LPCWSTR lpLibFileName)
VOID(WINAPI * FExitProcess)(UINT uExitCode)
BOOL(WINAPI * FEnumProcesses)(DWORD *lpidProcess, DWORD cb, DWORD *cbNeeded)
static BOOL IsToolHelpSupported(void)
static BOOL IsPsapiSupported(void)
DWORD(WINAPI * FGetModuleFileNameExA)(HANDLE hProcess, HMODULE hModule, LPSTR lpFilename, DWORD nSize)
BOOL(WINAPI * FModule32First)(HANDLE hSnapshot, LPMODULEENTRY32_A lpme)
HMODULE(WINAPI * FLoadLibraryExW)(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)
FARPROC(WINAPI * FGetProcAddress)(HMODULE hModule, LPCSTR lpProcName)
const API_FUNC_ID MANDATORY_API_FUNCS[]
int strcmp(const char *str1, const char *str2)
#define TH32CS_SNAPMODULE
#define TRUE
bool replacment for C indicating true.
#define FALSE
bool replacment for C indicating false.
struct tagPROCESSENTRY32 PROCESSENTRY32_A
MODULEENTRY32_A * LPMODULEENTRY32_A
PROCESSENTRY32_A * LPPROCESSENTRY32_A
#define NUMBER_OF_MANDATORY_API_FUNCS
MODULEENTRY32_A * PMODULEENTRY32_A
PROCESSENTRY32_A * PPROCESSENTRY32_A
Defines the CNcbiApplication and CAppException classes for creating NCBI applications.
char szFuncName[MAX_PATH]
char szCalleeModName[MAX_PATH]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4