none
How to clone a NetBufferList? RRS feed

  • Question

  • Hi all,

    I coding for a filter driver. Here I am trying to clone NetBufferList. How can i achieve this?

    I am adding the code:

    PNET_BUFFER_LIST NetBufferListClone; NET_BUFFER_LIST_POOL_PARAMETERS Parameters; PNET_BUFFER_LIST_POOL_PARAMETERS parameters; NET_BUFFER_POOL_PARAMETERS NBParameters; PNET_BUFFER_POOL_PARAMETERS pNBParameters; NDIS_HANDLE NBLPoolHandle; NDIS_HANDLE NBPoolHandle;

    NdisZeroMemory( &Parameters, sizeof(NET_BUFFER_LIST_POOL_PARAMETERS)); parameters= &Parameters; parameters->Header.Type = NDIS_OBJECT_TYPE_DEFAULT; parameters->Header.Revision = NET_BUFFER_LIST_POOL_PARAMETERS_REVISION_1; parameters->Header.Size = NDIS_SIZEOF_NET_BUFFER_LIST_POOL_PARAMETERS_REVISION_1; parameters->ProtocolId = NDIS_PROTOCOL_ID_DEFAULT ; parameters->fAllocateNetBuffer = TRUE; parameters->ContextSize = 1000*MEMORY_ALLOCATION_ALIGNMENT; parameters->PoolTag = 'TEig'; parameters->DataSize = 2500; NdisZeroMemory( &NBParameters, sizeof(NET_BUFFER_POOL_PARAMETERS)); pNBParameters= & NBParameters; pNBParameters->Header.Type = NDIS_OBJECT_TYPE_DEFAULT; pNBParameters->Header.Revision = NET_BUFFER_LIST_POOL_PARAMETERS_REVISION_1; pNBParameters->Header.Size = NDIS_SIZEOF_NET_BUFFER_LIST_POOL_PARAMETERS_REVISION_1; pNBParameters->PoolTag = 'ETig'; pNBParameters->DataSize = 2500; NBLPoolHandle = NdisAllocateNetBufferListPool(FilterDriverHandle, parameters); if(NBLPoolHandle == NULL) { DbgPrint("Failed to allocate NetbufferLIST"); return; } else { DbgPrint("Allocation is success For NBL pool"); } NBPoolHandle = NdisAllocateNetBufferPool(FilterDriverHandle, pNBParameters ); if(NBPoolHandle == NULL) { DbgPrint("Failed to allocate NB Pool"); } else{ DbgPrint("Allocation is success for NB Pool"); } NetBufferListClone = NdisAllocateCloneNetBufferList(NetBufferLists, NBLPoolHandle, NBPoolHandle, NDIS_CLONE_FLAGS_USE_ORIGINAL_MDLS ); if(NetBufferListClone == NULL) { DbgPrint("Clone Failed"); } else { DbgPrint("Clone Success"); }

    Here cloning is failing. It is giving the print in Debug view as  " ndisAllocateNetbufferandnetbufferlist: pool 850A7480 wrong pool type". what is problem with my code.? how can i resolve this?

    thanks.


    • Edited by Sathish308 Friday, July 31, 2015 9:21 AM
    Friday, July 31, 2015 9:19 AM

Answers

  • It is failing because there isn't any data in the NBL being cloned

     -Brian


    Azius Developer Training www.azius.com Windows device driver, internals, security, & forensics training and consulting. Blog at www.azius.com/blog

    Friday, July 31, 2015 6:20 PM
    Moderator