Reading /proc/registry/... returns extra char

Andrey Repin anrdaemon@freemail.ru
Wed May 26 14:24:00 GMT 2010


Greetings, Corinna Vinschen!

>> > $ cat >a.dat
>> > /proc/registry/HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/Syst
>> > emBootDevice

> This trailing NUL character was always there, already with Cygwin 1.5.
> It's part of the file content.  If strings are stored with a trailing
> NUL in a file, you don't want Cygwin to remove it for you, right?

Wrong. The training NULL is a string value terminator for REG_SZ variables,
also a string separator for REG_MULTI_SZ ones. (Which ends with a spare NULL)
It must not be exposed to the user. Seriously, when you are working with
NULL-terminated strings, do you print the NULL to the user? Or, more
specifically, can you ever reach it using string functions in first place? No,
only using direct memory access you can discover the NULL at the end of a
string.

BTW, get it as a bugreport - reading REG_MULTI_SZ from /proc/registry returns
only first string.

REGEDIT4

[HKEY_CURRENT_USER\Software\ACB]
"test"=hex(7):61,73,64,61,73,64,00,61,61,73,61,64,73,00,00

$ cat /proc/registry/HKEY_CURRENT_USER/Software/ACB/test
asdasd


--
WBR,
 Andrey Repin (anrdaemon@freemail.ru) 26.05.2010, <17:31>

Sorry for my terrible english...


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list