首页
社区
课程
招聘
[求助]这段代码怎么老是5秒后蓝屏
发表于: 2010-11-28 15:06 5024

[求助]这段代码怎么老是5秒后蓝屏

2010-11-28 15:06
5024
/* _Define at C++ */
#ifdef __cplusplus
extern "C"
{
#endif
#include <NTDDK.h>
#ifdef __cplusplus
}
#endif

/* _Memory Section*/
#define INITCODE code_seg("INIT")
#define LOCKCODE code_seg()

#pragma LOCKCODE
VOID onDpc(PKDPC pDpc,PVOID p1,PVOID p2,PVOID p3)
{
        KdPrint(("Test Is OK!\n"));
}

/* _Unload Routine  */
VOID TestMinUnload(PDRIVER_OBJECT  DriverObject)
{
        KdPrint(("TestMin UnLoad OK!\n"));
}

/* _Enter Point  */
#pragma INITCODE
NTSTATUS DriverEntry(PDRIVER_OBJECT pDriverObject,PUNICODE_STRING RegistryPath)
{
    KdPrint(("Enter TestMin EnterPoint!\n"));

        KTIMER ktimer;
        KeInitializeTimer(&ktimer);

        KDPC dpc;
        KeInitializeDpc(&dpc,onDpc,NULL);

        KeSetTimer(&ktimer,RtlConvertLongToLargeInteger(-10*1000*1000*5),&dpc);

        pDriverObject->DriverUnload = TestMinUnload;
    return STATUS_SUCCESS;
}

[课程]Linux pwn 探索篇!

收藏
免费 0
支持
分享
最新回复 (6)
雪    币: 40
活跃值: (14)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
2
IRQL_NOT_LESS_OR_EQUAL
同等答案
2010-11-28 16:10
0
雪    币: 8865
活跃值: (2379)
能力值: ( LV12,RANK:760 )
在线值:
发帖
回帖
粉丝
3

KDPC dpc;
KTIMER ktimer;
改成全局变量试试。
2010-11-30 00:10
0
雪    币: 285
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
4
Storage for the DPC object must be resident: in the device extension of a driver-created device object, in the controller extension of a driver-created controller object, or in nonpaged pool allocated by the caller.
2010-11-30 11:14
0
雪    币: 284
活跃值: (106)
能力值: ( LV9,RANK:160 )
在线值:
发帖
回帖
粉丝
5
变量的作用范围……你把局部变量当全局变量使用当然蓝屏了……
2010-11-30 11:47
0
雪    币: 1708
活跃值: (586)
能力值: ( LV15,RANK:670 )
在线值:
发帖
回帖
粉丝
6
static KTIMER ktimer;
2010-11-30 11:57
0
雪    币: 214
活跃值: (11)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
7
解决了,谢谢各位。还有点不懂,在dpc回调函数中我不再使用这些局部变量。怎么也会……高手说一下这个机理吧?
2010-12-1 12:41
0
游客
登录 | 注册 方可回帖
返回
//