windows-nt/Source/XPSP1/NT/net/sfm/afp/service/server/debug.c
2020-09-26 16:20:57 +08:00

92 lines
1.8 KiB
C
Raw 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.

/*****************************************************************************/
/** 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