Module: wine Branch: master Commit: 590cc1ad55e953d986e29341dc77408914b1e927 URL: http://source.winehq.org/git/wine.git/?a=commit;h=590cc1ad55e953d986e29341dc...
Author: Paul Chitescu paulc@voip.null.ro Date: Mon Nov 30 14:57:16 2009 +0200
kernel32: Reduce registry access to KEY_READ wherever possible.
---
dlls/kernel32/computername.c | 8 ++++---- dlls/kernel32/except.c | 2 +- dlls/kernel32/locale.c | 2 +- dlls/kernel32/process.c | 8 ++++---- dlls/kernel32/relay16.c | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/dlls/kernel32/computername.c b/dlls/kernel32/computername.c index 7ddbac8..258f297 100644 --- a/dlls/kernel32/computername.c +++ b/dlls/kernel32/computername.c @@ -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 ); diff --git a/dlls/kernel32/except.c b/dlls/kernel32/except.c index ca39ec6..701f921 100644 --- a/dlls/kernel32/except.c +++ b/dlls/kernel32/except.c @@ -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; diff --git a/dlls/kernel32/locale.c b/dlls/kernel32/locale.c index fb9b517..f1e6370 100644 --- a/dlls/kernel32/locale.c +++ b/dlls/kernel32/locale.c @@ -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; diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c index 7918048..83d3f6c 100644 --- a/dlls/kernel32/process.c +++ b/dlls/kernel32/process.c @@ -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 ); diff --git a/dlls/kernel32/relay16.c b/dlls/kernel32/relay16.c index b3ac234..f5a710f 100644 --- a/dlls/kernel32/relay16.c +++ b/dlls/kernel32/relay16.c @@ -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;