我正在尝试找出从 Windows Mobile 6.1 设备上备份整个注册表的最佳方法。我发现 OPENNETCF RegistryHelper 类据说可以保存基于蜂巢的密钥?
有人可以先帮我弄清楚这是否是最好的方法吗?
以下是我尝试使用并不断收到错误“无法生成注册表文件”的代码
private void button1_Click(object sender, EventArgs e)
{
RegistryKey Key = Registry.LocalMachine.OpenSubKey(@"System\StorageManager\Profiles\SDMMC");
string outputkey = @"\Storage Card\key.reg";
SaveHiveBasedKey(Key, outputkey);
}
public static void SaveHiveBasedKey(Microsoft.Win32.RegistryKey keyToSave, string destinationPath)
{
RegistryHelper.SaveHiveBasedKey(keyToSave, destinationPath);
}
异常详情:
System.ComponentModel.Win32Exception was unhandled
Message="Unable to generate registry file"
ErrorCode=-2147467259
NativeErrorCode=80
StackTrace:
at OpenNETCF.Win32.RegistryHelper.SaveHiveBasedKey()
at mc9090clone.Form1.SaveHiveBasedKey()
at mc9090clone.Form1.button1_Click()
at System.Windows.Forms.Control.OnClick()
at System.Windows.Forms.Button.OnClick()
at System.Windows.Forms.ButtonBase.WnProc()
at System.Windows.Forms.Control._InternalWnProc()
at Microsoft.AGL.Forms.EVL.EnterMainLoop()
at System.Windows.Forms.Application.Run()
at mc9090clone.Program.Main()
InnerException: