Help reading string data from the registry

Hi

the following code
[code]
HKEY pKey = NULL;
char data[255];
DWORD length = 0;
DWORD dwtype = REG_SZ;


LONG retVal = RegOpenKeyEx(HKEY_LOCAL_MACHINE, HASH, 0, KEY_ALL_ACCESS, &pKey);
if(retVal == ERROR_SUCCESS)
{

RegQueryValueEx(pKey, USER_HASH, 0, &dwtype, (LPBYTE)&data, &length);

[/code]

is supposed to grab string data from defined locations in the registry.
However when I output the data say like
MessageBox( NULL, data, "Blah", MB_OK)
the result is just a bunch of garbage characters instead of the string data.

Any ideas what i'm doing wrong
Thanks

Comments

  • RegQueryValueEx(pKey, USER_HASH, 0, &dwtype, (LPBYTE)[red][b]&[/red][/b]data, &length);

    It is an array.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion