1
0
mirror of https://github.com/nmap/nmap.git synced 2026-01-04 05:39:01 +00:00

Expand tabs and remove trailing whitespace in winpcap-nmap.nsi.

This commit is contained in:
david
2010-05-05 17:43:20 +00:00
parent 060d2b3c60
commit 07f3164937

View File

@@ -13,11 +13,11 @@
;; Rob Nicholls
;; Updated to 4.1.1, October 2009
;--------------------------------
;Include Modern UI
!include "MUI.nsh"
!include "FileFunc.nsh"
;--------------------------------
;Include Modern UI
!include "MUI.nsh"
!include "FileFunc.nsh"
;--------------------------------
;General
@@ -36,62 +36,62 @@ InstallDir $PROGRAMFILES\WinPcap
VIProductVersion "4.1.0.1753"
VIAddVersionKey /LANG=1033 "FileVersion" "4.1.0.1753"
VIAddVersionKey /LANG=1033 "ProductName" "WinPcap"
VIAddVersionKey /LANG=1033 "FileDescription" "WinPcap 4.1.1 installer"
VIAddVersionKey /LANG=1033 "ProductName" "WinPcap"
VIAddVersionKey /LANG=1033 "FileDescription" "WinPcap 4.1.1 installer"
VIAddVersionKey /LANG=1033 "LegalCopyright" ""
;--------------------------------
; Windows API Definitions
!define SC_MANAGER_ALL_ACCESS 0x3F
!define SERVICE_ALL_ACCESS 0xF01FF
!define SC_MANAGER_ALL_ACCESS 0x3F
!define SERVICE_ALL_ACCESS 0xF01FF
; Service Types
!define SERVICE_FILE_SYSTEM_DRIVER 0x00000002
!define SERVICE_KERNEL_DRIVER 0x00000001
!define SERVICE_WIN32_OWN_PROCESS 0x00000010
!define SERVICE_WIN32_SHARE_PROCESS 0x00000020
!define SERVICE_INTERACTIVE_PROCESS 0x00000100
!define SERVICE_FILE_SYSTEM_DRIVER 0x00000002
!define SERVICE_KERNEL_DRIVER 0x00000001
!define SERVICE_WIN32_OWN_PROCESS 0x00000010
!define SERVICE_WIN32_SHARE_PROCESS 0x00000020
!define SERVICE_INTERACTIVE_PROCESS 0x00000100
; Service start options
!define SERVICE_AUTO_START 0x00000002
!define SERVICE_BOOT_START 0x00000000
!define SERVICE_DEMAND_START 0x00000003
!define SERVICE_DISABLED 0x00000004
!define SERVICE_SYSTEM_START 0x00000001
!define SERVICE_AUTO_START 0x00000002
!define SERVICE_BOOT_START 0x00000000
!define SERVICE_DEMAND_START 0x00000003
!define SERVICE_DISABLED 0x00000004
!define SERVICE_SYSTEM_START 0x00000001
; Service Error control
!define SERVICE_ERROR_CRITICAL 0x00000003
!define SERVICE_ERROR_IGNORE 0x00000000
!define SERVICE_ERROR_NORMAL 0x00000001
!define SERVICE_ERROR_SEVERE 0x00000002
!define SERVICE_ERROR_CRITICAL 0x00000003
!define SERVICE_ERROR_IGNORE 0x00000000
!define SERVICE_ERROR_NORMAL 0x00000001
!define SERVICE_ERROR_SEVERE 0x00000002
; Service Control Options
!define SERVICE_CONTROL_STOP 0x00000001
!define SERVICE_CONTROL_PAUSE 0x00000002
!define SERVICE_CONTROL_STOP 0x00000001
!define SERVICE_CONTROL_PAUSE 0x00000002
;--------------------------------
;Interface Settings
!define MUI_ABORTWARNING
;--------------------------------
;Interface Settings
!define MUI_ABORTWARNING
;--------------------------------
;Pages
!insertmacro MUI_PAGE_LICENSE "LICENSE"
!insertmacro MUI_PAGE_LICENSE "LICENSE"
; Don't let user choose where to install the files. WinPcap doesn't let people, and it's one less thing for us to worry about.
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
Page custom optionsPage doOptions
Page custom finalPage doFinal
;--------------------------------
;Languages
!insertmacro MUI_LANGUAGE "English"
;--------------------------------
;Languages
!insertmacro MUI_LANGUAGE "English"
;--------------------------------
;Reserves
@@ -122,9 +122,9 @@ Function .onInit
var /GLOBAL inst_ver
var /GLOBAL my_ver
var /GLOBAL npf_startup
StrCpy $my_ver "4.1.0.1753"
StrCpy $my_ver "4.1.0.1753"
StrCpy $npf_startup "YES"
${GetParameters} $R0
ClearErrors
${GetOptions} $R0 "/NPFSTARTUP=" $npf_startup
@@ -139,12 +139,12 @@ Function .onInit
; check for the presence of Nmap's custom WinPcapInst registry key:
ReadRegStr $0 "HKLM" "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\WinPcapInst" "InstalledBy"
StrCmp $0 "Nmap" silent_uninstall winpcap_installedby_keys_not_present
winpcap_installedby_keys_not_present:
winpcap_installedby_keys_not_present:
; check for the presence of WinPcapInst's UninstallString
; and manually cleanup registry entries to avoid running
; the GUI uninstaller and assume our installer will overwrite
; the files. Needs to be checked in case someone (force)
; and manually cleanup registry entries to avoid running
; the GUI uninstaller and assume our installer will overwrite
; the files. Needs to be checked in case someone (force)
; installs WinPcap over the top of our installation
ReadRegStr $0 "HKLM" "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\WinPcapInst" "UninstallString"
StrCmp $0 "" winpcap_keys_not_present
@@ -157,20 +157,20 @@ Function .onInit
Delete $0\rpcapd.exe
Delete $0\LICENSE
Delete $0\uninstall.exe
; Official 4.1 installer creates an install.log
Delete $0\install.log
; Official 4.1 installer creates an install.log
Delete $0\install.log
RMDir "$0"
DeleteRegKey HKLM "Software\WinPcap"
; because we've deleted their uninstaller, skip the next
; because we've deleted their uninstaller, skip the next
; registry key check (we'll still need to overwrite stuff)
Goto winpcap-nmap_keys_not_present
winpcap_keys_not_present:
; if our old registry key is present then assume all is well
; (we got this far so the official WinPcap wasn't installed)
; and use our uninstaller to (magically) silently uninstall
; if our old registry key is present then assume all is well
; (we got this far so the official WinPcap wasn't installed)
; and use our uninstaller to (magically) silently uninstall
; everything cleanly and avoid having to overwrite files
ReadRegStr $0 "HKLM" "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\winpcap-nmap" "UninstallString"
StrCmp $0 "" winpcap-nmap_keys_not_present silent_uninstall
@@ -185,12 +185,12 @@ Function .onInit
ExecWait '"net stop npf"'
return
silent_uninstall:
; Our old UninstallString is present, should have quotes and uninstall.exe location
; and should support a silent uninstall by passing /S to it.
ExecWait '$0 /S _?=$INSTDIR'
return
silent_uninstall:
; Our old UninstallString is present, should have quotes and uninstall.exe location
; and should support a silent uninstall by passing /S to it.
ExecWait '$0 /S _?=$INSTDIR'
return
no_silent:
IfFileExists "$SYSDIR\wpcap.dll" do_version_check
@@ -215,45 +215,45 @@ Function .onInit
quit
try_uninstallers:
; check for UninstallString and use that in preference (should already have double quotes and uninstall.exe)
ReadRegStr $0 "HKLM" "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\WinPcapInst" "UninstallString"
StrCmp $0 "" no_uninstallstring
IfFileExists "$0" uninstaller_exists no_uninstallstring
uninstaller_exists:
ExecWait '$0 _?=$INSTDIR'
return
no_uninstallstring:
; didn't find an UninstallString, check for our old UninstallString and if uninstall.exe exists:
ReadRegStr $0 "HKLM" "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\winpcap-nmap" "UninstallString"
StrCmp $0 "" still_no_uninstallstring
IfFileExists "$0" old_uninstaller_exists still_no_uninstallstring
old_uninstaller_exists:
MessageBox MB_OK "Using our old UninstallString, file exists"
ExecWait '$0 _?=$INSTDIR'
return
still_no_uninstallstring:
; still didn't find anything, try looking for an uninstall.exe file at:
; check for UninstallString and use that in preference (should already have double quotes and uninstall.exe)
ReadRegStr $0 "HKLM" "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\WinPcapInst" "UninstallString"
StrCmp $0 "" no_uninstallstring
IfFileExists "$0" uninstaller_exists no_uninstallstring
uninstaller_exists:
ExecWait '$0 _?=$INSTDIR'
return
no_uninstallstring:
; didn't find an UninstallString, check for our old UninstallString and if uninstall.exe exists:
ReadRegStr $0 "HKLM" "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\winpcap-nmap" "UninstallString"
StrCmp $0 "" still_no_uninstallstring
IfFileExists "$0" old_uninstaller_exists still_no_uninstallstring
old_uninstaller_exists:
MessageBox MB_OK "Using our old UninstallString, file exists"
ExecWait '$0 _?=$INSTDIR'
return
still_no_uninstallstring:
; still didn't find anything, try looking for an uninstall.exe file at:
ReadRegStr $0 "HKLM" "Software\WinPcap" ""
; Strip any surrounding double quotes from around the install string,
; as WinPcap hasn't used quotes in the past, but our old installers did.
; Check the first and last character for safety!
StrCpy $1 $0 1
; as WinPcap hasn't used quotes in the past, but our old installers did.
; Check the first and last character for safety!
StrCpy $1 $0 1
StrCmp $1 "$\"" maybestripquotes nostrip
maybestripquotes:
StrLen $1 $0
IntOp $1 $1 - 1
StrCpy $1 $0 1 $1
maybestripquotes:
StrLen $1 $0
IntOp $1 $1 - 1
StrCpy $1 $0 1 $1
StrCmp $1 "$\"" stripquotes nostrip
stripquotes:
StrCpy $0 $0 -1 1
nostrip:
IfFileExists "$0\uninstall.exe" run_last_uninstaller no_uninstall_exe
run_last_uninstaller:
ExecWait '"$0\Uninstall.exe" _?=$INSTDIR'
no_uninstall_exe:
stripquotes:
StrCpy $0 $0 -1 1
nostrip:
IfFileExists "$0\uninstall.exe" run_last_uninstaller no_uninstall_exe
run_last_uninstaller:
ExecWait '"$0\Uninstall.exe" _?=$INSTDIR'
no_uninstall_exe:
; give up now, we've tried our hardest to determine a valid uninstaller!
return
@@ -337,8 +337,8 @@ Section "WinPcap" SecWinPcap
; 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
; 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.
@@ -351,7 +351,7 @@ Section "WinPcap" SecWinPcap
; Check windows version
ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
DetailPrint "Windows CurrentVersion: $R0"
StrCpy $R0 $R0 2
StrCpy $R0 $R0 2
StrCmp $R0 '6.' vista_files
File nt5\x86\Packet.dll
@@ -361,63 +361,63 @@ Section "WinPcap" SecWinPcap
File vista\x86\Packet.dll
install:
; check for x64, install the correct npf.sys file into system32\drivers
System::Call "kernel32::GetCurrentProcess() i .s"
System::Call "kernel32::IsWow64Process(i s, *i .r0)"
StrCmp $0 "0" is32bit is64bit
; Note, NSIS states: "You should always quote the path to make sure spaces
; in the path will not disrupt Windows to find the uninstaller."
; See: http://nsis.sourceforge.net/Add_uninstall_information_to_Add/Remove_Programs
; This matches (most) Windows installations. Rather inconsistently,
; DisplayIcon doesn't usually have quotes (even on Microsoft installations) and
; HKLM Software\PackageName doesn't usually have quotes either.
; Note, NSIS states: "You should always quote the path to make sure spaces
; in the path will not disrupt Windows to find the uninstaller."
; See: http://nsis.sourceforge.net/Add_uninstall_information_to_Add/Remove_Programs
; This matches (most) Windows installations. Rather inconsistently,
; DisplayIcon doesn't usually have quotes (even on Microsoft installations) and
; HKLM Software\PackageName doesn't usually have quotes either.
is32bit:
SetOutPath "$PROGRAMFILES\WinPcap"
File rpcapd.exe
SetOutPath "$PROGRAMFILES\WinPcap"
File rpcapd.exe
File LICENSE
WriteUninstaller "$PROGRAMFILES\WinPcap\uninstall.exe"
DetailPrint "Installing x86 driver"
SetOutPath $SYSDIR\drivers
WriteUninstaller "$PROGRAMFILES\WinPcap\uninstall.exe"
DetailPrint "Installing x86 driver"
SetOutPath $SYSDIR\drivers
File npf.sys ; x86 NT5/NT6 version
WriteRegStr HKLM "Software\WinPcap" "" "$PROGRAMFILES\WinPcap"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinPcapInst" "UninstallString" "$\"$PROGRAMFILES\WinPcap\uninstall.exe$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinPcapInst" "QuietUninstallString" "$\"$PROGRAMFILES\WinPcap\uninstall.exe$\" /S"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinPcapInst" "DisplayIcon" "$PROGRAMFILES\WinPcap\uninstall.exe"
WriteRegStr HKLM "Software\WinPcap" "" "$PROGRAMFILES\WinPcap"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinPcapInst" "UninstallString" "$\"$PROGRAMFILES\WinPcap\uninstall.exe$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinPcapInst" "QuietUninstallString" "$\"$PROGRAMFILES\WinPcap\uninstall.exe$\" /S"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinPcapInst" "DisplayIcon" "$PROGRAMFILES\WinPcap\uninstall.exe"
Goto npfdone
is64bit:
SetOutPath "$PROGRAMFILES64\WinPcap"
File rpcapd.exe
File rpcapd.exe
File LICENSE
WriteUninstaller "$PROGRAMFILES64\WinPcap\uninstall.exe"
DetailPrint "Installing x64 driver"
SetOutPath $SYSDIR\drivers
WriteUninstaller "$PROGRAMFILES64\WinPcap\uninstall.exe"
DetailPrint "Installing x64 driver"
SetOutPath $SYSDIR\drivers
; disable Wow64FsRedirection
System::Call kernel32::Wow64EnableWow64FsRedirection(i0)
File x64\npf.sys ; x64 NT5/NT6 version
; The x86 versions of wpcap.dll and packet.dll are
; The x86 versions of wpcap.dll and packet.dll are
; installed into the right place further above.
; install the 64-bit version of wpcap.dll into System32
SetOutPath $SYSDIR
SetOutPath $SYSDIR
File x64\wpcap.dll ; x64 NT5/NT6 version
; install the 64-bit version of packet.dll into System32
; check for vista, otherwise install the NT5 version (for XP and 2003)
StrCpy $R0 $R0 2
StrCpy $R0 $R0 2
StrCmp $R0 '6.' vista_x64_packet
File nt5\x64\Packet.dll ; x64 XP/2003 version
Goto nt5_x64_packet_done
vista_x64_packet:
File vista\x64\Packet.dll ; x64 Vista version
nt5_x64_packet_done:
WriteRegStr HKLM "Software\WinPcap" "" "$PROGRAMFILES64\WinPcap"
WriteRegStr HKLM "Software\WinPcap" "" "$PROGRAMFILES64\WinPcap"
; re-enable Wow64FsRedirection
System::Call kernel32::Wow64EnableWow64FsRedirection(i1)
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinPcapInst" "UninstallString" "$\"$PROGRAMFILES64\WinPcap\uninstall.exe$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinPcapInst" "QuietUninstallString" "$\"$PROGRAMFILES64\WinPcap\uninstall.exe$\" /S"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinPcapInst" "DisplayIcon" "$PROGRAMFILES64\WinPcap\uninstall.exe"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinPcapInst" "UninstallString" "$\"$PROGRAMFILES64\WinPcap\uninstall.exe$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinPcapInst" "QuietUninstallString" "$\"$PROGRAMFILES64\WinPcap\uninstall.exe$\" /S"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinPcapInst" "DisplayIcon" "$PROGRAMFILES64\WinPcap\uninstall.exe"
npfdone:
@@ -436,26 +436,26 @@ Section "WinPcap" SecWinPcap
skip_auto_start:
; Write the rest of the uninstall keys for Windows
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinPcapInst" "DisplayName" "WinPcap 4.1.1"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinPcapInst" "DisplayVersion" "4.1.0.1753"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinPcapInst" "Publisher" "CACE Technologies"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinPcapInst" "URLInfoAbout" "http://www.cacetech.com"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinPcapInst" "URLUpdateInfo" "http://www.winpcap.org"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinPcapInst" "VersionMajor" "4"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinPcapInst" "VersionMinor" "1"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinPcapInst" "InstalledBy" "Nmap"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinPcapInst" "DisplayName" "WinPcap 4.1.1"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinPcapInst" "DisplayVersion" "4.1.0.1753"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinPcapInst" "Publisher" "CACE Technologies"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinPcapInst" "URLInfoAbout" "http://www.cacetech.com"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinPcapInst" "URLUpdateInfo" "http://www.winpcap.org"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinPcapInst" "VersionMajor" "4"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinPcapInst" "VersionMinor" "1"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinPcapInst" "InstalledBy" "Nmap"
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinPcapInst" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinPcapInst" "NoRepair" 1
; delete our legacy winpcap-nmap keys if they still exist (e.g. official 4.0.2 force installed over our 4.0.2):
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\winpcap-nmap"
SectionEnd ; end the section
;--------------------------------
;Uninstaller Section
;--------------------------------
;Uninstaller Section
Section "Uninstall"