Click to See Complete Forum and Search --> : How to load REG files on the remote Machine?


CPP_Beginner
May 25th, 2006, 04:39 PM
Hi, I need to load REG files into the Windows Registry on the remote Machine. I found RegLoadKey() in MSDN (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/registry_functions.asp), but I donīt know, how to use it. Could someone to give me a simple Example, please? Or is another way to do it? Thanks to everyone.

I tried:

HKEY hKey;

if (RegLoadKey(hKey, "Software\\", "D:\\test.reg") == ERROR_SUCCESS)
{
ShowMessage("OK");
}

golanshahar
May 25th, 2006, 04:51 PM
Your problem is that your hKey is not initialized read the MSDN (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/regloadkey.asp).

If you want to write to HKEY_LOCAL_MACHINE simply pass it as a parameter:


::RegLoadKey(HKEY_LOCAL_MACHINE, "My Key", "D:\\test.reg");


Cheers

CPP_Beginner
May 25th, 2006, 05:00 PM
But what if I donīt know the Key? I need to update every Keys, which are in the REG file...