通过DMA搜索二进制数据 - DmaFindData
函数简介
通过 DMA 搜索指定的二进制数据。默认步长为 1,默认开启多线程,默认搜索全部内存类型。如需定制搜索,请使用 DmaFindDataEx。(高级版功能,普通版无法使用)
接口名称
DmaFindData
DLL调用
OLA_STRING_RETURN OLA_CALL_TYPE DmaFindData(int64_t instance, int64_t deviceId, int32_t pid, OLA_STRING_INPUT addr_range, OLA_STRING_INPUT data);
参数定义:
instance(长整型数): OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。deviceId(长整型数): 设备IDpid(整型数): 进程 PIDaddr_range(字符串): 地址范围data(字符串): 要搜索的二进制数据,支持 CE 数据格式
示例:
// 搜索二进制数据
const char* results = DmaFindData(instance, deviceId, 1234, "0x400000-0x500000", "00 01 23 45");
if (results != NULL && strlen(results) > 0) {
printf("搜索结果: %s\n", results);
// 解析结果(格式: addr1|addr2|addr3...)
char* copy = strdup(results);
char* token = strtok(copy, "|");
while (token != NULL) {
printf("找到地址: %s\n", token);
token = strtok(NULL, "|");
}
free(copy);
FreeStringPtr(instance, results);
}
// 使用 CE 格式搜索(支持通配符)
const char* results2 = DmaFindData(instance, deviceId, 1234, "0x400000-0x500000", "00 01 ?? 45 * ?? ?b");
if (results2 != NULL && strlen(results2) > 0) {
printf("搜索结果: %s\n", results2);
FreeStringPtr(instance, results2);
}
返回值
字符串:
返回二进制字符串的指针,数据格式为 addr1|addr2|addr3...|addrn
示例:123456|ff001122|dc12366
注意: 返回的字符串指针需要调用 FreeStringPtr 接口释放内存
参数说明
data(搜索数据):
- 支持 CE 数据格式
00 01 23 45- 精确匹配??- 任意字节?b- 低 4 位任意c?- 高 4 位任意*- 跳过任意字节
addr_range(地址范围):
- 格式:
0x开始地址-0x结束地址 - 例如:
0x400000-0x500000
应用场景
- 快速搜索内存中的数据
- 特征码搜索
- 内存分析
相关接口
- DmaFindDataEx - 高级搜索选项
- DmaFindInt - 搜索整数
- DmaFindString - 搜索字符串
