阅读:1301回复:0
问一个关于tdi的问题
我写了一个tdi的驱动作为客户端和服务器进行通信, 驱动是32位的, 在win xp上运行, 服务器就是普通应用程序
当服务器也是32位的时候, tdi驱动工作正常, 能正常收发包 当服务器编译成64位的时候, 驱动就工作不正常了, 收包的时候, 不会等到服务器的包到来KeWaitForSingleObject就直接返回了, 而且返回是成功,但实际上没收到有效的数据包 服务器我尝试了iocp 和 普通socket+线程, 都不行 实在找不到问题在哪里, 请大家指点迷津 驱动收数据函数 NTSTATUS Recv(PFILE_OBJECT FileObject, PVOID Data, ULONG Length, PKEVENT Event, PIO_STATUS_BLOCK IoStatus,LONGLONG NetTimeout) { PDEVICE_OBJECT DeviceObject; PMDL Mdl; PIRP Irp; NTSTATUS Status; LARGE_INTEGER tm; tm.QuadPart = NetTimeout; DeviceObject = IoGetRelatedDeviceObject(FileObject); Irp = TdiBuildInternalDeviceControlIrp(TDI_RECEIVE, DeviceObject, FileObject, Event, IoStatus); if (Irp == 0) return STATUS_INSUFFICIENT_RESOURCES; Mdl = IoAllocateMdl(Data, Length, FALSE, FALSE, Irp); __try { MmProbeAndLockPages(Mdl, KernelMode, IoModifyAccess); } __except(EXCEPTION_EXECUTE_HANDLER) { //IoFreeMdl (Mdl); Status = STATUS_UNSUCCESSFUL; return Status; } Mdl->Next = NULL; TdiBuildReceive(Irp, DeviceObject, FileObject, 0, 0, Mdl, TDI_RECEIVE_NORMAL, Length); Status = IoCallDriver(DeviceObject, Irp); KIRQL curIrql = KeGetCurrentIrql(); KdPrint(("zVDisk: Recv, curIrql[%x]\n",curIrql )); if (Status == STATUS_PENDING) Status = KeWaitForSingleObject(Event, UserRequest, KernelMode, FALSE, 0/*&tm*/); KdPrint(("zVDisk: Recv, Status[%x],Lenght[%d]\n",IoStatus.Status,Status.Information )); if(Status != STATUS_SUCCESS) { int kk=0; } return Status; } |
|
|