Fix some registry structures to match the Windows format.
[reactos.git] / reactos / ntoskrnl / cm / cm.h
index a87fd49..fd34016 100644 (file)
@@ -70,17 +70,18 @@ typedef struct _HIVE_HEADER
   /* When this hive file was last modified */
   LARGE_INTEGER  DateModified;
 
-  /* Registry format version ? (1?) */
-  ULONG  Unused3;
+  /* Registry format major version (1) */
+  ULONG  MajorVersion;
 
-  /* Registry format version ? (3?) */
-  ULONG  Unused4;
+  /* Registry format minor version (3)
+     Version 3 added fast indexes, version 5 has large value optimizations */
+  ULONG  MinorVersion;
 
-  /* Registry format version ? (0?) */
-  ULONG  Unused5;
+  /* Registry file type (0 - Primary, 1 - Log) */
+  ULONG  Type;
 
-  /* Registry format version ? (1?) */
-  ULONG  Unused6;
+  /* Registry format (1 is the only defined value so far) */
+  ULONG  Format;
 
   /* Offset into file from the byte after the end of the base block.
      If the hive is volatile, this is the actual pointer to the KEY_CELL */
@@ -93,10 +94,9 @@ typedef struct _HIVE_HEADER
   ULONG  Unused7;
 
   /* Name of hive file */
-  WCHAR  FileName[64];
+  WCHAR  FileName[48];
 
-  /* ? */
-  ULONG  Unused8[83];
+  ULONG  Reserved[99];
 
   /* Checksum of first 0x200 bytes */
   ULONG  Checksum;
@@ -113,14 +113,13 @@ typedef struct _BIN_HEADER
   /* Size in bytes, multiple of the block size (4KB) */
   ULONG  BinSize;
 
-  /* ? */
-  ULONG  Unused1;
+  ULONG  Reserved[2];
 
   /* When this bin was last modified */
   LARGE_INTEGER  DateModified;
 
-  /* ? */
-  ULONG  Unused2;
+  /* ? (In-memory only) */
+  ULONG  MemAlloc;
 } HBIN, *PHBIN;
 
 typedef struct _CELL_HEADER
@@ -353,6 +352,12 @@ typedef struct _KEY_OBJECT
 
   /* List of subkeys loaded */
   struct _KEY_OBJECT **SubKeys;
+
+  /* List entry into the global key object list */
+  LIST_ENTRY ListEntry;
+
+  /* Time stamp for the last access by the parse routine */
+  ULONG TimeStamp;
 } KEY_OBJECT, *PKEY_OBJECT;
 
 /* Bits 31-22 (top 10 bits) of the cell index is the directory index */
@@ -372,13 +377,28 @@ extern LIST_ENTRY CmiHiveListHead;
 
 extern ERESOURCE CmiRegistryLock;
 
+
 /* Registry Callback Function */
-typedef NTSTATUS (*PEX_CALLBACK_FUNCTION ) (
+typedef NTSTATUS (STDCALL *PEX_CALLBACK_FUNCTION ) (
     IN PVOID CallbackContext,
-    IN PVOID Argument1,
+    IN REG_NOTIFY_CLASS Argument1,
     IN PVOID Argument2
     );
 
+typedef struct _REGISTRY_CALLBACK
+{
+    LIST_ENTRY ListEntry;
+    EX_RUNDOWN_REF RundownRef;
+    PEX_CALLBACK_FUNCTION Function;
+    PVOID Context;
+    LARGE_INTEGER Cookie;
+    BOOLEAN PendingDelete;
+} REGISTRY_CALLBACK, *PREGISTRY_CALLBACK;
+
+NTSTATUS
+CmiCallRegisteredCallbacks(IN REG_NOTIFY_CLASS Argument1,
+                           IN PVOID Argument2);
+
 VOID
 CmiVerifyBinHeader(PHBIN BinHeader);
 VOID
@@ -424,12 +444,6 @@ CmiObjectParse(IN PVOID ParsedObject,
               IN OUT PWSTR *Path,
               IN ULONG Attribute);
 
-NTSTATUS STDCALL
-CmiObjectCreate(PVOID ObjectBody,
-               PVOID Parent,
-               PWSTR RemainingPath,
-               POBJECT_ATTRIBUTES ObjectAttributes);
-
 VOID STDCALL
 CmiObjectDelete(PVOID  DeletedObject);
 
@@ -438,7 +452,10 @@ CmiObjectSecurity(PVOID ObjectBody,
                  SECURITY_OPERATION_CODE OperationCode,
                  SECURITY_INFORMATION SecurityInformation,
                  PSECURITY_DESCRIPTOR SecurityDescriptor,
-                 PULONG BufferLength);
+                 PULONG BufferLength,
+                 PSECURITY_DESCRIPTOR *OldSecurityDescriptor,
+                 POOL_TYPE PoolType,
+                 PGENERIC_MAPPING GenericMapping);
 
 NTSTATUS STDCALL
 CmiObjectQueryName (PVOID ObjectBody,
@@ -470,10 +487,11 @@ CmiAddKeyToList(IN PKEY_OBJECT ParentKey,
 NTSTATUS
 CmiRemoveKeyFromList(IN PKEY_OBJECT NewKey);
 
-PKEY_OBJECT
+NTSTATUS
 CmiScanKeyList(IN PKEY_OBJECT Parent,
               IN PUNICODE_STRING KeyName,
-              IN ULONG Attributes);
+              IN ULONG Attributes,
+              PKEY_OBJECT* ReturnedObject);
 
 NTSTATUS
 CmiCreateVolatileHive(PREGISTRY_HIVE *RegistryHive);
@@ -641,13 +659,13 @@ CmiGetPackedNameLength(IN PUNICODE_STRING Name,
 
 BOOLEAN
 CmiComparePackedNames(IN PUNICODE_STRING Name,
-                     IN PCHAR NameBuffer,
+                     IN PUCHAR NameBuffer,
                      IN USHORT NameBufferSize,
                      IN BOOLEAN NamePacked);
 
 VOID
 CmiCopyPackedName(PWCHAR NameBuffer,
-                 PCHAR PackedNameBuffer,
+                 PUCHAR PackedNameBuffer,
                  ULONG PackedNameSize);
 
 BOOLEAN