Writing an array to a REG_MULTI_SZ registry key adds newlines
am 31.10.2007 17:31:03 von BasRijniersce
Hello,
I'm trying to write:
strMulti = new string[] { @"c:\pagefile.sys", "512", "512" };
with:
keyRead.SetValue(regKey, strMulti, regKind);
Where reKind is Multistring
Unfortunately it ends up int he registry as
c:\pagefile.sys
512
512
while it should be
c:\pagefile.sys 512 512
How can I get it to not write the terminating newlines?
Tx!
Bas
Re: Writing an array to a REG_MULTI_SZ registry key adds newlines
am 31.10.2007 22:26:56 von mattias.dont.want.spam
>Unfortunately it ends up int he registry as
>c:\pagefile.sys
>512
>512
Isn't that just how Regedt32 displays REG_MULTI_SZ values in the GUI?
Do you see any newlines if you read the value back?
Mattias
--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Re: Writing an array to a REG_MULTI_SZ registry key adds newlines
am 31.10.2007 22:41:01 von BasRijniersce
Hi,
"Mattias Sjögren" wrote:
> >Unfortunately it ends up int he registry as
> >c:\pagefile.sys
> >512
> >512
> Isn't that just how Regedt32 displays REG_MULTI_SZ values in the GUI?
> Do you see any newlines if you read the value back?
No, have a look at
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory
Management and then Paging files. It has one line per pagefile location.
What is the best way to scan for newlines? Just a Console.Write and print
the variable, if it advances to the next line it has a \n?
Bas
>
> Mattias
>
> --
> Mattias Sjögren [C# MVP] mattias @ mvps.org
> http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
> Please reply only to the newsgroup.
>