繁体   English   中英

Python:Windows 注册表 hive 访问不使用注册表 API

[英]Python: Windows registry hive access NOT using registry APIs

我正在尝试从 Windows 注册表中提取一些数据,包括来自 XP 计算机的软件 hive 和 ntuser.dat。 目前我正在使用reg.exe加载 hive 和_winreg来提取数据。 我需要使用reg.exe ,因为我从中备份数据的计算机通常处于脱机状态,我将它们的硬盘驱动器放在外部驱动器托架中,并将配置单元加载到另一个 Windows session 中。 启动正在备份的计算机是不可行的,因为它们经常出现硬盘故障或无法启动。

I've seen a utility called hivex which runs under Linux which combines a c-module with a python wrapper to allow for read-only (limited write) access to the Windows registry, without using the Windows Registry APIs. Sadly there doesn't appear to be a Windows version of hivex , assumingly because no one figured a need to access the Windows registry under Windows by directly accessing the hive files.

我很想放弃由subprocess.Popen()调用的reg.exe的依赖关系,因为调用外部可执行文件有很多问题,而且它使备份实用程序平台受到限制。

有谁知道允许直接访问 hive 文件本身的 python 模块? 我已经知道,并且目前正在使用_winreg ,因此建议这将无济于事。 提前致谢。

我不确定它有多好,但pywin32库为大多数 windows API 提供了绑定。 I don't know the windows API well enough to know if you can open arbitrary hive files, however it could be worth a quick look (the release contains a CHM with the full API mapping).

您是否看过regobj它提供了对注册表值的 Pythonic 访问(但它仍然基于 _winreg)

调用外部应用程序或使用注册表 API 有问题吗? 如果是前者,您可以使用RegLoadKey / RegUnLoadKey自己加载和卸载蜂巢。 如果是后者,那么我确定有人编写了一个 C 库来直接解析蜂巢。 一个快速的谷歌搜索给了我微软的离线注册表库

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM