[NTOSKRNL]

- Implement FsRtlRegisterFileSystemFilterCallbacks
- Fix returned ResultLength value in NtQuerySystemInformation
- Create \FileSystems\Filters folder in IopCreateRootDirectories, used by Windows fltmgr

svn path=/trunk/; revision=61874
This commit is contained in:
Timo Kreuzer 2014-01-28 23:40:27 +00:00
parent bb6ca7fcfc
commit 45e155f85a
3 changed files with 101 additions and 44 deletions

View file

@ -1956,51 +1956,51 @@ CallQS [] =
SI_QX(SystemPerformanceInformation),
SI_QX(SystemTimeOfDayInformation),
SI_QX(SystemPathInformation), /* should be SI_XX */
SI_QX(SystemProcessInformation),
SI_QX(SystemCallCountInformation),
SI_QX(SystemDeviceInformation),
SI_QX(SystemProcessorPerformanceInformation),
SI_QS(SystemFlagsInformation),
SI_QX(SystemProcessInformation), // aka SystemProcessesAndThreadsInformation
SI_QX(SystemCallCountInformation), // aka SystemCallCounts
SI_QX(SystemDeviceInformation), // aka SystemConfigurationInformation
SI_QX(SystemProcessorPerformanceInformation), // aka SystemProcessorTimes
SI_QS(SystemFlagsInformation), // aka SystemGlobalFlag
SI_QX(SystemCallTimeInformation), /* should be SI_XX */
SI_QX(SystemModuleInformation),
SI_QX(SystemLocksInformation),
SI_QX(SystemLocksInformation), // aka SystemLockInformation
SI_QX(SystemStackTraceInformation), /* should be SI_XX */
SI_QX(SystemPagedPoolInformation), /* should be SI_XX */
SI_QX(SystemNonPagedPoolInformation), /* should be SI_XX */
SI_QX(SystemHandleInformation),
SI_QX(SystemObjectInformation),
SI_QX(SystemPageFileInformation),
SI_QX(SystemVdmInstemulInformation),
SI_QX(SystemPageFileInformation), // aka SystemPagefileInformation
SI_QX(SystemVdmInstemulInformation), // aka SystemInstructionEmulationCounts
SI_QX(SystemVdmBopInformation), /* it should be SI_XX */
SI_QS(SystemFileCacheInformation),
SI_QS(SystemFileCacheInformation), // aka SystemCacheInformation
SI_QX(SystemPoolTagInformation),
SI_QX(SystemInterruptInformation),
SI_QS(SystemDpcBehaviourInformation),
SI_QX(SystemInterruptInformation), // aka SystemProcessorStatistics
SI_QS(SystemDpcBehaviourInformation), // aka SystemDpcInformation
SI_QX(SystemFullMemoryInformation), /* it should be SI_XX */
SI_XS(SystemLoadGdiDriverInformation),
SI_XS(SystemUnloadGdiDriverInformation),
SI_QS(SystemTimeAdjustmentInformation),
SI_XS(SystemLoadGdiDriverInformation), // correct: SystemLoadImage
SI_XS(SystemUnloadGdiDriverInformation), // correct: SystemUnloadImage
SI_QS(SystemTimeAdjustmentInformation), // aka SystemTimeAdjustment
SI_QX(SystemSummaryMemoryInformation), /* it should be SI_XX */
SI_QX(SystemNextEventIdInformation), /* it should be SI_XX */
SI_QX(SystemEventIdsInformation), /* it should be SI_XX */
SI_QX(SystemEventIdsInformation), /* it should be SI_XX */ // SystemPerformanceTraceInformation
SI_QX(SystemCrashDumpInformation),
SI_QX(SystemExceptionInformation),
SI_QX(SystemCrashDumpStateInformation),
SI_QX(SystemKernelDebuggerInformation),
SI_QX(SystemContextSwitchInformation),
SI_QS(SystemRegistryQuotaInformation),
SI_XS(SystemExtendServiceTableInformation),
SI_XS(SystemExtendServiceTableInformation), // correct: SystemLoadAndCallImage
SI_XS(SystemPrioritySeperation),
SI_QX(SystemPlugPlayBusInformation), /* it should be SI_XX */
SI_QX(SystemDockInformation), /* it should be SI_XX */
SI_QX(SystemPowerInformation), /* it should be SI_XX */
SI_QX(SystemPowerInformation), /* it should be SI_XX */ // SystemPowerInformationNative? SystemInvalidInfoClass2
SI_QX(SystemProcessorSpeedInformation), /* it should be SI_XX */
SI_QS(SystemCurrentTimeZoneInformation), /* it should be SI_QX */
SI_QS(SystemCurrentTimeZoneInformation), /* it should be SI_QX */ // aka SystemTimeZoneInformation
SI_QX(SystemLookasideInformation),
SI_XS(SystemSetTimeSlipEvent),
SI_XS(SystemCreateSession),
SI_XS(SystemDeleteSession),
SI_QX(SystemInvalidInfoClass4), /* it should be SI_XX */
SI_QX(SystemInvalidInfoClass4), /* it should be SI_XX */ // SystemSessionInformation?
SI_QX(SystemRangeStartInformation),
SI_QS(SystemVerifierInformation),
SI_XS(SystemAddVerifier),
@ -2021,7 +2021,7 @@ NtQuerySystemInformation(IN SYSTEM_INFORMATION_CLASS SystemInformationClass,
OUT PULONG UnsafeResultLength)
{
KPROCESSOR_MODE PreviousMode;
ULONG ResultLength;
ULONG ResultLength = 0;
NTSTATUS FStatus = STATUS_NOT_IMPLEMENTED;
PAGED_CODE();
@ -2038,8 +2038,11 @@ NtQuerySystemInformation(IN SYSTEM_INFORMATION_CLASS SystemInformationClass,
ProbeForWriteUlong(UnsafeResultLength);
}
if (UnsafeResultLength)
*UnsafeResultLength = 0;
/*
* Check the request is valid.
* Check if the request is valid.
*/
if (SystemInformationClass >= MAX_SYSTEM_INFO_CLASS)
{

View file

@ -1942,9 +1942,35 @@ FsRtlReleaseFileForModWrite(IN PFILE_OBJECT FileObject,
*--*/
NTSTATUS
NTAPI
FsRtlRegisterFileSystemFilterCallbacks(IN PDRIVER_OBJECT FilterDriverObject,
IN PFS_FILTER_CALLBACKS Callbacks)
FsRtlRegisterFileSystemFilterCallbacks(
PDRIVER_OBJECT FilterDriverObject,
PFS_FILTER_CALLBACKS Callbacks)
{
UNIMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
PFS_FILTER_CALLBACKS NewCallbacks;
PEXTENDED_DRIVER_EXTENSION DriverExtension;
PAGED_CODE();
/* Verify parameters */
if ((FilterDriverObject == NULL) || (Callbacks == NULL))
{
return STATUS_INVALID_PARAMETER;
}
/* Allocate a buffer for a copy of the callbacks */
NewCallbacks = ExAllocatePoolWithTag(NonPagedPool,
Callbacks->SizeOfFsFilterCallbacks,
'gmSF');
if (NewCallbacks == NULL)
{
return STATUS_INSUFFICIENT_RESOURCES;
}
/* Copy the callbacks */
RtlCopyMemory(NewCallbacks, Callbacks, Callbacks->SizeOfFsFilterCallbacks);
/* Set the callbacks in the driver extension */
DriverExtension = (PEXTENDED_DRIVER_EXTENSION)FilterDriverObject->DriverExtension;
DriverExtension->FsFilterCallbacks = NewCallbacks;
return STATUS_SUCCESS;
}

View file

@ -332,6 +332,7 @@ IopCreateRootDirectories()
OBJECT_ATTRIBUTES ObjectAttributes;
UNICODE_STRING DirName;
HANDLE Handle;
NTSTATUS Status;
/* Create the '\Driver' object directory */
RtlInitUnicodeString(&DirName, L"\\Driver");
@ -340,9 +341,14 @@ IopCreateRootDirectories()
OBJ_PERMANENT,
NULL,
NULL);
if (!NT_SUCCESS(NtCreateDirectoryObject(&Handle,
Status = NtCreateDirectoryObject(&Handle,
DIRECTORY_ALL_ACCESS,
&ObjectAttributes))) return FALSE;
&ObjectAttributes);
if (!NT_SUCCESS(Status))
{
DPRINT1("Failed to create \\Driver directory: 0x%lx\n", Status);
return FALSE;
}
NtClose(Handle);
/* Create the '\FileSystem' object directory */
@ -352,9 +358,31 @@ IopCreateRootDirectories()
OBJ_PERMANENT,
NULL,
NULL);
if (!NT_SUCCESS(NtCreateDirectoryObject(&Handle,
Status = NtCreateDirectoryObject(&Handle,
DIRECTORY_ALL_ACCESS,
&ObjectAttributes))) return FALSE;
&ObjectAttributes);
if (!NT_SUCCESS(Status))
{
DPRINT1("Failed to create \\FileSystem directory: 0x%lx\n", Status);
return FALSE;
}
NtClose(Handle);
/* Create the '\FileSystem' object directory */
RtlInitUnicodeString(&DirName, L"\\FileSystem\\Filters");
InitializeObjectAttributes(&ObjectAttributes,
&DirName,
OBJ_PERMANENT,
NULL,
NULL);
Status = NtCreateDirectoryObject(&Handle,
DIRECTORY_ALL_ACCESS,
&ObjectAttributes);
if (!NT_SUCCESS(Status))
{
DPRINT1("Failed to create \\FileSystem\\Filters directory: 0x%lx\n", Status);
return FALSE;
}
NtClose(Handle);
/* Return success */