How to Export and import .reg file in VS 2010 C++

Posted on 2012-08-22
Medium Priority
Last Modified: 2012-08-23
Using Visual Studio 2010, C++. I am looking for an example of exporting a registry key (and all keys and values under it), to a .reg file.  Then later importing what is in that .reg file, into the registry (is there anything different if doing this on an x86 or x64 system?).
Question by:eelou
  • 3
  • 2
LVL 86

Assisted Solution

jkr earned 1002 total points
ID: 38323317
If you don't insist on that being a .reg file format, take a look at 'RegSaveKey()' and the article at http://www.codeproject.com/Articles/7874/How-to-Save-and-Restore-Registry-Keys ("'How to Save and Restore Registry Keys")

Author Comment

ID: 38324603
We cannot use any code licensed under the open souce code.

Assisted Solution

lomo74 earned 498 total points
ID: 38325147
this project https://dl.dropbox.com/u/22313850/regdump.zip will export a registry key and all subkeys / values in standard .REG format.
the sample was developed by me for you, so there are no copyright issues. do whatever with it.

>> Then later importing what is in that .reg file, into the registry
you can use regedit /s for this.

>> is there anything different if doing this on an x86 or x64 system?
yes, there are differences if you are on a 64 bit system.
basically, on a 32 bit system you have only ONE registry.
on a 64 bit system, you have both 32 and 64 bit registry views.
Read here: http://msdn.microsoft.com/en-us/library/windows/desktop/aa384129%28v=vs.85%29.aspx
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.


Author Comment

ID: 38325971
I cannot look at the code until I get home (cannot open the zip file from work).  I can say that using regedit to import will not work because (it would be so easy if it would), because in a locked down system, regedit might be disabled.
LVL 86

Accepted Solution

jkr earned 1002 total points
ID: 38326281
>>We cannot use any code licensed under the open souce code.

Well, you are not supposed to use the code "as-is", the article should serve as an example on how to call 'RegSaveKey()' and 'RegLoadKey()'.

Author Closing Comment

ID: 38327583
Not complete, and not all usable. Otherwise thanks.

Featured Post


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
Suggested Courses

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question