資源簡(jiǎn)介
VC++寫的韓服輔助源碼,非常值得新人參考學(xué)習(xí)

代碼片段和文件信息
//?CallTracer.cpp:?implementation?of?the?CCallTracer?class.
//
//////////////////////////////////////////////////////////////////////
#include?“stdafx.h“
#include?“CallTracer.h“
#include?
#include?
#pragma?comment(lib?“dbghelp“)
//////////////////////////////////////////////////////////////////////
//?Construction/Destruction
//////////////////////////////////////////////////////////////////////
DWORD?CCallTracer::m_dwSymClients?=?0;
CCallTracer::CCallTracer()
{
????m_dwSymClients++;
????if(m_dwSymClients?<=?1)
????????InitSymbols();
????m_dwOptions?=?CALLTRACE_OPT_INFO_MODULE_FUNC?|?CALLTRACE_OPT_INFO_MODULE_SYMBOL;
}
CCallTracer::~CCallTracer()
{
????m_dwSymClients--;
????if(m_dwSymClients?<=?0)
????????FreeSymbols();
}
HRESULT?CCallTracer::InitSymbols()
{
????BOOL?bRet?=?TRUE;
????DWORD?dwOptions?=?SymGetOptions();
????SymSetOptions(dwOptions?|?SYMOPT_LOAD_LINES
??????????????????|?SYMOPT_DEFERRED_LOADS
??????????????????|?SYMOPT_OMAP_FIND_NEAREST);
????bRet?=?SymInitialize(GetCurrentProcess()
?????????????????????????NULL
?????????????????????????TRUE);
????return?bRet???S_OK?:?E_FAIL;
}
HRESULT?CCallTracer::FreeSymbols()
{
????BOOL?bRet?=?TRUE;
????bRet?=?SymCleanup(GetCurrentProcess());
????return?bRet???S_OK?:?E_FAIL;
}
HRESULT?CCallTracer::WalkStack(PFN_SHOWframe?pfnShowframe
???????????????????????????????PVOID?pParam?int?nMaxframes
???????????????????????????????PCONTEXT?pContext)
{
????HRESULT?hr?=?S_OK;
????STACKframe64?frame;
????int?nCount?=?0;
????TCHAR?szPath[MAX_PATH];
????DWORD?dwTimeMS;
????dwTimeMS?=?GetTickCount();
????assert(pContext?!=?NULL);
????m_Context?=?*pContext;
????memset(&frame?0x0?sizeof(frame));
????frame.AddrPC.Offset????=?m_Context.Eip;
????frame.AddrPC.Mode??????=?AddrModeFlat;
????frame.Addrframe.Offset?=?m_Context.Ebp;
????frame.Addrframe.Mode???=?AddrModeFlat;
????frame.AddrStack.Offset?=?m_Context.Esp;
????frame.AddrStack.Mode???=?AddrModeFlat;
????while(nCount?ames)?{
????????nCount++;
????????if(!StackWalk64(IMAGE_FILE_MACHINE_I386
????????????????????????GetCurrentProcess()?GetCurrentThread()
????????????????????????&frame?&m_Context
????????????????????????NULL
????????????????????????SymFunctionTableAccess64
????????????????????????SymGetModulebase64?NULL))?{
????????????//?Error?occured.
????????????break;
????????}
????????Showframe(&frame?pfnShowframe?pParam);
????????if(frame.Addrframe.Offset?==?0?||?frame.AddrReturn.Offset?==?0)?{
????????????//?End?of?stack.
????????????break;
????????}
????}
????//?Summary
????if(m_dwOptions?&?CALLTRACE_OPT_INFO_SUMMARY)?{
????????_stprintf(szPath?_T(“Total?frames:?%d;?Spend?%d?MS“)
??????????????????nCount???GetTickCount()?-?dwTimeMS);
????????pfnShowframe(szPath?pParam);
????}
????//?Show?symbol?search?path?at?last
????if(m_dwOptions?&?CALLTRACE_OPT_INFO_SEARCHPATH)?{
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
????.......???????221??2015-06-04?19:53??JL_Hanfu\clean?project.bat
????.......??????8334??2015-06-04?19:53??JL_Hanfu\common\CallTracer.cpp
????.......??????1890??2015-06-04?19:53??JL_Hanfu\common\CallTracer.h
????.......??????4744??2015-06-04?19:53??JL_Hanfu\common\CHook.cpp
????.......???????961??2015-06-04?19:53??JL_Hanfu\common\CHook.h
????.......??????1196??2015-06-04?19:53??JL_Hanfu\common\common.h
????.......??????6591??2015-06-04?19:53??JL_Hanfu\common\HookSystemcallx86tox64.cpp
????.......??????1057??2015-06-04?19:53??JL_Hanfu\common\HookSystemcallx86tox64.h
????.......??????5051??2015-06-04?19:53??JL_Hanfu\common\Inject.cpp
????.......???????395??2015-06-04?19:53??JL_Hanfu\common\Inject.h
????.......??????6273??2015-06-04?19:53??JL_Hanfu\common\Inlinehook.cpp
????.......??????1150??2015-06-04?19:53??JL_Hanfu\common\Inlinehook.h
????.......??????7596??2015-06-04?19:53??JL_Hanfu\common\Job.cpp
????.......??????2335??2015-06-04?19:53??JL_Hanfu\common\Job.h
????.......?????25022??2015-06-04?19:53??JL_Hanfu\common\LDasm.cpp
????.......???????743??2015-06-04?19:53??JL_Hanfu\common\LDasm.h
????.......???????644??2015-06-04?19:53??JL_Hanfu\common\Lock.h
????.......??????1143??2015-06-04?19:53??JL_Hanfu\common\Logger.cpp
????.......???????467??2015-06-04?19:53??JL_Hanfu\common\Logger.h
????.......?????10671??2015-06-04?19:53??JL_Hanfu\common\MSJEXHND.cpp
????.......??????1169??2015-06-04?19:53??JL_Hanfu\common\MSJEXHND.h
????.......???????140??2015-06-04?19:53??JL_Hanfu\common\protocol.cpp
????.......??????3012??2015-06-04?19:53??JL_Hanfu\common\protocol.h
????.......??????8442??2015-06-04?19:53??JL_Hanfu\common\RemoteLoadDll.cpp
????.......???????716??2015-06-04?19:53??JL_Hanfu\common\RemoteLoadDll.h
????.......??????2483??2015-06-04?19:53??JL_Hanfu\common\ThreadPool.cpp
????.......??????1266??2015-06-04?19:53??JL_Hanfu\common\ThreadPool.h
????.......??????8138??2015-06-04?19:53??JL_Hanfu\common\Toolhelp.h
????.......??????7236??2015-06-04?19:53??JL_Hanfu\common\TrayIcon.cpp
????.......??????1977??2015-06-04?19:53??JL_Hanfu\common\TrayIcon.h
............此處省略254個(gè)文件信息
- 上一篇:光流法代碼
- 下一篇:sm2算法源碼實(shí)現(xiàn)
評(píng)論
共有 條評(píng)論