Problems with InstDrv Plugin
Hello,
I've made an installer using InstDrv plugin, but I had some issues.
First, the driver I'm trying to install is a virtual device, a display mirror driver. I'm not the one who developed it, but I think it may have some bugs (I'll explain later in this post).
I've managed to make it install the driver (InitDriverSetup > CreateDevice > InstallDriver), but the function "CountDevices" don't find the installed device, the function "DeleteOemInfFiles" don't delete the INF files and the function "RemoveAllDevices" don't remove the installed devices.If I call "InstallDriver" with a previous driver installed, it updates the driver.
I don't know if this plugin has a bug, since I saw many people reporting problems with it, but the most problems were with the installation, and this is working here. But the problem might be in the driver. I tryed to edit the INF to find any possible bug, but I'm not familiar with driver development.
Here are the codes from INF and the part of my code that Install the driver:
PS: I made some comments with URLs in the INF to help me debug it.
# Initialization
InstDrv::InitDriverSetup /NOUNLOAD "{4D36E968-E325-11CD-BFC1-08002BE10318}" "CxDD_Mirror_Display1"
Pop $0
DetailPrint "Driver Setup Initiated"
# Check if there is any device already installed
InstDrv::CountDevices /NOUNLOAD
Pop $0
DetailPrint "Devices Found: $0"
StrCmp $0 "0" Continue Remove
Remove:
# Remove all instances of the Driver
InstDrv::RemoveAllDevices /NOUNLOAD
Pop $0
StrCmp $0 "00000000" +4 +1
DetailPrint "Old Devices: Could not remove [Code: $0]"
MessageBox MB_OK "Error removing old devices"
Goto Finish
DetailPrint "Old Devices: Removed"
Continue:
# Delete previous Driver INF and PNF files (stored by Windows on INF folder)
InstDrv::DeleteOemInfFiles /NOUNLOAD
Pop $0
StrCmp $0 "00000103" +4 +1
DetailPrint "Old INF Files: Could not remove [Code: $0]"
MessageBox MB_OK "Error removing old INF files"
Goto Finish
Pop $1
Pop $2
DetailPrint "Old INF Files: Removed ($1, $2)"
# Create the device
InstDrv::CreateDevice /NOUNLOAD
Pop $0
StrCmp $0 "00000000" +4 +1
DetailPrint "New Device: Could not create [Code: $0]"
MessageBox MB_OK "Error creating Device"
Goto Finish
DetailPrint "New Device: created"
# Install the Driver and check if a reboot is needed
DetailPrint "Installing driver from: $INSTDIR\Driver\CxDD.inf"
InstDrv::InstallDriver /NOUNLOAD "$INSTDIR\Driver\CxDD.inf"
Pop $0
StrCmp $0 "00000000" +4 +1
DetailPrint "New device driver: Not installed [Code: $0]"
MessageBox MB_OK "Error installing driver"
Goto Finish
DetailPrint "New device driver: Installed"
# Check if a reboot is needed
Pop $0
StrCmp $0 "0" Finish
DetailPrint "Reboot Needed"
SetRebootFlag true
Finish:
# Count how many Devices are present now
InstDrv::CountDevices /NOUNLOAD
Pop $0
DetailPrint "Devices Found After Install: $0"
; CxDD.inf
;
; Installation inf for the CxDD Mirror graphics adapter.
;
; Copyright (c) 2006 VAT Tecnologia da Informacao. All rights reserved
;
; http://msdn2.microsoft.com/en-us/library/ms790223.aspx
;
[Version]
Signature="$CHICAGO$"
Provider=%Company%
Class=Display
ClassGUID={4D36E968-E325-11CE-BFC1-08002BE10318}
DriverVer=01/31/2006,1.0.0.2
;CatalogFile=CxDD.cat ; Used by WHQL Digital Signatures
[DestinationDirs]
; Section = DirID
DefaultDestDir = 11
cxdd.Display = 11 ; system32
cxdd.Miniport = 12 ; drivers
;
; Driver information
;
[Manufacturer]
; http://msdn2.microsoft.com/en-us/library/ms794359.aspx
; Manufacturer = Models Section [,TargetOSVersion] [,TargetOSVersion] ...
; TargetOSVersion = NT[Architecture][.[OSMajorVersion][.[OSMinorVersion][.[ProductType][.SuiteMask]]]] (WinXP and Later)
%Company% = CxDD.Mfg
[CxDD.Mfg]
; http://msdn2.microsoft.com/en-us/library/ms794357.aspx
; device-description = install-section-name,hw-id[,compatible-id...]
%CxDD% = CxDD_Inst, CxDD_Mirror_Display1
;
; General installation section
;
[CxDD_Inst]
; http://msdn2.microsoft.com/en-us/library/ms794553.aspx
CopyFiles = CxDD.Miniport, CxDD.Display
;
; File List sections
;
[CxDD.Miniport]
CxDD.sys
[CxDD.Display]
CxDD.dll
;
; Service Installation
;
[CxDD_Inst.Services]
; http://msdn2.microsoft.com/en-us/library/ms794347.aspx
; http://msdn2.microsoft.com/en-us/library/ms794559.aspx
; AddService = ServiceName,[flags],service-install-section[,event-log-install-section[,[EventLogType][,EventName]]]...
AddService = cxdd, 0x00000002, CxDD_Service_Inst, CxDD_EventLog_Inst
[CxDD_Service_Inst]
DisplayName = %CxDD.SvcName% ; Friendly Name
Description = %CxDD.SvcDesc% ; Longer description
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 1 ; SERVICE_SYSTEM_START
ErrorControl = 0 ; SERVICE_ERROR_IGNORE
LoadOrderGroup = Video
ServiceBinary = %12%\CxDD.sys
[CxDD_EventLog_Inst]
AddReg = CxDD_EventLog_AddReg
[CxDD_EventLog_AddReg]
HKR,,EventMessageFile,0x00020000,"%SystemRoot%\System32\IoLogMsg.dll;%SystemRoot%\System32\drivers\CxDD.sys"
HKR,,TypesSupported,0x00010001,7
;
; Software Installation
;
[CxDD_Inst.SoftwareSettings]
; http://msdn2.microsoft.com/en-us/library/ms801089.aspx
AddReg = CxDD_SoftwareDeviceSettings
[CxDD_SoftwareDeviceSettings]
HKR,, MirrorDriver, %REG_DWORD%, 1
HKR,, InstalledDisplayDrivers, %REG_MULTI_SZ%, cxdd
HKR,, VgaCompatible, %REG_DWORD%, 0
HKR,, Attach.ToDesktop, %REG_DWORD%, 1
[CxDD_Inst.OpenGLSoftwareSettings]
AddReg = CxDD_OpenGLSoftwareSettings
[CxDD_OpenGLSoftwareSettings]
; Not currently used:
[CxDD_Inst.GeneralConfigData]
MaximumNumberOfDevices = 1
KeepExistingDriverEnabled = 1
;
; Source file information
;
[SourceDisksNames.x86]
1 = %DiskId%,,,""
[SourceDisksFiles]
cxdd.sys = 1
cxdd.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 = "CxDD Mirror Installation DISK (VIDEO)"
GraphAdap = "Graphics Adapter"
CxDD = "CxDD Mirror Driver"
Company = "IPTV - VAT Tecnologia da Informacao"
CxDD.SvcName = "IPTV - Mirror Driver Service"
CxDD.SvcDesc = "Give Application Sharing access to capture screen"