diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2013-10-31 14:26:42 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2013-10-31 14:26:42 +0000 |
commit | 5b312b4747cc4acda39c187369c02fcea456513b (patch) | |
tree | 56d9e0bec1c4b808933153d0a38903805bb0cc88 /winsup/cygwin/fhandler_registry.cc | |
parent | a5f316d8cfbd9f2abf018e3fe766a88820492ac1 (diff) | |
download | cygnal-5b312b4747cc4acda39c187369c02fcea456513b.tar.gz cygnal-5b312b4747cc4acda39c187369c02fcea456513b.tar.bz2 cygnal-5b312b4747cc4acda39c187369c02fcea456513b.zip |
* devices.in (dev_cygdrive_storage): Revert mapping to \Device\Null.
(dev_storage): Ditto for /dev.
* devices.cc: Regenerate.
* fhandler.cc (fhandler_base::open_null): New method to open a fake
\Device\Null handler.
(fhandler_base::open): Fix formatting. Change O_ACCMODE test to a
switch statement. Simplify a test which still tested for a now unused
create_disposition.
* fhandler.h (fhandler_base::open_null): Declare.
(fhandler_netdrive::close): Declare.
* fhandler_dev.cc (fhandler_dev::open): Open fake \Device\Null handle
by just calling new open_null method.
* fhandler_disk_file.cc (fhandler_cygdrive::open): Ditto.
* fhandler_netdrive.cc (fhandler_netdrive::open): Call open_null
rather than setting nohandle.
(fhandler_netdrive::close): New method.
* fhandler_registry.cc (fetch_hkey): Fix token in RegOpenUserClassesRoot
call. Create valid key for HKEY_CURRENT_CONFIG by mapping to real key
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Hardware Profiles\Current.
(fhandler_registry::open): Set nohandle only when using pseudo registry
handle.
* fhandler_virtual.cc (fhandler_virtual::opendir): Call open rather
than just setting nohandle here.
* fhandler_virtual::fstatvfs): Set ST_RDONLY fs flag.
* globals.cc (ro_u_null): New readonly UNICODE_STRING for \Device\Null.
* path.h (path_conv::set_path): Revert previous change caring for
wide_path.
Diffstat (limited to 'winsup/cygwin/fhandler_registry.cc')
-rw-r--r-- | winsup/cygwin/fhandler_registry.cc | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/winsup/cygwin/fhandler_registry.cc b/winsup/cygwin/fhandler_registry.cc index 10370550a..d4b6706c7 100644 --- a/winsup/cygwin/fhandler_registry.cc +++ b/winsup/cygwin/fhandler_registry.cc @@ -87,7 +87,7 @@ fetch_hkey (int idx) /* idx *must* be valid */ if (registry_keys[idx] == HKEY_CLASSES_ROOT) { if (RegOpenUserClassesRoot (cygheap->user.issetuid () - ? cygheap->user.imp_token () : hProcImpToken, + ? cygheap->user.imp_token () : hProcToken, 0, KEY_READ, &key) == ERROR_SUCCESS) return key; } @@ -96,6 +96,17 @@ fetch_hkey (int idx) /* idx *must* be valid */ if (RegOpenCurrentUser (KEY_READ, &key) == ERROR_SUCCESS) return key; } + else if (registry_keys[idx] == HKEY_CURRENT_CONFIG) + { + if (RegOpenKeyExW (HKEY_LOCAL_MACHINE, + L"System\\CurrentControlSet\\Hardware Profiles\\Current", + 0, KEY_READ, &key) == ERROR_SUCCESS) + return key; + } + /* Unfortunately there's no way to generate a valid OS registry key for + the other root keys. HKEY_USERS and HKEY_LOCAL_MACHINE are file + handles internally, HKEY_PERFORMANCE_DATA is just a bad hack and + no registry key at all. */ return registry_keys[idx]; } @@ -820,7 +831,8 @@ fhandler_registry::open (int flags, mode_t mode) set_io_handle (fetch_hkey (i)); /* Marking as nohandle allows to call dup on pseudo registry handles. */ - nohandle (true); + if (get_handle () >= HKEY_CLASSES_ROOT) + nohandle (true); flags |= O_DIROPEN; goto success; } |