[ros-diffs] [janderwald] 34133: - display default icon in file property dialog

janderwald at svn.reactos.org janderwald at svn.reactos.org
Fri Jun 27 19:23:25 CEST 2008


Author: janderwald
Date: Fri Jun 27 12:23:24 2008
New Revision: 34133

URL: http://svn.reactos.org/svn/reactos?rev=34133&view=rev
Log:
- display default icon in file property dialog

Modified:
    trunk/reactos/dll/win32/shell32/fprop.c

Modified: trunk/reactos/dll/win32/shell32/fprop.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/fprop.c?rev=34133&r1=34132&r2=34133&view=diff
==============================================================================
--- trunk/reactos/dll/win32/shell32/fprop.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/fprop.c [iso-8859-1] Fri Jun 27 12:23:24 2008
@@ -152,6 +152,49 @@
         {
             lvalue = lname = MAX_PATH;
             result = RegEnumValueW(hKey,0, name, &lname, NULL, NULL, (LPBYTE)value, &lvalue);
+        }
+        lname = MAX_PATH;
+        if (RegGetValueW(hKey, L"DefaultIcon", NULL, RRF_RT_REG_SZ, NULL, name, &lname) == ERROR_SUCCESS)
+        {
+            UINT IconIndex;
+            WCHAR szBuffer[MAX_PATH];
+            WCHAR * Offset;
+            HICON hIcon = 0;
+            HRSRC hResource;
+            LPVOID pResource = NULL;
+            HGLOBAL hGlobal;
+            HANDLE hLibrary;
+
+            Offset = wcsrchr(name, L',');
+            if (Offset)
+            {
+                IconIndex = _wtoi(Offset + 2);
+                *Offset = L'\0';
+                if (ExpandEnvironmentStringsW(name, szBuffer, MAX_PATH))
+                {
+                    szBuffer[MAX_PATH] = L'\0';
+                    hLibrary = LoadLibraryExW(szBuffer, NULL, LOAD_LIBRARY_AS_DATAFILE);
+                    if (hLibrary)
+                    {
+                        hResource = FindResourceW(hLibrary, MAKEINTRESOURCEW(IconIndex), (LPCWSTR)RT_ICON);
+                        if (hResource)
+                        {
+                            hGlobal = LoadResource(shell32_hInstance, hResource);
+                            if (hGlobal)
+                            {
+                                pResource = LockResource(hGlobal);
+                                if (pResource != NULL)
+                                {
+                                    hIcon = CreateIconFromResource(pResource, SizeofResource(shell32_hInstance, hResource), TRUE, 0x00030000);
+                                    TRACE("hIcon %p,- szBuffer %s IconIndex %u error %u icon %p hResource %p pResource %p\n", hIcon, debugstr_w(szBuffer), IconIndex, MAKEINTRESOURCEW(IconIndex), hResource, pResource);
+                                    SendDlgItemMessageW(hwndDlg, 14000, STM_SETICON, (WPARAM)hIcon, 0);
+                                }
+                            }
+                        }
+                        FreeLibrary(hLibrary);
+                    }
+                }
+            }
         }
         RegCloseKey(hKey);
     }



More information about the Ros-diffs mailing list