https://git.reactos.org/?p=reactos.git;a=commitdiff;h=95447d2fd11604eeea487…
commit 95447d2fd11604eeea4870ed7a6e9b3610eb1173
Author: Pierre Schweitzer <pierre(a)reactos.org>
AuthorDate: Sat Nov 4 21:14:50 2017 +0100
[CDFS] Implement open handle count
---
drivers/filesystems/cdfs/cdfs.h | 3 +++
drivers/filesystems/cdfs/cleanup.c | 2 ++
drivers/filesystems/cdfs/create.c | 3 +++
3 files changed, 8 insertions(+)
diff --git a/drivers/filesystems/cdfs/cdfs.h b/drivers/filesystems/cdfs/cdfs.h
index dff86cec2e..f5a8185834 100644
--- a/drivers/filesystems/cdfs/cdfs.h
+++ b/drivers/filesystems/cdfs/cdfs.h
@@ -170,6 +170,9 @@ typedef struct
/* Notifications */
LIST_ENTRY NotifyList;
PNOTIFY_SYNC NotifySync;
+
+ /* Incremented on IRP_MJ_CREATE, decremented on IRP_MJ_CLEANUP */
+ ULONG OpenHandleCount;
} DEVICE_EXTENSION, *PDEVICE_EXTENSION, VCB, *PVCB;
diff --git a/drivers/filesystems/cdfs/cleanup.c b/drivers/filesystems/cdfs/cleanup.c
index 5ee39b1616..10d7704636 100644
--- a/drivers/filesystems/cdfs/cleanup.c
+++ b/drivers/filesystems/cdfs/cleanup.c
@@ -55,6 +55,8 @@ CdfsCleanupFile(PCDFS_IRP_CONTEXT IrpContext,
return STATUS_SUCCESS;
}
+ DeviceExt->OpenHandleCount--;
+
/* Notify about the cleanup */
FsRtlNotifyCleanup(DeviceExt->NotifySync,
&(DeviceExt->NotifyList),
diff --git a/drivers/filesystems/cdfs/create.c b/drivers/filesystems/cdfs/create.c
index 6271893b67..de53b1e74a 100644
--- a/drivers/filesystems/cdfs/create.c
+++ b/drivers/filesystems/cdfs/create.c
@@ -241,6 +241,8 @@ CdfsCreateFile(PDEVICE_OBJECT DeviceObject,
CdfsCloseFile (DeviceExt, FileObject);
return STATUS_NOT_A_DIRECTORY;
}
+
+ DeviceExt->OpenHandleCount++;
}
/*
@@ -271,6 +273,7 @@ CdfsCreate(
/* DeviceObject represents FileSystem instead of logical volume */
DPRINT("Opening file system\n");
IrpContext->Irp->IoStatus.Information = FILE_OPENED;
+ DeviceExt->OpenHandleCount++;
return STATUS_SUCCESS;
}