Listing 1: Redefining Win32 APIs

#ifndef HTRACKER_H
#define HTRACKER_H

#ifdef _DEBUG

#include <windows.h>

// ******************
// Macro definitions:
// ******************

// Prevent warning 
// about redefinition:             
#undef CreateMutex

define \
CreateMutex(lpsa,owned,name) \
    DEBUG_CREATE_MUTEX \
    (__FILE__,__LINE__, \
     lpsa,owned,name)

#define CloseHandle(handle) \
      DEBUG_CLOSE_HANDLE \
      (__FILE__,__LINE__,handle)

// ********************
// Function prototypes:
// ********************

HANDLE DEBUG_CREATE_MUTEX
    (LPCTSTR szFile, 
     int nLine,
     LPSECURITY_ATTRIBUTES lpsa,
     BOOL bInitiallyOwned,
     LPCTSTR szMutexName);

BOOL DEBUG_CLOSE_HANDLE
    (LPCTSTR szFile,
     int nLine,
     HANDLE handle);

#endif // _DEBUG
#endif // HTRACKER_H

/* End of File */