summaryrefslogtreecommitdiff
path: root/driver.nsh
diff options
context:
space:
mode:
authorChristophe Fergeau <cfergeau@redhat.com>2012-02-28 21:19:49 +0100
committerChristophe Fergeau <cfergeau@redhat.com>2012-02-28 21:19:49 +0100
commitce16b7ea8508361e84dd02b8577fed784faacb12 (patch)
tree5e87c4449402036a6ddc0cefef425757d77fe6fb /driver.nsh
parent30d96f45c1a6a831bbcdd607589b75766f308582 (diff)
Add pnputil support to driver.nsh
The method used by driver.nsh only supports winxp/win2k. pnputil is what should be used for newer windows (Vista/7)
Diffstat (limited to 'driver.nsh')
-rw-r--r--driver.nsh22
1 files changed, 22 insertions, 0 deletions
diff --git a/driver.nsh b/driver.nsh
index 71ca103..c6d242f 100644
--- a/driver.nsh
+++ b/driver.nsh
@@ -60,6 +60,8 @@ Function InstallUpgradeDriver
StrCmp $R3 '2000' lbl_upgrade
StrCmp $R3 'XP' lbl_upgrade
StrCmp $R3 '2003' lbl_upgrade
+ StrCmp $R3 'Vista' lbl_pnputil
+ StrCmp $R3 '7' lbl_pnputil
DetailPrint "Windows $R3 doesn't support automatic driver updates."
; Upgrade the driver if the device is already plugged in
@@ -84,6 +86,7 @@ lbl_notplugged:
Goto lbl_noupgrade
lbl_noapi:
DetailPrint "Your Windows $R3 doesn't support driver updates."
+ Goto lbl_noupgrade
lbl_noupgrade:
; Pre-install the driver
@@ -92,6 +95,7 @@ lbl_noupgrade:
StrCmp $0 'error' lbl_inoapi
DetailPrint "Installing the driver..."
; INFPATH, INFDIR, SPOST_PATH, "", 0, 0, 0, 0
+ DetailPrint 'DEBUG: $R1 $R2 ${SPOST_PATH}'
System::Call '${sysSetupCopyOEMInf}?e (R1, R2, ${SPOST_PATH}, 0, 0, 0, 0, 0) .r0'
Pop $1 ; last error
IntCmp $0 1 lbl_nodriver
@@ -99,6 +103,24 @@ lbl_noupgrade:
Goto lbl_done
lbl_inoapi:
DetailPrint "Your Windows $R3 doesn't support driver pre-installation."
+ Goto lbl_nodriver
+
+lbl_pnputil:
+ DetailPrint 'pnputil.exe -i -a "$R1"'
+ nsExec::ExecToLog 'pnputil.exe -i -a "$R1"'
+ Pop $0
+ StrCmp $0 "error" lbl_pnputil_not_found
+ StrCmp $0 "timeout" lbl_pnputil_timeout
+ IntCmp $0 0 lbl_done
+ DetailPrint "pnputil.exe reported an error: $0"
+ Goto lbl_nodriver
+lbl_pnputil_not_found:
+ DetailPrint "pnputil.exe not found"
+ Goto lbl_nodriver
+lbl_pnputil_timeout:
+ DetailPrint "timeout waiting for pnputil.exe to run"
+ Goto lbl_nodriver
+
lbl_nodriver:
lbl_done: