hoarddetours.cpp File Reference

Hooks to Hoard for Detours. More...

#include "VERSION.h"
#include <windows.h>
#include <stdio.h>
#include <malloc.h>
#include "detours.h"
#include "cpuinfo.h"
#include "hldefines.h"
#include "check.h"
#include "fixedrequestheap.h"
#include "hoardmanager.h"
#include "addheaderheap.h"
#include "threadpoolheap.h"
#include "redirectfree.h"
#include "ignoreinvalidfree.h"
#include "conformantheap.h"
#include "hoardsuperblock.h"
#include "lockmallocheap.h"
#include "alignedsuperblockheap.h"
#include "alignedmmap.h"
#include "globalheap.h"
#include "ansiwrapper.h"
#include "debugheap.h"
#include "lockedheap.h"
#include "winlock.h"
#include "bins4k.h"
#include "bins8k.h"
#include "bins16k.h"
#include "bins64k.h"
#include "oneheap.h"
#include "freelistheap.h"
#include "threadheap.h"
#include "hybridheap.h"
#include "posixlock.h"
#include "spinlock.h"
#include "wrapper.cpp"

Classes

class  TheCustomHeapType

Defines

#define CUSTOM_PREFIX(n)   hoard##n
#define WIN32_LEAN_AND_MEAN
#define _WIN32_WINNT   0x0500
#define NT
#define REPLACE(module, x, fn)
#define REMOVE(module, x, fn)

Typedefs

typedef void(* exitFunctionType )(void)

Functions

static TheCustomHeapTypegetCustomHeap (void)
 DETOUR_TRAMPOLINE (void __cdecl real_onexit(void(*f)(void)), onexit)
 DETOUR_TRAMPOLINE (void __cdecl real_exit(int code), exit)
 DETOUR_TRAMPOLINE (void *__cdecl real_malloc(size_t sz), malloc)
 DETOUR_TRAMPOLINE (void *__cdecl real_realloc(void *ptr, size_t sz), realloc)
 DETOUR_TRAMPOLINE (void *__cdecl real_calloc(size_t sz, size_t n), calloc)
 DETOUR_TRAMPOLINE (void *__cdecl real_free(void *ptr), free)
 DETOUR_TRAMPOLINE (size_t __cdecl real_msize(void *ptr), _msize)
 DETOUR_TRAMPOLINE (void *__cdecl real_expand(void *memblock, size_t size), _expand)
 DETOUR_TRAMPOLINE (char *__cdecl real_strdup(const char *s), strdup)
void my_onexit (void(*function)(void))
void my_exit (int code)
void my_cexit (void)
void * my_expand (void *memblock, size_t size)
void trampolineInstall (HMODULE hModule, bool insert)
void trampolineWith (HMODULE hModule)
static void initializeMaps (void)
static void findUnusedHeap (void)
static void releaseHeap (void)
BOOL APIENTRY DllMain (HINSTANCE hModule, DWORD dwReason, PVOID lpReserved)

Variables

volatile int anyThreadCreated = 0
const int MaxThreads = 512
const int NumHeaps = 64
static void * objectAllocated = (void *) 0x1
static const int HOARD_MAX_EXIT_FUNCTIONS = 512
static int exitCount = 0
exitFunctionType exitFunctionBuffer [HOARD_MAX_EXIT_FUNCTIONS]

Detailed Description

Hooks to Hoard for Detours.

Author:
Emery Berger <http://www.cs.umass.edu/~emery>

Define Documentation

#define _WIN32_WINNT   0x0500
#define CUSTOM_PREFIX (  )     hoard##n
#define NT
#define REMOVE ( module,
x,
fn   ) 
Value:
{ \
  PBYTE p; \
  p = DetourFindFunction ((module), (x)); \
  if (p) { \
    DetourRemove (p, (PBYTE) (fn));  \
  } \
}
#define REPLACE ( module,
x,
fn   ) 
Value:
{ \
  PBYTE p; \
  p = DetourFindFunction ((module), (x)); \
  if (p) { \
    DetourFunction (p, (PBYTE) (fn));  \
  } \
}
#define WIN32_LEAN_AND_MEAN

Typedef Documentation

typedef void(* exitFunctionType)(void)

Function Documentation

DETOUR_TRAMPOLINE ( char *__cdecl   real_strdupconst char *s,
strdup   
)
DETOUR_TRAMPOLINE ( void *__cdecl   real_expandvoid *memblock, size_t size,
_expand   
)
DETOUR_TRAMPOLINE ( size_t __cdecl   real_msizevoid *ptr,
_msize   
)
DETOUR_TRAMPOLINE ( void *__cdecl   real_freevoid *ptr,
free   
)
DETOUR_TRAMPOLINE ( void *__cdecl   real_callocsize_t sz, size_t n,
calloc   
)
DETOUR_TRAMPOLINE ( void *__cdecl   real_reallocvoid *ptr, size_t sz,
realloc   
)
DETOUR_TRAMPOLINE ( void *__cdecl   real_mallocsize_t sz,
malloc   
)
DETOUR_TRAMPOLINE ( void __cdecl   real_exitint code,
exit   
)
DETOUR_TRAMPOLINE ( void __cdecl   real_onexitvoid(*f)(void),
onexit   
)
BOOL APIENTRY DllMain ( HINSTANCE  hModule,
DWORD  dwReason,
PVOID  lpReserved 
)
static void findUnusedHeap ( void   )  [static]
static TheCustomHeapType* getCustomHeap ( void   )  [inline, static]
static void initializeMaps ( void   )  [static]
void my_cexit ( void   ) 
void my_exit ( int  code  ) 
void* my_expand ( void *  memblock,
size_t  size 
)
void my_onexit ( void(*)(void)  function  ) 
static void releaseHeap ( void   )  [static]
void trampolineInstall ( HMODULE  hModule,
bool  insert 
)
void trampolineWith ( HMODULE  hModule  ) 

Variable Documentation

volatile int anyThreadCreated = 0
int exitCount = 0 [static]
const int HOARD_MAX_EXIT_FUNCTIONS = 512 [static]
const int MaxThreads = 512
const int NumHeaps = 64
void* objectAllocated = (void *) 0x1 [static]
Generated on Tue Aug 2 11:51:26 2011 for Galois by  doxygen 1.6.3