flynny1st
May 29th, 2007, 11:25 AM
Hi,
Hopefully an easy one here. I want to some variables form a file and then hook into a progrma, in this example calculator. The hook will then access these variables.
I read in the file and create the variables using the following
LPTSTR token = strtok( line, seps );
HGLOBAL memPtr = GlobalAlloc(GMEM_FIXED, strlen(token)+1); //pointer to mem block
if( memPtr && (hookList[i][0] = (LPTSTR)GlobalLock(memPtr)) != NULL )
hookList[i][0] = (LPTSTR) RtlMoveMemory(hookList[i][0], token, strlen(token)+1);
else
{
sprintf(buf, "Error: Could not allocate Memory");
MessageBox(NULL, buf, NULL, 0);
}
where line is the line from the text file and seps the seperation. Now it seems to be reading the variables in ok using this and can print them out.
However when i hook into calculator and try and access the array it returns null. is it possible to do what i am trying to do? and if so how?
Many thanks,
Matt.
Hopefully an easy one here. I want to some variables form a file and then hook into a progrma, in this example calculator. The hook will then access these variables.
I read in the file and create the variables using the following
LPTSTR token = strtok( line, seps );
HGLOBAL memPtr = GlobalAlloc(GMEM_FIXED, strlen(token)+1); //pointer to mem block
if( memPtr && (hookList[i][0] = (LPTSTR)GlobalLock(memPtr)) != NULL )
hookList[i][0] = (LPTSTR) RtlMoveMemory(hookList[i][0], token, strlen(token)+1);
else
{
sprintf(buf, "Error: Could not allocate Memory");
MessageBox(NULL, buf, NULL, 0);
}
where line is the line from the text file and seps the seperation. Now it seems to be reading the variables in ok using this and can print them out.
However when i hook into calculator and try and access the array it returns null. is it possible to do what i am trying to do? and if so how?
Many thanks,
Matt.