资源简介
VC++写的韩服辅助源码,非常值得新人参考学习

代码片段和文件信息
// 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 < nMaxframes) {
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) {
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
....... 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个文件信息
相关资源
- C++中头文件与源文件的作用详解
- C++多线程网络编程Socket
- VC++ 多线程文件读写操作
- 利用C++哈希表的方法实现电话号码查
- 移木块游戏,可以自编自玩,vc6.0编写
- C++纯文字DOS超小RPG游戏
- MFC数字钟(基于VC6.0)
- 安科瑞智能电能表MODBUS通讯程序 VC6
- VC++MFC小游戏实例教程(实例)+MFC类库
- VC6LineNumberAddin.dll
- 用VC6.0实现多边形扫描线填充算法
- 连铸温度场计算程序(C++)
- 6自由度机器人运动学正反解C++程序
- Em算法(使用C++编写)
- libstdc++-4.4.7-4.el6.i686.rpm
- VC++实现CMD命令执行与获得返回信息
- 白话C++(全)
- C++标准库第1、2
- 大数类c++大数类
- C++语言编写串口调试助手
- VC助手 VC6.0助手
- c++素数筛选法
- C++ mqtt 用法
- 商品库存管理系统 C++ MFC
- c++ 多功能计算器
- C++17 In Detail
- 嵌入式QtC++编程课件
- 颜色识别形状识别STM103嵌入式代码
- c++ 邮件多附件群发
- c++ 透明代理(hookproxy)
评论
共有 条评论