RegEnumValueA bugs and patch in dlls/advapi32/registry.c

Max max at veneto.com
Fri Jul 5 18:45:06 CDT 2002


Well, finally found and corrected a bug that made AutoCAD R14 hang...
I guess some other apps could have the same problem solved, but
had no time to test more :)

In RegEnumValueA, when the size for requested data buffer is too small,
function should return an error (as it does), but also return correct
buffer size (as it doesn't).
Found in AutoCAD; it asked for a reistry key value, got error, and then
looped forever trying to get val with wrong buffer size.

I guess, but had no time yet to check, that this problem could happen
somwhere else in Registry.c, I'll check it out next days.

With this patch, finally AutoCAD R14 is perfectly usable in wine, even without 
a native windows installed !

Here the patch :

--- dlls/advapi32/registry.c	Sat Jul  6 01:29:08 2002
+++ /home/massimo/wine-patches/registry.c	Sat Jul  6 01:35:32 2002
@@ -1157,6 +1157,9 @@
             RtlUnicodeToMultiByteSize( &len, info->Name, info->NameLength );
             if (len >= *val_count)
             {
+                /* CHANGELOG : 04.07.2002 by Max
+		   MUST RETURN REQUESTED CORRECT BUFFER SIZE, NOT ONLY TELL IT'S WRONG */
+                *val_count = len + 1 ;
                 status = STATUS_BUFFER_OVERFLOW;
                 goto done;
             }
@@ -1174,6 +1177,9 @@
             {
                 if (len > *count)
                 {
+                   /* CHANGELOG : 04.07.2002 by Max
+		    MUST RETURN REQUESTED CORRECT BUFFER SIZE, NOT ONLY TELL IT'S WRONG */
+                    *count = len+1 ;
                     status = STATUS_BUFFER_OVERFLOW;
                     goto done;
                 }

I'll just post it to wine-patches too.

Regards

Max



More information about the wine-devel mailing list