regedit: Avoid appending '\' and '0' to string value of imported key.

Jiaxing Wang hello.wjx at gmail.com
Thu Nov 20 01:29:07 CST 2014


After importing, string values are appended with '\' and '0'.
For example, importing:

[HKEY_LOCAL_MACHINE\testkey]
"value"="abc"

gets

[HKEY_LOCAL_MACHINE\testkey]
"value"="abc\0"

This is because the null character after last quote is included
which is not needed as the last quote has been changed to '\0' and
dwLen already include the last quote.
---
 programs/regedit/regproc.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/programs/regedit/regproc.c b/programs/regedit/regproc.c
index 80beb21..643b559 100644
--- a/programs/regedit/regproc.c
+++ b/programs/regedit/regproc.c
@@ -376,7 +376,6 @@ static LONG setValue(WCHAR* val_name, WCHAR* val_data, BOOL is_unicode)
             return ERROR_INVALID_DATA;
         val_data[dwLen-1] = '\0'; /* remove last quotes */
         lpbData = (BYTE*) val_data;
-        dwLen++;  /* include terminating null */
         dwLen = dwLen * sizeof(WCHAR); /* size is in bytes */
     }
     else if (dwParseType == REG_DWORD)  /* Convert the dword types */
-- 
1.9.1




More information about the wine-patches mailing list