Figure 3: Excerpt from log.cpp
/*----------------------------------------------------------------- FUNCTION: Logger::IntrerceptEntry PURPOSE: Main entry of the interceptor of exported functions and COM methods. It will be called by our stubs. PARAMETERS: . ASM_APIFunctionStub * p_pStub Pointer to the calling stub PDWORD p_pdwFrame function call stack frame -----------------------------------------------------------------*/ /*static*/ void __stdcall Logger::IntrerceptEntry ( ASM_APIFunctionStub * p_pStub, PDWORD p_pdwFrame ) { char l_szPrintedParams[512]; DWORD l_dwThis = 0; //__try //It will be nice to protect ourselves, //but hard without C library { int l_iNestedLevel = 0; PrivateStackFrame * l_pFrame = g_Data.m_pRetMgr? g_Data.m_pRetMgr->pInterceptFunctionReturn (p_pStub, p_pdwFrame, &l_iNestedLevel) : NULL; *l_szPrintedParams = 0; if(l_pFrame) { if(p_pdwFrame) p_pdwFrame++;//Skip DWORD return address ParamProcContext l_Context( *((FunctionParameters *)p_pStub->m_dwParamsOffset), *l_pFrame, p_pdwFrame, FALSE); l_Context.iProcAllParams(l_szPrintedParams, sizeof(l_szPrintedParams)); l_dwThis = l_Context.dwGetThis(); } vLogFunction(p_pStub, NULL, l_szPrintedParams, l_dwThis, l_iNestedLevel); // Patch the return address of this function so // that returns to us } /* __except(1) { MYTRACE(TF_Error, "ERROR : exception inside IntrerceptEntry"); } */ }//void __stdcall IntrerceptEntry