首页
社区
课程
招聘
[分享][推荐][原创]Windows_xp_win7-驱动编译与双虚拟机调试环境搭建
发表于: 4天前 1351

[分享][推荐][原创]Windows_xp_win7-驱动编译与双虚拟机调试环境搭建

4天前
1351

win7 虚拟机不能安装vm tools

vs2015支持模板导出,也可以选择制作自己的模板

image-20241225215103102

image-20241225215131580

image-20241225215218962

image-20241225215604598

创建first目录,在此目录中创建三个文件

first.c

TARGETNAME表示名字,编译出来之后模块的名字first.sys

SOURCES表示要编译的.c文件

image-20241225220248934

image-20241225220640605

image-20241225220717940

image-20241225221105405

image-20241225221449033

image-20241225221533209

image-20241225221603524

image-20241225221656680

image-20241225221749610

image-20241225221802026

image-20241225221823143

image-20241225221857378

image-20241225222132047

image-20241225222324785

image-20241225223552141

可能有下列情况,先尝试直接安装,直接安装不成功或者看报错信息在选择执行情况1或情况2

情况1:有可能安装IE11需要补丁,补丁链接如下

情况2安装证书:

在win10系统上Windows键+R 弹出运行对话框,输入certmgr.msc,打开Windows的证书管理器

导出如下证书安装在win7系统上

image-20241225224355149

image-20241225224604565

image-20241225230137520

image-20241225230849872

image-20241225230904010

image-20241225230924485

image-20241226012901806

image-20241226013221782

image-20241226013706476

image-20241226013858698

image-20241226014549378

image-20241226014635805

image-20241226015050873

image-20241226015146035

image-20241226015445158

image-20241226015510577

image-20241226015805570

image-20241226015838787

image-20241226185952446

image-20241226190145008

image-20241226190155635

image-20241226190259580

image-20241226185716228

image-20241226185803686

image-20241226185917154

32位支持内联asm汇编

64位利用在Source文件中直接添加asm文件,直接在asm文件中写汇编代码,然后将asm文件编译为OBJ文件。然后就可以在c++文件中声明asm文件中的函数后直接使用asm文件中用汇编写的函数

64位也可使用 DbgBreakPoint();

win7 x64安装驱动需要签名,这里使用64Signer

image-20241226192152329

image-20241226200005753

image-20241226201250995

image-20241226202412267

应用名称 版本 备注
windows7 x64 调试机 windows7 x64 sp1 cn_windows_7_professional_with_sp1_x64_dvd_u_677031.iso
windows7 x64 被调试机 windows7 x64 sp1 cn_windows_7_professional_with_sp1_x64_dvd_u_677031.iso
WDK 7600 7600.16385.1 https://www.microsoft.com/en-us/download/details.aspx?id=11800
VS 2015 Visual Studio 2015 Community
ie 11 ie 11 https://support.microsoft.com/zh-cn/windows/%E4%B8%8B%E8%BD%BD-internet-explorer-11-%E8%84%B1%E6%9C%BA%E5%AE%89%E8%A3%85%E7%A8%8B%E5%BA%8F-99d492a1-3a62-077b-c476-cf028aff9a7f
wingdb 6.12 调试工具
vmware workstation vmware workstation 17 pro
SRVINSTW.EXE SRVINSTW.EXE 安装驱动程序
dbgview64.exe dbgview64.exe 查看驱动打印
vs2013驱动开发模板 驱动配置模板 https://bbs.kanxue.com/thread-188471.htm
Everything Everything-1.4.1.935.x86-Setup
64Signer 64Signer 签名工具
         #include <ntddk.h>
 
VOID DriverUnload(PDRIVER_OBJECT driver){
             DbgPrint("first:Our driver is unloading\r\n");
         }
         NTSTATUS DriverEntry(PDRIVER_OBJECT driver,PUNICODE_STRING reg_path){
              
             DbgPrint("first:Our hello my salary\r\n");
              
             driver->DriverUnload=DriverUnload;
             return STATUS_SUCCESS;
}
         #include <ntddk.h>
 
VOID DriverUnload(PDRIVER_OBJECT driver){
             DbgPrint("first:Our driver is unloading\r\n");
         }
         NTSTATUS DriverEntry(PDRIVER_OBJECT driver,PUNICODE_STRING reg_path){
              
             DbgPrint("first:Our hello my salary\r\n");
              
             driver->DriverUnload=DriverUnload;
             return STATUS_SUCCESS;
}
!IF 0
Module Name:
makefile .
Notes:
DO NOT EDIT THIS FILE!!!
!ENDIF
!INCLUDE $(NTMAKEENV)\makefile.def
!IF 0
Module Name:
makefile .
Notes:
DO NOT EDIT THIS FILE!!!
!ENDIF
!INCLUDE $(NTMAKEENV)\makefile.def
TARGETNAME=first
TARGETTYPE=DRIVER
SOURCES=first.c
TARGETNAME=first
TARGETTYPE=DRIVER
SOURCES=first.c
net start first \\启动驱动
net stop first  \\停止驱动
sc delete first \\卸载驱动
net start first \\启动驱动
net stop first  \\停止驱动
sc delete first \\卸载驱动
32
 
http://www.microsoft.com/zh-cn/download/internet-explorer.aspx
 
64
 
http://www.microsoft.com/zh-cn/download/details.aspx?id=45154
32
 
http://www.microsoft.com/zh-cn/download/internet-explorer.aspx
 
64
 
http://www.microsoft.com/zh-cn/download/details.aspx?id=45154
1.Microsoft Root Certificate Authority 2010
 
2.Microsoft Root Certificate Authority 2011
 
3.COMODO RSA Certification Authority;
1.Microsoft Root Certificate Authority 2010
 
2.Microsoft Root Certificate Authority 2011
 
3.COMODO RSA Certification Authority;
bcdedit /copy {current} /d "Windwos7"
bcdedit /copy {current} /d "Windwos7"
bcdedit /debug ON
bcdedit /bootdebug ON
bcdedit /debug ON
bcdedit /bootdebug ON
#include <ntddk.h>
VOID DriverUnload(PDRIVER_OBJECT driver) {
    DbgPrint("first:Our driver is unloading\r\n");
}
NTSTATUS DriverEntry(PDRIVER_OBJECT driver, PUNICODE_STRING reg_path) {
    DbgBreakPoint();
    DbgPrint("first:Our hello my salary\r\n");
 
    driver->DriverUnload = DriverUnload;
    return STATUS_SUCCESS;
}
#include <ntddk.h>
VOID DriverUnload(PDRIVER_OBJECT driver) {
    DbgPrint("first:Our driver is unloading\r\n");
}
NTSTATUS DriverEntry(PDRIVER_OBJECT driver, PUNICODE_STRING reg_path) {
    DbgBreakPoint();
    DbgPrint("first:Our hello my salary\r\n");
 
    driver->DriverUnload = DriverUnload;
    return STATUS_SUCCESS;
}
symchk.exe /r c:\windows\system32\ /s SRV*C:\Users\test\Desktop\symblos\*http://msdl.microsoft.com/download/symbols
 
- /r c:\windows\system32\ 下载system32下的符号
- SRV*C:\Users\test\Desktop\symblos\ 下载符号的保存路径
- http://msdl.microsoft.com/download/symbols 微软的符号服务器
symchk.exe /r c:\windows\system32\ /s SRV*C:\Users\test\Desktop\symblos\*http://msdl.microsoft.com/download/symbols
 
- /r c:\windows\system32\ 下载system32下的符号
- SRV*C:\Users\test\Desktop\symblos\ 下载符号的保存路径
- http://msdl.microsoft.com/download/symbols 微软的符号服务器
C:\Users\test\Desktop\code\test\first6\x64\Checked_win7;srv*C:\Users\test\Desktop\symblos*http://msdl.microsoft.com/download/symbols
C:\Users\test\Desktop\code\test\first6\x64\Checked_win7;srv*C:\Users\test\Desktop\symblos*http://msdl.microsoft.com/download/symbols
应用名称 版本 备注
windows7 x64 调试机 windows7 x64 sp1 cn_windows_7_professional_with_sp1_x64_dvd_u_677031.iso
windows7 x64 被调试机 windows7 x64 sp1 cn_windows_7_professional_with_sp1_x64_dvd_u_677031.iso
WDK 7600 7600.16385.1 https://www.microsoft.com/en-us/download/details.aspx?id=11800
VS 2015 Visual Studio 2015 Community
ie 11 ie 11 https://support.microsoft.com/zh-cn/windows/%E4%B8%8B%E8%BD%BD-internet-explorer-11-%E8%84%B1%E6%9C%BA%E5%AE%89%E8%A3%85%E7%A8%8B%E5%BA%8F-99d492a1-3a62-077b-c476-cf028aff9a7f
wingdb 6.12 调试工具
vmware workstation vmware workstation 17 pro
SRVINSTW.EXE SRVINSTW.EXE 安装驱动程序
dbgview64.exe dbgview64.exe 查看驱动打印
vs2013驱动开发模板 驱动配置模板 https://bbs.kanxue.com/thread-188471.htm
Everything Everything-1.4.1.935.x86-Setup
64Signer 64Signer 签名工具
1
2
3
4
5
6
7
8
9
10
11
12
         #include <ntddk.h>
 
VOID DriverUnload(PDRIVER_OBJECT driver){
             DbgPrint("first:Our driver is unloading\r\n");
         }
         NTSTATUS DriverEntry(PDRIVER_OBJECT driver,PUNICODE_STRING reg_path){
              
             DbgPrint("first:Our hello my salary\r\n");
              
             driver->DriverUnload=DriverUnload;
             return STATUS_SUCCESS;
}
1
2
3
4
5
6
7
!IF 0
Module Name:
makefile .
Notes:
DO NOT EDIT THIS FILE!!!
!ENDIF
!INCLUDE $(NTMAKEENV)\makefile.def
1
2
3
TARGETNAME=first
TARGETTYPE=DRIVER
SOURCES=first.c
1
2
3
net start first \\启动驱动
net stop first  \\停止驱动
sc delete first \\卸载驱动
1
2
3
4
5
6
7
32
 
http://www.microsoft.com/zh-cn/download/internet-explorer.aspx
 
64
 
http://www.microsoft.com/zh-cn/download/details.aspx?id=45154
1
2
3
4
5
1.Microsoft Root Certificate Authority 2010
 
2.Microsoft Root Certificate Authority 2011
 
3.COMODO RSA Certification Authority;
1
bcdedit /copy {current} /d "Windwos7"
1
2
bcdedit /debug ON
bcdedit /bootdebug ON
1
2
3
4
5
6
7
8
9
10
11
#include <ntddk.h>
VOID DriverUnload(PDRIVER_OBJECT driver) {
    DbgPrint("first:Our driver is unloading\r\n");
}
NTSTATUS DriverEntry(PDRIVER_OBJECT driver, PUNICODE_STRING reg_path) {
    DbgBreakPoint();
    DbgPrint("first:Our hello my salary\r\n");
 
    driver->DriverUnload = DriverUnload;
    return STATUS_SUCCESS;
}
1
2
3
4
5
symchk.exe /r c:\windows\system32\ /s SRV*C:\Users\test\Desktop\symblos\*http://msdl.microsoft.com/download/symbols
 
- /r c:\windows\system32\ 下载system32下的符号
- SRV*C:\Users\test\Desktop\symblos\ 下载符号的保存路径
- http://msdl.microsoft.com/download/symbols 微软的符号服务器
1
C:\Users\test\Desktop\code\test\first6\x64\Checked_win7;srv*C:\Users\test\Desktop\symblos*http://msdl.microsoft.com/download/symbols
  • 因最近需要编写一些xp与win7上的驱动程序,但是网上搜索环境配置要不就很老旧,要不很繁琐,最好还是能双虚拟机调试,在网上没有找到能完全满足需求的,就整合网上的一些资源编写此文档。
  • 主要内容为使用vmware 双win7虚拟机调试、win7安装vs2015、使用驱动模板编译win7与xp驱动
  • 下载WDK 7600并解压执行
  • 勾选全部选项并点击ok
  • 选择路径,我这直接点击ok
  • 点击Finish完成安装
  • 创建first目录,在此目录中创建三个文件

  • first.c

  • makefile

[注意]APP应用上架合规检测服务,协助应用顺利上架!

收藏
免费 2
支持
分享
最新回复 (2)
雪    币: 110
活跃值: (3537)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
2
感谢大神分享
4天前
0
雪    币: 4649
活跃值: (6913)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
3
牛逼plus,好文章学习了
3天前
0
游客
登录 | 注册 方可回帖
返回
// // 统计代码