[ros-diffs] [cwittich] 41116: some small reg fixes

cwittich at svn.reactos.org cwittich at svn.reactos.org
Mon May 25 15:11:00 CEST 2009


Author: cwittich
Date: Mon May 25 17:10:58 2009
New Revision: 41116

URL: http://svn.reactos.org/svn/reactos?rev=41116&view=rev
Log:
some small reg fixes

Modified:
    trunk/reactos/dll/win32/advapi32/reg/reg.c

Modified: trunk/reactos/dll/win32/advapi32/reg/reg.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/reg/reg.c?rev=41116&r1=41115&r2=41116&view=diff
==============================================================================
--- trunk/reactos/dll/win32/advapi32/reg/reg.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/advapi32/reg/reg.c [iso-8859-1] Mon May 25 17:10:58 2009
@@ -4025,10 +4025,6 @@
     if (ErrorCode == ERROR_SUCCESS ||
         ErrorCode == ERROR_MORE_DATA)
     {
-        if (lpType != NULL)
-        {
-            *lpType = Type;
-        }
 
         if ((Type == REG_SZ) || (Type == REG_MULTI_SZ) || (Type == REG_EXPAND_SZ))
         {
@@ -4062,6 +4058,11 @@
         }
     }
 
+    if (lpType != NULL)
+    {
+        *lpType = Type;
+    }
+
     if (ValueData.Buffer != NULL)
     {
         RtlFreeHeap(ProcessHeap, 0, ValueData.Buffer);
@@ -4114,6 +4115,9 @@
         if (count) *count = 0;
     }
 
+    /* this matches Win9x behaviour - NT sets *type to a random value */
+    if (type) *type = REG_NONE;
+
     status = NtQueryValueKey( hkey, &name_str, KeyValuePartialInformation,
                               buffer, total_size, &total_size );
     if (status && status != STATUS_BUFFER_OVERFLOW) goto done;
@@ -4125,7 +4129,10 @@
         {
             if (buf_ptr != buffer) HeapFree( GetProcessHeap(), 0, buf_ptr );
             if (!(buf_ptr = HeapAlloc( GetProcessHeap(), 0, total_size )))
+            {
+                ClosePredefKey(hkey);
                 return ERROR_NOT_ENOUGH_MEMORY;
+            }
             info = (KEY_VALUE_PARTIAL_INFORMATION *)buf_ptr;
             status = NtQueryValueKey( hkey, &name_str, KeyValuePartialInformation,
                                       buf_ptr, total_size, &total_size );



More information about the Ros-diffs mailing list