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

📄 cppalloc.cpp

📁 WMD驱动编程,本人收集整理的10多个例子和编程环境配置文档,特别是8139驱动,加了许多说明,并测试通过.
💻 CPP
字号:
///////////////////////////////////////////////////////////////////////////////
// Copyright (C) 1999 - 2000 Mark Roddy
//
//	Hollis Technology Solutions
//	94 Dow Road
//	Hollis, NH 03049
//	info@hollistech.com
//	www.hollistech.com
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
//
// www.fsf.org
//
//
//	Synopsis: 
// 
//
//	Version Information:
//
//	$Header: /cpprun/sys/cpplib/cppAlloc.cpp 2     1/01/00 11:00p Markr $ 
//
///////////////////////////////////////////////////////////////////////////////
#define HTS_UNIQUE_FILE_ID 0x1204000

#include "hstcpp_internal.h"


PVOID __cdecl malloc(ULONG x,  ULONG id, POOL_TYPE pool)
{
    PVOID buffer = ExAllocatePoolWithTag(pool, x, id);

    if (buffer) {
        //
        // clear our buffer to zero
        //
        RtlZeroMemory(buffer, x);
    }

    return buffer;
}


void __cdecl free(PVOID x)
{
    if (x != NULL) {

        ExFreePool(x);
    }
}


void * __cdecl operator new(size_t size)
{
    return malloc(size, 'ppcO', NonPagedPool);
}


void * __cdecl operator new(size_t size,  void *location)
{
    return location;
}

void *__cdecl operator new( size_t size, ULONG tag, POOL_TYPE pool)
{
    return malloc(size, tag, pool);
}

void __cdecl operator delete(void * pVoid)
{
    free(pVoid);
}

///////////////////////////////////////////////////////////////////////////////
// 
// Change History Log
//
// $Log: /cpprun/sys/cpplib/cppAlloc.cpp $
// 
// 2     1/01/00 11:00p Markr
// 
// 1     12/16/99 11:45p Markr
//
///////////////////////////////////////////////////////////////////////////////

⌨️ 快捷键说明

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