WindowsXP-SP1/enduser/stuff/hhctrl/debug.h
2020-09-30 16:53:49 +02:00

68 lines
2.1 KiB
C
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//=--------------------------------------------------------------------------=
// Debug.H
//=--------------------------------------------------------------------------=
// Copyright 1995-1997 Microsoft Corporation. All Rights Reserved.
//
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
// PARTICULAR PURPOSE.
//=--------------------------------------------------------------------------=
//
// contains the various macros and the like which are only useful in DEBUG
// builds
//
#ifndef _DEBUG_H_
//=---------------------------------------------------------------------------=
// all the things required to handle our ASSERT mechanism
//=---------------------------------------------------------------------------=
//
#if DEBUG
// Function Prototypes
//
VOID DisplayAssert(LPSTR pszMsg, LPSTR pszAssert, LPSTR pszFile, UINT line);
// Macros
//
// *** Include this macro at the top of any source file using *ASSERT*() macros ***
//
#define SZTHISFILE static char _szThisFile[] = __FILE__;
// our versions of the ASSERT and FAIL macros.
//
#define ASSERT(fTest, szMsg) \
if (!(fTest)) { \
static char szMsgCode[] = szMsg; \
static char szAssert[] = #fTest; \
DisplayAssert(szMsgCode, szAssert, _szThisFile, __LINE__); \
}
#define FAIL(szMsg) \
{ static char szMsgCode[] = szMsg; \
DisplayAssert(szMsgCode, "FAIL", _szThisFile, __LINE__); }
// macro that checks a pointer for validity on input
//
#define CHECK_POINTER(val) if (!(val) || IsBadWritePtr((void *)(val), sizeof(void *))) return E_POINTER
#else // DEBUG
#define SZTHISFILE
#define ASSERT(fTest, err)
#define FAIL(err)
#define CHECK_POINTER(val)
#endif // DEBUG
#define _DEBUG_H_
#endif // _DEBUG_H_