www.pudn.com > IpFilter.rar > cppAlloc.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 
// 
///////////////////////////////////////////////////////////////////////////////