delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
X-SWARE-Spam-Status: | No, hits=3.2 required=5.0 tests=AWL,BAYES_50,FREEMAIL_FROM,KAM_THEBAT |
X-Spam-Check-By: | sourceware.org |
Date: | Wed, 26 May 2010 17:42:27 +0400 |
From: | Andrey Repin <anrdaemon AT freemail DOT ru> |
Reply-To: | Andrey Repin <cygwin AT cygwin DOT com> |
Message-ID: | <1254830174.20100526174227@mtu-net.ru> |
To: | Corinna Vinschen <cygwin AT cygwin DOT com> |
Subject: | Re: Reading /proc/registry/... returns extra char |
In-Reply-To: | <20100526114733.GG10652@calimero.vinschen.de> |
References: | <20100513181249 DOT GE13784 AT cupro DOT opengvs DOT com> <2BF01EB27B56CC478AD6E5A0A28931F2F01D44 AT A1DAL1SWPES19MB DOT ams DOT acs-inc DOT net> <20100526114733 DOT GG10652 AT calimero DOT vinschen DOT de> |
MIME-Version: | 1.0 |
X-IsSubscribed: | yes |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Id: | <cygwin.cygwin.com> |
List-Unsubscribe: | <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com> |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
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 AT freemail DOT 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
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |