https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c5a314b0f2699b7c3e691…
commit c5a314b0f2699b7c3e691be46f7a551d8a621708
Author: Pierre Schweitzer <pierre(a)reactos.org>
AuthorDate: Sun Oct 28 11:12:45 2018 +0100
Commit: Pierre Schweitzer <pierre(a)reactos.org>
CommitDate: Mon Oct 29 23:56:39 2018 +0100
[FLTMGR] Implement FltGetVolumeName()
---
drivers/filters/fltmgr/Volume.c | 45 ++++++++++++++++++++++++++++++++++++++
drivers/filters/fltmgr/fltmgr.spec | 1 +
2 files changed, 46 insertions(+)
diff --git a/drivers/filters/fltmgr/Volume.c b/drivers/filters/fltmgr/Volume.c
index b448fd3115..8e2a1339c8 100644
--- a/drivers/filters/fltmgr/Volume.c
+++ b/drivers/filters/fltmgr/Volume.c
@@ -190,5 +190,50 @@ FltDetachVolume(
return STATUS_NOT_IMPLEMENTED;
}
+NTSTATUS
+FLTAPI
+FltGetVolumeName(
+ _In_ PFLT_VOLUME Volume,
+ _Inout_opt_ PUNICODE_STRING VolumeName,
+ _Out_opt_ PULONG BufferSizeNeeded)
+{
+ NTSTATUS Status;
+
+ /* Check if caller just probes for size */
+ if (VolumeName == NULL)
+ {
+ /* Totally broken call */
+ if (BufferSizeNeeded == NULL)
+ {
+ return STATUS_INVALID_PARAMETER;
+ }
+
+ /* Return the appropriate size and quit */
+ *BufferSizeNeeded = Volume->DeviceName.Length;
+ return STATUS_BUFFER_TOO_SMALL;
+ }
+
+ /* We have an output buffer! Assume it's too small */
+ Status = STATUS_BUFFER_TOO_SMALL;
+
+ /* If we have output size, fill it */
+ if (BufferSizeNeeded != NULL)
+ {
+ *BufferSizeNeeded = Volume->DeviceName.Length;
+ }
+
+ /* Init that we didn't return a thing */
+ VolumeName->Length = 0;
+
+ /* If we have enough room, copy and return success */
+ if (VolumeName->MaximumLength >= Volume->DeviceName.Length)
+ {
+ RtlCopyUnicodeString(VolumeName, &Volume->DeviceName);
+ Status = STATUS_SUCCESS;
+ }
+
+ return Status;
+}
+
/* INTERNAL FUNCTIONS ******************************************************/
diff --git a/drivers/filters/fltmgr/fltmgr.spec b/drivers/filters/fltmgr/fltmgr.spec
index 3bf66621c4..0cc2288ce0 100644
--- a/drivers/filters/fltmgr/fltmgr.spec
+++ b/drivers/filters/fltmgr/fltmgr.spec
@@ -17,4 +17,5 @@
@ stdcall FltCreateFileEx(ptr ptr ptr ptr long ptr ptr ptr long long long long ptr long
long)
@ stdcall FltCreateFile(ptr ptr ptr long ptr ptr ptr long long long long ptr long long)
@ stdcall FltDetachVolume(ptr ptr ptr)
+ @ stdcall FltGetVolumeName(ptr ptr ptr)