分类: WINDOWS
2011-02-14 14:46:26
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, 0x00000002, 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,0x00020000,"%SystemRoot%\System32\IoLogMsg.dll;%SystemRoot%\System32\drivers\mirror.sys"
HKR,,TypesSupported,0x00010001,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 = 0x00000000
REG_MULTI_SZ = 0x00010000
REG_EXPAND_SZ = 0x00020000
REG_BINARY = 0x00000001
REG_DWORD = 0x00010001
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、远程桌面的效果