阅读:1268回复:1
关于passthru发送数据的问题,谢谢!
想做一个可以发送mac数据的东西,在PtDispatch函数里面发送应用程序下来的数据(完整的链路程数据)。
但是总是出错(蓝屏!),下面我把代码给大家看看,希望得到大家的指点!谢谢! //全局变量,由应用层提供数据,数据本身是没有问题的 UCHAR WritePacketData[MAX_PACKET_LENGTH]; //Mac包的内容 int void SendMyPacket( void) { NDIS_HANDLE PoolHandle; PNDIS_PACKET pNdisPacket; PNDIS_BUFFER pNdisBuffer; UINT PacketLeng; //分配PacketPool NdisAllocatePacketPool( &status, &PoolHandle, 1, MAX_PACKET_LENGTH ); if( status != NDIS_STATUS_SUCCESS ) { status = STATUS_INSUFFICIENT_RESOURCES; DBGPRINT((\"<==NdisAllocatePacketPool Failed !!!!!!!!!!!!!!! \\n\")); return -1;; } //分配Packet NdisAllocatePacket( &status, &pNdisPacket, PoolHandle); if (status != NDIS_STATUS_SUCCESS) { status = STATUS_INSUFFICIENT_RESOURCES; DBGPRINT((\"<==NdisAllocatePacket Failed!!!!!!!!!!!!!!! \\n\")); return -1;; } //分配Buffer NdisAllocateBuffer(&status, &pNdisBuffer, PoolHandle, &WritePacketData, PacketLeng); if(status!=NDIS_STATUS_SUCCESS ) { DBGPRINT((\"<==NdisAllocateBuffer Failed !!!!!!!!!!!!!!! \\n\")); return -1;; } pNdisBuffer->Next = NULL; //连接packet NdisChainBufferAtFront(pNdisPacket, pNdisBuffer); IoMarkIrpPending(Irp); //发送 NdisSend(&status, pAdaptList->BindingHandle, pNdisPacket); if (status != NDIS_STATUS_PENDING) { // The send didn\'t pend so call the completion handler now PtSendComplete( pAdaptList->BindingHandle, pNdisPacket, status ); DBGPRINT((\"<==Send Suceed !!!!!!!!!!!!!!! \\n\")); } else{ DBGPRINT((\"<==Send NDIS_STATUS_PENDING !!!!!!!!!!!!!!! \\n\")); } return 1; } |
|
|
沙发#
发布于:2002-08-14 14:34
你的代码我没有仔细看,但是我想应该是系统内存方面的问题,你最好屏蔽掉几行程序,慢慢地调试看看是哪部分代码出的问题。
|
|
|