假設值是REG_MULTI_SZ,這是否意味着每個序列中的字符串可以或不可以是空值終止
序列中的字符串必須被空終止否則將無法確定其中一個字符串結束和下一個字符串開始的位置。從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\0
The first \0 terminates the first string, the second to the last \0 terminates
the last string, and the final \0 terminates the sequence.
Note that the final terminator must be factored into the length of the string.
的文檔是模糊的,但我的理解是,最後空終止可能會丟失:
String1\0String2\0String3\0LastString
和讀碼值必須確保它們存在後續列提取。
如果用於包含該值的緩衝區足夠大,包括用於終止空字符的空間,只要代碼確保尾隨空值存在,則沒有任何事項需要關注。