概述:bdcedit用法整理|双机调试

更多命令https://docs.microsoft.com/zh-cn/windows-hardware/drivers/devtest/bcdedit–bootdebug

[toc]

禁用数字签名

1
bcdedit /set testsigning on

windows操作提供内核调试

1
2
bcdedit /debug on # 启动
bcdedit /debug off # 禁用

windows操作系统启动项的启动调试

1
2
bcdedit /bootdebug on # 启用
bcdedit /bootdebug off # 禁用

永久禁用数字签名方法

  1. 管理员CMD
  2. 输入 bcdedit.exe /set nointegritychecks on,执行完毕就结束了
  3. 如果要恢复签名,执行 bcdedit.exe /set nointegritychecks off就行

windbg和虚拟机的远程调试和网络调试设置

参考:windbg和虚拟机下的远程调试和网络调试设置_windbg调试虚拟机_satadriver的博客-CSDN博客

微软官方文档:BCDEdit /dbgsettings - Windows drivers | Microsoft Learn

WDF双机调试

参考:WDK1.2. bcdedit调试配置_bcdedit /dbgsettings hostip_ljymoonlight的博客-CSDN博客

双机调试基本步骤

网络连接

虚拟机设置

1
2
3
4
5
6
7
8
9
10
11
# 1. 打开调试模式
bcdedit /debug on

# 2. 设置网络方式调试
# hostip:主机IP地址
# port: 主机的端口
# key:(可省略) 登录密码
bcdedit /dbgsettings net hostip:192.168.0.102 port:50000 key:1.2.3.4

#3. 设置数字签名
bcdedit /set testsigning on

主机windbg连接虚拟机

如下图所示填入上述得到key或自定义设置的key之后连接即可。

串口调试

  1. 添加串行调试端口
  2. 设置管道名,并删除打印机
  3. 查看管道名

虚拟机设置

  1. 管理员cmd

  2. 依次输入以下指令

    1
    2
    3
    4
    5
    # 添加新的引导项
    bcdedit /copy {current} /d Debug

    # 设置引导项等待时间
    bcdedit /timeout 30
  3. 重启操作系统并再次管理员运行CMD

  4. 依次输入以下命令

    1
    2
    3
    4
    5
    bcdedit /dbgsettings SERIAL DEBUGPORT:1 BAUDRATE:115200

    bcdedit /bootdebug on

    bcdedit /debug on
  5. 运行 ‘msconfig’

    • win+R 输入 msconfig
    • 查看引导项是否有Debug模式
    • 查看高级选项,调试端口和波特率
  6. 到此为止,虚拟机设置完毕,启动后操作系统启动时选择 Debug

Windbg连接

  1. 连接内核
  2. 设置管道名