regedit fix
Francois Gouget
fgouget at codeweavers.com
Tue Mar 23 13:06:46 CST 2004
If I run something like 'regedit foo.reg' where foo.reg contains a
REG_EXPAND_SZ string like this:
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ShellFolders]
"Favorites"=str(2):"C:\\WINDOWS\\Favorites"
Then I'll get two extra characters in the registry. This is because:
* for REG_EXPAND_SZ strings the registry API relies on the dwLen
parameter instead of stopping at the '\0'.
* regedit did not update the dwLen parameter after passing the string
through REGPROC_unescape_string() which typically removes characters
(the duplicated baskslashes).
Changelog:
Francois Gouget <fgouget at codeweavers.com>
* programs/regedit/regproc.c
Compute dwLen after passing the string through
REGPROC_unescape_string() so we don't save garbage characters in the
registry.
--
Francois Gouget
fgouget at codeweavers.com
-------------- next part --------------
Index: programs/regedit/regproc.c
===================================================================
RCS file: /var/cvs/wine/programs/regedit/regproc.c,v
retrieving revision 1.12
diff -u -r1.12 regproc.c
--- a/programs/regedit/regproc.c 8 Dec 2003 22:48:07 -0000 1.12
+++ b/programs/regedit/regproc.c 23 Mar 2004 18:49:37 -0000
@@ -397,14 +397,17 @@
if ( dwParseType == REG_SZ) /* no conversion for string */
{
+ REGPROC_unescape_string(val_data);
+ /* Compute dwLen after REGPROC_unescape_string because it may
+ * have changed the string length and we don't want to store
+ * the extra garbage in the registry.
+ */
dwLen = strlen(val_data);
if (dwLen>0 && val_data[dwLen-1]=='"')
{
dwLen--;
val_data[dwLen]='\0';
}
- dwLen++;
- REGPROC_unescape_string(val_data);
lpbData = val_data;
} else if (dwParseType == REG_DWORD) /* Convert the dword types */
{
More information about the wine-patches
mailing list