RegEnumKeyEx bug & patch

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

 



Hi,

Here is a nasty little bug shown by CD-burning software Nero 5.5. This
application manages to delete wine ASPI's information in the following
way. 
First it asks to open a registry key that happens not to exist at that
point in time (first run after setup).  The error return code form
RegOpneKey is ignored, instead Nero uses the returned keyhandle NULL
to do a RegEnumKeyEx to get the subkeys. Each subkey is deleted with
RegDeleteKey (after recursively deleting sub sub keys).
Wine implements RegEnumKeyEx by NTEnumerate, which in case of a zero
keyhandle uses the registry root and returns as the first subkey
"Dyndata" aka HKEY_DYN_DATA. Just where the ASPI data was stored!

This behaviour must have been put there on purpose, so I must assume
it is correct. It is different though from the win32 RegEnumKeyEx that
returns an invalid_handle error, therefore I propose a fix in that
function.

For the Log:

	advapi32/	: registry.c
	
	Check for NULL keyvalue in RegEnumKeyExA/W

Rein.
-- 
Rein Klazes
rklazes@xs4all.nl
--- wine/dlls/advapi32/registry.c	Tue Jun 18 08:35:49 2002
+++ mywine/dlls/advapi32/registry.c	Thu Jun 27 17:43:30 2002
@@ -297,6 +297,8 @@
 
     if (reserved) return ERROR_INVALID_PARAMETER;
 
+    if (!hkey) return ERROR_INVALID_HANDLE;
+
     status = NtEnumerateKey( hkey, index, KeyNodeInformation,
                              buffer, sizeof(buffer), &total_size );
 
@@ -357,6 +359,8 @@
            name_len ? *name_len : -1, reserved, class, class_len, ft );
 
     if (reserved) return ERROR_INVALID_PARAMETER;
+
+    if (!hkey) return ERROR_INVALID_HANDLE;
 
     status = NtEnumerateKey( hkey, index, KeyNodeInformation,
                              buffer, sizeof(buffer), &total_size );

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

  Powered by Linux