我目前正在尝试从外部进程获得基地址 在Xcode中使用C++!
这是我走到这一步:all_image_infos通过在OS X上的pid C++
if (task_info(this->_pmach_port, TASK_DYLD_INFO, (task_info_t)&dyld_info, &count) == KERN_SUCCESS)
{
this->Read(this->dyld_info.all_image_info_addr, sizeof(dyld_all_image_infos), &this->all_image_infos);
printf("Got Task info!\nall_image offset: 0x%llx\ninfo array count: %i",this->dyld_info.all_image_info_addr,this->all_image_infos.infoArrayCount);
printf("Version: %i\n",this->all_image_infos.version);
for(int i=0;i< this->all_image_infos.infoArrayCount;i++) {
printf("image: %s %d\n",
this->all_image_infos.infoArray[i].imageFilePath,
this->all_image_infos.infoArray[i].imageLoadAddress
);
}
}
是没有问题的,我的输出如下:
Process To open: hl2_osx
Got Task info!
all_image offset: 0x8feb052c
info array count: 303 Version: 14
我的主要问题是,Xcode的停在那里我要输出的线我的模块的相关信息与 原因:
EXC_BAD_ACCESS(代码= EXC_I368_GPFLT)
我做错了什么?
因为我刚刚从Windows上使用WINAPI功能上写上一个Mac程序切换,
我希望有人能帮帮我!
我认为'imageFilePath'不是空结尾的字符串。 – pqnet 2014-08-28 18:06:56
@pqnet但是,我的信息数组也是空的。 – 2014-08-28 18:47:09