Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

50 lines
1.3 KiB

#include "rgb_pch.h"
#pragma hdrstop
namespace RGB_RAST_LIB_NAMESPACE
{
#if DBG
bool Assert(LPCSTR szFile, int nLine, LPCSTR szCondition)
{
typedef BOOL (*PFNBV)(VOID);
static bool bInit( false);
static PFNBV pIsDebuggerPresent= NULL;
LONG err;
char str[256];
// Initialize stuff
if(!bInit)
{
HINSTANCE hinst;
bInit= true;
// Get IsDebuggerPresent entry point
if((hinst = (HINSTANCE) GetModuleHandle("kernel32.dll")) ||
(hinst = (HINSTANCE) LoadLibrary("kernel32.dll")))
{
pIsDebuggerPresent = (PFNBV) GetProcAddress(hinst, "IsDebuggerPresent");
}
}
// Display a message box if no debugger is present
if(pIsDebuggerPresent && !pIsDebuggerPresent())
{
_snprintf(str, sizeof(str), "File:\t %s\nLine:\t %d\nAssertion:\t%s\n\nDo you want to invoke the debugger?", szFile, nLine, szCondition);
err = MessageBox(NULL, str, "RGBRast Assertion Failure", MB_SYSTEMMODAL | MB_YESNOCANCEL);
switch(err)
{
case IDYES: return true;
case IDNO: return false;
case IDCANCEL: FatalAppExit(0, "RGBRast Assertion Failure.. Application terminated"); return true;
}
}
return true;
}
#endif // DBG
}