www.pudn.com > IpFilter.rar > Debug.cpp
/////////////////////////////////////////////////////////////////////////////// // // (C) Copyright 1999 - 2000 Mark Roddy // All Rights Reserved // // Hollis Technology Solutions // 94 Dow Road // Hollis, NH 03049 // info@hollistech.com // // Synopsis: // // // Version Information: // // $Header: /iphook/sys/driver/Debug.cpp 4 4/23/00 5:10p Markr $ // /////////////////////////////////////////////////////////////////////////////// #include#include "stdio.h" #include "stddef.h" #include "htsglib.h" HTS_DEBUG_THIS_FILE ULONG HtsDebugLevel = HTS_DEBUG_LOW; #if DBG #define DEBUG_BUFFER_SIZE 256 void HtsDebugPrint( ULONG Level, PCHAR Format, ... ) { CHAR buffer[DEBUG_BUFFER_SIZE]; va_list args; va_start(args, Format); if ((Level & HTS_DEBUG_MASK) >= HtsDebugLevel) { _vsnprintf(buffer, DEBUG_BUFFER_SIZE, Format, args); DbgPrint(buffer); } va_end(args); } #else void HtsDebugPrint( ULONG Level, PCHAR Format, ... ) { } #endif ULONG HtsDriverId = 0; void HtsBugCheck(PCHAR message, ULONG param1, ULONG param2, ULONG param3, ULONG param4) { DbgPrint("\n\nKernel Failure: \"%s\" \n\n\n" "[ System Halting ]\n", message); KeBugCheckEx(BUGCODE_ID_DRIVER, param1, param2, param3, param4); } ULONG HtsExceptionFilter( ULONG Code, PEXCEPTION_POINTERS pointers) { PEXCEPTION_RECORD ExceptionRecord; PCONTEXT Context; ExceptionRecord = pointers->ExceptionRecord; Context = pointers->ContextRecord; #if DBG DbgPrint("*************** Exception Failure **************************\n"); DbgPrint("\n"); DbgPrint(" An unexpected exception occurred.\n"); DbgPrint(" Exception record at %x Context record at %x\n", ExceptionRecord, Context); DbgPrint(" WindBag: execute \"!cxr %x; !exr %x; !kb\" for stacktrace\n\n", Context, ExceptionRecord); DbgBreakPoint(); #endif return EXCEPTION_EXECUTE_HANDLER; } /////////////////////////////////////////////////////////////////////////////// // // Change History Log // // $Log: /iphook/sys/driver/Debug.cpp $ // // 4 4/23/00 5:10p Markr // // 3 1/27/00 10:35p Markr // Prepare to release! // ///////////////////////////////////////////////////////////////////////////////