Let me explain by telling the difference between REG files that have a REGEDIT4 (v4) signature and those that have a Windows Registry Editor 5.00 signature (v5).
REGEDIT4 files are designed to be readable by non-Unicode operating systems (NT/9x/ME) so are saved in ASCII encoding by REGEDIT when you export to v4 format (or using NT/9x/ME's REGEDIT).
In v4 REG files, REG_EXPAND_SZ (hex(2)) and and REG_MULTI_SZ (hex(7)) entries are specified as comma separated, null-terminated single byte char hex values (and hence cannot support non-ASCII codepages).
On the other hand, in v5 REG files, REG_EXPAND_SZ (hex(2)) and REG_MULTI_SZ (hex(7)) are specified as comma separated, null-terminated double byte char hex values (and thus support all languages!).
A common problem is that sometimes when copying/pasting multiple REG tweaks from different sources, some tweaks may be in v4 format and others in v5 format and so on...
Now mixing these together in a single REG file with incorrect signature WILL lead to problems.
For example, let's consider this example, I created a new key and a test multi string value and exported it twice in either REG formats...
Here's the output:
- Code: Select all
Windows Registry Editor Version 5.00
- Code: Select all
Notice in v5, how each character of the word (Hello!) is expressed as double-bytes. (H = 48h,00h | E = 65h,00h) while in v4 it is expressed as a single byte (H = 48h | E = 65h)...
Now, the way the old Reg2Inf engine worked was to convert consecutive 00,00s into a \r\n which is then used as a basis of splitting the lines of the REG_MULTI_SZ, but this only worked in English letters (simply because all of them use 00 for the second byte which would satisfy the replacement condition) while in other languages that used both bytes, it would not split or return incorrect results.
So now, in v0.35 of Reg2Inf, if you have a REG_MULTI_SZ that uses double-byte characters, you MUST specify Windows Registry Editor Version 5.00 signature or it will not convert correctly.
The same thing goes for REG_EXPAND_SZ too...
* Now, what does Reg2Inf do when it encounters a incorrect condition ?:
- In case of erroraneous v4 signature, any 00s may incorrectly be interpreted as new lines in the REG_MULTI_SZ and any non-ASCII hex codes will be converted to a ? (REG_EXPAND_SZ and REG_MULTI_SZ).
- In case of erroraneous v5 signature, you may get Chinese characters in the output INF instead of the result you expect.
So, to sum it up, use Unicode v5 strings whenever you can, if you have any blocks using the single byte ordering, put them in a separate REG file that has the v4 signature and then convert both of them simultaneously with the @"list.txt" method and Reg2Inf will properly merge and convert both.
Pheww... long post . If anyone has any comments and questions, please do post them .