Is there any available API function (or any function for that matter) that can merge a .REG file into the registry? Or, is there a way to programmatically write a BINARY value to the registry? That's really my dilema. I can use the Registry API functions to do just about everything else except that.
I'm having to write some various values to the registry and one needs to be a Binary type. I am currently using Windows Script Host to read/write string values to the registry. That works great but it doesn't support a BINARY value (hex data).
Anyone have any experience with this? I've been trying to use the RegSaveKey and RegRestoreKey function in the WIN32API. I've got the RegSaveKey to work, but I can't seem to get the RegRestoreKey to work.
Here's how I do the RegSaveKey:
#DEFINE HKEY_CURRENT_USER 2147483649
#DEFINE KEY_READ 131097
declare long RegLoadKey in ADVAPI32.DLL ;
integer nHKey, string cSubKey, string cRegFile
hKey = 0
nRegOpenResult = RegOpenKeyEX(HKEY_CURRENT_USER, ;
"Network\Persistent\LPT2", ;
0, KEY_READ, @hKey)
if nRegOpenResult = 0
rv=RegSaveKey(hKey, "C:\windows\desktop\reg", 0)
=RegCloseKey(hKey)
endif
And here's how I tried to use RegRestoreKey:
declare long RegRestoreKey in ADVAPI32.DLL ;
integer nHKey, string cRegFile, integer nOptional
rv=RegRestoreKey(HKEY_CURRENT_USER, "C:\windows\desktop\reg", 0)
I get error 120. I'm not sure what 120 is.
Steve