我目前正在嘗試從外部進程獲得基地址 在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