* Makefile.in (DLL_IMPORTS): Drop advapi32.dll.

* autoload.cc: Enable autoloading advapi32 functions.
	* environ.cc (regopt): Use wide char arguments in reg_key functions.
	* fhandler_console.cc (beep): Ditto.  Use WCHAR throughout.
	* registry.cc (reg_key): Rewrite reg_key class to use native NT registry
	functions.  Use WCHAR string parameters throughout.  Use PCWSTR rather
	than const WCHAR.  Drop multibyte char functionality.  Drop unused
	methods.
	(get_registry_hive_path): Use RtlQueryRegistryValues to fetch path from
	registry.
	(load_registry_hive): Drop useless check for user hive being available.
	Load hive using NtLoadKey.
	* registry.h: Accommodate above changes.
	* sched.cc (sched_rr_get_interval): Use wide char arguments in reg_key
	functions.
	* shared.cc (init_installation_root): Ditto.
	(shared_info::init_obcaseinsensitive): Use RtlQueryRegistryValues to
	fetch obcaseinsensitive value.
	(shared_info::heap_slop_size): Use wide char arguments in reg_key
	functions.
	(shared_info::heap_chunk_size): Ditto.
	* syscalls.cc (gethostid): Ditto.
	* winsup.h (__WIDE): Define.
	(_WIDE): Define.
	* libc/minires-os-if.c (get_registry_dns_items): Don't fetch values
	from registry.  Just extract them from given UNICODE_STRING parameter.
	(get_registry_dns): Fetch all registry values at once using
	RtlQueryRegistryValues.
This commit is contained in:
Corinna Vinschen
2011-04-19 10:02:06 +00:00
parent cbc26145e8
commit b18cb86be7
12 changed files with 322 additions and 299 deletions

View File

@@ -1,7 +1,7 @@
/* shared.cc: shared data area support.
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
2006, 2007, 2008, 2009 Red Hat, Inc.
2006, 2007, 2008, 2009, 2010, 2011 Red Hat, Inc.
This file is part of Cygwin.
@@ -109,7 +109,8 @@ init_installation_root ()
for (int i = 1; i >= 0; --i)
{
reg_key r (i, KEY_WRITE, CYGWIN_INFO_INSTALLATIONS_NAME, NULL);
reg_key r (i, KEY_WRITE, _WIDE (CYGWIN_INFO_INSTALLATIONS_NAME),
NULL);
if (r.set_string (installation_key_buf, installation_root)
== ERROR_SUCCESS)
break;
@@ -370,19 +371,19 @@ shared_destroy ()
void
shared_info::init_obcaseinsensitive ()
{
HKEY key;
DWORD size = sizeof (DWORD);
obcaseinsensitive = 1;
if (RegOpenKeyEx (HKEY_LOCAL_MACHINE,
"SYSTEM\\CurrentControlSet\\Control\\Session Manager\\kernel",
0, KEY_READ, &key) == ERROR_SUCCESS)
{
RegQueryValueEx (key, "obcaseinsensitive", NULL, NULL,
(LPBYTE) &obcaseinsensitive, &size);
RegCloseKey (key);
}
debug_printf ("obcaseinsensitive set to %d", obcaseinsensitive);
NTSTATUS status;
DWORD def_obcaseinsensitive = 1;
obcaseinsensitive = def_obcaseinsensitive;
RTL_QUERY_REGISTRY_TABLE tab[2] = {
{ NULL, RTL_QUERY_REGISTRY_DIRECT | RTL_QUERY_REGISTRY_NOSTRING,
L"obcaseinsensitive", &obcaseinsensitive, REG_DWORD,
&def_obcaseinsensitive, sizeof (DWORD) },
{ NULL, 0, NULL, NULL, 0, NULL, 0 }
};
status = RtlQueryRegistryValues (RTL_REGISTRY_CONTROL,
L"Session Manager\\kernel",
tab, NULL, NULL);
}
void inline
@@ -449,7 +450,7 @@ shared_info::heap_slop_size ()
{
reg_key reg (i, KEY_READ, NULL);
if ((heap_slop = reg.get_int ("heap_slop_in_mb", 0)))
if ((heap_slop = reg.get_int (L"heap_slop_in_mb", 0)))
break;
heap_slop = wincap.heapslop ();
}
@@ -475,7 +476,7 @@ shared_info::heap_chunk_size ()
/* FIXME: We should not be restricted to a fixed size heap no matter
what the fixed size is. */
if ((heap_chunk = reg.get_int ("heap_chunk_in_mb", 0)))
if ((heap_chunk = reg.get_int (L"heap_chunk_in_mb", 0)))
break;
heap_chunk = 384; /* Default */
}