Source code of Windows XP (NT5)
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.
 
 
 
 
 
 

92 lines
1.8 KiB

/*****************************************************************************/
/** Microsoft LAN Manager **/
/** Copyright (C) Microsoft Corp., 1992 **/
/*****************************************************************************/
//***
// File Name: debug.c
//
// Function: debug functions
//
// History:
//
// 05/21/92 Narendra Gidwani - Original Version 1.0
//***
#include <ctype.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include "afpsvcp.h"
#include "debug.h"
#ifdef DBG
VOID
AfpAssert(
IN PVOID FailedAssertion,
IN PVOID FileName,
IN ULONG LineNumber
)
{
BOOL ok;
CHAR choice[16];
DWORD bytes;
DWORD error;
AfpPrintf( "\nAssertion failed: %s\n at line %ld of %s\n",
FailedAssertion, LineNumber, FileName );
do {
AfpPrintf( "Break or Ignore [bi]? " );
bytes = sizeof(choice);
ok = ReadFile(
GetStdHandle(STD_INPUT_HANDLE),
&choice,
bytes,
&bytes,
NULL
);
if ( ok ) {
if ( toupper(choice[0]) == 'I' ) {
break;
}
if ( toupper(choice[0]) == 'B' ) {
DbgUserBreakPoint( );
}
} else {
error = GetLastError( );
}
} while ( TRUE );
return;
} // AfpAssert
VOID
AfpPrintf (
char *Format,
...
)
{
va_list arglist;
char OutputBuffer[1024];
ULONG length;
va_start( arglist, Format );
vsprintf( OutputBuffer, Format, arglist );
va_end( arglist );
length = strlen( OutputBuffer );
WriteFile( GetStdHandle(STD_OUTPUT_HANDLE), (LPVOID )OutputBuffer, length, &length, NULL );
} // AfpPrintf
#endif