写入指定地址的整数 - WriteInt
函数简介
写入指定地址的整数,支持多种整数类型和CE数据格式。
接口名称
WriteInt
DLL调用
int WriteInt(long instance, long hwnd, string addr, int type, long value);
参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| instance | 长整数型 | OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。 |
| hwnd | 长整数型 | 窗口句柄 |
| addr | 字符串 | 地址,支持CE数据格式,格式示例见下方。 |
| type | 整数型 | 整数类型(0:32位有符号,1:16位有符号,2:8位有符号,3:64位,4:32位无符号,5:16位无符号,6:8位无符号) |
| value | 长整数型 | 要写入的整数值 |
CE地址格式示例
<Game.exe>+1234 // 模块基址+偏移
<Game.exe>+1234+8+4 // 多级偏移(非指针)
[<Game.exe>+1234]+8+4 // 一级指针+偏移
[[<Game.exe>+1234]+8]+4 // 二级指针+偏移
[[[<module>+offset1]+offset2]+offset3] // 三级指针
[0x12345678]+10 // 直接地址+偏移
示例
C++
long instance = CreateCOLAPlugInterFace();
// hwnd 为目标窗口句柄
// 写入32位有符号整数,地址使用CE格式
int ret = WriteInt(instance, hwnd, "模块名+0x1A2B3C", 0, 99999);
printf("写入结果: %d\n", ret); // 1成功 0失败
// 写入64位整数
WriteInt(instance, hwnd, "0x12345678", 3, 123456789012345);
Python
# 待补充
返回值
1 成功,0 失败。
