📄 qsfile.cpp
字号:
/*++
Abstract:
This module contains the code that is very specific to query/set file
operations in the serial driver.
--*/
#include "precomp.h"
NTSTATUS
KdSerialDevice::DispatchQueryInformation(IN KdIrp &Irp)
/*++
Routine Description:
This routine is used to query the end of file information on
the opened serial port. Any other file information request
is returned with an invalid parameter.
This routine always returns an end of file of 0.
Arguments:
Irp - Pointer to the IRP for the current request
Return Value:
The function value is the final status of the call
--*/
{
// The status that gets returned to the caller and
// set in the Irp.
NTSTATUS Status;
DebugDump(DBG_DIAG6, ("Dispatch entry for: %x\n",Irp) );
if (CompleteIfError(Irp) != STATUS_SUCCESS)
return STATUS_CANCELLED;
Irp.Information() = 0L;
Status = STATUS_SUCCESS;
if (Irp.QueryFileInformationClass()==FileStandardInformation)
{
PFILE_STANDARD_INFORMATION Buf = (PFILE_STANDARD_INFORMATION)Irp.SystemBuffer();
Buf->AllocationSize.QuadPart = 0;
Buf->EndOfFile = Buf->AllocationSize;
Buf->NumberOfLinks = 0;
Buf->DeletePending = FALSE;
Buf->Directory = FALSE;
Irp.Information() = sizeof(FILE_STANDARD_INFORMATION);
}
else if (Irp.QueryFileInformationClass()==FilePositionInformation)
{
((PFILE_POSITION_INFORMATION)Irp.SystemBuffer())->
CurrentByteOffset.QuadPart = 0;
Irp.Information() = sizeof(FILE_POSITION_INFORMATION);
}
else
Status = STATUS_INVALID_PARAMETER;
DebugDump(DBG_DIAG6, ("Complete Irp: %x\n",Irp) );
Irp.Complete();
return Status;
}
NTSTATUS KdSerialDevice::DispatchSetInformation(IN KdIrp &Irp)
/*++
Routine Description:
This routine is used to set the end of file information on
the opened parallel port. Any other file information request
is returned with an invalid parameter.
This routine always ignores the actual end of file since
the query information code always returns an end of file of 0.
Arguments:
Irp - Pointer to the IRP for the current request
Return Value:
The function value is the final status of the call
--*/
{
// The status that gets returned to the caller and
// set in the Irp.
NTSTATUS Status;
DebugDump(DBG_DIAG6, ("Dispatch entry for: %x\n",Irp) );
if (CompleteIfError(Irp) != STATUS_SUCCESS)
return STATUS_CANCELLED;
Irp.Information() = 0L;
if (Irp.SetFileInformationClass()==FileEndOfFileInformation ||
Irp.SetFileInformationClass()==FileAllocationInformation )
{
Status = STATUS_SUCCESS;
}
else
Status = STATUS_INVALID_PARAMETER;
Irp.Status() = Status;
DebugDump(DBG_DIAG6, ("Complete Irp: %x\n",Irp) );
Irp.Complete();
return Status;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -