[FASTFAT] When not able to lock a volume due to open handles, print open handles
authorPierre Schweitzer <pierre@reactos.org>
Sun, 17 Dec 2017 17:19:03 +0000 (18:19 +0100)
committerPierre Schweitzer <pierre@reactos.org>
Sun, 17 Dec 2017 17:24:01 +0000 (18:24 +0100)
drivers/filesystems/fastfat/fsctl.c

index a406276..f059410 100644 (file)
@@ -1115,6 +1115,22 @@ VfatLockOrUnlockVolume(
     /* Deny locking if we're not alone */
     if (Lock && DeviceExt->OpenHandleCount != 1)
     {
+        PLIST_ENTRY ListEntry;
+
+        DPRINT1("Can't lock: %u opened\n", DeviceExt->OpenHandleCount);
+
+        ListEntry = DeviceExt->FcbListHead.Flink;
+        while (ListEntry != &DeviceExt->FcbListHead)
+        {
+            Fcb = CONTAINING_RECORD(ListEntry, VFATFCB, FcbListEntry);
+            ListEntry = ListEntry->Flink;
+
+            if (Fcb->OpenHandleCount  > 0)
+            {
+                DPRINT1("Opened (%u - %u): %wZ\n", Fcb->OpenHandleCount, Fcb->RefCount, &Fcb->PathNameU);
+            }
+        }
+
         return STATUS_ACCESS_DENIED;
     }