Patch for Bug #824

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Attached is a patch that resolved the issues brought up in bug #824 ('\0
character is added to REG_MULTI_SZ registry values' -
http://bugs.winehq.com/show_bug.cgi?id=824). I have resolved this issue by
changing the storage of the REG_MULTI_SZ values in the 'system.reg' from
being as a string deliminated by double quotes to being hex(7) values in the
same way that windows regedit stores them in .reg files when exported.
Whilst doing this I also noticed that a similar issued applies to
REG_EXPAND_SZ and this can be resolved in a similar fashion. I also noticed
that the WINE implementation of regedit exports the REG_EXPAND_SZ strings as
a double quote delimiated string (with implicit null terminator), unlike
windows regedit which stores it as hex(2) - so I have also patched the
implementation of regedit to store it as hex(2) values.

This means that by using the regedit tool in the fashion described in the
bug report the correct .reg file is exported compared to the windows
exported file.

I have been using a snapshot, wine-20030411, running under Gentoo with GCC
version 3.2.1. To check that this patch works I did a clean recompile of the
patched code. The affected source files are 'server/registry.c' and
'programs/regedit/regcode.c' neither of which have been altered in the last
2 months according to your CVS.

I hope that this is of some use to you.

Regards,

Nick Brereton


PS: Also attached is the .reg test case that I have been using, which I
created on my Windows XP pro machine and exported.



--- Programming/wine-20030411/server/registry.c	2003-02-25
04:04:18.000000000 +0000
+++ WineTmp/server/registry.c	2003-04-30 00:12:09.000000000 +0000
@@ -215,8 +215,6 @@
     switch(value->type)
     {
     case REG_SZ:
-    case REG_EXPAND_SZ:
-    case REG_MULTI_SZ:
         if (value->type != REG_SZ) fprintf( f, "str(%d):", value->type );
         fputc( '\"', f );
         if (value->data) dump_strW( (WCHAR *)value->data, value->len /
sizeof(WCHAR), f, "\"\"" );
@@ -230,6 +228,11 @@
             fprintf( f, "dword:%08lx", dw );
             break;
         }
+
+    /* these 3 fall through - should all be treated as binary values */
+    case REG_EXPAND_SZ:
+    case REG_MULTI_SZ:
+    case REG_BINARY:
         /* else fall through */
     default:
         if (value->type == REG_BINARY) count += fprintf( f, "hex:" );


--- Programming/wine-20030411/programs/regedit/regproc.c	2002-11-06
22:02:52.000000000 +0000
+++ WineTmp/programs/regedit/regproc.c	2003-04-30 00:09:16.000000000 +0000
@@ -1254,7 +1254,7 @@
             switch (value_type)
             {
             case REG_SZ:
-            case REG_EXPAND_SZ:
+            /* case REG_EXPAND_SZ: */
                 fputs("\"", file);
                 REGPROC_export_string(file, *val_buf);
                 fputs("\"\n", file);
@@ -1271,6 +1271,8 @@
                 printf("key name: \"%s\"\n", *reg_key_name_buf);
                 printf("value name:\"%s\"\n\n", *val_name_buf);
                 /* falls through */
+            case REG_EXPAND_SZ:
+                /* falls through */
             case REG_MULTI_SZ:
                 /* falls through */
             case REG_BINARY:

Attachment: programs_regedit_regproc.patch
Description: Binary data

Attachment: server_registry.patch
Description: Binary data

Attachment: testcase.reg
Description: Binary data


[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux