首页
社区
课程
招聘
[旧帖] [求助]简单的IDTHOOK ,不能加载 用的是INSTDRV 0.00雪花
发表于: 2009-4-17 19:09 3309

[旧帖] [求助]简单的IDTHOOK ,不能加载 用的是INSTDRV 0.00雪花

2009-4-17 19:09
3309
代码如下,简单的IDTHOOK 仅仅输出一下,就是加载提示错误,看不出原因
#include "ntddk.h"
#include <stdio.h>
#define MAKELONG(a, b) ((unsigned long) (((unsigned short) (a)) | ((unsigned long) ((unsigned short) (b))) << 16))

#define MAX_IDT_ENTRIES 0xFF
#pragma pack(1)

// entry in the IDT, this is sometimes called
// an "interrupt gate"
typedef struct
{
   unsigned short LowOffset;
   unsigned short selector;
   unsigned char unused_lo;
   unsigned char segment_type:4;    //0x0E is an interrupt gate
   unsigned char system_segment_flag:1;
   unsigned char DPL:2;           // descriptor privilege level
   unsigned char P:1;              /* present */
   unsigned short HiOffset;
} IDTENTRY;

/* sidt returns idt in this format */
typedef struct
{
   unsigned short IDTLimit;
   unsigned short LowIDTbase;
   unsigned short HiIDTbase;
} IDTINFO;

#pragma pack()

VOID OnUnload( IN PDRIVER_OBJECT DriverObject )
{  
   DbgPrint("ROOTKIT: OnUnload called\n");
}

NTSTATUS DriverEntry( IN PDRIVER_OBJECT theDriverObject, IN PUNICODE_STRING theRegistryPath )
{
   IDTINFO     idt_info;   
   IDTENTRY*   idt_entries;     
   unsigned long   count;

   theDriverObject->DriverUnload   = OnUnload;

   // load idt_info
   __asm   sidt   idt_info
  
   idt_entries = (IDTENTRY*) MAKELONG(idt_info.LowIDTbase,idt_info.HiIDTbase);

   for(count=0;count < MAX_IDT_ENTRIES;count++)
   {
     char _t[255];
     IDTENTRY *i = &idt_entries[count];
     unsigned long addr = 0;
     addr = MAKELONG(i->LowOffset, i->HiOffset);
   
     _snprintf(_t, 253, "Interrupt %d: ISR 0x%08X", count, addr);
     DbgPrint(_t);
   }

   return STATUS_SUCCESS;
}

[招生]科锐逆向工程师培训(2024年11月15日实地,远程教学同时开班, 第51期)

收藏
免费 0
支持
分享
最新回复 (1)
雪    币: 121
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
2
已解决

重启后即可运行
2009-4-17 19:39
0
游客
登录 | 注册 方可回帖
返回
//