能力值:
( LV2,RANK:10 )
|
-
-
求助一段代码看不懂,主要用途
是对的,这段是求字符串长度的常用方法。
00413FC0 . 8B4424 0C mov eax, dword ptr [esp+C] ;
00413FC4 . 57 push edi
00413FC5 . 83C9 FF or ecx, FFFFFFFF ;ecx=0xFFFF FFFF
00413FC8 . 8B5424 08 mov edx, dword ptr [esp+8] ;[esp+8]是保存长度的变量值
00413FCC . 8B38 mov edi, dword ptr [eax] ;[eax]中对应的是字符串首地址
00413FCE . 33C0 xor eax, eax ;al=0,
00413FD0 . F2:AE repne scas byte ptr es:[edi] ;扫描字符串ES:[EDI]中的AL字节值,到AL值停止,结合上面AL=0 即到字符串尾部'\0'时停止
00413FD2 . F7D1 not ecx ;取反得到长度值+1,因为把字符串尾部的'\0'也算进去了
00413FD4 . 49 dec ecx ;减一得到字符串长度
00413FD5 . 5F pop edi
00413FD6 . 890A mov dword ptr [edx], ecx ;把字符串长度保存到[edx]中,结合前面代码 进行理解
00413FD8 . C3 retn
|
能力值:
( LV2,RANK:10 )
|
-
-
|