views:

375

answers:

3

My question is a bit related to this one but it's not what I was aiming for:

http://stackoverflow.com/questions/35070/programmatically-merge-reg-file-into-win32-registry

What I want to do is to create a program that can import a .reg file using win32 or some other library. I tried looking around but failed at that part. Something like a regedit.exe /s function. Is it possible to do this without using regedit.exe or reg.exe in anyway?

So.. no system("myfile.reg") or like ShellExecute() using reg.exe or regedit.exe

Thanks!

+1  A: 

Well leaving aside the obvious - why would you want to do this, I would think that any search on google for registry viewer / tool would come up with a list of apps that will probably implement their own way of merging to the registry.

Failing that you could implement it yourself. The .reg files are text files and the registry is fairly simple and well documented with Win32 apis and wrapper functions for most high level languages.

Other than that you will need to provide more info.

Toby Allen
It's just something that I wish to work on. Not sure what details you're asking for though .. I tried looking around msdn and I can't seem to find anything..
Charles Khunt
I would say the answer to your question then is probably no. Windows provides APIs for creating registry keys and you can if you wish read a .reg file however there isnt an import reg file API
Toby Allen
+1  A: 

Since regedit.exe created the reg file in the first place, I'm not really sure why you wouldn't also want it to do the import.

One other option would be to parse the reg file and then convert the parsed information into direct calls to the RegCreateKey, RegSetValue Win32 API functions, but I suspect that would be a fair amount of coding effort.

jussij
A: 

See Microsoft SDK sample (C) "importing reg file with regX apis".