-/* $Id$
+/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: drivers/net/afd/afd/lock.c
* UPDATE HISTORY:
* 20040708 Created
*/
+
#include "afd.h"
PVOID GetLockedData(PIRP Irp, PIO_STACK_LOCATION IrpSp)
ASSERT(Irp->MdlAddress);
ASSERT(Irp->Tail.Overlay.DriverContext[0]);
+ UNREFERENCED_PARAMETER(IrpSp);
+
return Irp->Tail.Overlay.DriverContext[0];
}
}
/* The allocated address goes in index 0 */
- Irp->Tail.Overlay.DriverContext[0] = ExAllocatePool(NonPagedPool, MmGetMdlByteCount(Irp->MdlAddress));
+ Irp->Tail.Overlay.DriverContext[0] = ExAllocatePoolWithTag(NonPagedPool,
+ MmGetMdlByteCount(Irp->MdlAddress),
+ TAG_AFD_DATA_BUFFER);
+
if (!Irp->Tail.Overlay.DriverContext[0])
{
AFD_DbgPrint(MIN_TRACE,("Failed to allocate memory\n"));
}
/* We need to create the info struct that AFD expects for all send/recv requests */
- AfdInfo = ExAllocatePool(NonPagedPool, sizeof(AFD_RECV_INFO) + sizeof(AFD_WSABUF));
+ AfdInfo = ExAllocatePoolWithTag(NonPagedPool,
+ sizeof(AFD_RECV_INFO) + sizeof(AFD_WSABUF),
+ TAG_AFD_DATA_BUFFER);
+
if (!AfdInfo)
{
AFD_DbgPrint(MIN_TRACE,("Failed to allocate memory\n"));
ASSERT(Irp->MdlAddress);
ASSERT(Irp->Tail.Overlay.DriverContext[0]);
+ UNREFERENCED_PARAMETER(IrpSp);
+
/* Check if we need to copy stuff back */
if (Irp->Tail.Overlay.DriverContext[1] != NULL)
{
MmGetMdlByteCount(Irp->MdlAddress));
}
- ExFreePool(Irp->Tail.Overlay.DriverContext[0]);
+ ExFreePoolWithTag(Irp->Tail.Overlay.DriverContext[0], TAG_AFD_DATA_BUFFER);
MmUnlockPages( Irp->MdlAddress );
IoFreeMdl( Irp->MdlAddress );
Irp->MdlAddress = NULL;
/* Copy the buffer array so we don't lose it */
UINT Lock = LockAddress ? 2 : 0;
UINT Size = (sizeof(AFD_WSABUF) + sizeof(AFD_MAPBUF)) * (Count + Lock);
- PAFD_WSABUF NewBuf = ExAllocatePool( PagedPool, Size );
+ PAFD_WSABUF NewBuf = ExAllocatePoolWithTag(PagedPool, Size, TAG_AFD_WSA_BUFFER);
BOOLEAN LockFailed = FALSE;
PAFD_MAPBUF MapBuf;
- AFD_DbgPrint(MID_TRACE,("Called(%08x)\n", NewBuf));
+ AFD_DbgPrint(MID_TRACE,("Called(%p)\n", NewBuf));
if( NewBuf ) {
RtlZeroMemory(NewBuf, Size);
}
} _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) {
AFD_DbgPrint(MIN_TRACE,("Access violation copying buffer info "
- "from userland (%x %x)\n",
+ "from userland (%p %p)\n",
Buf, AddressLen));
- ExFreePool( NewBuf );
+ ExFreePoolWithTag(NewBuf, TAG_AFD_WSA_BUFFER);
_SEH2_YIELD(return NULL);
} _SEH2_END;
for( i = 0; i < Count; i++ ) {
- AFD_DbgPrint(MID_TRACE,("Locking buffer %d (%x:%d)\n",
+ AFD_DbgPrint(MID_TRACE,("Locking buffer %u (%p:%u)\n",
i, NewBuf[i].buf, NewBuf[i].len));
if( NewBuf[i].buf && NewBuf[i].len ) {
continue;
}
- AFD_DbgPrint(MID_TRACE,("NewMdl @ %x\n", MapBuf[i].Mdl));
+ AFD_DbgPrint(MID_TRACE,("NewMdl @ %p\n", MapBuf[i].Mdl));
if( MapBuf[i].Mdl ) {
AFD_DbgPrint(MID_TRACE,("Probe and lock pages\n"));
AFD_DbgPrint(MIN_TRACE,("Failed to lock pages\n"));
IoFreeMdl( MapBuf[i].Mdl );
MapBuf[i].Mdl = NULL;
- ExFreePool( NewBuf );
+ ExFreePoolWithTag(NewBuf, TAG_AFD_WSA_BUFFER);
return NULL;
}
} else {
- ExFreePool( NewBuf );
+ ExFreePoolWithTag(NewBuf, TAG_AFD_WSA_BUFFER);
return NULL;
}
}
}
- AFD_DbgPrint(MID_TRACE,("Leaving %x\n", NewBuf));
+ AFD_DbgPrint(MID_TRACE,("Leaving %p\n", NewBuf));
return NewBuf;
}
}
}
- ExFreePool( Buf );
+ ExFreePoolWithTag(Buf, TAG_AFD_WSA_BUFFER);
Buf = NULL;
}
UINT i;
NTSTATUS Status = STATUS_SUCCESS;
- PAFD_HANDLE FileObjects = ExAllocatePool
- ( NonPagedPool, HandleCount * sizeof(AFD_HANDLE) );
+ PAFD_HANDLE FileObjects = ExAllocatePoolWithTag(NonPagedPool,
+ HandleCount * sizeof(AFD_HANDLE),
+ TAG_AFD_POLL_HANDLE);
for( i = 0; FileObjects && i < HandleCount; i++ ) {
FileObjects[i].Status = 0;
ObDereferenceObject( (PVOID)HandleArray[i].Handle );
}
- ExFreePool( HandleArray );
+ ExFreePoolWithTag(HandleArray, TAG_AFD_POLL_HANDLE);
HandleArray = NULL;
}