Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results
The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.
Check out The OSR Learning Library at: https://www.osr.com/osr-learning-library/
Hi all.
Tell me please.
When I compose the MDL for NB, what should be the MdlFlags parameter of the MDL structure.
When I watch outgoing packets, the value of MdlFlag changes
4100 - 0001 0000 0000 0100
16412 - 0100 0000 0001 1100
12 - 0000 0000 0000 1100
when i allocate mdl to connect to NB using NdisAllocateMdl, MdlFlag is 12 (MDL_ALLOCATED_FIXID_SIZE | MDL_SOURCE_IS_NONPAGED_POOL)
Do I need to change this value and how?
Where can i find a read about it?
If I will not change the MdlFlags of the newly allocated MDLs, could this be causing network connections to not work properly?
Upcoming OSR Seminars | ||
---|---|---|
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead! | ||
Kernel Debugging | 13-17 May 2024 | Live, Online |
Developing Minifilters | 1-5 Apr 2024 | Live, Online |
Internals & Software Drivers | 11-15 Mar 2024 | Live, Online |
Writing WDF Drivers | 26 Feb - 1 Mar 2024 | Live, Online |
Comments
How to attach mdl to NB? Is this code is right?
VOID FilterSendNetBufferLists(NDIS_HANDLE FilterModuleContext, PNET_BUFFER_LIST NetBufferLists, NDIS_PORT_NUMBER PortNumber, ULONG SendFlags)
{
NET_BUFFER_LIST_NEXT_NBL(pNBL) = NULL;
PNET_BUFFER_LIST cloneNBL = NdisAllocateCloneNetBufferList(pNBL, NULL, NULL, NDIS_CLONE_FLAGS_USE_ORIGINAL_MDLS);//osr how_to_send_cloned_nbl
NET_BUFFER_LIST_NEXT_NBL(pNBL) = pTemp;
cloneNBL->SourceHandle = pFilter->FilterHandle;
for (int i = 0; i < MaxNetBufferListInfo; i++) NET_BUFFER_LIST_INFO(cloneNBL, i) = NET_BUFFER_LIST_INFO(pNBL, i); // I dont know why
}
NTSTATUS NdisEncryptDeviceIoControl(PDEVICE_OBJECT DeviceObject, PIRP Irp)
{
for (all NBs in NBL) {
PUCHAR pBuffer = NdisAllocateMemoryWithTagPriority(pFilter->FilterHandle, IrpSp->Parameters.DeviceIoControl.InputBufferLength - 1, FILTER_ALLOC_TAG, NormalPoolPriority);
RtlCopyMemory(pBuffer, (PUCHAR)Irp->AssociatedIrp.SystemBuffer + 1, IrpSp->Parameters.DeviceIoControl.InputBufferLength - 1);
PMDL pMdl = NdisAllocateMdl(pFilter->FilterHandle, pBuffer, IrpSp->Parameters.DeviceIoControl.InputBufferLength - 1);
pNB->MdlChain = pMdl;
pNB->DataLength = IrpSp->Parameters.DeviceIoControl.InputBufferLength - 1;
pNB->DataOffset = 0;
pNB->CurrentMdl = pMdl;
pNB->CurrentMdlOffset = pMdl->ByteOffset;
}
pNBL->Status = NDIS_STATUS_SUCCESS;
NdisFSendNetBufferLists(pFilter->FilterHandle, pNBL, NDIS_DEFAULT_PORT_NUMBER, 1);
}