323240867 发表于 2022-2-24 01:14

2022驱动学习-02驱动读内存过程原理

本帖最后由 323240867 于 2022-2-24 01:15 编辑

运行环境:
WIN10
涉及工具:
windbg,vs2019,VMware Workstation Pro
教程类型:
驱动学习笔记
视频是否带有论坛水印:

是否讲解思路和原理:


百度云盘
提取码:496u

1.启动运行环境




2.启动vs编写代码



3.调试打印结果


4.具体代码
#include <Ntddk.h>

VOID Unload(
    _In_ struct _DRIVER_OBJECT* DriverObject) {
    UNREFERENCED_PARAMETER(DriverObject);

    DbgPrint(" Unload!");
}

NTSTATUS DriverEntry(
    __in struct _DRIVER_OBJECT* DriverObject,
    __in PUNICODE_STRINGRegistryPath
)
{
    UNREFERENCED_PARAMETER(RegistryPath);

    DbgPrint("DriverEntry Hello World! DriverObject:%p\n", DriverObject);

    PVOID pAddres = (PVOID)0x009B0AD8;       //要读取的地址
    PVOID pDirectoryTableBase = (PVOID)0x0a3c0300;   //要读取进程的CR3

    ULONG Value = 0;
    PVOID pOldDirectoryTableBase = NULL;

    __asm {
      //屏蔽中断
      cli

      //保存环境
      pushad
      pushfd

      //保存旧的CR3
      mov eax, cr3
      mov pOldDirectoryTableBase, eax

      //修改CR3
      mov eax, pDirectoryTableBase
      mov cr3, eax
    }

    //操作
    RtlCopyMemory((PVOID)&Value, pAddres, 4);

    __asm {
      //还原CR3
      mov eax, pOldDirectoryTableBase
      mov cr3, eax
      //恢复环境
      popfd
      popad

      //恢复中断
      sti
    }


    DbgPrint("value:%d\n", Value);

    //注册卸载函数
    DriverObject->DriverUnload = Unload;

    return STATUS_SUCCESS;
}




KiaIVZW 发表于 2022-2-24 01:15

谢谢分享

wLlqmUDo49 发表于 2022-2-24 01:15

谢谢分享

WOoJhZzI4596 发表于 2022-2-24 01:19

谢谢分享

ChfZm7 发表于 2022-2-24 01:23

感谢楼主

YDoJpBwEuh 发表于 2022-2-24 01:27

每天都能学到新知识,赞!

cmxub 发表于 2022-2-24 01:34

感谢楼主

fMb42 发表于 2022-2-24 01:54

谢谢分享

osLHEYQ3768 发表于 2022-2-24 02:07

回复,顶帖,赚币,谢谢楼主

nNDtsS316 发表于 2022-2-24 02:34

膜拜大神!
页: [1] 2 3 4 5 6 7 8 9 10
查看完整版本: 2022驱动学习-02驱动读内存过程原理