阅读:1216回复:2
9x下如何使用TDI?我晕! 高手帮忙,给分!!
9x下想使用TDI,我研究了很久,我对Ndis不熟悉,可是9x下的资料很少,甚至DDK里面头文件都没有!
下面是我的程序,TdiSend的时候蓝屏,我估计是NDIS_BUFFER的定义有问题,DDK里面说是这样定义的,可是,其他地方又说与2000下的MDL相同,胡涂了!!! ret = TDIGETVERSION(); pTable = (TDIDispatchTable *)TDIGETINFO(); if(pTable != 0) { lpTdiConnect = pTable->TdiConnectEntry; lpTdiDisconnect = pTable->TdiDisconnectEntry; lpTdiReceive = pTable->TdiReceiveEntry; lpTdiSend = pTable->TdiSendEntry; lpTdiOpenConnection = pTable->TdiOpenConnectionEntry; lpTdiCloseConnection = pTable->TdiCloseConnectionEntry; lpTdiOpenAddress = pTable->TdiOpenAddressEntry; lpTdiCloseAddress = pTable->TdiCloseAddressEntry; lpTdiAssociateAddress = pTable->TdiAssociateAddressEntry; lpTdiDisAssociateAddress = pTable->TdiDisAssociateAddressEntry; } InitIPAddress(&LocalAddress, 0,//INADDR_ANY, // Any Local Address 0 // Any Local Port ); // // Setup Remote TDI Address // InitIPAddress( &RemoteAddress, inet_addr(\"127.000.000.001\"), 0x7777 ); status = (*lpTdiOpenAddress)(&Request, &AddrList, 6, 0); AddrHandle = Request.Handle.AddressHandle; status = (*lpTdiOpenConnection)(&Request, 0); status = (*lpTdiAssociateAddress)(&Request, AddrHandle); // //Setup conection info. // RequestAddr.UserDataLength = 0; RequestAddr.UserData = NULL; RequestAddr.OptionsLength = 0; RequestAddr.Options = NULL; RequestAddr.RemoteAddressLength = sizeof(TA_IP_ADDRESS); RequestAddr.RemoteAddress = (PTRANSPORT_ADDRESS)&RemoteAddress; (*lpTdiConnect)(&Request, &iTimeout, &RequestAddr, &RequestAddr); NdisBuf.length = sizeof(NDIS_BUFFER); NdisBuf.Buf = Buf; NdisBuf.MdlNext = 0; (*lpTdiSend)(&Request, 0, 10, &NdisBuf); } 下面是NDIS_BUFFER的定义(我自己根据DDK猜想的): typedef struct _NDIS_BUFFER{ int length; PVOID Buf; struct _NDIS_BUFFER *pNext; }NDIS_BUFFER, *PNDIS_BUFFER; |
|
最新喜欢:highw
|
沙发#
发布于:2002-07-01 11:34
明白了,这个NDIS_BUFFER只能用这玩意来分配:
NdisAllocatePacketPool NdisAllocateBufferPool NdisAllocateBuffer 谢谢各位关注! 我的QQ:9006476 有事我们多联系,欢迎来苏州啊,呵呵 |
|
|
板凳#
发布于:2002-07-01 12:58
我只对ndis imd比较熟,对TDI不太熟,
不过也正想研究研究,有时间可以交流一下! QQ:14147140 |
|