Hi

I am creating a DLL which will often make calls to another DLL. I have gone through the procedure of getting a handle to the other DLL and this works fine for some function calls. It seems like the functions which don't modify a parameter work fine. The access violation is occurring when a function takes a parameter which is modified. Some code:

// Function definitions
typedef int (__stdcall* LPFunction6) (LPSTR, LPSTR);
typedef int (__stdcall* LPFunction8) (short, short, long, long, short, LPSTR, LPSTR, short, short);

LPFunction6 DIAG_ReadMem32;
LPFunction8 DIAG_ConfigurationParameterSet;

// Get handle to dll
HINSTANCE hGetProcIDDLL = LoadLibrary("C:\\Windows\\System32\\UMASTER3XXXDPIL1.DLL");

// Get pointer to the function in the dll
DIAG_ReadMem32 = (LPFunction6)GetProcAddress(hGetProcIDDLL, "DIAG_ReadMem32");
DIAG_ConfigurationParameterSet = (LPFunction8)GetProcAddress(hGetProcIDDLL, "DIAG_ConfigurationParameterSet");

// User configuration parameters.
LPSTR memAddr = "FE000";
LPSTR returnData = "";

// Function calls
DIAG_ConfigurationParameterSet (0, 500, 1000, 10000, 0,	"c:\\windows\\system32\\pentcode.hex", "00001000", 0, 0);
iError = DIAG_ReadMem32(memAddr, returnData);    // This one is throwing access violation

I have tried also passing in the values to DIAG_ReadMem32, but to no avail.
Any help appreciated.

Edited 6 Years Ago by ftl25: n/a

I resolved this issue - I changed returnData from an LPSTR to a char array. This seems to have made the application quit its whinging.

char returnData[256];

// call function
iError = DIAG_ReadMem32(memAddr, returnData);

Edited 6 Years Ago by ftl25: n/a

This question has already been answered. Start a new discussion instead.