开发屏幕截图 mirror driver


mirror driver 镜像驱动,直接创建一个虚拟的显卡驱动(个人认为),将应用程序呼叫操作系统需要改变图形显示的时候事先截取应用程序需要显示的区域和内容,并缓冲到内存中。与实时捕获屏幕并比较差异的方法比较具有以下优点:
1、CPU占用率小,一般在5%以下,实时度高
2、不需要比较差异,因为截取的就是差异部分的图像缓冲
需要的驱动文件:
mirror.dll、mirror.inf、mirror.sys
如何获取这些文件:
1、从微软站点下载win2k ddk
2、安装DDK,例如F:/W2KDDK
3、编译F:/W2KDDK/src/video/displays/mirror/dll/下的 mirror.dll,编译方法:安装完DDK后在开始菜单- Development Kits – Windows 2000 DDK – 运行Free Build Environment 进入Dos模式,进入上面的目录,输入build sZ
4、编译F:/W2KDDK/src/video/miniport/mirror mirror.sys
5、复制或修改F:/W2KDDK/src/video/displays/mirror/app/mirror.inf文件,驱动文件
[Version]
Signature=”$CHICAGO$”
Provider=%Microsoft%
ClassGUID={4D36E968-E325-11CE-BFC1-08002BE10318}
Class=Display
DriverVer=06/01/1999,1.0
[DestinationDirs]
DefaultDestDir   = 11
mirror.Miniport = 12 ; drivers
mirror.Display   = 11 ; system32
;
; Driver information
;
[Manufacturer]
%Microsoft%   = Mirror.Mfg
[Mirror.Mfg]
%Mirror% = mirror, Microsoft_Mirror_Sample1
;
; General installation section
;
[mirror]
CopyFiles=mirror.Miniport, mirror.Display
;
; File sections
;
[mirror.Miniport]
mirror.sys
[mirror.Display]
mirror.dll

;
; Service Installation
;
[mirror.Services]
AddService = mirror, 0×00000002, mirror_Service_Inst, mirror_EventLog_Inst
[mirror_Service_Inst]
ServiceType    = 1                  ; SERVICE_KERNEL_DRIVER
StartType      = 1                  ; SERVICE_SYSTEM_START
ErrorControl   = 0                  ; SERVICE_ERROR_IGNORE
LoadOrderGroup = Video
ServiceBinary = %12%/mirror.sys
[mirror_EventLog_Inst]
AddReg = mirror_EventLog_AddReg
[mirror_EventLog_AddReg]
HKR,,EventMessageFile,0×00020000,”%SystemRoot%/System32/IoLogMsg.dll;%SystemRoot%/System32/drivers/mirror.sys”
HKR,,TypesSupported,0×00010001,7
;
; Software Installation
;
[mirror.SoftwareSettings]
AddReg = mirror_SoftwareDeviceSettings
[mirror_SoftwareDeviceSettings]
HKR,, MirrorDriver,                %REG_DWORD%,    1
HKR,, InstalledDisplayDrivers,     %REG_MULTI_SZ%, mirror
HKR,, VgaCompatible,               %REG_DWORD%,    0
HKR,, Attach.ToDesktop,            %REG_DWORD%,    1
[mirror.OpenGLSoftwareSettings]
AddReg = mirror_OpenGLSoftwareSettings
[mirror_OpenGLSoftwareSettings]
;
; Not currently used:
;
[mirror.GeneralConfigData]
MaximumNumberOfDevices = 1
KeepExistingDriverEnabled = 1
;
; Source file information
;
[SourceDisksNames.x86]
1 = %DiskId%,,,”"
[SourceDisksFiles]
mirror.sys = 1
mirror.dll = 1
[Strings]
;
; Non-Localizable Strings
;
REG_SZ         = 0×00000000
REG_MULTI_SZ   = 0×00010000
REG_EXPAND_SZ = 0×00020000
REG_BINARY     = 0×00000001
REG_DWORD      = 0×00010001
SERVICEROOT    = “System/CurrentControlSet/Services”
;
; Localizable Strings
;
DiskId       = “Mirror Installation DISK (VIDEO)”
GraphAdap    = “Graphics Adapter”
Microsoft    = “MicrosoftSoft”
Mirror       = “Microsoft Mirror Driver这里可以修改显示的信息”

6、安装驱动 进入控制面板 – 添加硬件 – 添加新硬件 – 手动选择硬件设备 – 显示卡 – 从磁盘安装 – 选择mirror.inf – 完成
7、打开设备管理器,在显示卡下确认是否已经安装mirror driver
安装完毕后,system32/drivers/mirror.sys和system32/mirror.dll要分别存在.
确实速度快,加上P2P,从开发后应用看达到了VNC、远程桌面的效果
本文来源于 冰山上的播客 http://xinsync.xju.edu.cn , 原文地址:http://xinsync.xju.edu.cn/index.php/archives/4839

  • 1
    点赞
  • 15
    收藏
    觉得还不错? 一键收藏
  • 5
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值