ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

memory.c
Go to the documentation of this file.
00001 /*
00002  * COPYRIGHT:   See COPYING in the top level directory
00003  * PROJECT:     ReactOS DNS Shared Library
00004  * FILE:        lib/dnslib/memory.c
00005  * PURPOSE:     DNS Memory Manager Implementation and Heap.
00006  */
00007 
00008 /* INCLUDES ******************************************************************/
00009 #include "precomp.h"
00010 
00011 /* DATA **********************************************************************/
00012 
00013 typedef PVOID
00014 (WINAPI *PDNS_ALLOC_FUNCTION)(IN SIZE_T Size);
00015 typedef VOID
00016 (WINAPI *PDNS_FREE_FUNCTION)(IN PVOID Buffer);
00017 
00018 PDNS_ALLOC_FUNCTION pDnsAllocFunction;
00019 PDNS_FREE_FUNCTION pDnsFreeFunction;
00020 
00021 /* FUNCTIONS *****************************************************************/
00022 
00023 VOID
00024 WINAPI
00025 Dns_Free(IN PVOID Address)
00026 {
00027     /* Check if whoever imported us specified a special free function */
00028     if (pDnsFreeFunction)
00029     {
00030         /* Use it */
00031         pDnsFreeFunction(Address);
00032     }
00033     else
00034     {
00035         /* Use our own */
00036         LocalFree(Address);
00037     }
00038 }
00039 
00040 PVOID
00041 WINAPI
00042 Dns_AllocZero(IN SIZE_T Size)
00043 {
00044     PVOID Buffer;
00045 
00046     /* Check if whoever imported us specified a special allocation function */
00047     if (pDnsAllocFunction)
00048     {
00049         /* Use it to allocate the memory */
00050         Buffer = pDnsAllocFunction(Size);
00051         if (Buffer)
00052         {
00053             /* Zero it out */
00054             RtlZeroMemory(Buffer, Size);
00055         }
00056     }
00057     else
00058     {
00059         /* Use our default */
00060         Buffer = LocalAlloc(LMEM_ZEROINIT, Size);
00061     }
00062 
00063     /* Return the allocate pointer */
00064     return Buffer;
00065 }
00066 

Generated on Sun May 27 2012 04:18:13 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.