Talk:Driver installation and update

From NSIS Wiki
Jump to navigationJump to search

Extra functionality

I've used this function to install drivers. And in some circumstances I had to install an older driver over a new one, for this, i've changed the fourth parameter (flags) to 1 (INSTALLFLAG_FORCE) and it did the work.

 System::Call '${sysUpdateDriverForPlugAndPlayDevices}?e (0, R0, R1, 1, 0) .r0'

Maybe someone could add the this as an optional functionality to this function...

Rafael Vargas 09:37, 27 August 2008 (PDT)


Code that should be added to drvsetup.nsh (values taken from newdev.h):

!define INSTALLFLAG_FORCE 0x1
!define INSTALLFLAG_READONLY 0x2
!define INSTALLFLAG_NONINTERACTIVE 0x4

--Crayon 15:51, 16 December 2008 (UTC)

Alternative to GetWindowsVersion

Instead of using the following block of code:

 ; Get the Windows version
 Call GetWindowsVersion
 Pop $R3 ; Windows Version
 ;DetailPrint 'Windows Version: $R3'
 StrCmp $R3 '2000' lbl_upgrade
 StrCmp $R3 'XP' lbl_upgrade
 StrCmp $R3 '2003' lbl_upgrade
 DetailPrint "Windows $R3 doesn't support automatic driver updates."

You could use this one (built-in function in winver.nsh):

 ${If} ${AtLeastWin2000}
  Goto lbl_upgrade
 ${EndIf}
 DetailPrint "This Windows version doesn't support automatic driver updates."

If you use it, $R3 will be empty so make sure all the places were it is shown are modified. --Crayon 15:51, 16 December 2008 (UTC)