DLL函数动态加载
来源:互联网 发布:足球意大利克德国知乎 编辑:程序博客网 时间:2024/06/10 01:19
问题1:
我在动态调用ZLIB.DLL中的uncompress和compress时出现 Debug Error! 提示 The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.
解决方法:
调步调试,在函数返回时堆栈有4个字节的参数没有谈出.我将我的原始调用方法:
typedef int (WINAPI *ZLIBCOMPRESS) ( Bytef *dest , uLongf *destLen , const Bytef *source , uLong sourceLen);
t ypedef int (WINAPI*ZLIBUNCOMPRESS) (Bytef *dest, uLongf *destLen , const Bytef *source, uLong sourceLen);
改为:
typedef int (__cdecl *ZLIBCOMPRESS) ( Bytef *dest , uLongf *destLen , const Bytef *source , uLong sourceLen);
typedef int ( __cdecl *ZLIBUNCOMPRESS) (Bytef *dest, uLongf *destLen , const Bytef *source, uLong sourceLen);
程序就OK.
结论:调用约定不匹配造成的
问题2:
DLL注入出现提示 The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.
解决方法:
DLL中的代码
void doIt2(){
mbox("start");
__asm{
pushad
mov eax, code //参数
push eax
mov edx, 0x00401019 //函数地址
call edx
popad
}
mbox("over");
}
在弹出"over"之后就会弹出这个错误提示,如何能解决?
解决:::::::::::::::::
使用MFC写出来的函数它都会在后面给你加一个chkesp()函数,来判断堆栈是否正确,
从你代码上看
pushad
push eax
call edx
add esp,4 <-- 这里得加上才行
popad
结论:
调用约定不匹配造成的
我在动态调用ZLIB.DLL中的uncompress和compress时出现 Debug Error! 提示 The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.
解决方法:
调步调试,在函数返回时堆栈有4个字节的参数没有谈出.我将我的原始调用方法:
typedef int (WINAPI *ZLIBCOMPRESS) ( Bytef *dest , uLongf *destLen , const Bytef *source , uLong sourceLen);
t ypedef int (WINAPI*ZLIBUNCOMPRESS) (Bytef *dest, uLongf *destLen , const Bytef *source, uLong sourceLen);
改为:
typedef int (__cdecl *ZLIBCOMPRESS) ( Bytef *dest , uLongf *destLen , const Bytef *source , uLong sourceLen);
typedef int ( __cdecl *ZLIBUNCOMPRESS) (Bytef *dest, uLongf *destLen , const Bytef *source, uLong sourceLen);
程序就OK.
结论:调用约定不匹配造成的
问题2:
DLL注入出现提示 The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.
解决方法:
DLL中的代码
void doIt2(){
mbox("start");
__asm{
pushad
mov eax, code //参数
push eax
mov edx, 0x00401019 //函数地址
call edx
popad
}
mbox("over");
}
在弹出"over"之后就会弹出这个错误提示,如何能解决?
解决:::::::::::::::::
使用MFC写出来的函数它都会在后面给你加一个chkesp()函数,来判断堆栈是否正确,
从你代码上看
pushad
push eax
call edx
add esp,4 <-- 这里得加上才行
popad
结论:
调用约定不匹配造成的
- DLL函数动态加载
- 如何使用DLL函数动态加载-静态加载
- 如何使用DLL函数动态加载-静态加载
- 动态加载DLL
- 动态加载dll
- 动态加载DLL
- C#动态加载DLL
- 动态加载Dll
- C++ 动态加载DLL
- C#动态加载DLL
- C#动态加载DLL
- C#动态加载DLL
- 动态加载 dll
- C#动态加载DLL
- C#动态加载DLL
- C++动态加载dll
- C#动态加载DLL
- C#动态加载DLL
- 对话框可以拖动改变大小
- 保存为BMP,Jpg,Png格式的图片
- 调用windows系统常用功能
- VB.NET里的MD5加密函数
- INNER JOIN 使用及实例详解
- DLL函数动态加载
- 获取ftpserver 文件大小的问题
- asp.net中cookie的使用
- 使用iText操作pdf文件
- 关于字符编码问题
- VC各类之间的调用函数总结
- 关于sizeof的最大值问题
- IN&EXISTS与NOT IN&NOT EXISTS 的优化
- 如何手工编写动态链接库(windows dll)