Alexandre Julliard : shell32: Add support for the NoDrives registry key.
Alexandre Julliard
julliard at winehq.org
Fri Feb 15 05:35:58 CST 2008
Module: wine
Branch: master
Commit: ab820ef24ccc37375335eac543cda04c4c264405
URL: http://source.winehq.org/git/wine.git/?a=commit;h=ab820ef24ccc37375335eac543cda04c4c264405
Author: Alexandre Julliard <julliard at winehq.org>
Date: Fri Feb 15 10:58:14 2008 +0100
shell32: Add support for the NoDrives registry key.
---
dlls/shell32/shfldr_mycomp.c | 40 +++++++++++++++++++++++++++++++++++++++-
1 files changed, 39 insertions(+), 1 deletions(-)
diff --git a/dlls/shell32/shfldr_mycomp.c b/dlls/shell32/shfldr_mycomp.c
index af9958e..213b5d4 100644
--- a/dlls/shell32/shfldr_mycomp.c
+++ b/dlls/shell32/shfldr_mycomp.c
@@ -252,6 +252,44 @@ static HRESULT WINAPI ISF_MyComputer_fnParseDisplayName (IShellFolder2 *iface,
return hr;
}
+/* retrieve a map of drives that should be displayed */
+static DWORD get_drive_map(void)
+{
+ static const WCHAR policiesW[] = {'S','o','f','t','w','a','r','e','\\',
+ 'M','i','c','r','o','s','o','f','t','\\',
+ 'W','i','n','d','o','w','s','\\',
+ 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
+ 'P','o','l','i','c','i','e','s','\\',
+ 'E','x','p','l','o','r','e','r',0};
+ static const WCHAR nodrivesW[] = {'N','o','D','r','i','v','e','s',0};
+ static DWORD drive_mask, init_done;
+
+ if (!init_done)
+ {
+ DWORD type, size, data, mask = 0;
+ HKEY hkey;
+
+ if (!RegOpenKeyW( HKEY_LOCAL_MACHINE, policiesW, &hkey ))
+ {
+ size = sizeof(data);
+ if (!RegQueryValueExW( hkey, nodrivesW, NULL, &type, (LPBYTE)&data, &size ) && type == REG_DWORD)
+ mask |= data;
+ RegCloseKey( hkey );
+ }
+ if (!RegOpenKeyW( HKEY_CURRENT_USER, policiesW, &hkey ))
+ {
+ size = sizeof(data);
+ if (!RegQueryValueExW( hkey, nodrivesW, NULL, &type, (LPBYTE)&data, &size ) && type == REG_DWORD)
+ mask |= data;
+ RegCloseKey( hkey );
+ }
+ drive_mask = mask;
+ init_done = 1;
+ }
+
+ return GetLogicalDrives() & ~drive_mask;
+}
+
/**************************************************************************
* CreateMyCompEnumList()
*/
@@ -271,7 +309,7 @@ static BOOL CreateMyCompEnumList(IEnumIDList *list, DWORD dwFlags)
if (dwFlags & SHCONTF_FOLDERS)
{
WCHAR wszDriveName[] = {'A', ':', '\\', '\0'};
- DWORD dwDrivemap = GetLogicalDrives();
+ DWORD dwDrivemap = get_drive_map();
HKEY hkey;
UINT i;
More information about the wine-cvs
mailing list