纯汇编如何获得LoadLibrary地址和实现GetProcAddress? 100分求教---***
我有代码,可是不懂汇编,看不懂。
想做个远程程序注入的,不想靠Dll,想直接写代码,不过如果用C++直接写成程序的话,代码太大。
所以我想到了用汇编实现一些简单的代码。
哪位牛人帮我解释下一下代码:
函数:(实现GetProcAddress的功能)
00400164 60 pushad
00400165 8B6C24 24 mov ebp,dword ptr ss:[esp+24]
00400169 8B45 3C mov eax,dword ptr ss:[ebp+3C]
0040016C 8B7C05 78 mov edi,dword ptr ss:[ebp+eax+78]
00400170 01EF add edi,ebp
00400172 8B4F 18 mov ecx,dword ptr ds:[edi+18]
00400175 8B5F 20 mov ebx,dword ptr ds:[edi+20]
00400178 01EB add ebx,ebp
0040017A 49 dec ecx
0040017B 8B348B mov esi,dword ptr ds:[ebx+ecx*4]
0040017E 01EE add esi,ebp
00400180 31C0 xor eax,eax
00400182 99 cdq
00400183 AC lods byte ptr ds:[esi]
00400184 84C0 test al,al
00400186 74 07 je short SmallLea.0040018F
00400188 C1CA 0D ror edx,0D
0040018B 01C2 add edx,eax
0040018D ^ EB F4 jmp short SmallLea.00400183
0040018F 3B5424 28 cmp edx,dword ptr ss:[esp+28]
00400193 ^ 75 E5 jnz short SmallLea.0040017A
00400195 8B5F 24 mov ebx,dword ptr ds:[edi+24]
00400198 01EB add ebx,ebp
0040019A 66:8B0C4B mov cx,word ptr ds:[ebx+ecx*2]
0040019E 8B5F 1C mov ebx,dword ptr ds:[edi+1C]
004001A1 01EB add ebx,ebp
004001A3 032C8B add ebp,dword ptr ds:[ebx+ecx*4]
004001A6 896C24 1C mov dword ptr ss:[esp+1C],ebp
004001AA 61 popad
004001AB C3 retn
调用代码:
004001AC 31DB xor ebx,ebx
004001AE 64:8B43 30 mov eax,dword ptr fs:[ebx+30]
004001B2 8B40 0C mov eax,dword ptr ds:[eax+C]
004001B5 8B70 1C mov esi,dword ptr ds:[eax+1C]
004001B8 AD lods dword ptr ds:[esi]
004001B9 8B40 08 mov eax,dword ptr ds:[eax+8]
004001BC 5E pop esi
004001BD 68 8E4E0EEC push EC0E4E8E
004001C2 50 push eax
004001C3 FFD6 call esi ; 汇编实现的GetProcAddress
004001C5 66:53 push bx
004001C7 66:68 3332 push 3233
004001CB 68 7773325F push 5F327377
004001D0 54 push esp
004001D1 FFD0 call eax ; LoadLibrary("ws2_32");
004001D3 68 CBEDFC3B push 3BFCEDCB
004001D8 50 push eax
004001D9 FFD6 call esi ; 汇编实现的GetProcAddress
004001DB 5F pop edi
004001DC 89E5 mov ebp,esp
004001DE 66:81ED 0802 sub bp,208
004001E3 55 push ebp
004001E4 6A 02 push 2
004001E6 FFD0 call eax ; ws2_32.WSAStartup(2);
004001E8 68 D909F5AD push ADF509D9
004001ED 57 push edi
004001EE FFD6 call esi ; SmallLea.00400164
想做个远程程序注入的,不想靠Dll,想直接写代码,不过如果用C++直接写成程序的话,代码太大。
所以我想到了用汇编实现一些简单的代码。
哪位牛人帮我解释下一下代码:
函数:(实现GetProcAddress的功能)
00400164 60 pushad
00400165 8B6C24 24 mov ebp,dword ptr ss:[esp+24]
00400169 8B45 3C mov eax,dword ptr ss:[ebp+3C]
0040016C 8B7C05 78 mov edi,dword ptr ss:[ebp+eax+78]
00400170 01EF add edi,ebp
00400172 8B4F 18 mov ecx,dword ptr ds:[edi+18]
00400175 8B5F 20 mov ebx,dword ptr ds:[edi+20]
00400178 01EB add ebx,ebp
0040017A 49 dec ecx
0040017B 8B348B mov esi,dword ptr ds:[ebx+ecx*4]
0040017E 01EE add esi,ebp
00400180 31C0 xor eax,eax
00400182 99 cdq
00400183 AC lods byte ptr ds:[esi]
00400184 84C0 test al,al
00400186 74 07 je short SmallLea.0040018F
00400188 C1CA 0D ror edx,0D
0040018B 01C2 add edx,eax
0040018D ^ EB F4 jmp short SmallLea.00400183
0040018F 3B5424 28 cmp edx,dword ptr ss:[esp+28]
00400193 ^ 75 E5 jnz short SmallLea.0040017A
00400195 8B5F 24 mov ebx,dword ptr ds:[edi+24]
00400198 01EB add ebx,ebp
0040019A 66:8B0C4B mov cx,word ptr ds:[ebx+ecx*2]
0040019E 8B5F 1C mov ebx,dword ptr ds:[edi+1C]
004001A1 01EB add ebx,ebp
004001A3 032C8B add ebp,dword ptr ds:[ebx+ecx*4]
004001A6 896C24 1C mov dword ptr ss:[esp+1C],ebp
004001AA 61 popad
004001AB C3 retn
调用代码:
004001AC 31DB xor ebx,ebx
004001AE 64:8B43 30 mov eax,dword ptr fs:[ebx+30]
004001B2 8B40 0C mov eax,dword ptr ds:[eax+C]
004001B5 8B70 1C mov esi,dword ptr ds:[eax+1C]
004001B8 AD lods dword ptr ds:[esi]
004001B9 8B40 08 mov eax,dword ptr ds:[eax+8]
004001BC 5E pop esi
004001BD 68 8E4E0EEC push EC0E4E8E
004001C2 50 push eax
004001C3 FFD6 call esi ; 汇编实现的GetProcAddress
004001C5 66:53 push bx
004001C7 66:68 3332 push 3233
004001CB 68 7773325F push 5F327377
004001D0 54 push esp
004001D1 FFD0 call eax ; LoadLibrary("ws2_32");
004001D3 68 CBEDFC3B push 3BFCEDCB
004001D8 50 push eax
004001D9 FFD6 call esi ; 汇编实现的GetProcAddress
004001DB 5F pop edi
004001DC 89E5 mov ebp,esp
004001DE 66:81ED 0802 sub bp,208
004001E3 55 push ebp
004001E4 6A 02 push 2
004001E6 FFD0 call eax ; ws2_32.WSAStartup(2);
004001E8 68 D909F5AD push ADF509D9
004001ED 57 push edi
004001EE FFD6 call esi ; SmallLea.00400164
...全文
相关推荐
VB6.0判断DLL文件是否已经注册 源码
总结一下,VB6.0中判断DLL文件是否已经注册,主要通过API调用`LoadLibrary`、`GetProcAddress`和`FreeLibrary`来实现。
如何用vc6创建和使用dll
`GetProcAddress`则根据这个句柄获取函数地址。
WINDOWS程序员使用指南 DLL和内存管理
在Windows环境下,程序员可以通过LoadLibrary和GetProcAddress函数动态地加载和调用DLL中的函数。
vc++基础培训百例 61-100例
VC++支持创建和调用DLL,通过LoadLibrary和GetProcAddress函数实现对DLL中函数的调用。以上是对每个实例的初步猜测,实际内容会根据源码具体实现而有所不同。
dhcp 调用dll 修改ip
通过这些文件,你可以进一步理解并实现上述过程,完成DHCP调用DLL修改IP的功能。在实际操作时,请确保遵循安全编程原则,避免恶意代码注入和权限滥用。


