Connect to Registry
-
Is there any way to connect to the system registry in Windows XP Home Edition ? RegConnectRegistry doesn't work because bypasses the authentication layer - so how to get around this problem ? Mila
Have you tried something like this: if(::RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Example Company\\Example Program\\VersionBuilt", 0, KEY_READ, &hKey) == ERROR_SUCCESS) { // Get version //dwSize = sizeof(dwValue); DWORD nType = REG_SZ; unsigned char pRegData[256]; DWORD nBuffLen = 256; char* pLocation = "VersionBuilt"; RegQueryValueEx(hKey, pLocation, NULL, &nType, pRegData, &nBuffLen); ::RegCloseKey(hKey); csVersion.Format( "%s", &pRegData[ 5]); }
-
Is there any way to connect to the system registry in Windows XP Home Edition ? RegConnectRegistry doesn't work because bypasses the authentication layer - so how to get around this problem ? Mila
Are you really trying to connect to a registry on a remote machine running WinXP Home Edition? If 'yes' then forget about it since the function to use is the one you mentioned, ::RegConnectRegistry, and will always fail on the Home Edition. What you perhaps can do is write an application that acts as a server that you can connect to using sockets and develop your own protocol for reading and/or writing the registry on the remote machine. If you are trying to read and/or write the local registry you should use ::RegOpenKeyEx or ::RegCreateKeyEx instead. However, in either case, depending on what access rights the user have running the application that desires access to the registry, the operation might fail due to lack of access rights. -- Roger