Textfile for a registry value

c++ / delphi package - dll injection and api hooking
c357323
Posts: 9
Joined: Tue Jul 13, 2004 4:54 am

Post by c357323 »

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?
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

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.
Post Reply