Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C++ (http://www.velocityreviews.com/forums/f39-c.html)
-   -   Newbie Question (http://www.velocityreviews.com/forums/t267633-newbie-question.html)

Toli 06-23-2003 09:59 PM

Newbie Question
 
I have a simple question, im trying to access a dll called
'runtest.dll', with a routine with the header:

void RunTest(LPVOID lpData, int nDataLen, LPSTR szstrResult, int
nMaxResLen)

Currently my code, gives me an access violation writing with a memory
address. The point of runtest.dll is to accept data from a file
(lpData), and return (in szstrResult) a string created from the data
(which is binary data). Sound simple enough? My code is below, any
help is greatly appreciated. Thanks in advance.


typedef VOID (*MYPROC)(LPVOID, int, LPSTR, int);
void passFile(LPCSTR fileName)
{
HINSTANCE testLib;
testLib = LoadLibrary("runtest.dll");
if (testLib==0)
{
return;
}
MYPROC procTest;
procTest = (MYPROC) GetProcAddress(testLib,"RunTest");

HANDLE hFile;
hFile = CreateFile(fileName, GENERIC_READ, FILE_SHARE_READ, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
CHAR buf[2048];
DWORD dwNumRead=sizeof(buf);
ReadFile(hFile, buf, sizeof(DWORD)*256,&dwNumRead,NULL);
CHAR lpstrResult[256]
(procTest) (buf,sizeof(buf),lpstrResult,sizeof(lpstrResult);
FreeLibrary(testLib);
}

Dan Cernat 06-23-2003 11:33 PM

Re: Newbie Question
 
Hmm,


LPVOID, LPSTR, HINSTANCE, DWORD ...

try a Microsoft newsgroup.

Dan





All times are GMT. The time now is 01:54 AM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


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 46 47 48 49 50 51 52 53 54 55 56 57