[求助]驱动与应用程序通信
发表于:
2009-12-22 21:37
4019
驱动
NTSTATUS ICOL(IN PDEVICE_OBJECT pDevObj,IN PIRP Irp)
{
NTSTATUS status = STATUS_SUCCESS;
PIO_STACK_LOCATION irpStack;
PVOID InputBuffer;
PVOID OutputBuffer;
ULONG InputBufferLength;
ULONG OutputBufferLength;
Irp->IoStatus.Status = status;
irpStack=IoGetCurrentIrpStackLocation(Irp);
Irp->IoStatus.Information=0;
InputBuffer= OutputBuffer = Irp->AssociatedIrp.SystemBuffer;
InputBufferLength = irpStack->Parameters.DeviceIoControl.InputBufferLength;
OutputBufferLength = irpStack->Parameters.DeviceIoControl.OutputBufferLength;
switch (irpStack->Parameters.DeviceIoControl.IoControlCode)
{
case IOCTL_TS_PRONAME:
DbgPrint((PCHAR)InputBuffer);
RtlCopyMemory(OutputBuffer,InputBuffer,OutputBufferLength);
Irp->IoStatus.Information=OutputBufferLength;
break;
default:
status = STATUS_INVALID_PARAMETER;
break;
}
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return status;
}
程序
var
junk:DWORD;
inData:array[0..1023] of char;
outData:array[0..1023] of char;
begin
inData:='kiss';
DeviceIoControl(hDev,2050,@inData,Length(inData) ,@outData,Length(outData),junk,nil);
ShowMessage(outData);
end;
驱动能收到传进的的值,但是程序却拿不到返回值,也就是outData什么东西都没有,为什么,请各位大牛帮帮小菜
[招生]科锐逆向工程师培训(2024年11月15日实地,远程教学同时开班, 第51期)