⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fastio.cpp

📁 一个文件过滤驱动的实例
💻 CPP
📖 第 1 页 / 共 5 页
字号:
FsTPMFastIoMdlWriteComplete (
							   IN PFILE_OBJECT FileObject,
							   IN PLARGE_INTEGER FileOffset,
							   IN PMDL MdlChain,
							   IN PDEVICE_OBJECT DeviceObject
							   )

							   /*++

							   Routine Description:

							   This routine is the fast I/O "pass through" routine for completing an
							   MDL write operation.

							   This function simply invokes the file system's cooresponding routine, if
							   it has one.  It should be the case that this routine is invoked only if
							   the PrepareMdlWrite function is supported by the underlying file system,
							   and therefore this function will also be supported, but this is not
							   assumed by this driver.

							   Arguments:

							   FileObject - Pointer to the file object to complete the MDL write upon.

							   FileOffset - Supplies the file offset at which the write took place.

							   MdlChain - Pointer to the MDL chain used to perform the write operation.

							   DeviceObject - Pointer to this driver's device object, the device on
							   which the operation is to occur.

							   Return Value:

							   The function value is TRUE or FALSE, depending on whether or not it is
							   possible to invoke this function on the fast I/O path.

							   --*/

{
	// 暂不予支持
	return FALSE;

	FsTPM_DbgPrint(("->FsTPMFastIoMdlWriteComplete \n"));

	PDEVICE_OBJECT deviceObject;
	PFAST_IO_DISPATCH fastIoDispatch;

	PAGED_CODE();
	ASSERT(IS_MY_DEVICE_EXTENSION( DeviceObject->DeviceExtension ));

	//
	//  Pass through logic for this type of Fast I/O
	//

	deviceObject = ((PHOOK_EXTENSION) (DeviceObject->DeviceExtension))->Vcb.NextLowerDevice;
	if (deviceObject) {

		fastIoDispatch = deviceObject->DriverObject->FastIoDispatch;

		if (VALID_FAST_IO_DISPATCH_HANDLER( fastIoDispatch, MdlWriteComplete )) {

			return (fastIoDispatch->MdlWriteComplete)(
				FileObject,
				FileOffset,
				MdlChain,
				deviceObject );
		}
	}
	return FALSE;
}


/*********************************************************************************
UNIMPLEMENTED FAST IO ROUTINES

The following four Fast Io routines are for compression on the wire
which is not yet implemented in NT.

FastIoReadCompressed, FastIoWriteCompressed, 
FastIoMdlReadCompleteCompressed, FastIoMdlWriteCompleteCompressed
**********************************************************************************/


BOOLEAN
FsTPMFastIoReadCompressed (
							 IN PFILE_OBJECT FileObject,
							 IN PLARGE_INTEGER FileOffset,
							 IN ULONG Length,
							 IN ULONG LockKey,
							 OUT PVOID Buffer,
							 OUT PMDL *MdlChain,
							 OUT PIO_STATUS_BLOCK IoStatus,
							 OUT struct _COMPRESSED_DATA_INFO *CompressedDataInfo,
							 IN ULONG CompressedDataInfoLength,
							 IN PDEVICE_OBJECT DeviceObject
							 )

							 /*++

							 Routine Description:

							 This routine is the fast I/O "pass through" routine for reading compressed
							 data from a file.

							 This function simply invokes the file system's cooresponding routine, or
							 returns FALSE if the file system does not implement the function.

							 Arguments:

							 FileObject - Pointer to the file object that will be read.

							 FileOffset - Supplies the offset into the file to begin the read operation.

							 Length - Specifies the number of bytes to be read from the file.

							 LockKey - The key to be used in byte range lock checks.

							 Buffer - Pointer to a buffer to receive the compressed data read.

							 MdlChain - A pointer to a variable to be filled in w/a pointer to the MDL
							 chain built to describe the data read.

							 IoStatus - Variable to receive the final status of the read operation.

							 CompressedDataInfo - A buffer to receive the description of the compressed
							 data.

							 CompressedDataInfoLength - Specifies the size of the buffer described by
							 the CompressedDataInfo parameter.

							 DeviceObject - Pointer to this driver's device object, the device on
							 which the operation is to occur.

							 Return Value:

							 The function value is TRUE or FALSE based on whether or not fast I/O
							 is possible for this file.

							 --*/

{
	// 暂不予支持
	return FALSE;

	FsTPM_DbgPrint(("->FsTPMFastIoReadCompressed \n"));

	PDEVICE_OBJECT deviceObject;
	PFAST_IO_DISPATCH fastIoDispatch;

	PAGED_CODE();
	ASSERT(IS_MY_DEVICE_EXTENSION( DeviceObject->DeviceExtension ));

	//
	//  Pass through logic for this type of Fast I/O
	//

	deviceObject = ((PHOOK_EXTENSION) (DeviceObject->DeviceExtension))->Vcb.NextLowerDevice;

	if (deviceObject) {

		fastIoDispatch = deviceObject->DriverObject->FastIoDispatch;

		if (VALID_FAST_IO_DISPATCH_HANDLER( fastIoDispatch, FastIoReadCompressed )) {

			return (fastIoDispatch->FastIoReadCompressed)(
				FileObject,
				FileOffset,
				Length,
				LockKey,
				Buffer,
				MdlChain,
				IoStatus,
				CompressedDataInfo,
				CompressedDataInfoLength,
				deviceObject );
		}
	}
	return FALSE;
}


BOOLEAN
FsTPMFastIoWriteCompressed (
							  IN PFILE_OBJECT FileObject,
							  IN PLARGE_INTEGER FileOffset,
							  IN ULONG Length,
							  IN ULONG LockKey,
							  IN PVOID Buffer,
							  OUT PMDL *MdlChain,
							  OUT PIO_STATUS_BLOCK IoStatus,
							  IN struct _COMPRESSED_DATA_INFO *CompressedDataInfo,
							  IN ULONG CompressedDataInfoLength,
							  IN PDEVICE_OBJECT DeviceObject
							  )

							  /*++

							  Routine Description:

							  This routine is the fast I/O "pass through" routine for writing compressed
							  data to a file.

							  This function simply invokes the file system's cooresponding routine, or
							  returns FALSE if the file system does not implement the function.

							  Arguments:

							  FileObject - Pointer to the file object that will be written.

							  FileOffset - Supplies the offset into the file to begin the write operation.

							  Length - Specifies the number of bytes to be write to the file.

							  LockKey - The key to be used in byte range lock checks.

							  Buffer - Pointer to the buffer containing the data to be written.

							  MdlChain - A pointer to a variable to be filled in w/a pointer to the MDL
							  chain built to describe the data written.

							  IoStatus - Variable to receive the final status of the write operation.

							  CompressedDataInfo - A buffer to containing the description of the
							  compressed data.

							  CompressedDataInfoLength - Specifies the size of the buffer described by
							  the CompressedDataInfo parameter.

							  DeviceObject - Pointer to this driver's device object, the device on
							  which the operation is to occur.

							  Return Value:

							  The function value is TRUE or FALSE based on whether or not fast I/O
							  is possible for this file.

							  --*/

{
	// 暂不予支持
	return FALSE;

	FsTPM_DbgPrint(("->FsTPMFastIoWriteCompressed \n"));

	PDEVICE_OBJECT deviceObject;
	PFAST_IO_DISPATCH fastIoDispatch;

	PAGED_CODE();
	ASSERT(IS_MY_DEVICE_EXTENSION( DeviceObject->DeviceExtension ));

	//
	//  Pass through logic for this type of Fast I/O
	//

	deviceObject = ((PHOOK_EXTENSION) (DeviceObject->DeviceExtension))->Vcb.NextLowerDevice;
	if (deviceObject) {

		fastIoDispatch = deviceObject->DriverObject->FastIoDispatch;

		if (VALID_FAST_IO_DISPATCH_HANDLER( fastIoDispatch, FastIoWriteCompressed )) {

			return (fastIoDispatch->FastIoWriteCompressed)(
				FileObject,
				FileOffset,
				Length,
				LockKey,
				Buffer,
				MdlChain,
				IoStatus,
				CompressedDataInfo,
				CompressedDataInfoLength,
				deviceObject );
		}
	}
	return FALSE;
}


BOOLEAN
FsTPMFastIoMdlReadCompleteCompressed (
										IN PFILE_OBJECT FileObject,
										IN PMDL MdlChain,
										IN PDEVICE_OBJECT DeviceObject
										)

										/*++

										Routine Description:

										This routine is the fast I/O "pass through" routine for completing an
										MDL read compressed operation.

										This function simply invokes the file system's cooresponding routine, if
										it has one.  It should be the case that this routine is invoked only if
										the read compressed function is supported by the underlying file system,
										and therefore this function will also be supported, but this is not assumed
										by this driver.

										Arguments:

										FileObject - Pointer to the file object to complete the compressed read
										upon.

										MdlChain - Pointer to the MDL chain used to perform the read operation.

										DeviceObject - Pointer to this driver's device object, the device on
										which the operation is to occur.

										Return Value:

										The function value is TRUE or FALSE, depending on whether or not it is
										possible to invoke this function on the fast I/O path.

										--*/

{
	// 暂不予支持
	return FALSE;

	FsTPM_DbgPrint(("->FsTPMFastIoMdlReadCompleteCompressed \n"));

	PDEVICE_OBJECT deviceObject;
	PFAST_IO_DISPATCH fastIoDispatch;

	ASSERT(IS_MY_DEVICE_EXTENSION( DeviceObject->DeviceExtension ));

	//
	//  Pass through logic for this type of Fast I/O
	//

	deviceObject = ((PHOOK_EXTENSION) (DeviceObject->DeviceExtension))->Vcb.NextLowerDevice;

	if (deviceObject) {

		fastIoDispatch = deviceObject->DriverObject->FastIoDispatch;

		if (VALID_FAST_IO_DISPATCH_HANDLER( fastIoDispatch, MdlReadCompleteCompressed )) {

			return (fastIoDispatch->MdlReadCompleteCompressed)(
				FileObject,
				MdlChain,
				deviceObject );
		}
	}
	return FALSE;
}


BOOLEAN
FsTPMFastIoMdlWriteCompleteCompressed (
	IN PFILE_OBJECT FileObject,
	IN PLARGE_INTEGER FileOffset,
	IN PMDL MdlChain,
	IN PDEVICE_OBJECT DeviceObject
	)

	/*++

	Routine Description:

	This routine is the fast I/O "pass through" routine for completing a
	write compressed operation.

	This function simply invokes the file system's cooresponding routine, if
	it has one.  It should be the case that this routine is invoked only if
	the write compressed function is supported by the underlying file system,
	and therefore this function will also be supported, but this is not assumed
	by this driver.

	Arguments:

	FileObject - Pointer to the file object to complete the compressed write
	upon.

	FileOffset - Supplies the file offset at which the file write operation
	began.

	MdlChain - Pointer to the MDL chain used to perform the write operation.

	DeviceObject - Pointer to this driver's device object, the device on
	which the operation is to occur.

	Return Value:

	The function value is TRUE or FALSE, depending on whether or not it is
	possible to invoke this function on the fast I/O path.

	--*/

{
	// 暂不予支持
	return FALSE;

	FsTPM_DbgPrint(("->FsTPMFastIoMdlWriteCompleteCompressed \n"));

	PDEVICE_OBJECT deviceObject;
	PFAST_IO_DISPATCH fastIoDispatch;

	ASSERT(IS_MY_DEVICE_EXTENSION( DeviceObject->DeviceExtension ));

	//
	//  Pass through logic for this type of Fast I/O
	//

	deviceObject = ((PHOOK_EXTENSION) (DeviceObject->DeviceExtension))->Vcb.NextLowerDevice;

	if (deviceObject) {

		fastIoDispatch = deviceObject->DriverObject->FastIoDispatch;

		if (VALID_FAST_IO_DISPATCH_HANDLER( fastIoDispatch, MdlWriteCompleteCompressed )) {

			return (fastIoDispatch->MdlWriteCompleteCompressed)(
				FileObject,
				FileOffset,
				MdlChain,
				deviceObject );
		}
	}
	return FALSE;
}


BOOLEAN
FsTPMFastIoQueryOpen (
						IN PIRP Irp,
						OUT PFILE_NETWORK_OPEN_INFORMATION NetworkInformation,
						IN PDEVICE_OBJECT DeviceObject
						)

						/*++

						Routine Description:

						This routine is the fast I/O "pass through" routine for opening a file
						and returning network information it.

						This function simply invokes the file system's cooresponding routine, or
						returns FALSE if the file system does not implement the function.

						Arguments:

						Irp - Pointer to a create IRP that represents this open operation.  It is
						to be used by the file system for common open/create code, but not
						actually completed.

						NetworkInformation - A buffer to receive the information required by the
						network about the file being opened.

						DeviceObject - Pinter to this driver's device object, the device on
						which the operation is to occur.

						Return Value:

						The function value is TRUE or FALSE based on whether or not fast I/O
						is possible for this file.

						--*/


{
	// 暂不予支持
	return FALSE;

	FsTPM_DbgPrint(("->FsTPMFastIoQueryOpen \n"));

	PDEVICE_OBJECT deviceObject;
	PFAST_IO_DISPATCH fastIoDispatch;
	BOOLEAN result;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -