【请教】如何列举注册表分支?
很高兴您能注意到这个帖子,希望您能帮助我解决个这个问题,在这里小弟先谢谢了。
问题如下:
现在我想写一个注册表操作相关的程序,在写的过程中,遇到了一些问题,
我想实现的目标是:将 HKEY_LOCAL_MACHINE 这个项下的所有的分支给列举出来,比如
HKEY_LOCAL_MACHINE 的分支:
HARDWARE
SAM
SECURITY
SOFTWARE
SYSTEM
为了实现这一目的,我去查阅了MSDN中注册表操作相关的函数,其中与列举内容相关的函数有:
RegEnumKeyEx
The RegEnumKeyEx function enumerates subkeys of the specified open registry key. The function retrieves information about one subkey each time it is called. Unlike the RegEnumKey function, RegEnumKeyEx retrieves the class name of the subkey and the time it was last modified.
RegEnumValue
The RegEnumValue function enumerates the values for the specified open registry key. The function copies one indexed value name and data block for the key each time it is called.
这两个函数,一个是列举子键,一个是列举键值,没有列举分支的功能,在MSDN中也没有找到相应的列举分支的函数。
在提问之前,我分析了微软自带的regedit.exe中所使用的函数,里面也没有发现什么特殊的内容。
现在请教大家,如何列举注册表的分支,应该用哪个函数?或者是用哪种方法呢?
很高兴您能注意到这个帖子,希望您能帮助我解决个这个问题,在这里小弟先谢谢了。
问题如下:
现在我想写一个注册表操作相关的程序,在写的过程中,遇到了一些问题,
我想实现的目标是:将 HKEY_LOCAL_MACHINE 这个项下的所有的分支给列举出来,比如
HKEY_LOCAL_MACHINE 的分支:
HARDWARE
SAM
SECURITY
SOFTWARE
SYSTEM
为了实现这一目的,我去查阅了MSDN中注册表操作相关的函数,其中与列举内容相关的函数有:
RegEnumKeyEx
The RegEnumKeyEx function enumerates subkeys of the specified open registry key. The function retrieves information about one subkey each time it is called. Unlike the RegEnumKey function, RegEnumKeyEx retrieves the class name of the subkey and the time it was last modified.
RegEnumValue
The RegEnumValue function enumerates the values for the specified open registry key. The function copies one indexed value name and data block for the key each time it is called.
这两个函数,一个是列举子键,一个是列举键值,没有列举分支的功能,在MSDN中也没有找到相应的列举分支的函数。
在提问之前,我分析了微软自带的regedit.exe中所使用的函数,里面也没有发现什么特殊的内容。
现在请教大家,如何列举注册表的分支,应该用哪个函数?或者是用哪种方法呢?





2008-8-7 14:02
