Writing an array to a REG_MULTI_SZ registry key adds newlines

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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
 
Hi,

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
 
Back
Top