[SHELL32] Show/Hide hidden files/folders through registry. By Lee Schroeder. CORE...
authorAmine Khaldi <amine.khaldi@reactos.org>
Sat, 14 Mar 2015 12:18:33 +0000 (12:18 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Sat, 14 Mar 2015 12:18:33 +0000 (12:18 +0000)
svn path=/trunk/; revision=66689

reactos/boot/bootdata/hivedef.inf
reactos/dll/win32/shell32/CDefView.cpp

index a683813..9e08b2b 100644 (file)
@@ -1842,6 +1842,7 @@ HKCU,"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CLSID\{20D04FE0-3AEA-10
 HKCU,"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced","ListviewShadow",0x00010001,0x00000001
 HKCU,"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced","HideFileExt",0x00010001,0x00000000
 HKCU,"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced","StartMenuLogoff",0x00010001,0x00000001
+HKCU,"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced","Hidden",0x00010003,1
 
 ; default shell
 HKCU,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon",,0x00000012
index 5a9ee99..09ffe8e 100644 (file)
@@ -860,16 +860,34 @@ INT CALLBACK CDefView::fill_list( LPVOID ptr, LPVOID arg )
 HRESULT CDefView::FillList()
 {
     CComPtr<IEnumIDList> pEnumIDList;
-    PITEMID_CHILD    pidl;
-    DWORD        dwFetched;
-    HRESULT        hRes;
-    HDPA        hdpa;
+    PITEMID_CHILD pidl;
+    DWORD         dwFetched;
+    HRESULT       hRes;
+    HDPA          hdpa;
+    HKEY          hKey;
+    DWORD         dFlags = SHCONTF_NONFOLDERS | SHCONTF_FOLDERS;
 
     TRACE("%p\n", this);
 
-    /* get the itemlist from the shfolder*/
-    /* FIXME: make showing hidden files a setting. */
-    hRes = m_pSFParent->EnumObjects(m_hWnd, SHCONTF_NONFOLDERS | SHCONTF_FOLDERS | SHCONTF_INCLUDEHIDDEN, &pEnumIDList);
+    /* determine if there is a setting to show all the hidden files/folders */
+    if (RegOpenKeyExW(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced", 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS)
+    {
+        DWORD dataLength, flagVal;
+
+        dataLength = sizeof(flagVal);
+        if (RegQueryValueExW(hKey, L"Hidden", NULL, NULL, (LPBYTE)&flagVal, &dataLength) == ERROR_SUCCESS)
+        {
+            /* if the value is 1, then show all hidden files/folders */
+            if (flagVal == 1)
+                dFlags |= SHCONTF_INCLUDEHIDDEN;
+        }
+
+        /* close the key */
+        RegCloseKey(hKey);
+    }
+
+    /* get the itemlist from the shfolder */
+    hRes = m_pSFParent->EnumObjects(m_hWnd, dFlags, &pEnumIDList);
     if (hRes != S_OK)
     {
         if (hRes == S_FALSE)