none
how to set NdisSetNblFlag () and NET_BUFFER_LIST_INFO () in NDIS for windows 7 ? RRS feed

  • Question

  • i want to get 3g dongle NDIS type support for my application . I got information from microsoft but i tried that . I can't connect with NDIS type USB dongle bu i can connect RAS type modem . I am uisng windows 7 32 bit

    i change INF file like this :

    *************************************

    [MYDRIVE.ndi.AddReg]
    
    HKR, Ndi\Interfaces, UpperRange, , "noupper"
    HKR, Ndi\Interfaces, LowerRange, , "nolower"
    HKR, Ndi\Interfaces, FilterMediaTypes, , "nolower, ethernet, wan, ndis5, ppip"
    
    and in virtual INF file 
    
    [DRIVENET.ndi]
    
    Characteristics = 0x81 ; NCF_HAS_UI & NCF_VIRTUAL
    *IfType = IF_TYPE_ETHERNET_CSMACD,IF_TYPE_WWANPP
    *MediaType = NdisMedium802_3,NdisMediumWirelessWan
    *PhysicalMediaType = NdisPhysicalMedium802_3,NdisPhysicalMediumWirelessWan
    CopyFiles = MDVNET.CopyFiles
    AddReg = MDVNET.Reg

    *************************************

    in driver entry.cpp file

    **********************************

    NDIS_MEDIUM g_aMediumArray[] = {
    	NdisMedium802_3,
    	NdisMediumWan,
    	NdisMediumWirelessWan,
    };

    ******************************************

    In filter.cpp

    **************************************

    NDIS_STATUS CFilter::Attach(
    	IN NDIS_HANDLE NdisFilterHandle,
    	IN PNDIS_FILTER_ATTACH_PARAMETERS AttachParameters
    ) {
    
    if (
    		(AttachParameters->MiniportMediaType != NdisMedium802_3)
    		&& (AttachParameters->MiniportMediaType != NdisMediumWan)
    		&& (AttachParameters->MiniportMediaType != NdisMediumNative802_11)
    		&& (AttachParameters->MiniportMediaType != NdisMediumWirelessWan)
    	) {
    		status = NDIS_STATUS_INVALID_PARAMETER;
                    goto exit
              }
    
    if (AttachParameters->MiniportMediaType == NdisMediumWirelessWan) {
    
    		PnpDevice = true;
    
    	}
    }


    **********************************************

    for netbufferlist chnages :

    ***********************************

    send function :

    VOID CFilter::SendNetBufferLists( IN PNET_BUFFER_LIST NetBufferLists, IN NDIS_PORT_NUMBER PortNumber, IN ULONG SendFlags ) { while (pNetBufferList) { pNextNetBufferList = NET_BUFFER_LIST_NEXT_NBL(pNetBufferList); NET_BUFFER_LIST_NEXT_NBL(pNetBufferList) = NULL; PNET_BUFFER pNewNetBuffer = NET_BUFFER_LIST_FIRST_NB(pNewNetBufferList); NET_BUFFER_FIRST_MDL(pNewNetBuffer) = NET_BUFFER_FIRST_MDL(pNetBuffer); NET_BUFFER_DATA_LENGTH(pNewNetBuffer) = NET_BUFFER_DATA_LENGTH(pNetBuffer); NET_BUFFER_DATA_OFFSET(pNewNetBuffer) = NET_BUFFER_DATA_OFFSET(pNetBuffer); NET_BUFFER_CURRENT_MDL(pNewNetBuffer) = NET_BUFFER_CURRENT_MDL(pNetBuffer); NET_BUFFER_CURRENT_MDL_OFFSET(pNewNetBuffer) = NET_BUFFER_CURRENT_MDL_OFFSET(pNetBuffer); NDIS_SET_NET_BUFFER_LIST_CANCEL_ID(pNewNetBufferList, NDIS_GET_NET_BUFFER_LIST_CANCEL_ID(pNetBufferList)); NdisCopySendNetBufferListInfo(pNewNetBufferList, pNetBufferList); pNewNetBufferList->SourceHandle = m_hFilter; pNewNetBufferList->ParentNetBufferList = pNetBufferList; /****NdisSetNblFlag () and NET_BUFFER_LIST_INFO ()  /******

    if (PnpDevice == true ) { NdisSetNblFlag(pNewNetBufferList, NDIS_NBL_FLAGS_IS_IPV4); NET_BUFFER_LIST_INFO(pNewNetBufferList, NetBufferListFrameType) = (PVOID)(ULONG_PTR)RtlUshortByteSwap(0x0800); }

    receive function :

    VOID CFilter::ReceiveNetBufferLists( IN PNET_BUFFER_LIST NetBufferLists, IN NDIS_PORT_NUMBER PortNumber, IN ULONG /* NumberOfNetBufferLists */, IN ULONG ReceiveFlags) { while (pNetBufferList) { pNextNetBufferList = NET_BUFFER_LIST_NEXT_NBL(pNetBufferList); NET_BUFFER_LIST_NEXT_NBL(pNetBufferList) = NULL; PNET_BUFFER pNewNetBuffer = NET_BUFFER_LIST_FIRST_NB(pNewNetBufferList); NET_BUFFER_FIRST_MDL(pNewNetBuffer) = NET_BUFFER_FIRST_MDL(pNetBuffer); NET_BUFFER_DATA_LENGTH(pNewNetBuffer) = NET_BUFFER_DATA_LENGTH(pNetBuffer); NET_BUFFER_DATA_OFFSET(pNewNetBuffer) = NET_BUFFER_DATA_OFFSET(pNetBuffer); NET_BUFFER_CURRENT_MDL(pNewNetBuffer) = NET_BUFFER_CURRENT_MDL(pNetBuffer); NET_BUFFER_CURRENT_MDL_OFFSET(pNewNetBuffer) = NET_BUFFER_CURRENT_MDL_OFFSET(pNetBuffer); NDIS_SET_NET_BUFFER_LIST_CANCEL_ID(pNewNetBufferList, NDIS_GET_NET_BUFFER_LIST_CANCEL_ID(pNetBufferList)); NdisCopyReceiveNetBufferListInfo(pNewNetBufferList, pNetBufferList); if (ReceiveFlags & NDIS_RECEIVE_FLAGS_RESOURCES) { NdisFIndicateReceiveNetBufferLists(m_hFilter, pNewNetBufferList, PortNumber, 1, NDIS_RECEIVE_FLAGS_RESOURCES | (ReceiveFlags & ~NDIS_RECEIVE_FLAGS_DISPATCH_LEVEL)); NdisFreeNetBufferList(pNewNetBufferList); } else { pNewNetBufferList->SourceHandle = m_hFilter; pNewNetBufferList->ParentNetBufferList = pNetBufferList; /****NdisSetNblFlag () and NET_BUFFER_LIST_INFO ()  /******

    if (PnpDevice == true) { NdisSetNblFlag(pNewNetBufferList, NDIS_NBL_FLAGS_IS_IPV4); NET_BUFFER_LIST_INFO(pNewNetBufferList, NetBufferListFrameType) = (PVOID)(ULONG_PTR)RtlUshortByteSwap(0x0800); } }

    ********************************************************************

    Why can't i connect with NDIS type only? working with RAS type . and another issue is when i change the adapter properties to "TCP/IP4  -> obtain IP addres automatically and Obtain DNS server address automatically " , the adpter is enabled in my interface list . But i can't connect . in case of RAS , it will automatically detecting and connecting . What is the actual problem ? how i connect with NDIS type USB 3g Dongle . please help me 



    • Edited by vinay kp123 Tuesday, November 24, 2015 7:18 AM code
    Tuesday, November 24, 2015 7:01 AM

All replies

  • yes . With out our application ( Filter ) i can connect NDIS , RAS type and i can browse manually . But Using my application i can't connect when i put NDIS configuratin on dongle  but i can connect and detect when i put RAS .

    The actual thing i am doing is that , i have a application which shows all active adapters and using that adapter my application connect . 

      
    Wednesday, November 25, 2015 11:36 AM
  • So, is this correct: if your filter is installed, and "does nothing", the dongle in NDIS mode fails to connect to the carrier?

    ( or is it actually RNDIS? I've seen recently Chinese dongles in RNDIS mode) 

    -- pa

    Wednesday, November 25, 2015 1:02 PM
  • i can see like this

    it will works ine when i connect with RAS type . but my application can't connect with NDIS mode .

    Thursday, November 26, 2015 6:23 AM