资源简介
[软件调试].张银奎.随书光盘,解压后67M
代码片段和文件信息
//----------------------------------------------------------------------
//
// RealBug - simple driver to serve as debuggee for training purpose.
//
// Copyright (C) 2006 Raymond Zhang
// Advanced Debugging - http://advdbg.org
//
//----------------------------------------------------------------------
#include “ntddk.h“
#include “..\Imbuggy\ioctlcmd.h“
#include “debug.h“
#define MAX_LOOP 1
VOID SehFilter()
{
int i;
LARGE_INTEGER li;
li.QuadPart=-100000;
for(i=0;i {
DBGOUT((“Execute SEH filter now %d“KeGetCurrentIrql()));
KeDelayExecutionThread(KernelModeTRUE &li);
}
}
VOID SehHandler()
{
DBGOUT((“Execute handler now“));
}
VOID SEH()
{
__try
{
__try
{
*(int *)0=1;
}
__except(SehFilter() EXCEPTION_CONTINUE_SEARCH)
{
DBGOUT((“Never should reach here“));
}
}
__except(SehFilter() EXCEPTION_EXECUTE_HANDLER)
{
SehHandler();
}
}
VOID UncaughtException()
{
*(int *)0=1;
}
VOID NullPointer()
{
*(int *)0=1;
}
#pragma warning(disable : 4723)
VOID PropDivideZero()
{
int nm;
n=1;
m=0;
__try
{
n=n/m;
}
__except(EXCEPTION_EXECUTE_HANDLER)
{
DBGOUT((“Caught divide by zero safely.“));
}
}
#pragma warning(default : 4723)
VOID DivideZero()
{
int nm;
PropDivideZero();
n=1;
m=0;
n=n/m;
}
VOID
StackOverflow(
PCHAR psz
)
{
int i=0;
CHAR szVar[10]=“aaaaa...“;
for(i=0; i< 1000;i++)
psz[i]=szVar[i];
}
NTSTATUS
RealBugDeviceControl(
IN PFILE_object Fileobject
IN BOOLEAN Wait
IN PVOID InputBuffer
IN ULONG InputBufferLength
OUT PVOID OutputBuffer
IN ULONG OutputBufferLength
IN ULONG IoControlCode
OUT PIO_STATUS_BLOCK IoStatus
IN PDEVICE_object Deviceobject
)
{
IoStatus->Status = STATUS_SUCCESS;
IoStatus->Information = 0;
switch ( IoControlCode ) {
case IOCTL_DIVIDEBYZERO:
DivideZero();
break;
case IOCTL_NULLPOINTER:
NullPointer();
break;
case IOCTL_SEH:
SEH();
break;
case IOCTL_EXCEPTION:
UncaughtException();
break;
case IOCTL_BUGCHECK:
KeBugCheck(0x88888888);
break;
case IOCTL_STACK_OVERFLOW:
StackOverflow(“zzzzzz...“);
break;
default:
IoStatus->Status = STATUS_NOT_SUPPORTED;
break;
}
return IoStatus->Status;
}
NTSTATUS
RealBugDispatch(
IN PDEVICE_object Deviceobject
IN PIRP Irp
)
{
PIO_STACK_LOCATION iosp;
PVOID inputBuffer;
PVOID outputBuffer;
ULONG inputBufferLength;
ULONG outputBufferLength;
ULONG ioControlCode;
NTSTATUS status;
//
// Switch on the request type
//
iosp = IoGetCurrentIrpStackLocation (Irp);
switch (iosp->MajorFunction) {
case IRP_MJ_CREATE:
case IRP_MJ_CLOSE:
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1147904 2008-07-26 10:19 tools\监视和记录CPU执行轨迹的CpuWhere\CpuWhere_src\CpuWhere\cpu_where_log.doc
文件 29958 2007-04-08 17:44 src\chap25\objsamp\dump.txt
文件 5145 2007-04-08 23:29 src\chap25\objsamp\dump_sym.txt
文件 23317 2007-04-13 22:56 src\chap25\objsamp\dump_sym_rel.txt
文件 1314 2008-01-26 12:14 dump\WER16fb.dir00\manifest.txt
文件 1190 2006-04-22 15:04 src\chap11\VEH\ReadMe.txt
文件 1190 2006-04-23 12:17 src\chap12\UEF\ReadMe.txt
文件 1196 2008-04-05 13:00 src\chap30\wtee\ReadMe.txt
文件 1202 2005-12-17 10:14 src\chap03\fault\ReadMe.txt
文件 1208 2004-02-05 15:00 src\chap02\AcsVio\ReadMe.txt
文件 1208 2006-01-08 14:32 src\chap04\DataBP\ReadMe.txt
文件 1208 2005-07-08 18:56 src\chap04\HiInt3\ReadMe.txt
文件 1208 2006-12-24 12:09 src\chap21\Assert\ReadMe.txt
文件 1208 2006-10-03 21:59 src\chap22\BufOvr\ReadMe.txt
文件 1208 2007-02-04 09:36 src\chap23\HeapHFC\ReadMe.txt
文件 1208 2006-10-31 19:28 src\chap23\HiHeap\ReadMe.txt
文件 1208 2007-02-17 16:48 src\chap24\SehRaw\ReadMe.txt
文件 1214 2007-12-16 23:31 src\chap04\B2BStep\ReadMe.txt
文件 1214 2006-03-07 20:50 src\chap04\TryInt1\ReadMe.txt
文件 1214 2006-04-16 14:30 src\chap11\SEH\SEH_Mix\ReadMe.txt
文件 1214 2006-05-01 22:43 src\chap12\JitDbgr\ReadMe.txt
文件 1214 2006-12-03 14:06 src\chap21\CppSLib\ReadMe.txt
文件 1214 2007-11-10 20:30 src\chap23\MemLeak\ReadMe.txt
文件 1214 2007-02-20 11:17 src\chap24\Interop\ReadMe.txt
文件 1214 2007-02-12 18:32 src\chap24\SehComp\ReadMe.txt
文件 1215 2005-07-19 09:49 src\chap02\ProtSeg\ReadMe.txt
文件 1215 2006-10-02 14:56 src\chap22\AllcStk\ReadMe.txt
文件 1220 2007-10-01 15:52 src\chap01\Err2Fail\ReadMe.txt
文件 1220 2007-12-02 10:52 src\chap10\Breakout\ReadMe.txt
文件 1220 2007-12-01 10:32 src\chap10\TinyDbge\ReadMe.txt
............此处省略1544个文件信息
- 上一篇:大漠7.1830
- 下一篇:unity推箱子完整项目源码
评论
共有 条评论