dlls/advapi32/registry.c patch

Massimo max at veneto.com
Fri Jul 5 10:13:16 CDT 2002


This patch solves bug 842.
When RegEnumValuesA gets called with too small buffers, it should
return an error code (as it did already), but also correct buffer sizes (as it didn't) to 
allow calling app to make a new correct call.
Note : I didn't had time to investigate if others RegXXXX functions
suffer same problem, just fixed RegEnumValuesA !

Regards

Max

License : LGPL or X11
ChangeLog:
  Correct returned buffer sizes in case of buffers too small.



-------------- next part --------------
--- 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)
             {
+		 /* 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)
                 {
+		     /* MUST RETURN REQUESTED CORRECT BUFFER SIZE, NOT ONLY TELL IT'S WRONG */
+                    *count = len+1 ;
                     status = STATUS_BUFFER_OVERFLOW;
                     goto done;
                 }


More information about the wine-patches mailing list