how to read content of memory address 0xfeafe000 in c?

泄露秘密 提交于 2019-12-12 06:46:37

问题


i have tried to read content of a memory address 0xfeafe000 and 0xfe9b000. i have used a few techinue but unable to do so. i have tried following codes, they are-

1.

unsigned int *abar = (unsigned int *) 0x0feaf000;
printf("\n %x",*abar);// got segmentation fault

2.

char txt[512];
  memcpy(txt,(char *)0xfeafe000,sizeof(txt));
  printf("%s",txt);// got segmentation fault

is there anather way to resolve this or any flaws in my attempts??


回答1:


The logical address in your program is mapped by the OS into an address that's valid for your process, so you have no access to an absolute address in most systems.

If you got a system with direct access to the real address space, then your first example should works, but I would suggest to make abar const in that case.



来源:https://stackoverflow.com/questions/31000017/how-to-read-content-of-memory-address-0xfeafe000-in-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!