CE ( Cheat Engine ) 插 件 开 发 文 档 [译] (1)

CE ( Cheat Engine ) 插 件 开 发 文 档 [译] (1)

**************************************************
*****************Welcome to read******************
**************************************************
*本文件由仍唱我的歌翻译,如果转载,请通过作者同意! 
*作者:  仍唱我的歌
*QQ:  77039166,443027
*MSN:  Miya_Wong@hotmail.com,wsq8589@126.com
*ICQ:  460577281
*Blog: http://blog.sina.com.cn/miyauu
*HomePage: http://flyuu.cn
*翻译时间:   2007年7月21日星期六
*如有错误,请及时与作者,联系并给予纠正信息。再次谢谢您的阅读
**************************************************

Cheat Engine插件系统允许你为Cheat Engine应用程序增加功能. 这要取决于您对它的功能补充.

这个文件将描述从您的Dll中导出的函数,以及您返回的结果,和这个导出函数导入您的Dll。

---------------------------------

1: 你的Dll导出的函数
本节将说明哪些是导出函数,和他们所得到的,还有返回的。

1.1: BOOL GetVersion(struct PluginVersion *pv, int sizeofpluginversion);

此例行得到填充过一个结构体指针,和这个结构体的长度。

PluginVersion的格式:
struct PluginVersion
{
  unsigned int version; //这里写最低版本。与Dll是否符合(目前只支持1个)
  char *pluginname;  //使这个指针指向以0结尾的字符串(在你的dll里分配内存或者静态地址,而不是在栈)
};

返回值将会为 TRUE


1.2: BOOL InitializePlugin(struct ExportedFunctions *ef , int pluginid);

当这个插件被激活时这个例行会被调用。它接收包含所有的CE内部的函数指针和变量指针的结构体指针。所有的函数使用stdcall调用约定。(译者提醒:关于stdcall的说明,和stdcall的调用约定请查阅MSDN,这里不予讲解)

ExportedFunctions 的格式:
struct ExportedFunctions
{
  int sizeofExportedFunctions;
  PVOID ShowMessage; //指向CE的 showmessgae 函数 (译者提醒:MSDN:PVOID Pointer to any type. 意思为PVOID 指向任何类型。下文如同)
  PVOID RegisterFunction; //用此来注册一个特定类型的插件
  PVOID UnregisterFunction; //卸载一个用RegisterFunction注册过的一个函数
  PULONG OpenedProcessID; //指向一个当前选中的进程ID
  /*译者提醒:MSDN:PULONG Pointer to a ULONG.这里给大家(不懂VC的)说两句,微软定义的一些类型基本上是从某个基类型来的。
  *MSDN:typedef [attributes] basetype aliasname;  这是 typedef 的用法。
  *
  *[attributer] (译者提醒:attributer 的意思是属性 )  我给大家翻译一下:
  *Any attribute specifications must follow    任何属性必须遵循 typedef 关键字,如果没有属性,并且没有其它类型(例如:
  *the typedef keyword. If no attributes     enum, struct, 或 union)被指明,这个别名会当作一个 #define(译者提醒:
  *and no other type (for example, enum, struct,  #define 在C/C++ 中为宏定义)而且不会出现在类型库中。如果没有你想得到的
  *or union) are specified, the alias is treated  属性,在类型库中,public 可以被用作明确地包含这个别名。在 typedef 之前,
  *as a #define and does not appear in the type   helpstring, helpcontext, 和 uuid 属性可以被认可。更多的信息,请参阅
  *library. If no other attribute is desired,   Attribute Descrtiptions.如果 uuid 被忽略,这个类型定义不会被单独的
  *public can be used to explicitly include the   指定到系统。
  *alias in the type library. The helpstring,   
  *helpcontext, and uuid attributes are accepted  
  *before a typedef. For more information, see
  *Attribute Descriptions. If uuid is omitted,    
  *the typedef is not uniquely specified in the system.  
  *//
  *//
  *//
  *basetype (译者提醒:basetype 的意思是基类型,就是像int long char 这些的类型)
  *   The type for which the alias is defined.    别名指定的类型
  *//
  *//
  *//
  *aliasname (译者提醒:aliasname 的意思是别名的名字)
  *   Name by which the type will be known in the type library. 这个将会被发表到类型库里的类型名字
  *//
  *//
  *看到这里,你是不是会有些迷茫呢?呵呵,也许是我的英文翻译水平太差了吧,没办法,我也是只上过小学,不要告诉别人啊。
  *我给大家举一个例子:
  *   typedef [public]  long DWORD;
  *这个例行的意思是用 DWORD 来表示 long 类型(切记,不是替代),所以我用 long 定义一个变量,再用 DWORD 定义一个变量,
  *他们的类型是一样的,直接可以进行转换。这回您是否看懂了呢?如果还是没懂,哎,您联系我,呵,我再给您讲一遍
  *在VC++6.0里面,微软定义的许多类型都是某个英文单词或者是它的缩写,比如拿 PUINT 来说吧,P 是 Pointer 的意思,
  *而 Pointer 的意思是指针,UNIT 是U + INT,呵呵,聪明的你一定会想到 U = unsigned(意为无符号的),所以 PUINT 是指向一个
  *无符号的整型。这回您懂了吗?
  *下面还将会出现这种方式的类型,我想您一定会想到它是什么类型的!
  *//
  *//
  *//
  */
 
  PHANDLE OpenedProcessHandle; //指向一个当前选中的进程句柄

  PVOID GetMainWindowHandle; //返回一个主窗口的句柄(无论是什么前提, 推荐使用 delphi 做一个真正的用户界面升级)
  PVOID AutoAssembler; //指向 AutoAssembler 函数的指针
  PVOID ce_assembler; //指向 assembler 函数的指针
  PVOID ce_disassembler; //指向 disassembler 函数的指针
  PVOID ce_ChangeRegistersAtAddress; //指向 ChangeRegAtBP 函数的指针
  PVOID ce_InjectDLL; //指向 ce 的 Inject DLL 函数指针的指针
  PVOID ce_freezemem; //指向一个 冻结存贮器的程序的指针
  PVOID ce_unfreezemem; //指向一个 解冻存贮器程序 (用它从 冻结存贮器 撤消冻结)的指针
  PVOID ce_fixmem; //指向一个 修理存贮器 程序的指针
  PVOID ce_processlist; //指向一个 进程列表 程序的指针
  PVOID ce_ReloadSettings; //指向一个 刷新设置 程序的指针
  PVOID ce_GetAddressFromPointer; //指向一个 GetAddressFromPointer 的指针

  //指向一个包含函数指针的地址
  PVOID ReadProcessMemory;   //指向一个指向 ReadProcessMemory 指针的指针 (改变它为API Hook, 或者你自己用它)
  PVOID WriteProcessMemory;   //指向一个指向 WriteProcessMemory 指针的指针 (改变它为API Hook, 或者你自己用它)

  PVOID GetThreadContext;   //   ...
  PVOID SetThreadContext;   //   ...
  PVOID SuspendThread;    //   ...
  PVOID ResumeThread;    //   ...
  PVOID OpenProcess;    //   ...
  PVOID WaitForDebugEvent;   //   ...
  PVOID ContinueDebugEvent;   //   ...
  PVOID DebugActiveProcess;   //   ...
  PVOID StopDebugging;    //   ...
  PVOID StopRegisterChange;   //   ...
  PVOID VirtualProtect;    //   ...
  PVOID VirtualProtectEx;   //   ...
  PVOID VirtualQueryEx;    //   ...
  PVOID VirtualAllocEx;    //   ...
  PVOID CreateRemoteThread;   //   ...
  PVOID OpenThread;    //   ...
  PVOID GetPEProcess;    //   ...
  PVOID GetPEThread;    //   ...
  PVOID GetThreadsProcessOffset;  //   ...
  PVOID GetThreadListEntryOffset;  //   ...
  PVOID GetProcessnameOffset;   //   ...
  PVOID GetDebugportOffset;   //   ...
  PVOID GetPhysicalAddress;   //   ...
  PVOID ProtectMe;    //   ...
  PVOID GetCR4;     //   ...
  PVOID GetCR3;     //   ...
  PVOID SetCR3;     //   ...
  PVOID GetSDT;     //   ...
  PVOID GetSDTShadow;    //   ...
  PVOID setAlternateDebugMethod;  //   ...
  PVOID getAlternateDebugMethod;  //   ...
  PVOID DebugProcess;    //   ...
  PVOID ChangeRegOnBP;    //   ...
  PVOID RetrieveDebugData;   //   ...
  PVOID StartProcessWatch;   //   ...
  PVOID WaitForProcessListData;  //   ...
  PVOID GetProcessNameFromID;   //   ...
  PVOID GetProcessNameFromPEProcess; //   ...
  PVOID KernelOpenProcess;   //   ...
  PVOID KernelReadProcessMemory;  //   ...
  PVOID KernelWriteProcessMemory;  //   ...
  PVOID KernelVirtualAllocEx;   //   ...
  PVOID IsValidHandle;    //   ...
  PVOID GetIDTCurrentThread;   //   ...
  PVOID GetIDTs;     //   ...
  PVOID MakeWritable;    //   ...
  PVOID GetLoadedState;    //   ...
  PVOID DBKSuspendThread;   //   ...
  PVOID DBKResumeThread;   //   ...
  PVOID DBKSuspendProcess;   //   ...
  PVOID DBKResumeProcess;   //   ...
  PVOID KernelAlloc;    //   ...
  PVOID GetKProcAddress;   //   ...
  PVOID CreateToolhelp32Snapshot;  //   ...
  PVOID Process32First;            //   ...
  PVOID Process32Next;             //   ...
  PVOID Thread32First;             //   ...
  PVOID Thread32Next;              //   ...
  PVOID Module32First;             //   ...
  PVOID Module32Next;              //   ...
  PVOID Heap32ListFirst;           //   ...
  PVOID Heap32ListNext;            //   ...


  //以下为 delphi 7 高级企业版下的 dll 程序员可用
  PVOID mainform; //指向一个 Tmainform 对象的指针. (主窗口) 与 TFORM 一致
  PVOID memorybrowser; //指向一个 TMemoryBrowser 对象的指针 (内存查看窗口), 与 mainform 相同
};
使用 sizeofExportedFunctions 校验你得到的版本是否相配。如果不相配,则返回 FALSE;

推荐你随后在你的程序中使用注册回调函数并保存。更多关于这些函数在 2 章节。

这个插件必需去注册和卸载回调函数。

1.3: BOOL DisablePlugin(void);
当插件卸载时调用此行。
用它去清空你的内存,卸载所有的函数,卸载你安装的 api 钩子,和一些其它,使你能够继续运行。
返回 TRUE

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值