wangchengluck
驱动牛犊
驱动牛犊
  • 注册日期2009-07-26
  • 最后登录2009-09-24
  • 粉丝0
  • 关注0
  • 积分10分
  • 威望91点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
阅读:1875回复:3

我的passthru成功执行DriverEntry()后 不调用PtBindAdapter()

楼主#
更多 发布于:2009-08-08 10:23
我的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);
}

附件名称/大小 下载次数 最后更新
91630895.rar (582KB)  8 2009-08-08 10:23
wangchengluck
驱动牛犊
驱动牛犊
  • 注册日期2009-07-26
  • 最后登录2009-09-24
  • 粉丝0
  • 关注0
  • 积分10分
  • 威望91点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
沙发#
发布于:2009-08-08 22:10
自己顶   苦等
zhaock
驱动太牛
驱动太牛
  • 注册日期2002-01-26
  • 最后登录2018-06-02
  • 粉丝3
  • 关注2
  • 积分73328分
  • 威望362317点
  • 贡献值1点
  • 好评度226点
  • 原创分0分
  • 专家分0分
  • 社区居民
板凳#
发布于:2009-08-18 20:00
是用inf安装成功了?
bangzhu
驱动牛犊
驱动牛犊
  • 注册日期2009-03-01
  • 最后登录2009-11-09
  • 粉丝0
  • 关注0
  • 积分9分
  • 威望91点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
地板#
发布于:2009-08-23 22:33
我开始也安装不成功~~后来才发现,安装passthru要两个inf文件。
游客

返回顶部