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