none
NDIS 6.0 Filter NetBufferList Clone RRS feed

  • 问题

  •        I want to clone NBLs in context of send routine, send cloned NBLs to lower driver, free cloned NBLs and complete original NBLs in context of send complete,

    in window7 virtual machine , ICMP packets is OK, but IE can not open web page, I debug all send NBLs, all successed, please help me

    VOID FilterSend(NDIS_HANDLE Context, PNET_BUFFER_LIST Buffers, NDIS_PORT_NUMBER Port, ULONG Flags) { NDIS_HANDLE Handle = NULL; PNET_BUFFER_LIST Current = Buffers; PNET_BUFFER_LIST Next = NULL; PMODULE Module = (PMODULE)Context; KdPrint(("FilterSend.\n")); GetModuleHandle(Module, &Handle); do { PNET_BUFFER_LIST Clone = NULL; Next = NET_BUFFER_LIST_NEXT_NBL(Current); NET_BUFFER_LIST_NEXT_NBL(Current) = NULL; Clone = NdisAllocateCloneNetBufferList(Current, Filter.Buffers, Filter.Buffer, NDIS_CLONE_FLAGS_USE_ORIGINAL_MDLS); if (NULL != Clone) { Clone->ParentNetBufferList = Current; /*Clone->Context = Current->Context;*/ if (NULL != Current->Context) { Clone->Context = Current->Context; KdPrint(("Context is not NULL.\n")); } NdisFSendNetBufferLists(Handle, Clone, Port, Flags); } else { KdPrint(("NdisAllocateCloneNetBufferList.\n")); }

      Current = Next;
    }
    while (NULL != Current);
    }

    VOID FilterSendComplete(NDIS_HANDLE Context, PNET_BUFFER_LIST Buffers, ULONG Flags)
    {
    	NDIS_HANDLE Handle = NULL;
    
    	PNET_BUFFER_LIST Current = Buffers;
    	PNET_BUFFER_LIST Next = NULL;
    
    	PMODULE Module = (PMODULE)Context;
    
    	KdPrint(("FilterSendComplete.\n"));
    
    	GetModuleHandle(Module, &Handle);
    
    	do 
    	{
    		Next = NET_BUFFER_LIST_NEXT_NBL(Current);
    		NET_BUFFER_LIST_NEXT_NBL(Current) = NULL;
    
    		if (NULL != Current->ParentNetBufferList)
    		{
    			PNET_BUFFER_LIST Original = Current->ParentNetBufferList;
    			
    			NET_BUFFER_LIST_STATUS(Original) = NET_BUFFER_LIST_STATUS(Current);
    			if (NDIS_STATUS_SUCCESS != NET_BUFFER_LIST_STATUS(Original))
    			{
    				KdPrint(("Send packet failed.\n"));
    			}
    
    			Current->ParentNetBufferList = NULL;
    			NdisFreeCloneNetBufferList(Current, NDIS_CLONE_FLAGS_USE_ORIGINAL_MDLS);
    
    			NdisFSendNetBufferListsComplete(Handle, Original, Flags);
    		}
    		else 
    		{
    			NdisFSendNetBufferListsComplete(Handle, Current, Flags);
    		}
    
    		Current = Next;
    	}
    	while (NULL != Current);
    }

    
    
     
    • 已编辑 qstesiro 2012年9月18日 14:04
    2012年9月18日 14:03

全部回复