看流星社区

 找回密码
 注册账号
查看: 2243|回复: 0

win7 遍历DPC源码

[复制链接]

该用户从未签到

发表于 2016-9-21 14:22:17 | 显示全部楼层 |阅读模式



  1. #include<ntddk.h>
  2. typedef struct _KTIMER_TABLE_ENTRY
  3. {
  4.         ULONG Lock;
  5.         LIST_ENTRY Entry;
  6.         ULARGE_INTEGER Time;
  7. } KTIMER_TABLE_ENTRY, *PKTIMER_TABLE_ENTRY;
  8. PKTIMER_TABLE_ENTRY timeTable;

  9. PKTIMER pkTimer;
  10. PLIST_ENTRY plist;

  11. VOID EnumDpcTimer()
  12. {
  13.         ULONG kPrcb=0;
  14.         ULONG index = 0;

  15.         __asm push eax;
  16.         __asm mov eax,fs:[0x20];
  17.         __asm add eax,0x19A0
  18.         __asm mov kPrcb,eax;
  19.         __asm pop eax;
  20.         //timeTable = (PKTIMER_TABLE_ENTRY)(kPrcb+0x19A0);
  21.         timeTable = (PKTIMER_TABLE_ENTRY)(kPrcb);
  22.         for (index; index < 0x100; index++)
  23.         {
  24.                 plist=timeTable[index].Entry.Flink;
  25.                 if (!MmIsAddressValid(plist))
  26.                 {
  27.                         continue;
  28.                 }
  29.                 while (plist!=&timeTable[index].Entry)
  30.                 {
  31.                         //pkTimer=(PKTIMER)((ULONG)plist-0x18);
  32.                         pkTimer=(PKTIMER)CONTAINING_RECORD(plist,KTIMER,TimerListEntry);

  33.                         if (MmIsAddressValid(pkTimer)&&MmIsAddressValid(pkTimer->Dpc))
  34.                         {
  35.                                 if (pkTimer->Period&0xF0000000)
  36.                                 {
  37.                                         break;
  38.                                 }
  39.                                 KdPrint(("0x%08x  ,0x%08x  , %d\n",pkTimer,pkTimer->Dpc->DeferredRoutine,pkTimer->Period));
  40.                         }else
  41.                         {
  42.                                 break;
  43.                         }

  44.                         plist=plist->Flink;
  45.                 }
  46.         }
  47. }
  48. VOID DdkUnload(IN PDRIVER_OBJECT objDriver)
  49. {
  50.         // 2. 删除设备对象
  51.         if ( objDriver->DeviceObject )
  52.                 IoDeleteDevice(objDriver->DeviceObject);
  53. }
  54. NTSTATUS DriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING  RegistryPath)
  55. {
  56.         UNREFERENCED_PARAMETER(RegistryPath);

  57.         EnumDpcTimer();
  58.         // 5. 设置卸载函数
  59.         DriverObject->DriverUnload = DdkUnload;
  60.         return STATUS_SUCCESS;
  61. }

复制代码
点击按钮快速添加回复内容: 支持 高兴 激动 给力 加油 苦寻 生气 回帖 路过 感恩
您需要登录后才可以回帖 登录 | 注册账号

本版积分规则

小黑屋|手机版|Archiver|看流星社区 |网站地图

GMT+8, 2024-3-19 13:28

Powered by Kanliuxing X3.4

© 2010-2019 kanliuxing.com

快速回复 返回顶部 返回列表