Feered
June 17th, 2010, 12:58 AM
Okay, for some reason when I call RegQueryValueEx, my buffer pads every other byte with a space. So the output is something like "1 0 0 1 u s w e s t" and so on... I've tried a few different methods but can't seem to nail this one...
On top of that, when I cout the data, it only prints the first byte...
int main ()
{
HKEY hKey;
DWORD cType;
char lpData[1024] = {0};
DWORD buffersize = sizeof(lpData);
if(RegOpenKeyEx(HKEY_CURRENT_USER, TEXT("Software\\Blizzard Entertainment\\Warcraft III"),NULL,KEY_READ,&hKey) == ERROR_SUCCESS)
{
cout << "Opened successfully";
}else{
cout << "Failed to open reg key: " << GetLastError() << "\n";
}
RegQueryValueEx(hKey,TEXT("Battle.net Gateways"),NULL,&cType,(LPBYTE) lpData,&buffersize);
cout << "Registry Key Open: mem key location=" << hKey << "\n\n";
cout << "Data: " << lpData;
RegCloseKey (hKey);
system("Pause");
}
On top of that, when I cout the data, it only prints the first byte...
int main ()
{
HKEY hKey;
DWORD cType;
char lpData[1024] = {0};
DWORD buffersize = sizeof(lpData);
if(RegOpenKeyEx(HKEY_CURRENT_USER, TEXT("Software\\Blizzard Entertainment\\Warcraft III"),NULL,KEY_READ,&hKey) == ERROR_SUCCESS)
{
cout << "Opened successfully";
}else{
cout << "Failed to open reg key: " << GetLastError() << "\n";
}
RegQueryValueEx(hKey,TEXT("Battle.net Gateways"),NULL,&cType,(LPBYTE) lpData,&buffersize);
cout << "Registry Key Open: mem key location=" << hKey << "\n\n";
cout << "Data: " << lpData;
RegCloseKey (hKey);
system("Pause");
}