📄 divbyzerofault.c
字号:
/****************************************************************************** * * Copyright (c) 2003 Gerhard W. Gruber * * PROJECT: pICE * $Source: /cvsroot/pice/pice/module/divbyzerofault.c,v $ * $Revision: 1.3 $ * $Date: 2004/02/17 23:07:36 $ * $Author: lightweave $ * $Name: $ * * $Log: divbyzerofault.c,v $ * Revision 1.3 2004/02/17 23:07:36 lightweave * * Improved the DEBUG facillity and replaced the configuration handler with a * new code which now can read MS Windows INI style files. See CHANGES.txt for * more details. * Also added a macro which prevents compiling for kernels before 2.4.19. * * Revision 1.2 2003/06/18 22:00:22 lightweave * DEBUG and DEBUG_SERIAL added * * *****************************************************************************/static char *ident = "$Header: /cvsroot/pice/pice/module/divbyzerofault.c,v 1.3 2004/02/17 23:07:36 lightweave Exp $";/*++Copyright (c) 1998-2001 Klaus P. GerlicherModule Name: divbyzerofault.cAbstract: handle divide by zero on x86Environment: Kernel mode onlyAuthor: Klaus P. GerlicherRevision History: 07-Mar-2001: createdCopyright notice: This file may be distributed under the terms of the GNU Public License.--*/////////////////////////////////////////////////////// INCLUDES////#include "remods.h"#include "precomp.h"////////////////////////////////////////////////////// DEFINES////#define DIVIDE_BY_ZERO_VECTOR (0x00)////////////////////////////////////////////////////// GLOBALS////ULONG OldDivideByZeroHandler = 0;////////////////////////////////////////////////////// FUNCTIONS//////************************************************************************* // HandleDivideByZeroFault() // //************************************************************************* void HandleDivideByZeroFault(EXCEPTION_FRAME* pFrame){ DECL_TEMP; LPSTR pSymbolName; ALLOC_TEMP(1024);#ifdef ACTIVATE_SYMBOL_LOOKUP if( FindSymbolByAddress(&pSymbolName,GetLinearAddress(pFrame->cs,pFrame->eip)) ) PICE_sprintf(TEMP,"pICE: Breakpoint due to division by zero at %.4X:%.8X (%s)\n",pFrame->cs,pFrame->eip,pSymbolName); else#endif // ACTIVATE_SYMBOL_LOOKUP PICE_sprintf(TEMP,"pICE: Breakpoint due to division by zero at %.4X:%.8X\n",pFrame->cs,pFrame->eip); Print(OUTPUT_WINDOW,TEMP); FREE_TEMP();}//************************************************************************* // InstallDivideByZeroHook() // //************************************************************************* void InstallDivideByZeroHook(void){#ifdef ACTIVATE_DIVIDE_BY_ZERO_HOOK ENTER_FUNC(); if(!OldDivideByZeroHandler) { HookInterruptVector(DIVIDE_BY_ZERO_VECTOR,(PVOID)&DebuggerDivideByZeroFault,(PVOID)&OldDivideByZeroHandler); } LEAVE_FUNC();#endif // ACTIVATE_DIVIDE_BY_ZERO_HOOK}//************************************************************************* // DeInstallDivideByZeroHook() // //************************************************************************* void DeInstallDivideByZeroHook(void){#ifdef ACTIVATE_DIVIDE_BY_ZERO_HOOK ENTER_FUNC(); if(OldDivideByZeroHandler) { HookInterruptVector(DIVIDE_BY_ZERO_VECTOR,(PVOID)OldDivideByZeroHandler,NULL); } LEAVE_FUNC();#endif // ACTIVATE_DIVIDE_BY_ZERO_HOOK}// EOF
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -