[HALACPI]: Begin rough implementation of the Hal ACPI PnP Driver. Will probably need...
[reactos.git] / reactos / hal / halx86 / generic / misc.c
index f778b17..00ea13b 100644 (file)
@@ -18,6 +18,47 @@ BOOLEAN HalpNMIInProgress;
 
 /* PRIVATE FUNCTIONS **********************************************************/
 
+NTSTATUS 
+NTAPI
+HalpOpenRegistryKey(IN PHANDLE KeyHandle,
+                    IN HANDLE RootKey,
+                    IN PUNICODE_STRING KeyName,
+                    IN ACCESS_MASK DesiredAccess, 
+                    IN BOOLEAN Create)
+{
+    NTSTATUS Status;
+    ULONG Disposition;
+    OBJECT_ATTRIBUTES ObjectAttributes;
+    
+    /* Setup the attributes we received */
+    InitializeObjectAttributes(&ObjectAttributes,
+                               KeyName,
+                               OBJ_CASE_INSENSITIVE,
+                               RootKey,
+                               NULL);
+
+    /* What to do? */
+    if ( Create )
+    {
+        /* Create the key */
+        Status = ZwCreateKey(KeyHandle,
+                             DesiredAccess,
+                             &ObjectAttributes,
+                             0,
+                             NULL,
+                             REG_OPTION_VOLATILE,
+                             &Disposition);
+    }
+    else
+    {
+        /* Open the key */
+        Status = ZwOpenKey(KeyHandle, DesiredAccess, &ObjectAttributes);
+    }
+        
+    /* We're done */
+    return Status;
+}
+
 VOID
 NTAPI
 HalpCheckPowerButton(VOID)