|
字符串函数的汇编代码是怎样的
如果是调用了win 系统Dll中提供函数 如CreateFileA MessageBoxA 等等Win API 是直接Call过去的,然后你提的strcpy strcmp 之类的 我不太清楚 ,但是我做了个实验 发现这函数是展开的,代码如下 void CMy1111Dlg::OnOK() { char szContent[100] = {"Hi"}; if (strcmp(szContent, "Hello World") == 0) { ::MessageBox(NULL ,"OK" ,NULL ,NULL); } else { ::MessageBox(NULL ,"不 OK" ,NULL ,NULL); } } OD反之: 0040147F 90 NOP 00401480 . 83EC 64 SUB ESP,64 00401483 . 66:A1 3830400>MOV AX,WORD PTR DS:[403038] 00401489 . 8A0D 3A304000 MOV CL,BYTE PTR DS:[40303A] 0040148F . 53 PUSH EBX 00401490 . 56 PUSH ESI 00401491 . 57 PUSH EDI 00401492 . 66:894424 0C MOV WORD PTR SS:[ESP+C],AX 00401497 . 884C24 0E MOV BYTE PTR SS:[ESP+E],CL 0040149B . B9 18000000 MOV ECX,18 004014A0 . 33C0 XOR EAX,EAX 004014A2 . 8D7C24 0F LEA EDI,DWORD PTR SS:[ESP+F] 004014A6 . F3:AB REP STOS DWORD PTR ES:[EDI] 004014A8 . AA STOS BYTE PTR ES:[EDI] 004014A9 . BE 2C304000 MOV ESI,1111.0040302C ; ASCII "Hello World" 004014AE . 8D4424 0C LEA EAX,DWORD PTR SS:[ESP+C] 004014B2 > 8A10 MOV DL,BYTE PTR DS:[EAX] 004014B4 . 8A1E MOV BL,BYTE PTR DS:[ESI] 004014B6 . 8ACA MOV CL,DL 004014B8 . 3AD3 CMP DL,BL 004014BA . 75 1E JNZ SHORT 1111.004014DA 004014BC . 84C9 TEST CL,CL 004014BE . 74 16 JE SHORT 1111.004014D6 004014C0 . 8A50 01 MOV DL,BYTE PTR DS:[EAX+1] 004014C3 . 8A5E 01 MOV BL,BYTE PTR DS:[ESI+1] 004014C6 . 8ACA MOV CL,DL 004014C8 . 3AD3 CMP DL,BL 004014CA . 75 0E JNZ SHORT 1111.004014DA 004014CC . 83C0 02 ADD EAX,2 004014CF . 83C6 02 ADD ESI,2 004014D2 . 84C9 TEST CL,CL 004014D4 .^ 75 DC JNZ SHORT 1111.004014B2 004014D6 > 33C0 XOR EAX,EAX 004014D8 . EB 05 JMP SHORT 1111.004014DF 004014DA > 1BC0 SBB EAX,EAX 004014DC . 83D8 FF SBB EAX,-1 004014DF > 5F POP EDI 004014E0 . 5E POP ESI 004014E1 . 5B POP EBX 004014E2 . 85C0 TEST EAX,EAX 004014E4 . 6A 00 PUSH 0 ; /Style = MB_OK|MB_APPLMODAL 004014E6 . 6A 00 PUSH 0 ; |Title = NULL 004014E8 . 75 11 JNZ SHORT 1111.004014FB ; | 004014EA . 68 28304000 PUSH 1111.00403028 ; |Text = "OK" 004014EF . 6A 00 PUSH 0 ; |hOwner = NULL 004014F1 . FF15 CC214000 CALL DWORD PTR DS:[<&USER32.MessageBoxA>>; \MessageBoxA 004014F7 . 83C4 64 ADD ESP,64 004014FA . C3 RETN 004014FB > 68 20304000 PUSH 1111.00403020 ; |Text = "不 OK" 00401500 . 6A 00 PUSH 0 ; |hOwner = NULL 00401502 . FF15 CC214000 CALL DWORD PTR DS:[<&USER32.MessageBoxA>>; \MessageBoxA 00401508 . 83C4 64 ADD ESP,64 0040150B . C3 RETN 0040150C 90 NOP 0040150D 90 NOP 建议LZ动动手 实践一下,这样更有说服力 进步更快~ |
|
|
|
[求助]一个程序操作时自动打开网页 怎么破解
To:tmsdy 关于方法2 是一种比较邪的方法,他的原理是破坏调用函数的参数,让函数调用失败已达到目的,我给的修改是错误(依然能打开,这里说句不好意思),我重新实验了一下,这样 0040281B 6A 01 PUSH 1 0040281D 55 PUSH EBP 0040281E 55 PUSH EBP 0040281F 51 PUSH ECX 00402820 68 FE704000 PUSH EasyShut.004070FE ; ASCII "net/soft/19788.htm" 00402825 53 PUSH EBX 00402826 FF15 C4524000 CALL DWORD PTR DS:[<&SHELL32.ShellExecut>; SHELL32.ShellExecuteA 0040282C 8D4C24 10 LEA ECX,DWORD PTR SS:[ESP+10] 00402830 . E8 99120000 CALL <JMP.&MFC42.#800_??1CString@@QAE@XZ> 这样就行了,你也可以自己乱改改参数试试,我就是乱改的 反正能达到目的 对于第一种方法,先讲一点相关知识 函数调用时参数传递考虑两个问题: 1、按什么顺序将参数入栈; 2、函数结束后,由谁来平衡堆栈; 围绕这两个问题,不同语言定了不同的调用约定,包括__cdcel(C规范)、PASCAL、stdcall及Fastcall四种方式 win32API采用stdcall方式,由被调用函数返回前平衡堆栈,故你在MessageBoxA函数后面看不到平衡堆栈的操作(在函数内部就完成堆栈平衡操作了) sprintf函数采用的是__cdcel方式,需要调用者自己平衡堆栈,所以函数返回后有个 add esp,xx http://www.rrgod.com/ 下面我们先做一个实验,建立一个MFC空Dlg程序,然后在按钮里加代码如下 void CMy1111Dlg::OnOK() { ::ShellExecuteA(m_hWnd, "open", "http://www.baidu.com", NULL, NULL, NULL) ; } OD之,发现: 0040147E 90 NOP 0040147F 90 NOP 00401480 . 8B41 20 MOV EAX,DWORD PTR DS:[ECX+20] 00401483 . 6A 00 PUSH 0 ; /IsShown = 0 00401485 . 6A 00 PUSH 0 ; |DefDir = NULL 00401487 . 6A 00 PUSH 0 ; |Parameters = NULL 00401489 . 68 28304000 PUSH 1111.00403028 ; |FileName = "http://www.baidu.com" 0040148E . 68 20304000 PUSH 1111.00403020 ; |Operation = "open" 00401493 . 50 PUSH EAX ; |hWnd 00401494 . FF15 B4214000 CALL DWORD PTR DS:[<&SHELL32.ShellExecut>; \ShellExecuteA 0040149A . C3 RETN 0040149B 90 NOP 0040149C 90 NOP 说明这个函数 是自己来平衡栈的,不需要我们平衡,不用管ESP,开始你误导我了,呵呵,下面你知道怎么做了吧 参考: 我的相关问题分析: http://hi.baidu.com/blueapple%5Fc/blog/item/d73cab2ba5272e26d52af134.html 我讨论过的帖子:http://bbs.pediy.com/showthread.php?t=103317 |
|
[推荐]软件破解入门,新手学破解
收下,谢谢~ |
|
[求助]一个程序操作时自动打开网页 怎么破解
嘿嘿,我问的那个问题别人不知道,你肯定知道 ,跟这个是一模一样的问题,nop掉调用函数,栈平衡出问题了,最后是个高手给解决了,也是这2种方法,哈哈 |
|
|
|
[求助]一个程序操作时自动打开网页 怎么破解
方法1: 全部nop掉以下代码 0040281B . 6A 01 PUSH 1 ; /IsShown = 1 0040281D . 55 PUSH EBP ; |DefDir 0040281E . 55 PUSH EBP ; |Parameters 0040281F . 51 PUSH ECX ; |FileName 00402820 . 68 E0704000 PUSH EasyShut.004070E0 ; |open 00402825 . 55 PUSH EBP ; |hWnd 00402826 . FF15 C4524000 CALL DWORD PTR DS:[<&SHELL32.ShellExecut>; \ShellExecuteA 然后将 0040282C 8D4C24 10 LEA ECX,DWORD PTR SS:[ESP+10] 修改为 0040282C 8D4C24 10 LEA ECX,DWORD PTR SS:[ESP-8] |
|
[邀请码已发][原创]求邀请码。解[本人闭关修炼多时,今日出关,自己写个CrackME,求破解 ]
就不贴了吧,这个太弱了,我昨天刚刚写了一个更强一点的 链接:http://bbs.pediy.com/showthread.php?t=103416 |
|
[活动结束]看雪十周年论坛活动 [1楼己公布结果]
菜多次回出现什么情况? |
|
[活动结束]看雪十周年论坛活动 [1楼己公布结果]
我有人品有长相 肯定是我的~~嘎嘎~ |
|
nop掉一个MessageBox的疑惑
您的解释: 函数调用时参数传递考虑两个问题: 1、按什么顺序将参数入栈; 2、函数结束后,由谁来平衡堆栈; 围绕这两个问题,不同语言定了不同的调用约定,包括__cdcel(C规范)、PASCAL、stdcall及Fastcall四种方式 win32API采用stdcall方式,由被调用函数返回前平衡堆栈,故你在MessageBoxA函数后面看不到平衡堆栈的操作(在函数内部就完成堆栈平衡操作了) sprintf函数采用的是__cdcel方式,需要调用者自己平衡堆栈,所以函数返回后有个 add esp,xx http://www.rrgod.com/ 非常好,感谢ing |
|
nop掉一个MessageBox的疑惑
[QUOTE=sessiondiy;728912]方法二 004024D5 . 6A 00 push 0 004024D7 . 8B46 20 mov eax, [esi+20] 004024DA . 68 70764000 push 00407670 004024DF ...[/QUOTE] 你的2个附件我都试过了,都很好,可是我咋看不懂捏? 有时间麻烦稍稍解释下好不,没时间就算了,谢谢你 备注:第一个我看明白啦,哈哈 原来让第一个参数(句柄)无效就ok啦,这么“邪”的办法都想得出来,厉害啊 呵呵 膜拜~~~ 第二个好像也明白了,原来的代码是将 esi送堆栈某位置(这应该是Release版本的优化作用,貌似是一个提前入栈的?!反正是这么个感觉),这一nop后堆栈当前位置都变了,后面的函数参数可能就会顺序错乱,导致非常严重的后果。呵呵,非常感谢。。 |
操作理由
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 }}
勋章
兑换勋章
证书
证书查询 >
能力值