|
[求助]高手请进!一道一道看似简单,其实很复杂的面试题目的思索!
十分感谢你的回答!!用宏是能很好的解决那个面试题,也可以用全局变量或静态变量在main之前初始化的特性来解答此面试题。甚至可以用writeFile来代替printf来输出到控制台。(其实printf应该也是调用的此函数,并且此函数不是c运行库的函数,而是windows库函数)。但是我这里提问的是,我贴出来的做法的问题出在哪里? |
|
|
|
[求助]高手请进!一道一道看似简单,其实很复杂的面试题目的思索!
问最后一个问题:两种跳转方式 MOV EAX, OFFSET main MOV BYTE PTR[EAX], 0xE9 //构造jmp 相对地址 指令并放在main函数处 MOV ecx,OFFSET SHOWSTRING; sub ecx, offset main; sub ecx,5 MOV DWORD PTR[EAX+1], ecx //将printf语句地址放在eax+1处 ///////////////////////////////////////////////////////////////////////////////////////////////////////////// //MOV EAX, OFFSET main //MOV BYTE PTR[EAX], 0xB8 //MOV EAX, 0x //MOV DWORD PTR[EAX+1], OFFSET SHOWSTRING //将printf语句地址放在eax+1处 //MOV WORD PTR[EAX+5], 0xE0FF // JMP EAX:FFE0 怎么下面构造的跳转会出问题呢?能不能分析下??elianmeng,aait |
|
[求助]高手请进!一道一道看似简单,其实很复杂的面试题目的思索!
主要是你更新的解答。所以我就没有看。是在抱歉。 |
|
[求助]高手请进!一道一道看似简单,其实很复杂的面试题目的思索!
这个答案在vs2008下还是通不过。不过你们的回答给了我很好的思路。非常谢谢你们的回答。如果可以,希望能再改改。这个堆栈平衡很有问题。 1)尤其是怎样构造是的main函数正常返回,使得crt启动函数正常调用main函数,并正确清理资源返回。 2)要保持堆栈平衡,需要构造一些清栈的代码,并起到绕过编译器所加的检查代码。当然,要是能使得完全通过debug下的各个检查就更好了 3)main函数起始处只是一系列int 3指令罢了,不用nop吧!并在main里面nop貌似没啥作用!因为我们的__asm { MOV EAX, OFFSET main MOV BYTE PTR[EAX], 0xB8 //MOV EAX, 0x MOV DWORD PTR[EAX+1], OFFSET SHOWSTRING //将printf语句地址放在eax+1处 MOV WORD PTR[EAX+5], 0xE0FF // JMP EAX:FFE0 }根本就不是将mov eax,OFFSET SHOWSTRING与jmp eax指令码写到我们所见到的main函数里面。而只是写在了jmp指令处。 |
|
[求助]高手请进!一道一道看似简单,其实很复杂的面试题目的思索!
看雪还是看雪,逛看雪的人还真是不一般。佩服,分析的很好。没想到真的是堆栈平衡问题,感谢你的回答。我这里还有一点疑问: 1)“加了5个nop是因为程序一开始修改main()函数的指令为jmp printf,但是要给main()函数至少5个字节的空间,否则修改main()函数就会破坏紧跟main()函数的代码。所以留出5个nop为指令空间占位。” 经过调式,可以得到,这个main函数地址处的第一个指令其实是条jmp指令,其后是一大堆的nop指令而已。此面试题的题意是不要在main函数里面显示的加代码。 2)需要保证什么条件,才能使得启动函数正常返回。有时我调试的时候,根本就没有从 mainCRTStartup();返回。而是直接退出了。(这得好好分析这个函数) 3)我觉得要保持堆栈平衡,需要构造一些清栈的代码,并起到绕过编译器所加的检查代码。当然,要是能使得完全通过debug下的各个检查就更好了 再次感谢你的回答,给了提供了非常关键的思路。 |
|
[求助]数学不好,请教书P59中的,“没下边”的中括号是什么意思?
向下取整与向上取整的意思 |
|
[求助]P167-169页DWORD SHOOT的原理???
每次都是自己搞明白的,我的想法是对的,只是flink偏移为0罢了。链表节点卸下语句使得有机会在任意地址写入任意四字节数据的 |
|
[分享]2012 最新的API大全
这个链接主页肯定是楼主的吧, |
|
[原创][分享]IDA权威指南视频教程(持续更新帖,更新至第四课)
楼主,资源怎么下载不了 |
|
[求助]请问35页的一句话怎么理解?
读这本书需要较为深入的理解c++,这点可以看看c++ 编程思想 |
|
[求助]书中第126面的每个case语句中为何还有pop语句?
惭愧,没有看完整的反汇编 |
操作理由
RANk
{{ user_info.golds == '' ? 0 : user_info.golds }}
雪币
{{ experience }}
课程经验
{{ score }}
学习收益
{{study_duration_fmt}}
学习时长
基本信息
荣誉称号:
{{ honorary_title }}
能力排名:
No.{{ rank_num }}
等 级:
LV{{ rank_lv-100 }}
活跃值:
在线值:
浏览人数:{{ visits }}
最近活跃:{{ last_active_time }}
注册时间:{{ user_info.create_date_jsonfmt }}
勋章
兑换勋章
证书
证书查询 >
能力值