Posted September 28, 200519 yr void EzRegQu(int user, const char* path, const char* keyname, char* buffer) { HKEY hkey; DWORD dword; dword = sizeof(buffer); if (user == 1) RegOpenKeyEx(HKEY_LOCAL_MACHINE,path,0,KEY_ALL_ACCESS,&hkey); else if (user == 2) RegOpenKeyEx(HKEY_CURRENT_USER,path,0,KEY_ALL_ACCESS,&hkey); else if (user == 3) RegOpenKeyEx(HKEY_CLASSES_ROOT,path,0,KEY_ALL_ACCESS,&hkey); RegQueryValueEx(hkey,keyname,NULL,NULL,(LPBYTE)buffer,&dword); RegCloseKey(hkey); } I could've sworn this was working before, but.... it's not setting buffer to anything... why not?
September 28, 200519 yr You realize buffer is being passed as a parameter right? It would have a value when it's first pushed onto the stack, even before the function is called. Unless you worded the post incorrectly, I think the problem lies elsewhere in your code.
September 28, 200519 yr Author Buffer is an empty character string. Nothing in it. Just initalized with a certain amount of memory allocated to it.
September 29, 200519 yr You're setting dword to the size of a pointer. A pointer on a 32 bit architecture is ALWAYS 4 bytes. So no matter what, you're setting dword to 4.