1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-26 17:39:03 +00:00

Initialize our NPF/Start registry key with the value 3 (SERVICE_DEMAND_START)

before possibly changing it to 2 (SERVICE_AUTO_START) at the user's request.
This ensures that if the "Start NPF service at boot" option is unchecked, the
NPF service will not start at boot, even if WinPcap was previously installed
that way. The patch is by Rob Nicholls.
This commit is contained in:
david
2010-01-15 20:14:15 +00:00
parent 5459be2d91
commit d7b920cae6

View File

@@ -333,6 +333,16 @@ FunctionEnd
; The stuff to install
Section "WinPcap" SecWinPcap
; stop the service, in case it's still registered, so files can be
; safely overwritten and the service can be deleted.
nsExec::Exec "net stop npf"
; NB: We may need to introduce a check here to ensure that NPF
; has been stopped before we continue, otherwise we Sleep for a
; while and try the check again. This might help prevent any race
; conditions during a silent install (and potentially during the
; slower GUI installation.
; These x86 files are automatically redirected to the right place on x64
SetOutPath $SYSDIR
File pthreadVC.dll
@@ -398,13 +408,13 @@ Section "WinPcap" SecWinPcap
npfdone:
; stop the service, in case it's still registered, so it can be deleted
nsExec::Exec "net stop npf"
; register the driver as a system service using Windows API calls
; this will work on Windows 2000 (that lacks sc.exe) and higher
Call registerServiceAPI
; Create the default NPF startup setting of 3 (SERVICE_DEMAND_START)
WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Services\NPF" "Start" 3
; automatically start the service if performing a silent install, unless
; /NPFSTARTUP=NO was given.
IfSilent 0 skip_auto_start