搜索字符串 - FindStringEx
函数简介
搜索指定范围内的字符串,可定制步长、多线程、内存类型等。
接口名称
FindStringEx
DLL调用
long FindStringEx(long instance, long hwnd, string addr_range, string string_value, int type, int step, int multi_thread, int mode);
参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| instance | 长整数型 | OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。 |
| hwnd | 长整数型 | 窗口句柄 |
| addr_range | 字符串 | 地址范围 |
| string_value | 字符串 | 要搜索的字符串 |
| type | 整数型 | 类型(0:Ascii,1:Unicode,2:UTF8) |
| step | 整数型 | 步长 |
| multi_thread | 整数型 | 是否开启多线程 |
| mode | 整数型 | 搜索模式(0:全部,1:可写,2:不可写,4:可执行,8:不可执行,16:写时复制,32:不写时复制) |
示例
C++
long instance = CreateCOLAPlugInterFace();
// hwnd 为目标窗口句柄
// 搜索Ascii字符串,步长1,开启多线程,搜索可写内存
long strPtr = FindStringEx(instance, hwnd, "0x00400000-0x7FFFFFFF", "Hello", 0, 1, 1, 1);
char* result = GetStringFromPtr(strPtr);
printf("搜索结果: %s\n", result);
FreeStringPtr(strPtr);
Python
# 待补充
返回值
返回字符串的指针,格式: "addr1|addr2|...|addrn"。
注意事项
- 返回的字符串指针需调用 FreeStringPtr 释放内存。
