网易博客迁移,不知道为什么封禁了帐号,先迁移部分博客过来到csdn
(吐槽:网易莫名其妙的封禁了博客帐号,也不告知是什么原因! 所以这种云上的或者外部网站的,真的不好,哪天你的大量心血就没了!:( , 这个对用户知识太不尊重了!CSDN最好能够提供设置博客分享权限的功能,因为有时候自己工作的一些笔记会记录,但是由于设置商业机密,这样就不能放在博客上进行分享,此时设置下博客权限,至少对一般人是可以屏蔽的!!)
1. 按照VS2015开发工具 (实际测试采用版本,1607,对应的版本为)
Microsoft Visual Studio Professional 2015 (
专业版:HMGNV-WCYXV-X7G9W-YCX63-B98R2
企业版:HM6NR-QXX7C-DFW2Y-8B82K-WTYJV)
Debugging Tools for Windows 10.0.14393.0
2. 按照WDK10开发包 (Windows Driver Kit 10.0.14393.0)
注意: 一定SDK和WDK版本必须一致,否则会出现各种环境错误,编译不通过问题
https://developer.microsoft.com/zh-cn/windows/hardware/windows-driver-kit
3. 输入测试代码
4. 设置工程属性
设置工程为多字节
C/C++ -- > 告警删除
C/C++ -- > 打开预处理定义,增加: NDIS630, _WINSOCK_DEPRECATED_NO_WARNINGS(这个是关闭WINSock的一些告警)
链接--> 添加库uuid.lib;ndis.lib;fwpkclnt.lib
Driver Setting --> general --> Target OS Version: windows10 / windows7选择自己的调试目标平台, 编译对应平台的驱动。
Driver Signing: Sign Mode -->Off , 关闭签名(如果打开签名,则直接安装好证书后,选择证书和交叉证书等即可)
(PS: 证书签名还是需要使用正规的签名证书
不过一般都是交叉证书,需要将多本证书都放在签名脚本中
然后打开命令行,进入到VC\Bin\vcvar.bat环境变量设置,运行该脚本后
就可以使用signtool来进行签名了)
签名指导:
https://www.digicert.com/code-signing/signcode-signtool-command-line.htm
https://www.digicert.com/code-signing/driver-signing-in-windows-using-signtool.htm#using_kernel_mode
https://msdn.microsoft.com/en-us/library/windows/hardware/dn653569(v=vs.85).aspx
https://stackoverflow.com/questions/7258613/driver-install-fails-because-cross-signing-chain-doesnt-contain-microsoft
https://knowledge.verisign.com/support/code-signing-support/index?page=content&actp=CROSSLINK&id=SO5820
例如:
signtool sign /v /ac ms_vericode.cer /f certcodesign.pfx /p **** /n "XXXX有限公司" /tr http://timestamp.wosign.com/rfc3161 /fd sha256 filepath.sys
signtool verify /v /kp filepath.sys
附:
(https://github.com/Microsoft/Windows-driver-samples/blob/master/filesys/miniFilter/minispy/filter/minispy.c#L980 -----windows在github上的驱动示例源码)
VirtualKD 是一个开源的调试辅助软件,能够帮助 WinDBG 与 VMWare 建立快速通讯
网址: http://virtualkd.sysprogs.org/
下载后文件为VirtualKD-3.0.exe, 放入到虚拟机,打开解压,会有一个target目录,右键“管理员”运行vminstall.exe
注意: win8以后还要禁止签名,查看: http://virtualkd.sysprogs.org/win8/
真机中为VMMON64.exe,打开设置调试器路径: 点击Debugger path,选择windebug.exe路径, win10 kits路径为:
C:\Program Files (x86)\Windows Kits\10\Debuggers\x64\windebug.exe
安装windows调试驱动:
C:\Program Files (x86)\Windows Kits\10\Remote\x64\WDK Test Target Setup x64-x64_en-us.msi
6. 重启虚拟机,进入内核调试模式:
7. 打开DebugView, 复制到reg文件中打开注册,重启虚拟机即可。 -->这个在Win7_64(VM)对应到外面的Win10_64可以,Win7_32(VM)无法打印出来
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Debug Print Filter]
"DEFAULT"=dword:0000000F
8. windbg的符号表路径
!sym noise
D:\Work\DaiDoubleFCBTest\Drv_20171026_filedeny\Drv;srv*;SRV*D:\win10_net* http://msdl.microsoft.com/download/symbols
.reload /f nt ---可以指定模块下载
错误1:
解决: 将文件修改为*.c 或者函数加上extern "C", 编译器C++编译为@8, 不是C的开头。
测试代码如下:
#include <ntddk.h>
#pragma warning(push)
#pragma warning(disable:4201)
#include <fwpsk.h>
#pragma warning(pop)
#include <fwpmk.h>
#include <ws2ipdef.h>
#include <in6addr.h>
#include <ip2string.h>
VOID
DriverUnload(
IN PDRIVER_OBJECT driverObject
)
{
UNREFERENCED_PARAMETER(DriverObject);
KdPrint(("CloudScreen DriverUnload successful!"));
DbgPrint("CloudScreen DriverUnload successful!");
return;
}
NTSTATUS
DriverEntry(
IN PDRIVER_OBJECT driverObject,
IN PUNICODE_STRING registryPath
)
{
NTSTATUS status = STATUS_SUCCESS;
UNREFERENCED_PARAMETER(registryPath);
driverObject->DriverUnload = DriverUnload;
KdPrint(("CloudScreen DriverEntry successful!"));
DbgPrint("CloudScreen DriverEntry successful!");
return status;
}
参考:
http://www.mycode.net.cn/language/cpp/1771.html
工具下载:
https://developer.microsoft.com/zh-cn/windows/hardware/license-terms-enterprise-wdk
https://developer.microsoft.com/zh-cn/windows/hardware/windows-driver-kit