Jul 25, 2012 at 5:35am UTC
I need to call a function in zipf.dll passing a Source Path.
And this function waits for pointer of a path string.
But the compiler can not pass the pointer of this path.
I need a suggestion:
HINSTANCE hGetProcIDDLL = LoadLibrary("c:\\loadDll\\zipf.dll");
char* pstr = "c:\temp\";
if (hGetProcIDDLL != 0)
{
FARPROC lpfnGetProcessID = GetProcAddress(HMODULE (hGetProcIDDLL),"CopyAllFilesToD");
typedef long (__stdcall * pICFUNC2)(char*);
pICFUNC2 MyFunction2;
MyFunction2 = pICFUNC2(lpfnGetProcessID2);
MyFunction2((int)"D:\\bb\\");
}
else
printf("Load library failed to load!\n");
Thank you.
Jul 25, 2012 at 6:11am UTC
LoadLibrary() isn't a C++ standard function.
I'm assuming you mean the windows function for loading DLLs. Please use the other forum next time.
I also noticed that you forgot to FreeLibrary()
Are you sure that the exported function in the DLL file has the name "CopyAllFilesToD"?
Use a program to find out. dll export viewer is good.
Jul 25, 2012 at 12:33pm UTC
I Decompiled the Dll the exact function name is this:
1 2 3 4 5 6 7 8 9 10
//With Dependency Walker I get this name:
bool ZipFS::CopyAllFilesToRAMDrive(char const *)
//Decompiled with IDA.
char __cdecl ZipFS__CopyAllFilesToRAMDrive(int a1)
{
char Dest; // [sp+E8h] [bp-184h]@1
sprintf(&Dest, "%s\\*.*" , a1);
}
I want to call this fuction passing a Pointer of a Path.
Last edited on Jul 25, 2012 at 2:58pm UTC
Jul 25, 2012 at 4:40pm UTC
The decomplied function doesn't make to much sense.
It seems to be a static function which takes char const *
or better known const char *
. so in any case remove the (int) cast.
You need to check whether you found the function.