remote registry reading problem
A REG_MULTI_SZ value is a null terminated string of null terminated substrings...
In other words, it looks like this:
sValue = "abc" & chr(0) & "123" & chr(0) & "xyz" & chr(0) & chr(0)
The value returned by RegObj has the final null that terminates the string stripped, but not the
nulls that terminate each substring.
You have to split the value into an array and ignore the extra (empty) array element
For example,
Assume a REG_MULTI_SZ value was written containing:
==> "abc" & chr(0) & "123" & chr(0) & "xyz" & chr(0) & chr(0)
RegObj will "read it back" (minus the final null) as:
==> "abc" & chr(0) & "123" & chr(0) & "xyz" & chr(0)
If you then split the value returned on the chr(0):
arValue = split(sValue,chr(0))
arValue will have an extra (empty) element because the string being split ends with the delimiter
used to do the split (i.e., the last element is what follows the last delimiter which in this case
is nothing).
If you just try to display the raw value returned with MsgBox or WScript.Echo, both will truncate
the string displayed at the first embedded null...
--
Michael Harris
Microsoft.MVP.Scripting
--
Please do not email questions - post them to the newsgroup instead.
--
How can I read multistring key value on a remote machine?
RegRead method doesnt seem to work "on remote" and objKey.Value returns only the
first part of REG_MULTI_SZ value.
Please help me.