only create handles with access rights needed for the operation

svn path=/trunk/; revision=14983
This commit is contained in:
Thomas Bluemel 2005-05-05 00:07:27 +00:00
parent 7a3fb8af07
commit 079656c5c4

View file

@ -407,7 +407,7 @@ CreateNestedKey(PHKEY KeyHandle,
break; break;
} }
Status = NtCreateKey (&LocalKeyHandle, Status = NtCreateKey (&LocalKeyHandle,
KEY_ALL_ACCESS, KEY_CREATE_SUB_KEY,
&LocalObjectAttributes, &LocalObjectAttributes,
0, 0,
NULL, NULL,
@ -575,7 +575,7 @@ RegCreateKeyA (HKEY hKey,
0, 0,
NULL, NULL,
0, 0,
KEY_ALL_ACCESS, MAXIMUM_ALLOWED,
NULL, NULL,
phkResult, phkResult,
NULL); NULL);
@ -597,7 +597,7 @@ RegCreateKeyW (HKEY hKey,
0, 0,
NULL, NULL,
0, 0,
KEY_ALL_ACCESS, MAXIMUM_ALLOWED,
NULL, NULL,
phkResult, phkResult,
NULL); NULL);
@ -1653,7 +1653,7 @@ RegOpenKeyA (HKEY hKey,
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
return RegOpenKeyExA( hKey, lpSubKey, 0, KEY_ALL_ACCESS, phkResult); return RegOpenKeyExA( hKey, lpSubKey, 0, MAXIMUM_ALLOWED, phkResult);
} }
@ -1678,7 +1678,7 @@ RegOpenKeyW (HKEY hKey,
*phkResult = hKey; *phkResult = hKey;
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
return RegOpenKeyExW(hKey, lpSubKey, 0, KEY_ALL_ACCESS, phkResult); return RegOpenKeyExW(hKey, lpSubKey, 0, MAXIMUM_ALLOWED, phkResult);
} }
@ -2214,7 +2214,7 @@ RegQueryValueExW (HKEY hKey,
return ERROR_OUTOFMEMORY; return ERROR_OUTOFMEMORY;
} }
Status = NtQueryValueKey (hKey, Status = NtQueryValueKey (KeyHandle,
&ValueName, &ValueName,
KeyValuePartialInformation, KeyValuePartialInformation,
ValueInfo, ValueInfo,
@ -2526,7 +2526,7 @@ RegQueryValueW (HKEY hKey,
KeyHandle, KeyHandle,
NULL); NULL);
Status = NtOpenKey (&RealKey, Status = NtOpenKey (&RealKey,
KEY_ALL_ACCESS, KEY_QUERY_VALUE,
&ObjectAttributes); &ObjectAttributes);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
@ -2641,7 +2641,7 @@ RegReplaceKeyW (HKEY hKey,
KeyHandle, KeyHandle,
NULL); NULL);
Status = NtOpenKey (&RealKeyHandle, Status = NtOpenKey (&RealKeyHandle,
KEY_ALL_ACCESS, MAXIMUM_ALLOWED,
&KeyObjectAttributes); &KeyObjectAttributes);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
@ -3205,7 +3205,7 @@ RegSetValueW (HKEY hKey,
KeyHandle, KeyHandle,
NULL); NULL);
Status = NtOpenKey (&RealKey, Status = NtOpenKey (&RealKey,
KEY_ALL_ACCESS, KEY_SET_VALUE,
&ObjectAttributes); &ObjectAttributes);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {