阅读:1875回复:3
我的passthru成功执行DriverEntry()后 不调用PtBindAdapter()
我的passthru成功执行DriverEntry()后 不调用PtBindAdapter()
NTSTATUS DriverEntry( IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath ) /*++ Routine Description: Arguments: Return Value: --*/ { NDIS_STATUS Status; NDIS_PROTOCOL_CHARACTERISTICS PChars; NDIS_MINIPORT_CHARACTERISTICS MChars; PNDIS_CONFIGURATION_PARAMETER Param; NDIS_STRING Name; NDIS_HANDLE WrapperHandle; DbgBreakPoint();//放在需要调试的地方 DbgPrint("Driver Entry"); //return NDIS_STATUS_SUCCESS; //AfxMessageBox("fsfasfasdfasfasf"); // // Register the miniport with NDIS. Note that it is the miniport // which was started as a driver and not the protocol. Also the miniport // must be registered prior to the protocol since the protocol's BindAdapter // handler can be initiated anytime and when it is, it must be ready to // start driver instances. // NdisMInitializeWrapper(&WrapperHandle, DriverObject, RegistryPath, NULL); NdisZeroMemory(&MChars, sizeof(NDIS_MINIPORT_CHARACTERISTICS)); MChars.MajorNdisVersion = 4; MChars.MinorNdisVersion = 0; MChars.InitializeHandler = MPInitialize; MChars.QueryInformationHandler = MPQueryInformation; MChars.SetInformationHandler = MPSetInformation; MChars.ResetHandler = MPReset; MChars.TransferDataHandler = MPTransferData; MChars.HaltHandler = MPHalt; // // We will disable the check for hang timeout so we do not // need a check for hang handler! // MChars.CheckForHangHandler = NULL; MChars.SendHandler = MPSend; MChars.ReturnPacketHandler = MPReturnPacket; // // Either the Send or the SendPackets handler should be specified. // If SendPackets handler is specified, SendHandler is ignored // MChars.SendPacketsHandler = MPSendPackets; Status = NdisIMRegisterLayeredMiniport(WrapperHandle, &MChars, sizeof(MChars), &DriverHandle); ASSERT(Status == NDIS_STATUS_SUCCESS); NdisMRegisterUnloadHandler(WrapperHandle, PtUnload); // // Now register the protocol. // NdisZeroMemory(&PChars, sizeof(NDIS_PROTOCOL_CHARACTERISTICS)); PChars.MajorNdisVersion = 4; PChars.MinorNdisVersion = 0; // // Make sure the protocol-name matches the service-name under which this protocol is installed. // This is needed to ensure that NDIS can correctly determine the binding and call us to bind // to miniports below. // NdisInitUnicodeString(&Name, L"SFilter"); // Protocol name PChars.Name = Name; PChars.OpenAdapterCompleteHandler = PtOpenAdapterComplete; PChars.CloseAdapterCompleteHandler = PtCloseAdapterComplete; PChars.SendCompleteHandler = PtSendComplete; PChars.TransferDataCompleteHandler = PtTransferDataComplete; PChars.ResetCompleteHandler = PtResetComplete; PChars.RequestCompleteHandler = PtRequestComplete; PChars.ReceiveHandler = PtReceive; PChars.ReceiveCompleteHandler = PtReceiveComplete; PChars.StatusHandler = PtStatus; PChars.StatusCompleteHandler = PtStatusComplete; PChars.BindAdapterHandler = PtBindAdapter; PChars.UnbindAdapterHandler = PtUnbindAdapter; PChars.UnloadHandler = NULL; PChars.ReceivePacketHandler = PtReceivePacket; PChars.PnPEventHandler= PtPNPHandler; NdisRegisterProtocol(&Status, &ProtHandle, &PChars, sizeof(NDIS_PROTOCOL_CHARACTERISTICS)); ASSERT(Status == NDIS_STATUS_SUCCESS); NdisIMAssociateMiniport(DriverHandle, ProtHandle); /********Add By me******************/ if( MyInit(WrapperHandle) ) { return NDIS_STATUS_NOT_SUPPORTED; } /**************************************/ return(Status); } |
|
|
沙发#
发布于:2009-08-08 22:10
自己顶 苦等
|
|
板凳#
发布于:2009-08-18 20:00
是用inf安装成功了?
|
|
地板#
发布于:2009-08-23 22:33
我开始也安装不成功~~后来才发现,安装passthru要两个inf文件。
|
|