Loading function from system32 DLL

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.

Where I get the function structure from:
- http://support.dataaccess.com/Forums/showthread.php?40757-External_Function-translation-help/page2

Working VB.NET from someone else: http://www.musatcha.com/articles/ibmaps.php

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#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
};

using namespace std;
HINSTANCE hinstDLL;

typedef short (__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
}


Thanks.
Topic archived. No new replies allowed.