Author: tkreuzer
Date: Tue Jan 28 23:40:27 2014
New Revision: 61874
URL:
http://svn.reactos.org/svn/reactos?rev=61874&view=rev
Log:
[NTOSKRNL]
- Implement FsRtlRegisterFileSystemFilterCallbacks
- Fix returned ResultLength value in NtQuerySystemInformation
- Create \FileSystems\Filters folder in IopCreateRootDirectories, used by Windows fltmgr
Modified:
trunk/reactos/ntoskrnl/ex/sysinfo.c
trunk/reactos/ntoskrnl/fsrtl/fastio.c
trunk/reactos/ntoskrnl/io/iomgr/iomgr.c
Modified: trunk/reactos/ntoskrnl/ex/sysinfo.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/sysinfo.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/ex/sysinfo.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ex/sysinfo.c [iso-8859-1] Tue Jan 28 23:40:27 2014
@@ -1654,7 +1654,7 @@
/* Check who is calling */
if (PreviousMode != KernelMode)
{
- static const UNICODE_STRING Win32kName =
+ static const UNICODE_STRING Win32kName =
RTL_CONSTANT_STRING(L"\\SystemRoot\\System32\\win32k.sys");
/* Make sure we can load drivers */
@@ -1663,7 +1663,7 @@
/* FIXME: We can't, fail */
return STATUS_PRIVILEGE_NOT_HELD;
}
-
+
_SEH2_TRY
{
/* Probe and copy the unicode string */
@@ -1684,7 +1684,7 @@
_SEH2_YIELD(return _SEH2_GetExceptionCode());
}
_SEH2_END;
-
+
/* Recursively call the function, so that we are from kernel mode */
return ZwSetSystemInformation(SystemExtendServiceTableInformation,
(PVOID)&Win32kName,
@@ -1956,51 +1956,51 @@
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 @@
OUT PULONG UnsafeResultLength)
{
KPROCESSOR_MODE PreviousMode;
- ULONG ResultLength;
+ ULONG ResultLength = 0;
NTSTATUS FStatus = STATUS_NOT_IMPLEMENTED;
PAGED_CODE();
@@ -2038,8 +2038,11 @@
ProbeForWriteUlong(UnsafeResultLength);
}
+ if (UnsafeResultLength)
+ *UnsafeResultLength = 0;
+
/*
- * Check the request is valid.
+ * Check if the request is valid.
*/
if (SystemInformationClass >= MAX_SYSTEM_INFO_CLASS)
{
Modified: trunk/reactos/ntoskrnl/fsrtl/fastio.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/fsrtl/fastio.c?re…
==============================================================================
--- trunk/reactos/ntoskrnl/fsrtl/fastio.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/fsrtl/fastio.c [iso-8859-1] Tue Jan 28 23:40:27 2014
@@ -1802,7 +1802,7 @@
Exclusive = TRUE;
ResourceToAcquire = FcbHeader->Resource;
}
- else if (!FcbHeader->PagingIoResource ||
+ else if (!FcbHeader->PagingIoResource ||
(FcbHeader->Flags & FSRTL_FLAG_ACQUIRE_MAIN_RSRC_SH))
{
/* Acquire main resource shared if flag is specified or
@@ -1942,9 +1942,35 @@
*--*/
NTSTATUS
NTAPI
-FsRtlRegisterFileSystemFilterCallbacks(IN PDRIVER_OBJECT FilterDriverObject,
- IN PFS_FILTER_CALLBACKS Callbacks)
-{
- UNIMPLEMENTED;
- return STATUS_NOT_IMPLEMENTED;
-}
+FsRtlRegisterFileSystemFilterCallbacks(
+ PDRIVER_OBJECT FilterDriverObject,
+ PFS_FILTER_CALLBACKS Callbacks)
+{
+ 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;
+}
Modified: trunk/reactos/ntoskrnl/io/iomgr/iomgr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/iomgr.c?…
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/iomgr.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/iomgr.c [iso-8859-1] Tue Jan 28 23:40:27 2014
@@ -110,7 +110,7 @@
IOC_TAG1,
32,
&ExSystemLookasideListHead);
-
+
/* Initialize the Lookaside List for Large IRPs */
ExInitializeSystemLookasideList(&IoLargeIrpLookaside,
NonPagedPool,
@@ -137,11 +137,11 @@
&ExSystemLookasideListHead);
/* Allocate the global lookaside list buffer */
- CurrentList = ExAllocatePoolWithTag(NonPagedPool,
+ CurrentList = ExAllocatePoolWithTag(NonPagedPool,
4 * KeNumberProcessors *
sizeof(GENERAL_LOOKASIDE),
TAG_IO);
-
+
/* Loop all processors */
for (i = 0; i < KeNumberProcessors; i++)
{
@@ -165,13 +165,13 @@
&ExSystemLookasideListHead);
Prcb->PPLookasideList[LookasideCompletionList].P = CurrentList;
CurrentList++;
-
+
}
else
{
Prcb->PPLookasideList[LookasideCompletionList].P =
&IoCompletionPacketLookaside;
}
-
+
/* Set the Large IRP List */
Prcb->PPLookasideList[LookasideLargeIrpList].L = &IoLargeIrpLookaside;
if (CurrentList)
@@ -185,7 +185,7 @@
&ExSystemLookasideListHead);
Prcb->PPLookasideList[LookasideLargeIrpList].P = CurrentList;
CurrentList++;
-
+
}
else
{
@@ -205,7 +205,7 @@
&ExSystemLookasideListHead);
Prcb->PPLookasideList[LookasideSmallIrpList].P = CurrentList;
CurrentList++;
-
+
}
else
{
@@ -223,10 +223,10 @@
TAG_MDL,
128,
&ExSystemLookasideListHead);
-
+
Prcb->PPLookasideList[LookasideMdlList].P = CurrentList;
CurrentList++;
-
+
}
else
{
@@ -332,6 +332,7 @@
OBJECT_ATTRIBUTES ObjectAttributes;
UNICODE_STRING DirName;
HANDLE Handle;
+ NTSTATUS Status;
/* Create the '\Driver' object directory */
RtlInitUnicodeString(&DirName, L"\\Driver");
@@ -340,9 +341,14 @@
OBJ_PERMANENT,
NULL,
NULL);
- if (!NT_SUCCESS(NtCreateDirectoryObject(&Handle,
- DIRECTORY_ALL_ACCESS,
- &ObjectAttributes))) return FALSE;
+ Status = NtCreateDirectoryObject(&Handle,
+ DIRECTORY_ALL_ACCESS,
+ &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 @@
OBJ_PERMANENT,
NULL,
NULL);
- if (!NT_SUCCESS(NtCreateDirectoryObject(&Handle,
- DIRECTORY_ALL_ACCESS,
- &ObjectAttributes))) return FALSE;
+ Status = NtCreateDirectoryObject(&Handle,
+ DIRECTORY_ALL_ACCESS,
+ &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 */