- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
MSDN 说 RegEnumValue 得到的字符串数据
If the data has the REG_SZ, REG_MULTI_SZ or REG_EXPAND_SZ type, the string may not have been stored with the proper null-terminating characters. Therefore, even if the function returns ERROR_SUCCESS, the application should ensure that the string is properly terminated before using it; otherwise, it may overwrite a buffer. (Note that REG_MULTI_SZ strings should have two null-terminating characters.)
假设一个值为 REG_MULTI_SZ,这是否意味着序列中的每个字符串都可以或不能以 null 终止,或者只是最后一个双 null 终止符可能不存在,但所有内部 null 终止符都存在?
最佳答案
Suppose a value is REG_MULTI_SZ, does this mean that each of the strings in the sequence can or cannot be null-terminated
序列中的字符串必须 以null 终止,否则将无法确定其中一个字符串的结束位置和下一个字符串的开始位置。来自 Registry Value Types描述 REG_MULTI_SZ
:
A sequence of null-terminated strings, terminated by an empty string (\0).The following is an example: String1\0String2\0String3\0LastString\0\0The first \0 terminates the first string, the second to the last \0 terminatesthe last string, and the final \0 terminates the sequence.Note that the final terminator must be factored into the length of the string.
The documentation is vague but my interpretation is that the last null terminators may be missing:
String1\0String2\0String3\0LastString
和读取该值的代码必须确保它们存在以用于后续的字符串提取。
如果用于包含值的缓冲区足够大,包括用于终止空字符的空间,只要代码确保存在尾随空值,就没有什么可担心的。
关于c - RegEnumValue 和 REG_MULTI_SZ 类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16563208/
我正在尝试使用 C++ 将 REG_MULTI_SZ 值写入 Windows 注册表。我卡住的地方是将我必须的 c 字符串转换为 MULTI_SZ 格式。有没有方便的方法来做到这一点? 最佳答案 你必
我正在尝试为 python 2.7 中的新注册表项创建新的 REG_MULTI_SZ 值 此代码非常适合 REG_SZ、REG_DWORD 和其他使用 string/int 的代码,但我找不到为多尺寸
我有 1 个类型为 REG_MULTI_SZ 的注册表项。此条目中已包含一些字符串。 现在我想使用 .net classRegistryKey 添加 1 个字符串。这个类有方法 key.SetValu
MSDN 说 RegEnumValue 得到的字符串数据 If the data has the REG_SZ, REG_MULTI_SZ or REG_EXPAND_SZ type, the str
要添加一个 REG_MULTI_SZ 多行注册表值,我可以这样做 reg.exe ADD "HKLM\path\to\registry\key" /v RegistryValue /t REG_MUL
有一个 REG_MULTI_SZ 值,我想将其粘贴在一个字符串数组中,以便我的程序可以用它们做其他事情。我从来没有使用过 C++ 来访问注册表,所以在学习了一些示例之后我有点不知所措。我正在使用 VS
如何从 vs 2008 中的设置项目安装程序将 reg_multi_sz 值添加到注册表中?他们拥有的唯一选项是字符串值、环境字符串值、二进制值、双字值请帮忙 最佳答案 将其作为常规字符串值输入并用此
在我们的 vc++ win32 应用程序中,我们正在读取 reg_multi_sz 类型的注册表值,它在 32 位上运行良好,但在 64 位上运行时给出空缓冲区。如何从我的 32 位应用程序中读取 6
我是一名优秀的程序员,十分优秀!