Hi, I have an undocumented DLL that I want to load a function from, though, there has been a lot of people trying to pull data from this DLL already, but in other languages, like VB.NET, Perl, Python so translations would be great.
I've been following a tutorial on loading DLL from goffconcepts.com/techarticles/cpp/calldll.html, and wrote the following code. I have included the errors in the comments. Secondly, from searching through the web, I got that the function ShockproofGetAccelerometerData returns no value and uses the structure AccelData as parameters. I have also included a copy of a DLL at http://www.mediafire.com/file/7kaobwb0qj2hy87/Sensor.DLL.
#include <iostream>
#include <windows.h>
#include <stdio.h>
struct AccelData
{
int status;
short x; //raw data
short y; //raw data
short xx; //avg. of 40ms
short yy; //avg. of 40ms
char temp; //raw value
short x0; //used for auto-center
short y0; //used for auto-center
};
usingnamespace std;
HINSTANCE hinstDLL;
typedefshort (__stdcall * pICFUNC)(AccelData);
int main(void)
{
GetAccelData(); //was not defined in scope
FreeLibrary(hinstDLL);
return 0;
}
short GetAccelData(void)
{
hinstDLL = LoadLibrary("Sensor.dll");
if(hinstDLL == 0)
{
hinstDLL = LoadLibrary("sensor.dll");
}
FARPROC lpfnGetProcessID = GetProcAddress(HMODULE(hinstDLL),"ShockproofGetAccelerometerData");
pICFUNC ShockproofGetAccelerometerData;
ShockproofGetAccelerometerData = pICFUNC(lpfnGetProcessID);
return myReturnVal; //could not be resolved
}