📄 iorw.c
字号:
// iorw.c
//
// Generated by C DriverWizard 3.1.0 (Build 1722)
// Requires DDK Only
// File created on 1/23/2009
//
#include "pch.h"
#include "..\intrface.h"
#ifdef CHARSAMPLE_WMI_TRACE
#include "iorw.tmh"
#endif
///////////////////////////////////////////////////////////////////////////////////////////////////
// CharSampleDeviceIoControlDispatch
// Handled incoming IOCTL requests
//
// Arguments:
// IN DeviceObject
// Device object for our device
//
// IN Irp
// The IOCTL IRP to handle
//
// Return Value:
// NT status code
//
NTSTATUS CharSampleDeviceIoControlDispatch(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp
)
{
PIO_STACK_LOCATION irpStack;
NTSTATUS status;
PCHARSAMPLE_DEVICE_EXTENSION deviceExtension;
PVOID inputBuffer;
ULONG inputLength;
PVOID outputBuffer;
ULONG outputLength;
CharSampleDebugPrint(DBG_IO, DBG_TRACE, __FUNCTION__"++. IRP %p", Irp);
CHAR n,c[]="零一二三四五六七八九";
deviceExtension = (PCHARSAMPLE_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
// Get our IRP stack location
irpStack = IoGetCurrentIrpStackLocation(Irp);
// Get the buffer lengths
inputLength = irpStack->Parameters.DeviceIoControl.InputBufferLength;
outputLength = irpStack->Parameters.DeviceIoControl.OutputBufferLength;
switch (irpStack->Parameters.DeviceIoControl.IoControlCode)
{
case IOCTL_800:
CharSampleDebugPrint(DBG_IO, DBG_INFO, __FUNCTION__": IOCTL_800");
status = CharSampleCheckIoLock(&deviceExtension->IoLock, Irp);
if (!NT_SUCCESS(status) || (status == STATUS_PENDING))
{
CharSampleDebugPrint(DBG_IO, DBG_WARN, __FUNCTION__"--. IRP %p STATUS %x", Irp, status);
return status;
}
// buffered ioctl
inputBuffer = Irp->AssociatedIrp.SystemBuffer;
outputBuffer = Irp->AssociatedIrp.SystemBuffer;
n=*(CHAR *)inputBuffer;
if((n>='0')&&(n<='9'))
{
n-='0';
strcpy((PCHAR)outputBufeer,&c[n*2],2);
Irp->IoStatus.Information=2;
status=STATUS_SUCCESS;
}
else
status=STATUS_INVALID_PARAMETER;
status = STATUS_NOT_IMPLEMENTED;
Irp->IoStatus.Information = 0;
Irp->IoStatus.Status = status;
IoCompleteRequest (Irp, IO_NO_INCREMENT);
CharSampleDecrementIoCount(&deviceExtension->IoLock);
break;
default:
status = STATUS_INVALID_DEVICE_REQUEST;
Irp->IoStatus.Status = status;
IoCompleteRequest (Irp, IO_NO_INCREMENT);
break;
}
CharSampleDebugPrint(DBG_IO, DBG_TRACE, __FUNCTION__"--. IRP %p STATUS %x", Irp, status);
return status;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -