kernel32: Reduce registry access to KEY_READ wherever possible.

This commit is contained in:
Paul Chitescu 2009-11-30 14:57:16 +02:00 committed by Alexandre Julliard
parent 77b98c9e65
commit 590cc1ad55
5 changed files with 12 additions and 12 deletions

View file

@ -206,12 +206,12 @@ static BOOL get_use_dns_option(void)
BOOL ret = TRUE;
_init_attr( &attr, &nameW );
RtlOpenCurrentUser( KEY_ALL_ACCESS, &root );
RtlOpenCurrentUser( KEY_READ, &root );
attr.RootDirectory = root;
RtlInitUnicodeString( &nameW, NetworkW );
/* @@ Wine registry key: HKCU\Software\Wine\Network */
if (!NtOpenKey( &hkey, KEY_ALL_ACCESS, &attr ))
if (!NtOpenKey( &hkey, KEY_READ, &attr ))
{
RtlInitUnicodeString( &nameW, UseDNSW );
if (!NtQueryValueKey( hkey, &nameW, KeyValuePartialInformation, tmp, sizeof(tmp), &dummy ))
@ -321,12 +321,12 @@ BOOL WINAPI GetComputerNameW(LPWSTR name,LPDWORD size)
_init_attr ( &attr, &nameW );
RtlInitUnicodeString( &nameW, ComputerW );
if ( ( st = NtOpenKey( &hkey, KEY_ALL_ACCESS, &attr ) ) != STATUS_SUCCESS )
if ( ( st = NtOpenKey( &hkey, KEY_READ, &attr ) ) != STATUS_SUCCESS )
goto out;
attr.RootDirectory = hkey;
RtlInitUnicodeString( &nameW, ActiveComputerNameW );
if ( ( st = NtOpenKey( &hsubkey, KEY_ALL_ACCESS, &attr ) ) != STATUS_SUCCESS )
if ( ( st = NtOpenKey( &hsubkey, KEY_READ, &attr ) ) != STATUS_SUCCESS )
goto out;
RtlInitUnicodeString( &nameW, ComputerNameW );

View file

@ -212,7 +212,7 @@ static BOOL start_debugger(PEXCEPTION_POINTERS epointers, HANDLE hEvent)
attr.SecurityQualityOfService = NULL;
RtlInitUnicodeString( &nameW, AeDebugW );
if (!NtOpenKey( &hDbgConf, KEY_ALL_ACCESS, &attr ))
if (!NtOpenKey( &hDbgConf, KEY_READ, &attr ))
{
char buffer[64];
KEY_VALUE_PARTIAL_INFORMATION *info;

View file

@ -3017,7 +3017,7 @@ static HANDLE NLS_RegOpenKey(HANDLE hRootKey, LPCWSTR szKeyName)
RtlInitUnicodeString( &keyName, szKeyName );
InitializeObjectAttributes(&attr, &keyName, 0, hRootKey, NULL);
if (NtOpenKey( &hkey, KEY_ALL_ACCESS, &attr ) != STATUS_SUCCESS)
if (NtOpenKey( &hkey, KEY_READ, &attr ) != STATUS_SUCCESS)
hkey = 0;
return hkey;

View file

@ -432,7 +432,7 @@ static BOOL set_registry_environment(void)
/* first the system environment variables */
RtlInitUnicodeString( &nameW, env_keyW );
if (NtOpenKey( &hkey, KEY_ALL_ACCESS, &attr ) == STATUS_SUCCESS)
if (NtOpenKey( &hkey, KEY_READ, &attr ) == STATUS_SUCCESS)
{
set_registry_variables( hkey, REG_SZ );
set_registry_variables( hkey, REG_EXPAND_SZ );
@ -441,9 +441,9 @@ static BOOL set_registry_environment(void)
}
/* then the ones for the current user */
if (RtlOpenCurrentUser( KEY_ALL_ACCESS, &attr.RootDirectory ) != STATUS_SUCCESS) return ret;
if (RtlOpenCurrentUser( KEY_READ, &attr.RootDirectory ) != STATUS_SUCCESS) return ret;
RtlInitUnicodeString( &nameW, envW );
if (NtOpenKey( &hkey, KEY_ALL_ACCESS, &attr ) == STATUS_SUCCESS)
if (NtOpenKey( &hkey, KEY_READ, &attr ) == STATUS_SUCCESS)
{
set_registry_variables( hkey, REG_SZ );
set_registry_variables( hkey, REG_EXPAND_SZ );
@ -542,7 +542,7 @@ static void set_additional_environment(void)
attr.SecurityDescriptor = NULL;
attr.SecurityQualityOfService = NULL;
RtlInitUnicodeString( &nameW, profile_keyW );
if (!NtOpenKey( &hkey, KEY_ALL_ACCESS, &attr ))
if (!NtOpenKey( &hkey, KEY_READ, &attr ))
{
profile_dir = get_reg_value( hkey, profiles_valueW );
all_users_dir = get_reg_value( hkey, all_users_valueW );

View file

@ -119,7 +119,7 @@ void RELAY16_InitDebugLists(void)
static const WCHAR SnoopIncludeW[] = {'S','n','o','o','p','I','n','c','l','u','d','e',0};
static const WCHAR SnoopExcludeW[] = {'S','n','o','o','p','E','x','c','l','u','d','e',0};
RtlOpenCurrentUser( KEY_ALL_ACCESS, &root );
RtlOpenCurrentUser( KEY_READ, &root );
attr.Length = sizeof(attr);
attr.RootDirectory = root;
attr.ObjectName = &name;
@ -129,7 +129,7 @@ void RELAY16_InitDebugLists(void)
RtlInitUnicodeString( &name, configW );
/* @@ Wine registry key: HKCU\Software\Wine\Debug */
if (NtOpenKey( &hkey, KEY_ALL_ACCESS, &attr )) hkey = 0;
if (NtOpenKey( &hkey, KEY_READ, &attr )) hkey = 0;
NtClose( root );
if (!hkey) return;