设为首页 加入收藏

TOP

C++开发驱动中的重载问题
2013-04-10 11:39:01 来源: 作者: 【 】 浏览:186
Tags:开发 驱动 重载 问题

  template <POOL_TYPE PoolType> class CAllocator

  {

  public:

  void* operator new(unsigned int size)

  {

  return ExAllocatePoolWithTag(PoolType, size, OSNTAG);

  }

  void* operator new[](unsigned int size)

  {

  return ExAllocatePoolWithTag(PoolType, size, OSNTAG);

  }

  PVOID operator new (size_t Size, void *addr)

  {

  return addr;

  }

  VOID operator delete(PVOID pMemory)

  {

  if(pMemory!=NULL)

  ExFreePool(pMemory);

  }

  VOID operator delete[](PVOID pMemory)

  {

  if(pMemory!=NULL)

  ExFreePool(pMemory);

  }

  };

  typedef CAllocator<NonPagedPool> CNPAllocator;

  typedef CAllocator<PagedPool> CPAllocator;

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇通过变换A B得出xzy 的.. 下一篇c++与汇编混合编程

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: