通过DMA搜索字符串Ex - DmaFindStringEx
函数简介
通过 DMA 搜索指定范围内的字符串,支持自定义步长和多线程选项。(高级版功能,普通版无法使用)
接口名称
DmaFindStringEx
DLL调用
OLA_STRING_RETURN OLA_CALL_TYPE DmaFindStringEx(int64_t instance, int64_t deviceId, int32_t pid, OLA_STRING_INPUT addr_range, OLA_STRING_INPUT string_value, int32_t type, int32_t step, int32_t multi_thread, int32_t mode);
参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| instance | 长整数型 | OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。 |
| deviceId | 长整数型 | 设备ID |
| pid | 整数型 | 进程 PID |
| addr_range | 字符串 | 地址范围,格式:0x开始地址-0x结束地址 |
| string_value | 字符串 | 要搜索的字符串 |
| type | 整数型 | 字符串类型:0=Ascii, 1=Unicode, 2=UTF8 |
| step | 整数型 | 步长(1=逐字节, 2=推荐) |
| multi_thread | 整数型 | 是否开启多线程(0=否, 1=是) |
| mode | 整数型 | 搜索模式:0=全部, 1=可写, 2=不可写, 4=可执行, 8=不可执行, 16=写时复制, 32=不写时复制 |
示例
const char* results = DmaFindStringEx(instance, deviceId, 1234, "0x400000-0x500000", "Hello", 0, 1, 1, 0);
if (results != NULL && strlen(results) > 0) {
printf("搜索结果: %s\n", results);
FreeStringPtr(instance, results);
}
返回值
字符串指针,数据格式为 addr1|addr2|addr3...,示例:123456|ff001122|dc12366。
返回的字符串指针需要调用 FreeStringPtr 释放内存。
