wine/dlls/shell32 shfldr_desktop.c

Alexandre Julliard julliard at wine.codeweavers.com
Wed Nov 23 08:25:40 CST 2005


ChangeSet ID:	21416
CVSROOT:	/opt/cvs-commit
Module name:	wine
Changes by:	julliard at winehq.org	2005/11/23 08:25:40

Modified files:
	dlls/shell32   : shfldr_desktop.c 

Log message:
	Michael Jung <mjung at iss.tu-darmstadt.de>
	Also scan HKEY_CURRENT_USER for shell namespace extensions in Desktop
	folder.
	Fixed a handle leak in case of failing AddToEnumList call.

Patch: http://cvs.winehq.org/patch.py?id=21416

Old revision  New revision  Changes     Path
 1.49          1.50          +22 -21     wine/dlls/shell32/shfldr_desktop.c

Index: wine/dlls/shell32/shfldr_desktop.c
diff -u -p wine/dlls/shell32/shfldr_desktop.c:1.49 wine/dlls/shell32/shfldr_desktop.c:1.50
--- wine/dlls/shell32/shfldr_desktop.c:1.49	23 Nov 2005 14:25:40 -0000
+++ wine/dlls/shell32/shfldr_desktop.c	23 Nov 2005 14:25:40 -0000
@@ -274,36 +274,37 @@ static BOOL CreateDesktopEnumList(IEnumI
     if (dwFlags & SHCONTF_FOLDERS)
     {
         HKEY hkey;
-        LONG r;
+        UINT i;
 
         /* create the pidl for This item */
         ret = AddToEnumList(list, _ILCreateMyComputer());
 
-        r = RegOpenKeyExW(HKEY_LOCAL_MACHINE, Desktop_NameSpaceW,
-                          0, KEY_READ, &hkey);
-        if (ret && ERROR_SUCCESS == r)
-        {
-            WCHAR iid[50];
-            int i=0;
-            BOOL moreKeys = TRUE;
-
-            while (ret && moreKeys)
+        for (i=0; i<2; i++) {
+            if (ret && !RegOpenKeyExW(i == 0 ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER,
+                                      Desktop_NameSpaceW, 0, KEY_READ, &hkey))
             {
-                DWORD size;
+                WCHAR iid[50];
+                int i=0;
 
-                size = sizeof (iid);
-                r = RegEnumKeyExW(hkey, i, iid, &size, 0, NULL, NULL, NULL);
-                if (ERROR_SUCCESS == r)
+                while (ret)
                 {
-                    ret = AddToEnumList(list, _ILCreateGuidFromStrW(iid));
-                    i++;
+                    DWORD size;
+                    LONG r;
+
+                    size = sizeof (iid);
+                    r = RegEnumKeyExW(hkey, i, iid, &size, 0, NULL, NULL, NULL);
+                    if (ERROR_SUCCESS == r)
+                    {
+                        ret = AddToEnumList(list, _ILCreateGuidFromStrW(iid));
+                        i++;
+                    }
+                    else if (ERROR_NO_MORE_ITEMS == r)
+                        break;
+                    else
+                        ret = FALSE;
                 }
-                else if (ERROR_NO_MORE_ITEMS == r)
-                    moreKeys = FALSE;
-                else
-                    ret = FALSE;
+                RegCloseKey(hkey);
             }
-            RegCloseKey(hkey);
         }
     }
 



More information about the wine-cvs mailing list