[MOUNTMGR]
[reactos.git] / reactos / drivers / filters / mountmgr / database.c
index 77b9e21..5342861 100644 (file)
@@ -194,6 +194,39 @@ GetRemoteDatabaseEntry(IN HANDLE Database,
     return Entry;
 }
 
+/*
+ * @implemented
+ */
+NTSTATUS
+WriteRemoteDatabaseEntry(IN HANDLE Database,
+                         IN LONG Offset,
+                         IN PDATABASE_ENTRY Entry)
+{
+    NTSTATUS Status;
+    LARGE_INTEGER ByteOffset;
+    IO_STATUS_BLOCK IoStatusBlock;
+
+    ByteOffset.QuadPart = Offset;
+    Status = ZwWriteFile(Database,
+                         NULL,
+                         NULL,
+                         NULL,
+                         &IoStatusBlock,
+                         Entry,
+                         Entry->EntrySize,
+                         &ByteOffset,
+                         NULL);
+    if (NT_SUCCESS(Status))
+    {
+        if (IoStatusBlock.Information < Entry->EntrySize)
+        {
+            Status = STATUS_INSUFFICIENT_RESOURCES;
+        }
+    }
+
+    return Status;
+}
+
 /*
  * @implemented
  */
@@ -1431,7 +1464,7 @@ ChangeRemoteDatabaseUniqueId(IN PDEVICE_INFORMATION DeviceInformation,
 
         /* Recreate the entry from the previous one */
         NewEntry->EntrySize = Entry->EntrySize + NewUniqueId->UniqueIdLength - OldUniqueId->UniqueIdLength;
-        NewEntry->DatabaseOffset = Entry->DatabaseOffset;
+        NewEntry->EntryReferences = Entry->EntryReferences;
         NewEntry->SymbolicNameOffset = sizeof(DATABASE_ENTRY);
         NewEntry->SymbolicNameLength = Entry->SymbolicNameLength;
         NewEntry->UniqueIdOffset = Entry->SymbolicNameLength + sizeof(DATABASE_ENTRY);