阅读:4476回复:2
各位高手怎么在TDI驱动中得到网卡的流量,本地端口号、本地IP地址、IP数据大小
我现在得到了远程IP地址和端口号
case IRP_MJ_INTERNAL_DEVICE_CONTROL: switch (IrpStack->MinorFunction) { case TDI_ACCEPT: break; case TDI_ACTION: break; case TDI_ASSOCIATE_ADDRESS: break; case TDI_DISASSOCIATE_ADDRESS: break; case TDI_CONNECT: DBGPRINT("[TDI_CONNECT])...\n"); pTDIRequestKernel=(PTDI_REQUEST_KERNEL )&IrpStack->Parameters; DBPrintTransportAddress( (pTDIRequestKernel->RequestConnectionInformation)->RemoteAddress);//这是解释远程IP连接的IP地址 break; case TDI_DISCONNECT: break; case TDI_LISTEN: break; case TDI_QUERY_INFORMATION: break; case TDI_RECEIVE: break; case TDI_RECEIVE_DATAGRAM: break; case TDI_SEND: break; case TDI_SEND_DATAGRAM: break; case TDI_SET_EVENT_HANDLER: break; case TDI_SET_INFORMATION: break; default: break; } 我在TDI_SEND:中能得到本机IP地址和端口号,还有发送IP包的大小请问怎么操作,希望高手能够给个例子代码 我这样写代码得到本地IP不正确 if(Irp-MdlAddress) { TDI_ADDRESS_INFO *tai = (TDI_ADDRESS_INFO*)MmGetSystemAddressForMdl(Irp->MdlAddress); TA_ADDRESS *addr = tai->Address.Address; KdPrint(("%x ",ntohl(((TDI_ADDRESS_IP*)(addr->address))->in_addr))); } 请高手回答一下 } |
|
沙发#
发布于:2010-08-13 12:33
版主请回答一下
|
|
板凳#
发布于:2011-08-24 01:18
同求 这样就可以该校园网的流量了吗?
|
|