only create handles with access rights needed for the operation
Modified: trunk/reactos/lib/advapi32/reg/reg.c

Modified: trunk/reactos/lib/advapi32/reg/reg.c
--- trunk/reactos/lib/advapi32/reg/reg.c	2005-05-04 23:06:15 UTC (rev 14982)
+++ trunk/reactos/lib/advapi32/reg/reg.c	2005-05-05 00:07:27 UTC (rev 14983)
@@ -407,7 +407,7 @@
           break;
         }
       Status = NtCreateKey (&LocalKeyHandle,
-			    KEY_ALL_ACCESS,
+			    KEY_CREATE_SUB_KEY,
 			    &LocalObjectAttributes,
 			    0,
 			    NULL,
@@ -575,7 +575,7 @@
 			  0,
 			  NULL,
 			  0,
-			  KEY_ALL_ACCESS,
+			  MAXIMUM_ALLOWED,
 			  NULL,
 			  phkResult,
 			  NULL);
@@ -597,7 +597,7 @@
 			  0,
 			  NULL,
 			  0,
-			  KEY_ALL_ACCESS,
+			  MAXIMUM_ALLOWED,
 			  NULL,
 			  phkResult,
 			  NULL);
@@ -1653,7 +1653,7 @@
 		return ERROR_SUCCESS;
 	}
 
-	return RegOpenKeyExA( hKey, lpSubKey, 0, KEY_ALL_ACCESS, phkResult);
+	return RegOpenKeyExA( hKey, lpSubKey, 0, MAXIMUM_ALLOWED, phkResult);
 }
 
 
@@ -1678,7 +1678,7 @@
 		*phkResult = hKey;
 		return ERROR_SUCCESS;
 	}
-	return RegOpenKeyExW(hKey, lpSubKey, 0, KEY_ALL_ACCESS, phkResult);
+	return RegOpenKeyExW(hKey, lpSubKey, 0, MAXIMUM_ALLOWED, phkResult);
 }
 
 
@@ -2214,7 +2214,7 @@
       return ERROR_OUTOFMEMORY;
     }
 
-  Status = NtQueryValueKey (hKey,
+  Status = NtQueryValueKey (KeyHandle,
 			    &ValueName,
 			    KeyValuePartialInformation,
 			    ValueInfo,
@@ -2526,7 +2526,7 @@
 				  KeyHandle,
 				  NULL);
       Status = NtOpenKey (&RealKey,
-			  KEY_ALL_ACCESS,
+			  KEY_QUERY_VALUE,
 			  &ObjectAttributes);
       if (!NT_SUCCESS(Status))
 	{
@@ -2641,7 +2641,7 @@
 				  KeyHandle,
 				  NULL);
       Status = NtOpenKey (&RealKeyHandle,
-			  KEY_ALL_ACCESS,
+			  MAXIMUM_ALLOWED,
 			  &KeyObjectAttributes);
       if (!NT_SUCCESS(Status))
 	{
@@ -3205,7 +3205,7 @@
 				  KeyHandle,
 				  NULL);
       Status = NtOpenKey (&RealKey,
-			  KEY_ALL_ACCESS,
+			  KEY_SET_VALUE,
 			  &ObjectAttributes);
       if (!NT_SUCCESS(Status))
 	{