mirror of
https://github.com/reactos/reactos.git
synced 2025-08-02 12:55:43 +00:00
[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:
parent
bb6ca7fcfc
commit
45e155f85a
3 changed files with 101 additions and 44 deletions
|
@ -1654,7 +1654,7 @@ SSI_DEF(SystemExtendServiceTableInformation)
|
||||||
/* Check who is calling */
|
/* Check who is calling */
|
||||||
if (PreviousMode != KernelMode)
|
if (PreviousMode != KernelMode)
|
||||||
{
|
{
|
||||||
static const UNICODE_STRING Win32kName =
|
static const UNICODE_STRING Win32kName =
|
||||||
RTL_CONSTANT_STRING(L"\\SystemRoot\\System32\\win32k.sys");
|
RTL_CONSTANT_STRING(L"\\SystemRoot\\System32\\win32k.sys");
|
||||||
|
|
||||||
/* Make sure we can load drivers */
|
/* Make sure we can load drivers */
|
||||||
|
@ -1663,7 +1663,7 @@ SSI_DEF(SystemExtendServiceTableInformation)
|
||||||
/* FIXME: We can't, fail */
|
/* FIXME: We can't, fail */
|
||||||
return STATUS_PRIVILEGE_NOT_HELD;
|
return STATUS_PRIVILEGE_NOT_HELD;
|
||||||
}
|
}
|
||||||
|
|
||||||
_SEH2_TRY
|
_SEH2_TRY
|
||||||
{
|
{
|
||||||
/* Probe and copy the unicode string */
|
/* Probe and copy the unicode string */
|
||||||
|
@ -1684,7 +1684,7 @@ SSI_DEF(SystemExtendServiceTableInformation)
|
||||||
_SEH2_YIELD(return _SEH2_GetExceptionCode());
|
_SEH2_YIELD(return _SEH2_GetExceptionCode());
|
||||||
}
|
}
|
||||||
_SEH2_END;
|
_SEH2_END;
|
||||||
|
|
||||||
/* Recursively call the function, so that we are from kernel mode */
|
/* Recursively call the function, so that we are from kernel mode */
|
||||||
return ZwSetSystemInformation(SystemExtendServiceTableInformation,
|
return ZwSetSystemInformation(SystemExtendServiceTableInformation,
|
||||||
(PVOID)&Win32kName,
|
(PVOID)&Win32kName,
|
||||||
|
@ -1956,51 +1956,51 @@ CallQS [] =
|
||||||
SI_QX(SystemPerformanceInformation),
|
SI_QX(SystemPerformanceInformation),
|
||||||
SI_QX(SystemTimeOfDayInformation),
|
SI_QX(SystemTimeOfDayInformation),
|
||||||
SI_QX(SystemPathInformation), /* should be SI_XX */
|
SI_QX(SystemPathInformation), /* should be SI_XX */
|
||||||
SI_QX(SystemProcessInformation),
|
SI_QX(SystemProcessInformation), // aka SystemProcessesAndThreadsInformation
|
||||||
SI_QX(SystemCallCountInformation),
|
SI_QX(SystemCallCountInformation), // aka SystemCallCounts
|
||||||
SI_QX(SystemDeviceInformation),
|
SI_QX(SystemDeviceInformation), // aka SystemConfigurationInformation
|
||||||
SI_QX(SystemProcessorPerformanceInformation),
|
SI_QX(SystemProcessorPerformanceInformation), // aka SystemProcessorTimes
|
||||||
SI_QS(SystemFlagsInformation),
|
SI_QS(SystemFlagsInformation), // aka SystemGlobalFlag
|
||||||
SI_QX(SystemCallTimeInformation), /* should be SI_XX */
|
SI_QX(SystemCallTimeInformation), /* should be SI_XX */
|
||||||
SI_QX(SystemModuleInformation),
|
SI_QX(SystemModuleInformation),
|
||||||
SI_QX(SystemLocksInformation),
|
SI_QX(SystemLocksInformation), // aka SystemLockInformation
|
||||||
SI_QX(SystemStackTraceInformation), /* should be SI_XX */
|
SI_QX(SystemStackTraceInformation), /* should be SI_XX */
|
||||||
SI_QX(SystemPagedPoolInformation), /* should be SI_XX */
|
SI_QX(SystemPagedPoolInformation), /* should be SI_XX */
|
||||||
SI_QX(SystemNonPagedPoolInformation), /* should be SI_XX */
|
SI_QX(SystemNonPagedPoolInformation), /* should be SI_XX */
|
||||||
SI_QX(SystemHandleInformation),
|
SI_QX(SystemHandleInformation),
|
||||||
SI_QX(SystemObjectInformation),
|
SI_QX(SystemObjectInformation),
|
||||||
SI_QX(SystemPageFileInformation),
|
SI_QX(SystemPageFileInformation), // aka SystemPagefileInformation
|
||||||
SI_QX(SystemVdmInstemulInformation),
|
SI_QX(SystemVdmInstemulInformation), // aka SystemInstructionEmulationCounts
|
||||||
SI_QX(SystemVdmBopInformation), /* it should be SI_XX */
|
SI_QX(SystemVdmBopInformation), /* it should be SI_XX */
|
||||||
SI_QS(SystemFileCacheInformation),
|
SI_QS(SystemFileCacheInformation), // aka SystemCacheInformation
|
||||||
SI_QX(SystemPoolTagInformation),
|
SI_QX(SystemPoolTagInformation),
|
||||||
SI_QX(SystemInterruptInformation),
|
SI_QX(SystemInterruptInformation), // aka SystemProcessorStatistics
|
||||||
SI_QS(SystemDpcBehaviourInformation),
|
SI_QS(SystemDpcBehaviourInformation), // aka SystemDpcInformation
|
||||||
SI_QX(SystemFullMemoryInformation), /* it should be SI_XX */
|
SI_QX(SystemFullMemoryInformation), /* it should be SI_XX */
|
||||||
SI_XS(SystemLoadGdiDriverInformation),
|
SI_XS(SystemLoadGdiDriverInformation), // correct: SystemLoadImage
|
||||||
SI_XS(SystemUnloadGdiDriverInformation),
|
SI_XS(SystemUnloadGdiDriverInformation), // correct: SystemUnloadImage
|
||||||
SI_QS(SystemTimeAdjustmentInformation),
|
SI_QS(SystemTimeAdjustmentInformation), // aka SystemTimeAdjustment
|
||||||
SI_QX(SystemSummaryMemoryInformation), /* it should be SI_XX */
|
SI_QX(SystemSummaryMemoryInformation), /* it should be SI_XX */
|
||||||
SI_QX(SystemNextEventIdInformation), /* 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(SystemCrashDumpInformation),
|
||||||
SI_QX(SystemExceptionInformation),
|
SI_QX(SystemExceptionInformation),
|
||||||
SI_QX(SystemCrashDumpStateInformation),
|
SI_QX(SystemCrashDumpStateInformation),
|
||||||
SI_QX(SystemKernelDebuggerInformation),
|
SI_QX(SystemKernelDebuggerInformation),
|
||||||
SI_QX(SystemContextSwitchInformation),
|
SI_QX(SystemContextSwitchInformation),
|
||||||
SI_QS(SystemRegistryQuotaInformation),
|
SI_QS(SystemRegistryQuotaInformation),
|
||||||
SI_XS(SystemExtendServiceTableInformation),
|
SI_XS(SystemExtendServiceTableInformation), // correct: SystemLoadAndCallImage
|
||||||
SI_XS(SystemPrioritySeperation),
|
SI_XS(SystemPrioritySeperation),
|
||||||
SI_QX(SystemPlugPlayBusInformation), /* it should be SI_XX */
|
SI_QX(SystemPlugPlayBusInformation), /* it should be SI_XX */
|
||||||
SI_QX(SystemDockInformation), /* 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_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_QX(SystemLookasideInformation),
|
||||||
SI_XS(SystemSetTimeSlipEvent),
|
SI_XS(SystemSetTimeSlipEvent),
|
||||||
SI_XS(SystemCreateSession),
|
SI_XS(SystemCreateSession),
|
||||||
SI_XS(SystemDeleteSession),
|
SI_XS(SystemDeleteSession),
|
||||||
SI_QX(SystemInvalidInfoClass4), /* it should be SI_XX */
|
SI_QX(SystemInvalidInfoClass4), /* it should be SI_XX */ // SystemSessionInformation?
|
||||||
SI_QX(SystemRangeStartInformation),
|
SI_QX(SystemRangeStartInformation),
|
||||||
SI_QS(SystemVerifierInformation),
|
SI_QS(SystemVerifierInformation),
|
||||||
SI_XS(SystemAddVerifier),
|
SI_XS(SystemAddVerifier),
|
||||||
|
@ -2021,7 +2021,7 @@ NtQuerySystemInformation(IN SYSTEM_INFORMATION_CLASS SystemInformationClass,
|
||||||
OUT PULONG UnsafeResultLength)
|
OUT PULONG UnsafeResultLength)
|
||||||
{
|
{
|
||||||
KPROCESSOR_MODE PreviousMode;
|
KPROCESSOR_MODE PreviousMode;
|
||||||
ULONG ResultLength;
|
ULONG ResultLength = 0;
|
||||||
NTSTATUS FStatus = STATUS_NOT_IMPLEMENTED;
|
NTSTATUS FStatus = STATUS_NOT_IMPLEMENTED;
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
@ -2038,8 +2038,11 @@ NtQuerySystemInformation(IN SYSTEM_INFORMATION_CLASS SystemInformationClass,
|
||||||
ProbeForWriteUlong(UnsafeResultLength);
|
ProbeForWriteUlong(UnsafeResultLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (UnsafeResultLength)
|
||||||
|
*UnsafeResultLength = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check the request is valid.
|
* Check if the request is valid.
|
||||||
*/
|
*/
|
||||||
if (SystemInformationClass >= MAX_SYSTEM_INFO_CLASS)
|
if (SystemInformationClass >= MAX_SYSTEM_INFO_CLASS)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1802,7 +1802,7 @@ FsRtlAcquireFileForModWriteEx(IN PFILE_OBJECT FileObject,
|
||||||
Exclusive = TRUE;
|
Exclusive = TRUE;
|
||||||
ResourceToAcquire = FcbHeader->Resource;
|
ResourceToAcquire = FcbHeader->Resource;
|
||||||
}
|
}
|
||||||
else if (!FcbHeader->PagingIoResource ||
|
else if (!FcbHeader->PagingIoResource ||
|
||||||
(FcbHeader->Flags & FSRTL_FLAG_ACQUIRE_MAIN_RSRC_SH))
|
(FcbHeader->Flags & FSRTL_FLAG_ACQUIRE_MAIN_RSRC_SH))
|
||||||
{
|
{
|
||||||
/* Acquire main resource shared if flag is specified or
|
/* Acquire main resource shared if flag is specified or
|
||||||
|
@ -1942,9 +1942,35 @@ FsRtlReleaseFileForModWrite(IN PFILE_OBJECT FileObject,
|
||||||
*--*/
|
*--*/
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
FsRtlRegisterFileSystemFilterCallbacks(IN PDRIVER_OBJECT FilterDriverObject,
|
FsRtlRegisterFileSystemFilterCallbacks(
|
||||||
IN PFS_FILTER_CALLBACKS Callbacks)
|
PDRIVER_OBJECT FilterDriverObject,
|
||||||
|
PFS_FILTER_CALLBACKS Callbacks)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
PFS_FILTER_CALLBACKS NewCallbacks;
|
||||||
return STATUS_NOT_IMPLEMENTED;
|
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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,7 +110,7 @@ IopInitLookasideLists(VOID)
|
||||||
IOC_TAG1,
|
IOC_TAG1,
|
||||||
32,
|
32,
|
||||||
&ExSystemLookasideListHead);
|
&ExSystemLookasideListHead);
|
||||||
|
|
||||||
/* Initialize the Lookaside List for Large IRPs */
|
/* Initialize the Lookaside List for Large IRPs */
|
||||||
ExInitializeSystemLookasideList(&IoLargeIrpLookaside,
|
ExInitializeSystemLookasideList(&IoLargeIrpLookaside,
|
||||||
NonPagedPool,
|
NonPagedPool,
|
||||||
|
@ -137,11 +137,11 @@ IopInitLookasideLists(VOID)
|
||||||
&ExSystemLookasideListHead);
|
&ExSystemLookasideListHead);
|
||||||
|
|
||||||
/* Allocate the global lookaside list buffer */
|
/* Allocate the global lookaside list buffer */
|
||||||
CurrentList = ExAllocatePoolWithTag(NonPagedPool,
|
CurrentList = ExAllocatePoolWithTag(NonPagedPool,
|
||||||
4 * KeNumberProcessors *
|
4 * KeNumberProcessors *
|
||||||
sizeof(GENERAL_LOOKASIDE),
|
sizeof(GENERAL_LOOKASIDE),
|
||||||
TAG_IO);
|
TAG_IO);
|
||||||
|
|
||||||
/* Loop all processors */
|
/* Loop all processors */
|
||||||
for (i = 0; i < KeNumberProcessors; i++)
|
for (i = 0; i < KeNumberProcessors; i++)
|
||||||
{
|
{
|
||||||
|
@ -165,13 +165,13 @@ IopInitLookasideLists(VOID)
|
||||||
&ExSystemLookasideListHead);
|
&ExSystemLookasideListHead);
|
||||||
Prcb->PPLookasideList[LookasideCompletionList].P = CurrentList;
|
Prcb->PPLookasideList[LookasideCompletionList].P = CurrentList;
|
||||||
CurrentList++;
|
CurrentList++;
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Prcb->PPLookasideList[LookasideCompletionList].P = &IoCompletionPacketLookaside;
|
Prcb->PPLookasideList[LookasideCompletionList].P = &IoCompletionPacketLookaside;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the Large IRP List */
|
/* Set the Large IRP List */
|
||||||
Prcb->PPLookasideList[LookasideLargeIrpList].L = &IoLargeIrpLookaside;
|
Prcb->PPLookasideList[LookasideLargeIrpList].L = &IoLargeIrpLookaside;
|
||||||
if (CurrentList)
|
if (CurrentList)
|
||||||
|
@ -185,7 +185,7 @@ IopInitLookasideLists(VOID)
|
||||||
&ExSystemLookasideListHead);
|
&ExSystemLookasideListHead);
|
||||||
Prcb->PPLookasideList[LookasideLargeIrpList].P = CurrentList;
|
Prcb->PPLookasideList[LookasideLargeIrpList].P = CurrentList;
|
||||||
CurrentList++;
|
CurrentList++;
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -205,7 +205,7 @@ IopInitLookasideLists(VOID)
|
||||||
&ExSystemLookasideListHead);
|
&ExSystemLookasideListHead);
|
||||||
Prcb->PPLookasideList[LookasideSmallIrpList].P = CurrentList;
|
Prcb->PPLookasideList[LookasideSmallIrpList].P = CurrentList;
|
||||||
CurrentList++;
|
CurrentList++;
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -223,10 +223,10 @@ IopInitLookasideLists(VOID)
|
||||||
TAG_MDL,
|
TAG_MDL,
|
||||||
128,
|
128,
|
||||||
&ExSystemLookasideListHead);
|
&ExSystemLookasideListHead);
|
||||||
|
|
||||||
Prcb->PPLookasideList[LookasideMdlList].P = CurrentList;
|
Prcb->PPLookasideList[LookasideMdlList].P = CurrentList;
|
||||||
CurrentList++;
|
CurrentList++;
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -332,6 +332,7 @@ IopCreateRootDirectories()
|
||||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||||
UNICODE_STRING DirName;
|
UNICODE_STRING DirName;
|
||||||
HANDLE Handle;
|
HANDLE Handle;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
/* Create the '\Driver' object directory */
|
/* Create the '\Driver' object directory */
|
||||||
RtlInitUnicodeString(&DirName, L"\\Driver");
|
RtlInitUnicodeString(&DirName, L"\\Driver");
|
||||||
|
@ -340,9 +341,14 @@ IopCreateRootDirectories()
|
||||||
OBJ_PERMANENT,
|
OBJ_PERMANENT,
|
||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
if (!NT_SUCCESS(NtCreateDirectoryObject(&Handle,
|
Status = NtCreateDirectoryObject(&Handle,
|
||||||
DIRECTORY_ALL_ACCESS,
|
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);
|
NtClose(Handle);
|
||||||
|
|
||||||
/* Create the '\FileSystem' object directory */
|
/* Create the '\FileSystem' object directory */
|
||||||
|
@ -352,9 +358,31 @@ IopCreateRootDirectories()
|
||||||
OBJ_PERMANENT,
|
OBJ_PERMANENT,
|
||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
if (!NT_SUCCESS(NtCreateDirectoryObject(&Handle,
|
Status = NtCreateDirectoryObject(&Handle,
|
||||||
DIRECTORY_ALL_ACCESS,
|
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);
|
NtClose(Handle);
|
||||||
|
|
||||||
/* Return success */
|
/* Return success */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue