storing the registry key class name to make PDFXChange-Viewer happy

Patrick ragamuffin at datacomm.ch
Fri Mar 6 03:41:01 CST 2009


Dear Dan, Juan, Austin et al

I still hope that one of you guys could take care of including this in
the mainline wine - i sent a patch to wine-patches which still applies
fine to the latest git tree.

Any help for including the bugfix is much appreciatet. The code is
totally copyright free. Please help getting this bug fixed. Just submit
the code as your own or vote for the inclusion of my patch or improove
it and resubmit, ... any help is appreciated!

Greets

Patrick


@dan 
On Mon, 2009-03-02 at 18:38 +0100, Dan Kegel wrote:
> Oh, but I meant to say, you should write your own test
> to verify the bug you're trying to fix, and make sure
> your test passes on windows.  See
> http://www.winehq.org/docs/winedev-guide/testing
> Then submit the test along with your bugfix.
> That way your bug will stay fixed, because everyone
> will run your test (along with all the others) before they
> submit changes to wine.

It might be difficult to write a test since the test would actually pass
already as long as you don't shutdown and restart wineserver, which is
not done during the tests I guess...

>From 554fc44b2c94acda06521cb5be5b3143054eebf7 Mon Sep 17 00:00:00 2001
From: Patrick <ragamuffin at datacomm.ch>
Date: Mon, 2 Mar 2009 10:12:26 +0100
Subject: save/load registry key class names

---
 server/registry.c |   41 +++++++++++++++++++++++++++++++++++++----
 1 files changed, 37 insertions(+), 4 deletions(-)

diff --git a/server/registry.c b/server/registry.c
index d83486b..afe7771 100644
--- a/server/registry.c
+++ b/server/registry.c
@@ -246,6 +246,10 @@ static void save_subkeys( const struct key *key, const struct key *base, FILE *f
     {
         fprintf( f, "\n[" );
         if (key != base) dump_path( key, base, f );
+        if (key->class != NULL) {
+                fprintf( f, "] [" );
+                dump_strW( key->class, key->classlen / sizeof(WCHAR), f, "[]" );
+        }
         fprintf( f, "] %u\n", (unsigned int)((key->modif - ticks_1601_to_1970) / TICKS_PER_SEC) );
         for (i = 0; i <= key->last_value; i++) dump_value( &key->values[i], f );
     }
@@ -1107,12 +1111,12 @@ static int get_data_type( const char *buffer, int *type, int *parse_type )
 static struct key *load_key( struct key *base, const char *buffer, int flags,
                              int prefix_len, struct file_load_info *info )
 {
-    WCHAR *p;
-    struct unicode_str name;
-    int res;
+    WCHAR *p, *c;
+    struct unicode_str name, class;
+    int res, c_res;
     unsigned int mod;
     timeout_t modif = current_time;
-    data_size_t len;
+    data_size_t len, c_len;
 
     if (!get_file_tmp_space( info, strlen(buffer) * sizeof(WCHAR) )) return NULL;
 
@@ -1122,6 +1126,32 @@ static struct key *load_key( struct key *base, const char *buffer, int flags,
         file_read_error( "Malformed key", info );
         return NULL;
     }
+
+    c_len = info->tmplen - len;
+    if ((c_res = parse_strW( info->tmp + len / sizeof(WCHAR), &c_len, buffer + res, ']' )) == -1)
+    {
+	/* no class name */
+        class.len = 0;
+    }
+    else
+    {
+	res += c_res;
+
+        c = info->tmp + len / sizeof(WCHAR);
+        while (*c) { if (*c++ == '[') break; }
+
+        if (!*c)
+        {
+            /* malformed class name - ignore */
+            class.len = 0;
+        }
+	else
+	{
+            class.str = c;
+            class.len = c_len - (c - (info->tmp + len / sizeof(WCHAR)) + 1) * sizeof(WCHAR);
+        }
+    }
+
     if (sscanf( buffer + res, " %u", &mod ) == 1)
         modif = (timeout_t)mod * TICKS_PER_SEC + ticks_1601_to_1970;
 
@@ -1140,6 +1170,9 @@ static struct key *load_key( struct key *base, const char *buffer, int flags,
     }
     name.str = p;
     name.len = len - (p - info->tmp + 1) * sizeof(WCHAR);
+
+    if (class.len > 0)
+        return create_key( base, &name, &class, flags, modif, &res );
     return create_key( base, &name, NULL, flags, modif, &res );
 }
 
-- 
1.6.1.3






More information about the wine-devel mailing list