我动态调用了一个dll后,使用里面的函数,但是出现了越界的现在,请问改如何调试呀?
typedef UINT (CALLBACK* LPFNDLLFUNC1)(char*,char*,int);
bool Extract()
{
HINSTANCE hDll;
LPFNDLLFUNC1 lpfnDllFunc1; // Function pointer hDll=::LoadLibrary("Iksbase.dll");
lpfnDllFunc1 = (UINT (__stdcall *)(char *,char *,int))0x62015920;
lpfnDllFunc1(Z0Name,ZXName,8);
FreeLibrary(hDll);
}函数功能正常,但返回的时候,便出现越界错误了。
typedef UINT (CALLBACK* LPFNDLLFUNC1)(char*,char*,int);
bool Extract()
{
HINSTANCE hDll;
LPFNDLLFUNC1 lpfnDllFunc1; // Function pointer hDll=::LoadLibrary("Iksbase.dll");
lpfnDllFunc1 = (UINT (__stdcall *)(char *,char *,int))0x62015920;
lpfnDllFunc1(Z0Name,ZXName,8);
FreeLibrary(hDll);
}函数功能正常,但返回的时候,便出现越界错误了。
#include <windows.h>
typedef VOID (*MYPROC)(LPTSTR);
VOID main(VOID)
{
HINSTANCE hinstLib;
MYPROC ProcAdd;
BOOL fFreeResult, fRunTimeLinkSuccess = FALSE;
hinstLib = LoadLibrary("myputs");
if (hinstLib != NULL)
{
ProcAdd = (MYPROC) GetProcAddress(hinstLib, "myPuts");
if (fRunTimeLinkSuccess = (ProcAdd != NULL))
(ProcAdd) ("message via DLL function\n");
fFreeResult = FreeLibrary(hinstLib);
}
if (! fRunTimeLinkSuccess)
printf("message via alternative method\n");
}
lpfnDllFunc1 = (UINT (__stdcall *)(char *,char *,int))0x62015920;
看看你的DLL加载成功没有!!
地址0x62015920;处是否是函数的条用地址!!!!!!!
太好了,终于解决了!!!