HighTechTalks DotNet Forums  

Need help trying to backup the registry...

Dotnet Framework (Interop) microsoft.public.dotnet.framework.interop


Discuss Need help trying to backup the registry... in the Dotnet Framework (Interop) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Michael Moreno
 
Posts: n/a

Default Need help trying to backup the registry... - 09-21-2007 , 08:32 AM






Hello,

I am trying to clean up the registry and I would like to backup the
keys I delete into .hiv files.using RegSaveKey and RegRestoreKey from
the advapi32.dll.

I have managed to declare them:

[StructLayout(LayoutKind.Sequential)]
public struct SECURITY_ATTRIBUTES
{
public int nLength;
public IntPtr lpSecurityDescriptor;
public int bInheritHandle;
}

[DllImport("advapi32.dll", EntryPoint = "RegSaveKey")]
public static extern int RegSaveKeyA(int hKey, string lpFile,
ref SECURITY_ATTRIBUTES lpSecurityAttributes);

[DllImport("advapi32.dll", EntryPoint = "RegRestoreKey")]
public static extern int RegRestoreKeyA(int hKey, string lpFile, int
dwFlags);

But I do not know how to use them!

Would you know:
- How do I get the hKey value? Do I have to use either RegCreateKeyEx
or RegOpenKeyEx?
- How do I initialize lpSecurityAttributes ?

Any help in C# would be very very appreciated!

thanks,
Michael

--
Michael
----
http://michael.moreno.free.fr/
http://port.cogolin.free.fr/



Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.