?? filespy.c
字號:
Length,
Wait,
LockKey,
CheckForReadOperation,
IoStatus,
deviceObject);
goto SpyFastIoCheckIfPossible_Exit;
} else {
returnValue = FALSE;
}
SpyFastIoCheckIfPossible_Exit:
if (shouldLog) {
//
// Log the necessary information for the end of the Fast I/O
// operation if we were able to allocate a RecordList to store
// this information
//
if (recordList) {
SpyLogFastIoComplete(
0,
FileObject,
IoStatus,
recordList);
}
}
return returnValue;
}
DBGSTATIC
BOOLEAN
SpyFastIoRead(
IN PFILE_OBJECT FileObject,
IN PLARGE_INTEGER FileOffset,
IN ULONG Length,
IN BOOLEAN Wait,
IN ULONG LockKey,
OUT PVOID Buffer,
OUT PIO_STATUS_BLOCK IoStatus,
IN PDEVICE_OBJECT DeviceObject
)
/*++
Routine Description:
This routine is the fast I/O "pass through" routine for reading from a
file.
This function simply invokes the next driver's cooresponding routine, or
returns FALSE if the next driver does not implement the function.
Arguments:
FileObject - Pointer to the file object to be read.
FileOffset - Byte offset in the file of the read.
Length - Length of the read operation to be performed.
Wait - Indicates whether or not the caller is willing to wait if the
appropriate locks, etc. cannot be acquired
LockKey - Provides the caller's key for file locks.
Buffer - Pointer to the caller's buffer to receive the data read.
IoStatus - Pointer to a variable to receive the I/O status of the
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 based on whether or not fast I/O
is possible for this file.
--*/
{
PDEVICE_OBJECT deviceObject;
PFAST_IO_DISPATCH fastIoDispatch;
BOOLEAN returnValue;
PRECORD_LIST recordList;
BOOLEAN shouldLog;
PAGED_CODE();
if (DeviceObject->DeviceExtension == NULL) {
return FALSE;
}
if (shouldLog = SHOULD_LOG(DeviceObject)) {
//
// Log the necessary information for the start of the Fast I/O
// operation
//
recordList = SpyLogFastIoStart(
READ,
0,
FileObject,
FileOffset,
Length,
Wait );
}
//
// Pass through logic for this type of Fast I/O
//
deviceObject =
((PDEVICE_EXTENSION) (DeviceObject->DeviceExtension))->
NextDriverDeviceObject;
if (!deviceObject) {
returnValue = FALSE;
goto SpyFastIoRead_Exit;
}
fastIoDispatch = deviceObject->DriverObject->FastIoDispatch;
if (VALID_FAST_IO_DISPATCH_HANDLER( fastIoDispatch, FastIoRead )) {
returnValue = (fastIoDispatch->FastIoRead)( FileObject,
FileOffset,
Length,
Wait,
LockKey,
Buffer,
IoStatus,
deviceObject);
goto SpyFastIoRead_Exit;
} else {
returnValue = FALSE;
goto SpyFastIoRead_Exit;
}
SpyFastIoRead_Exit:
if (shouldLog) {
//
// Log the necessary information for the end of the Fast I/O operation
// if we were able to allocate a RecordList to store this information
//
if (recordList) {
SpyLogFastIoComplete(
0,
FileObject,
IoStatus,
recordList);
}
}
return returnValue;
}
DBGSTATIC
BOOLEAN
SpyFastIoWrite(
IN PFILE_OBJECT FileObject,
IN PLARGE_INTEGER FileOffset,
IN ULONG Length,
IN BOOLEAN Wait,
IN ULONG LockKey,
IN PVOID Buffer,
OUT PIO_STATUS_BLOCK IoStatus,
IN PDEVICE_OBJECT DeviceObject
)
/*++
Routine Description:
This routine is the fast I/O "pass through" routine for writing to a
file.
This function simply invokes the next driver's cooresponding routine, or
returns FALSE if the next driver does not implement the function.
Arguments:
FileObject - Pointer to the file object to be written.
FileOffset - Byte offset in the file of the write operation.
Length - Length of the write operation to be performed.
Wait - Indicates whether or not the caller is willing to wait if the
appropriate locks, etc. cannot be acquired
LockKey - Provides the caller's key for file locks.
Buffer - Pointer to the caller's buffer that contains the data to be
written.
IoStatus - Pointer to a variable to receive the I/O status of the
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 based on whether or not fast I/O
is possible for this file.
--*/
{
PDEVICE_OBJECT deviceObject;
PFAST_IO_DISPATCH fastIoDispatch;
PRECORD_LIST recordList;
BOOLEAN returnValue;
BOOLEAN shouldLog;
PAGED_CODE();
if (DeviceObject->DeviceExtension == NULL) {
return FALSE;
}
if (shouldLog = SHOULD_LOG(DeviceObject)) {
//
// Log the necessary information for the start of the Fast I/O
// operation
//
recordList = SpyLogFastIoStart(
WRITE,
0,
FileObject,
FileOffset,
Length,
Wait );
}
//
// Pass through logic for this type of Fast I/O
//
deviceObject =
((PDEVICE_EXTENSION) (DeviceObject->DeviceExtension))->
NextDriverDeviceObject;
if (!deviceObject) {
returnValue = FALSE;
goto SpyFastIoWrite_Exit;
}
fastIoDispatch = deviceObject->DriverObject->FastIoDispatch;
if (VALID_FAST_IO_DISPATCH_HANDLER( fastIoDispatch, FastIoWrite )) {
returnValue = (fastIoDispatch->FastIoWrite)( FileObject,
FileOffset,
Length,
Wait,
LockKey,
Buffer,
IoStatus,
deviceObject);
} else {
returnValue = FALSE;
}
SpyFastIoWrite_Exit:
if (shouldLog) {
//
// Log the necessary information for the end of the Fast I/O operation
// if we were able to allocate a RecordList to store this information
//
if (recordList) {
SpyLogFastIoComplete(
0,
FileObject,
IoStatus,
recordList);
}
}
return returnValue;
}
DBGSTATIC
BOOLEAN
SpyFastIoQueryBasicInfo(
IN PFILE_OBJECT FileObject,
IN BOOLEAN Wait,
OUT PFILE_BASIC_INFORMATION Buffer,
OUT PIO_STATUS_BLOCK IoStatus,
IN PDEVICE_OBJECT DeviceObject
)
/*++
Routine Description:
This routine is the fast I/O "pass through" routine for querying basic
information about the file.
This function simply invokes the next driver's cooresponding routine, or
returns FALSE if the next driver does not implement the function.
Arguments:
FileObject - Pointer to the file object to be queried.
Wait - Indicates whether or not the caller is willing to wait if the
appropriate locks, etc. cannot be acquired
Buffer - Pointer to the caller's buffer to receive the information about
the file.
IoStatus - Pointer to a variable to receive the I/O status of the
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 based on whether or not fast I/O
is possible for this file.
--*/
{
PDEVICE_OBJECT deviceObject;
PFAST_IO_DISPATCH fastIoDispatch;
BOOLEAN returnValue;
PRECORD_LIST recordList;
BOOLEAN shouldLog;
PAGED_CODE();
if (DeviceObject->DeviceExtension == NULL) {
return FALSE;
}
if (shouldLog = SHOULD_LOG(DeviceObject)) {
//
// Log the necessary information for the start of the Fast I/O
// operation
//
recordList = SpyLogFastIoStart(
QUERY_BASIC_INFO,
0,
FileObject,
NULL,
0,
Wait );
}
//
// Pass through logic for this type of Fast I/O
//
deviceObject =
((PDEVICE_EXTENSION) (DeviceObject->DeviceExtension))->
NextDriverDeviceObject;
if (!deviceObject) {
returnValue = FALSE;
goto SpyFastIoQueryBasicInfo_Exit;
}
fastIoDispatch = deviceObject->DriverObject->FastIoDispatch;
if (VALID_FAST_IO_DISPATCH_HANDLER( fastIoDispatch, FastIoQueryBasicInfo )) {
returnValue = (fastIoDispatch->FastIoQueryBasicInfo)( FileObject,
Wait,
Buffer,
IoStatus,
deviceObject);
} else {
returnValue = FALSE;
}
SpyFastIoQueryBasicInfo_Exit:
if (shouldLog) {
//
// Log the necessary information for the end of the Fast I/O operation
// if we were able to allocate a RecordList to store this information
//
if (recordList) {
SpyLogFastIoComplete(
0,
FileObject,
IoStatus,
recordList);
}
}
return returnValue;
}
DBGSTATIC
BOOLEAN
SpyFastIoQueryStandardInfo(
IN PFILE_OBJECT FileObject,
IN BOOLEAN Wait,
OUT PFILE_STANDARD_INFORMATION Buffer,
OUT PIO_STATUS_BLOCK IoStatus,
IN PDEVICE_OBJECT DeviceObject
)
/*++
Routine Description:
This routine is the fast I/O "pass through" routine for querying standard information about the file.
This function simply invokes the next driver's cooresponding routine, or
returns FALSE if the next driver does not implement the function.
Arguments:
FileObject - Pointer to the file object to be queried.
Wait - Indicates whether or not the caller is willing to wait if the
appropriate locks, etc. cannot be acquired
Buffer - Pointer to the caller's buffer to receive the information about
the file.
IoStatus - Pointer to a variable to receive the I/O status of the
operation.
DeviceObject - Pointer to this driver's device object, the device on
which the operation is to occur.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -