⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 memory.h

📁 pppoe client
💻 H
字号:

//********************************************************************
//	日期:	2004/08/24 - 24:8:2004   18:14
//	名前:	tiamo
//	描述:	memory manager
//*********************************************************************

#pragma once

#ifdef DBG
	// memory block sig
	#define MEMORY_BLOCK_SIG					MAKE_SIG('M','B','H','D')

	// memory block header
	typedef struct __tagMemoryCookie
	{
		LIST_ENTRY								m_ltMemoryBlockAnchor;			// list anchor
		ULONG									m_ulMemorySig;					// our sig
		union
		{
			ULONG								m_ulFileName;					// file name
			UCHAR								m_ucFileName[4];
		};
		
		ULONG									m_ulLine;						// line
		ULONG									m_ulSize;						// size
		ULONG									m_ulSig;						// sig
	}MEMORY_BLOCK_HEADER,*PMEMORY_BLOCK_HEADER;

	// public routine
	extern "C"
	{
		// init memory system,IRQL <= DISPATCH_LEVEL
		VOID InitializeMemorySystem();

		// shut down memory system,IRQL <= DISPATCH_LEVEL
		VOID ShutdownMemorySystem();
	}

	// private routine
	extern "C"
	{
		// helper routine to allocate memory,IRQL <= DISPATCH_LEVEL
		NDIS_STATUS DebugAllocMemory(PVOID *pVirtualAddress,ULONG ulSize,ULONG ulSig,ULONG ulFile,ULONG ulLine);

		// free memory IRQL <= DISPATCH_LEVEL
		VOID DebugFreeMemory(PVOID pVirtualAddress,ULONG ulSize);
	
		// dump leak, IRQL <= DISPATCH_LEVEL
		VOID DumpLeak();
	}

	// memory block list head
	extern LIST_ENTRY g_ltMemoryBlocksHead;

	// memory lock
	extern NDIS_SPIN_LOCK g_lockMemory;

	#define AllocateMemory(out,size,sig)			DebugAllocMemory(out,size,sig,__ulFILE__,__LINE__)
	#define FreeMemory(p,size)						DebugFreeMemory(p,size)
#else
	#define AllocateMemory(out,size,sig)			NdisAllocateMemoryWithTag(out,size,sig)
	#define FreeMemory(p,size)						NdisFreeMemory(p,size,0)
#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -