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/