开发者

Modifying a non-local registry hive

I'm writing a program for my workplace an开发者_如何学Cd because we work on computers damaged by hard drives we sometimes need to work with their registries before they'll boot.

Most notably, we're trying to fix the 0x7b error that stems from the Registry Hive that controls the default Hard disk drivers being damaged and the computer wont boot.

Microsoft has a Knowledge Base entry on how to do it manually, but we want to automate it. That being said, what's required is that I have to edit the registry hive on a different hard drive.

How can I modify the Registry Hive that is located on a different Hard drive with C#? The other hard drive will contain a complete OS, but will not be currently running.


I assume that you can read the files on the target drive. You need to use the RegLoadKey() Win32 API (or the .NET quivalent if there is one) to load the hive into a key in the local computer's registry. Manipulate that hive's contents under the key you passed to RegLoadKey().

Then RegUnloadKey().

Read the docs for RegLoadKey() - you might need to muck around with privileges to get things to work properly.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜