将不同的注册表值类型转换为字符串?

编程入门 行业动态 更新时间:2024-10-27 20:32:47
本文介绍了将不同的注册表值类型转换为字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我遍历注册表,获取键的值并将它们存储为字符串.我发现有很多不同的类型.其中一些类型导致我的文件流编写器失败.是否可以将以下所有内容转换为字符串形式.实际数据值并不重要,重要的是区分不同值的能力.

im traversing through the registry, taking the values of the keys and storing them as strings. I have discovered there are many different types. Some of these types are causing my filestream writer to fail. Is it possible to convert all of the below into a string form. The actual data value is not important, just the ability to differentiate between different values.

  • 双字
  • 扩展字符串
  • 二进制(这和 byte[] 一样吗?)
  • 多字符串

-

if (String.Compare(SubKey.GetValueKind(v[i]).ToString(), "String") == 0) { String s = SubKey.GetValue(v[i]).ToString(); RegistryKeyDataValue rkdv = new RegistryKeyDataValue(s); rkdv.incrementNumberOfTimesUsed(); rkdv.setTypeOfData("S"); r.addDataValue(rkdv); r.setCurrentDataValue(s); String hash = ""; h.setHashData(hash); hash = h.HashString(s); }

我稍后遇到问题,因为我想将值写入文件,并且需要将所有不同类型转换为字符串.

I'm having problems later on because i want to write the values to a file and i need to convert all different types to a string.

推荐答案

对于将注册表值作为字符串写入文件,已经有一个不错的标准.在 Regedit.exe 中,选择一个键后使用 File + Export 来查看它的样子.此知识库文章中提供了文档.

There already is a decent standard for writing registry values as strings to a file. In Regedit.exe, use File + Export after selecting a key to see what that looks like. Documentation is available in this KB article.

更多推荐

将不同的注册表值类型转换为字符串?

本文发布于:2023-07-10 08:32:22,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1089853.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:转换为   字符串   注册表   类型

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!