阅读:1329回复:1
弱问:驱动程序返回不了给定数据
弱问:驱动程序返回不了给定数据
Test(PIRP irp) { USHORT val; val=14; PIO_STACK_LOCATION irpStack = IoGetCurrentIrpStackLocation( irp ); ULONG dwInputLength = irpStack->Parameters.DeviceIoControl.InputBufferLength; ULONG dwOutputLength= irpStack->Parameters.DeviceIoControl.OutputBufferLength; PVOID p = ExAllocatePoolWithQuota(NonPagedPoolCacheAligned, 2); RtlCopyMemory(p, &val, 2); irp->AssociatedIrp.SystemBuffer=p; return CompleteIrp(irp,0,2);} CompleteIrp( PIRP Irp, NTSTATUS status, ULONG info) { Irp->IoStatus.Status = status; Irp->IoStatus.Information = info; // return byte information IoCompleteRequest(Irp,IO_NO_INCREMENT); return status; } 为什么应用程序端接收不到我给定的数据呢? 我改成 PVOID p =irp->AssociatedIrp.SystemBuffer; RtlCopyMemory(p, &val, 2); return CompleteIrp(irp,0,1); 也不行,为什么会这样呢?是不是要映射虚地址啊,我采用的是 Buffered方式 各位大侠,请指教 |
|
|
沙发#
发布于:2007-04-06 11:21
哈哈 解决了,原来覆盖原sys文件后 要重启电脑
|
|