7 #define FOURCC(a,b,c,d) (((a)<<24)|((b)<<16)|((c)<<8)|(d))
10 #define FBSD_MALLOC FOURCC('d','s','b','f')
11 #define EXALLOC_TAG FOURCC('E','x','A','l')
12 #define IRP_TAG FOURCC('P','I','R','P')
13 #define NPLOOK_TAG FOURCC('N','P','L','A')
15 #define AllocatePacketWithBuffer(x,y,z) AllocatePacketWithBufferX(x,y,z,__FILE__,__LINE__)
16 #define FreeNdisPacket(x) FreeNdisPacketX(x,__FILE__,__LINE__)
19 #define MTMARK() TrackDumpFL(__FILE__, __LINE__)
20 #define exAllocatePool(x,y) ExAllocatePoolX(x,y,__FILE__,__LINE__)
21 #define exAllocatePoolWithTag(x,y,z) ExAllocatePoolX(x,y,__FILE__,__LINE__)
22 #define exFreePool(x) ExFreePoolX(x,__FILE__,__LINE__)
23 #define exAllocateFromNPagedLookasideList(x) ExAllocateFromNPagedLookasideListX(x,__FILE__,__LINE__)
24 #define exFreeToNPagedLookasideList(x,y) ExFreeToNPagedLookasideListX(x,y,__FILE__,__LINE__)
26 typedef struct _ALLOCATION_TRACKER
{
32 } ALLOCATION_TRACKER
, *PALLOCATION_TRACKER
;
35 VOID
TrackWithTag( ULONG Tag
, PVOID Thing
, PCHAR File
, ULONG Line
);
36 #define Track(Tag,Thing) TrackWithTag(Tag,Thing,__FILE__,__LINE__)
37 VOID
UntrackFL( PCHAR File
, ULONG Line
, PVOID Thing
, ULONG Tag
);
38 #define Untrack(Thing) UntrackFL(__FILE__,__LINE__,Thing)
39 VOID
TrackDumpFL( PCHAR File
, ULONG Line
);
40 #define TrackDump() TrackDumpFL(__FILE__,__LINE__)
42 static __inline PVOID
ExAllocateFromNPagedLookasideListX( PNPAGED_LOOKASIDE_LIST List
, PCHAR File
, ULONG Line
) {
43 PVOID Out
= ExAllocateFromNPagedLookasideList( List
);
44 if( Out
) TrackWithTag( NPLOOK_TAG
, Out
, File
, Line
);
48 static __inline VOID
ExFreeToNPagedLookasideListX( PNPAGED_LOOKASIDE_LIST List
, PVOID Thing
, PCHAR File
, ULONG Line
) {
49 UntrackFL(File
, Line
, Thing
, NPLOOK_TAG
);
50 ExFreeToNPagedLookasideList( List
, Thing
);
53 static __inline PVOID
ExAllocatePoolX( POOL_TYPE type
, SIZE_T size
, PCHAR File
, ULONG Line
) {
54 PVOID Out
= ExAllocatePool( type
, size
);
55 if( Out
) TrackWithTag( EXALLOC_TAG
, Out
, File
, Line
);
59 static __inline VOID
ExFreePoolX( PVOID Data
, PCHAR File
, ULONG Line
) {
60 UntrackFL(File
, Line
, Data
, EXALLOC_TAG
);
67 #define TrackingInit()
70 #define exAllocatePoolWithTag(x,y,z) ExAllocatePoolWithTag(x,y,z)
71 #define exAllocatePool(x,y) ExAllocatePool(x,y)
72 #define exFreePool(x) ExFreePool(x)
73 #define exAllocateFromNPagedLookasideList(x) ExAllocateFromNPagedLookasideList(x)
74 #define exFreeToNPagedLookasideList(x,y) ExFreeToNPagedLookasideList(x,y)
75 #define TrackWithTag(w,x,y,z)
76 #define UntrackFL(w,x,y,z)