Textfile for a registry value

c++ / delphi package - dll injection and api hooking

Postby c357323 » Sat Jul 17, 2004 4:36 pm

Hello madshi,

In my RegQueryValueExCallback inside My.dll, I did the following:

strcpy((char *) lpData, "Modified Data");
*lpcbData = 14;
*lpType = REG_SZ;

The result during run time is this error message:
"Access violation at address 10001026 in module 'My.dll'. Write of address 00000000"

The cause of the error is : strcpy((char *) lpData, "Modified Data"); , NOT the other two data manipulation.
Do you have any idea what is the cause of this different response to manipulating data?
c357323
 
Posts: 9
Joined: Tue Jul 13, 2004 4:54 am

Postby madshi » Sat Jul 17, 2004 4:46 pm

You need to make sure that the pointers you're writing to are actually valid (non NULL). Programs often call RegQueryValueEx twice, once with NULL pointers to ask how much memory is needed, then again with buffers in the appropriate size.
madshi
Site Admin
 
Posts: 9821
Joined: Sun Mar 21, 2004 5:25 pm

Previous

Return to madCodeHook

Who is online

Users browsing this forum: No registered users and 9 guests