阅读:1807回复:3
快来啊,我不行了!!!!
BOOLEAN GetProtocolBlock(OUT PNDIS_STATUS Status,
OUT PNDIS_HANDLE ProtocolHandle, IN PNDIS_STRING ProtoName ) { NDIS_PROTOCOL_CHARACTERISTICS ProtocolChar; PNDIS_PROTOCOL_BLOCK ProtocolCharBlock; // // Name MUST match string used by ndisdev.asm to declare the driver name; case counts. // This is necessary for binding to proceed properly. // NDIS_STRING NProtoName = NDIS_STRING_CONST("IPP"); NDIS_HANDLE NdisProtocolHandle; NdisZeroMemory( (UCHAR*)&ProtocolChar, sizeof(NDIS_PROTOCOL_CHARACTERISTICS) ); ProtocolChar.MajorNdisVersion = 0x03; ProtocolChar.MinorNdisVersion = 0x0; ProtocolChar.Reserved = 0; ProtocolChar.Name = NProtoName; NdisRegisterProtocol( Status, &NdisProtocolHandle, &ProtocolChar, sizeof(NDIS_PROTOCOL_CHARACTERISTICS) ); if (*Status != NDIS_STATUS_SUCCESS) { DebugPrint((2,"NdisRegisterProtocol IPP fail !\n\r")); return FALSE; } ProtocolCharBlock = (PNDIS_PROTOCOL_BLOCK)NdisProtocolHandle; DebugPrint((1,"version = %d\n\r",ProtocolCharBlock->ProtocolCharacteristics.MajorNdisVersion)); DebugPrint((1,"version = %s\n\r",ProtocolCharBlock->ProtocolCharacteristics.Name.Buffer)); ProtocolCharBlock = ProtocolCharBlock->NextProtocol; DebugPrint((1,"ProtocolCharBlock = %8x\n\r",ProtocolCharBlock)); NdisDeregisterProtocol( Status, NdisProtocolHandle ); if ( *Status != NDIS_STATUS_SUCCESS ) { DebugPrint((2,"NdisDeregisterProtocol IPP fail !\n\r")); return FALSE; } while(ProtocolCharBlock) { if(NdisEqualString(ProtoName,&ProtocolCharBlock->ProtocolCharacteristics.Name,FALSE)) { DebugPrint((2,"Find Tcp/Ip Protocol Entry \n\r")); break; } ProtocolCharBlock = ProtocolCharBlock->NextProtocol; } if(ProtocolCharBlock == NULL) { DebugPrint((2,"TCP/IP Protocol No register!\n\r")); return FALSE; } *ProtocolHandle = ProtocolCharBlock; return TRUE; } /*********************************************************/ /* 以上这段代码是用来获得tcp/ip协议的入口,再98下调试成功,不过在nt下却无法通过,现象是 用ProtocolCharBlock = ProtocolCharBlock->NextProtocol 来取下一个协议时总是为空,请教各位大吓 ???*/ /* 调用时如下: NDIS_STRING ProtoName = NDIS_STRING_CONST("MSTCP"); if(GetProtocolBlock(&status, &pProtocolCharBlock, &ProtoName) == TRUE) { ...... } [drvfan 编辑于 2001-09-21 09:14] |
|
沙发#
发布于:2001-09-21 09:57
nt4.0下的NDIS版本有可能是ndis4.0 和ndis4.1
所以Nextprotocol的偏移量就不同,ndis4.0下的偏移量是0x60 ndis4.1下的偏移量是0x8c 在NT下的TCPIP协议名应该就是tcpip而不是mstcp |
|
|
板凳#
发布于:2001-09-21 16:17
我已经修改了版本,还是不行!!!!
|
|
地板#
发布于:2001-09-21 16:21
请问在ndis4.1下,majorndisversion 和.MinorNdisVersion 应该如何填写:
ProtocolChar.MajorNdisVersion = 4 ?; ProtocolChar.MinorNdisVersion = 1 ?; 如果写4和1发现无法登记协议。 |
|