[FLTMGR] Implement FltGetVolumeName()

This commit is contained in:
Pierre Schweitzer 2018-10-28 11:12:45 +01:00
parent 21fcbcb37f
commit c5a314b0f2
2 changed files with 46 additions and 0 deletions

View file

@ -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 ******************************************************/

View file

@ -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)