[~] setup: Installer was redesigned to allow user select what components to install: Pykd(required), Snippets(optional), Python(optional), VC Runtime(optional).

[~] setup: Snippets installed to "My Documents"\pykd. 
[~] setup: Python and VCRuntime present only if not detected by installer.
[~] setup: Installer add extension dir and snippets dir to PYTHONPATH via appropriate Python registry entry. So, snippets can be launched from WinDbg without path specifying. Also, extension can be easy used when run outside of WinDbg.
[~] setup: Provided uninstaller. Its also allow user to select what components to remove: Pykd(required), Python(optional), VC Runtime(optional).


git-svn-id: https://pykd.svn.codeplex.com/svn@63452 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
SND\air_max_cp 2011-04-04 16:49:58 +00:00
parent 6089daf982
commit f111bd9610
4 changed files with 331 additions and 171 deletions

View File

@ -1,19 +1,27 @@
Function WinSxS_HasAssembly ;legacyDllName,(Strong)AssemblyName !ifndef HASASSEMBLY_INCLUDED
/* !define HASASSEMBLY_INCLUDED
push 'msvcr80.dll' !verbose Push
push 'Microsoft.VC80.CRT,version="8.0.50727.42",type="win32",processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b"' !verbose 3
call WinSxS_HasAssembly
pop $0 ;0 on fail, 1 if it is in WinSxS or 2 if LoadLibrary worked on pre xp (call GetDLLVersion to make sure if you require a minimum version) !include LogicLib.nsh
*/ !include Util.nsh
Exch $8
Exch !macro _WinSxS_HasAssembly
Exch $7 /*
push $9 push 'msvcr80.dll'
StrCpy $9 0 push 'Microsoft.VC80.CRT,version="8.0.50727.42",type="win32",processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b"'
push $0 Call WinSxS_HasAssembly
push $R0 pop $0 ;0 on fail, 1 if it is in WinSxS or 2 if LoadLibrary worked on pre xp (call GetDLLVersion to make sure if you require a minimum version)
push $R1 */
${If} ${AtLeastWinXP} Exch $8
Exch
Exch $7
push $9
StrCpy $9 0
push $0
push $R0
push $R1
${If} ${AtLeastWinXP}
System::Call "sxs::CreateAssemblyCache(*i.R0,i0)i.r0" System::Call "sxs::CreateAssemblyCache(*i.R0,i0)i.r0"
${If} $0 == 0 ${If} $0 == 0
System::Call '*(i 24,i0,l,i0,i0)i.R1' ;TODO,BUGBUG: check alloc success System::Call '*(i 24,i0,l,i0,i0)i.R1' ;TODO,BUGBUG: check alloc success
@ -26,18 +34,29 @@ ${If} ${AtLeastWinXP}
System::Free $R1 System::Free $R1
System::Call $R0->2() ;IAssemblyCache::Release System::Call $R0->2() ;IAssemblyCache::Release
${EndIf} ${EndIf}
${Else} ${Else}
System::Call kernel32::LoadLibrary(t"$7")i.r0 System::Call kernel32::LoadLibrary(t"$7")i.r0
${If} $0 != 0 ${If} $0 != 0
StrCpy $9 2 StrCpy $9 2
System::Call 'kernel32::FreeLibrary(i r0)' System::Call 'kernel32::FreeLibrary(i r0)'
${EndIf} ${EndIf}
${EndIf} ${EndIf}
pop $R1 pop $R1
pop $R0 pop $R0
pop $0 pop $0
Exch 2 Exch 2
pop $8 pop $8
pop $7 pop $7
Exch $9 Exch $9
!macroend
Function WinSxS_HasAssembly
!insertmacro _WinSxS_HasAssembly
FunctionEnd FunctionEnd
Function un.WinSxS_HasAssembly
!insertmacro _WinSxS_HasAssembly
FunctionEnd
!verbose Pop
!endif

View File

@ -11,6 +11,7 @@ SetCompressor LZMA
!include "WinVer.nsh" !include "WinVer.nsh"
!include "FileFunc.nsh" !include "FileFunc.nsh"
!include "x64.nsh" !include "x64.nsh"
!include "Sections.nsh"
!addincludedir .\Include !addincludedir .\Include
!addplugindir .\Plugins !addplugindir .\Plugins
@ -29,6 +30,7 @@ SetCompressor LZMA
!define PRODUCT_VERSION "0.0.0.16" !define PRODUCT_VERSION "0.0.0.16"
!define PRODUCT_URL "http://pykd.codeplex.com/" !define PRODUCT_URL "http://pykd.codeplex.com/"
!define PRODUCT_NAME_AND_VERSION "${PRODUCT_FULL_NAME} ${PRODUCT_ARCH} ${PRODUCT_VERSION}" !define PRODUCT_NAME_AND_VERSION "${PRODUCT_FULL_NAME} ${PRODUCT_ARCH} ${PRODUCT_VERSION}"
!define PRODUCT_MANUFACTURER "PyKd Team"
!if ${PRODUCT_ARCH} == "x64" !if ${PRODUCT_ARCH} == "x64"
!define ARCH "amd64" !define ARCH "amd64"
@ -46,6 +48,7 @@ BrandingText "${PRODUCT_FULL_NAME}"
RequestExecutionLevel admin RequestExecutionLevel admin
ShowInstDetails show ShowInstDetails show
ShowUninstDetails show
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Variables # Variables
@ -57,9 +60,11 @@ ShowInstDetails show
!define MUI_ABORTWARNING !define MUI_ABORTWARNING
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\orange-install.ico" !define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\orange-install.ico"
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\orange-uninstall.ico"
!define MUI_HEADERIMAGE !define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Header\orange.bmp" !define MUI_HEADERIMAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Header\orange.bmp"
!define MUI_HEADERIMAGE_UNBITMAP "${NSISDIR}\Contrib\Graphics\Header\orange-uninstall.bmp"
!define MUI_WELCOMEPAGE_TITLE_3LINES !define MUI_WELCOMEPAGE_TITLE_3LINES
!define MUI_WELCOMEFINISHPAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Wizard\orange.bmp" !define MUI_WELCOMEFINISHPAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Wizard\orange.bmp"
@ -70,20 +75,28 @@ ShowInstDetails show
!define MUI_FINISHPAGE_TITLE_3LINES !define MUI_FINISHPAGE_TITLE_3LINES
!define MUI_FINISHPAGE_TEXT_LARGE !define MUI_FINISHPAGE_TEXT_LARGE
!define MUI_FINISHPAGE_TEXT "${PRODUCT_NAME_AND_VERSION} was successfully installed.$\n$\n\ !define MUI_FINISHPAGE_TEXT "${PRODUCT_NAME_AND_VERSION} was successfully installed.$\n$\n\
Run WinDbg and type $\".load pykd.pyd$\" to start using plugin." Run WinDbg and type $\".load pykd.pyd$\" to start using it."
!define MUI_FINISHPAGE_NOAUTOCLOSE !define MUI_FINISHPAGE_NOAUTOCLOSE
!define MUI_COMPONENTSPAGE_SMALLDESC
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Pages # Pages
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Installer Pages # Installer Pages
!insertmacro MUI_PAGE_WELCOME !insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "pykd_license.txt" !insertmacro MUI_PAGE_LICENSE "pykd_license.txt"
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY !insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH !insertmacro MUI_PAGE_FINISH
# Uninstaller Pages
#!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_COMPONENTS
!insertmacro MUI_UNPAGE_INSTFILES
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Languages (first is default language) # Languages (first is default language)
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
@ -96,41 +109,51 @@ ShowInstDetails show
VIProductVersion "${PRODUCT_VERSION}" VIProductVersion "${PRODUCT_VERSION}"
VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductName" "${PRODUCT_SHORT_NAME}" VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductName" "${PRODUCT_SHORT_NAME}"
VIAddVersionKey /LANG=${LANG_ENGLISH} "Comments" "${PRODUCT_NAME_AND_VERSION}" VIAddVersionKey /LANG=${LANG_ENGLISH} "Comments" "${PRODUCT_NAME_AND_VERSION}"
#VIAddVersionKey /LANG=${LANG_ENGLISH} "CompanyName" "${MANUFACTURER}" VIAddVersionKey /LANG=${LANG_ENGLISH} "CompanyName" "${PRODUCT_MANUFACTURER}"
#VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalTrademarks" "${PRODUCT_NAME} is a trademark of ${MANUFACTURER} company" VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalTrademarks" "${PRODUCT_SHORT_NAME} is a trademark of ${PRODUCT_MANUFACTURER}"
VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "© All rights reserved" VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "© All rights reserved 2010-2011"
VIAddVersionKey /LANG=${LANG_ENGLISH} "FileDescription" "${PRODUCT_SHORT_NAME} setup" VIAddVersionKey /LANG=${LANG_ENGLISH} "FileDescription" "${PRODUCT_SHORT_NAME} setup"
VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "${PRODUCT_VERSION}" VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "${PRODUCT_VERSION}"
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Before first page displayed # Some logic-lib like macro
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
Function .onInit !macro SetRegView64
System::Call 'kernel32::CreateMutexA(i 0, i 0, t "${PRODUCT_SHORT_NAME}_${PRODUCT_ARCH}_setup") i .r1 ?e'
Pop $R0
${If} $R0 != 0
MessageBox MB_OK|MB_ICONEXCLAMATION "The installer is already running."
Abort
${EndIf}
!if ${PRODUCT_ARCH} == "x64" !if ${PRODUCT_ARCH} == "x64"
${IfNot} ${RunningX64} SetRegView 64
MessageBox MB_OK|MB_ICONEXCLAMATION "This installation requires 64-bit OS."
Abort
${EndIf}
!endif !endif
!macroend
!define SetRegView64 "!insertmacro SetRegView64"
# Get installation folder from registry if available !macro SetRegView32
!if ${PRODUCT_ARCH} == "x64" !if ${PRODUCT_ARCH} == "x64"
${IfThen} ${RunningX64} ${|} SetRegView 64 ${|} SetRegView 32
!endif !endif
ReadRegStr $INSTDIR HKLM "Software\${PRODUCT_SHORT_NAME}" "InstallPath" !macroend
!if ${PRODUCT_ARCH} == "x64" !define SetRegView32 "!insertmacro SetRegView32"
${IfThen} ${RunningX64} ${|} SetRegView 32 ${|}
!endif
FunctionEnd
!macro _IsVcRuntimeInstalled _a _b _t _f
!insertmacro _LOGICLIB_TEMP
Push 'msvcr80.dll'
Push 'Microsoft.VC80.CRT,version="8.0.50727.4053",type="win32",processorArchitecture="${ARCH}",publicKeyToken="1fc8b3b9a1e18e3b"'
${WinSxS_HasAssembly}
Pop $_LOGICLIB_TEMP
!insertmacro _== $_LOGICLIB_TEMP 1 `${_t}` `${_f}`
!macroend
!define IsVcRuntimeInstalled `"" IsVcRuntimeInstalled ""`
!define un.IsVcRuntimeInstalled `"" IsVcRuntimeInstalled ""`
!macro _IsPythonInstalled _a _b _t _f
!insertmacro _LOGICLIB_TEMP
${SetRegView64}
# Check Python ${PYTHON_VERSION} ${PRODUCT_ARCH}...
ReadRegStr $_LOGICLIB_TEMP HKLM "Software\Python\PythonCore\${PYTHON_VERSION}\InstallPath" ""
${SetRegView32}
!insertmacro _!= $_LOGICLIB_TEMP "" `${_t}` `${_f}`
!macroend
!define IsPythonInstalled `"" IsPythonInstalled ""`
!define un.IsPythonInstalled `"" IsPythonInstalled ""`
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Check WinDbg executable presence in selected directory # Check WinDbg executable presence in selected directory
@ -146,69 +169,35 @@ FunctionEnd
# Installer Sections # Installer Sections
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
Section "${PRODUCT_SHORT_NAME}" Section1 Section "${PRODUCT_SHORT_NAME} ${PRODUCT_ARCH}" sec_pykd
DetailPrint "Check Microsoft Visual C++ 2005 SP1 (${PRODUCT_ARCH}) runtime library..." SectionIn RO
push 'msvcr80.dll'
#push 'Microsoft.VC80.CRT,version="8.0.50727.4027",type="win32",processorArchitecture="${ARCH}",publicKeyToken="1fc8b3b9a1e18e3b"'
push 'Microsoft.VC80.CRT,version="8.0.50727.4053",type="win32",processorArchitecture="${ARCH}",publicKeyToken="1fc8b3b9a1e18e3b"'
call WinSxS_HasAssembly
pop $R0
${If} $R0 == 1 # Set Section properties
DetailPrint "Success" SetOverwrite on
${Else}
DetailPrint "Not find"
DetailPrint "Going to download and install it."
MessageBox MB_YESNOCANCEL|MB_ICONQUESTION "${PRODUCT_SHORT_NAME} requires Microsoft Visual C++ 2005 SP1 (${PRODUCT_ARCH}) runtime library. Download and install it automatically?$\n\ # CURRENT USER
Press YES to allow.$\n\ SetShellVarContext current
Press NO to continue without runtime.$\n\
Press CANCEL to exit from installer." IDYES DownloadAndInstallRuntime IDNO ContinueNoRuntime
DetailPrint "${PRODUCT_FULL_NAME} installation cancelled."
Abort
DownloadAndInstallRuntime:
DetailPrint "Downloading Microsoft Visual C++ 2005 SP1 (${PRODUCT_ARCH}) runtime library..."
inetc::get /CAPTION "${PRODUCT_SHORT_NAME}" /QUESTION "" /POPUP "" /TIMEOUT=30000 "${VC_RUNTIME_URL}" "$TEMP\vcredist_${PRODUCT_ARCH}.exe" /END
Pop $0
${If} $0 == "OK"
DetailPrint "Successfully downloaded."
DetailPrint "Installing Microsoft Visual C++ 2005 SP1 (${PRODUCT_ARCH}) runtime library..."
IfErrors ClearErrorFlag
ClearErrorFlag:
ExecWait "$TEMP\vcredist_${PRODUCT_ARCH}.exe"
IfErrors RuntimeInstallFailed
DetailPrint "Successfully installed."
${Else}
RuntimeInstallFailed:
DetailPrint "Operation failed. Installation will be continued without Visual C++ runtime."
DetailPrint "Please download and install it manually from product download page:"
DetailPrint "${VC_RUNTIME_URL}"
${EndIf}
ContinueNoRuntime:
${EndIf} DetailPrint "Extracting extension..."
SetOutPath "$INSTDIR"
DetailPrint "Check Python ${PYTHON_VERSION} ${PRODUCT_ARCH}..."
!if ${PRODUCT_ARCH} == "x64" !if ${PRODUCT_ARCH} == "x64"
${IfThen} ${RunningX64} ${|} SetRegView 64 ${|} File "..\x64\Release\pykd.pyd"
!endif !else
ReadRegStr $R0 HKLM "Software\Python\PythonCore\${PYTHON_VERSION}\InstallPath" "" File "..\Release\pykd.pyd"
!if ${PRODUCT_ARCH} == "x64"
${IfThen} ${RunningX64} ${|} SetRegView 32 ${|}
!endif !endif
SectionEnd
${If} $R0 == "" Section "Snippets" sec_snippets
DetailPrint "Appropiate Python version was no not find in:" # Set Section properties
DetailPrint "HKLM\Software\Python\PythonCore\${PYTHON_VERSION}\InstallPath" SetOverwrite on
DetailPrint "Going to download and install it."
MessageBox MB_YESNOCANCEL|MB_ICONQUESTION "${PRODUCT_SHORT_NAME} requires Python ${PYTHON_VERSION}. Download and install it automatically?$\n\ DetailPrint "Extracting snippets..."
Press YES to allow.$\n\ SetOutPath "$DOCUMENTS\${PRODUCT_SHORT_NAME}"
Press NO to continue without Python.$\n\ File "..\Snippets\*.py"
Press CANCEL to exit from installer." IDYES DownloadAndInstallPython IDNO ContinueNoPython SectionEnd
DetailPrint "${PRODUCT_FULL_NAME} installation cancelled."
Abort Section "Python ${PYTHON_VERSION} ${PRODUCT_ARCH}" sec_python
DownloadAndInstallPython:
DetailPrint "Downloading Python..." DetailPrint "Downloading Python..."
inetc::get /CAPTION "${PRODUCT_SHORT_NAME}" /QUESTION "" /POPUP "" /TIMEOUT=30000 "${PYTHON_URL_BASE}${PYTHON_INSTALLER}" "$TEMP\${PYTHON_INSTALLER}" /END inetc::get /CAPTION "${PRODUCT_SHORT_NAME}" /QUESTION "" /POPUP "" /TIMEOUT=30000 "${PYTHON_URL_BASE}${PYTHON_INSTALLER}" "$TEMP\${PYTHON_INSTALLER}" /END
Pop $0 Pop $0
@ -226,36 +215,172 @@ Section "${PRODUCT_SHORT_NAME}" Section1
DetailPrint "Please download and install it manually:" DetailPrint "Please download and install it manually:"
DetailPrint "${PYTHON_URL_BASE}${PYTHON_INSTALLER}" DetailPrint "${PYTHON_URL_BASE}${PYTHON_INSTALLER}"
${EndIf} ${EndIf}
ContinueNoPython: SectionEnd
Section "Visual C++ 2005 SP1 (${PRODUCT_ARCH}) runtime" sec_vcruntime
DetailPrint "Downloading Microsoft Visual C++ 2005 SP1 (${PRODUCT_ARCH}) runtime library..."
inetc::get /CAPTION "${PRODUCT_SHORT_NAME}" /QUESTION "" /POPUP "" /TIMEOUT=30000 "${VCRUNTIME_URL}" "$TEMP\vcredist_${PRODUCT_ARCH}.exe" /END
Pop $0
${If} $0 == "OK"
DetailPrint "Successfully downloaded."
DetailPrint "Installing Microsoft Visual C++ 2005 SP1 (${PRODUCT_ARCH}) runtime library..."
IfErrors ClearErrorFlag
ClearErrorFlag:
ExecWait "$TEMP\vcredist_${PRODUCT_ARCH}.exe"
IfErrors RuntimeInstallFailed
DetailPrint "Successfully installed."
${Else} ${Else}
DetailPrint "Python ${PYTHON_VERSION} ${PRODUCT_ARCH} location: $R0" RuntimeInstallFailed:
DetailPrint "Operation failed. Installation will be continued without Visual C++ runtime."
DetailPrint "Please download and install it manually from product download page:"
DetailPrint "${VCRUNTIME_URL}"
${EndIf} ${EndIf}
# Set Section properties
SetOverwrite on
# CURRENT USER
SetShellVarContext current
# Set Section Files and Shortcuts
SetOutPath "$INSTDIR"
# Extract files
!if ${PRODUCT_ARCH} == "x64"
File "..\x64\Release\pykd.pyd"
!else
File "..\Release\pykd.pyd"
!endif
SectionEnd SectionEnd
Section -FinishSection Section -FinishSection
#Store installation folder ${SetRegView64}
!if ${PRODUCT_ARCH} == "x64" DetailPrint "Storing installation folder..."
${IfThen} ${RunningX64} ${|} SetRegView 64 ${|}
!endif
WriteRegStr HKLM "Software\${PRODUCT_SHORT_NAME}" "InstallPath" "$INSTDIR" WriteRegStr HKLM "Software\${PRODUCT_SHORT_NAME}" "InstallPath" "$INSTDIR"
!if ${PRODUCT_ARCH} == "x64"
${IfThen} ${RunningX64} ${|} SetRegView 32 ${|} DetailPrint "Adding extension dir and snippets dir to PYTHONPATH..."
!endif WriteRegStr HKLM "Software\Python\PythonCore\${PYTHON_VERSION}\PythonPath\${PRODUCT_SHORT_NAME}" "" "$INSTDIR;$DOCUMENTS\${PRODUCT_SHORT_NAME}"
DetailPrint "Registering uninstaller..."
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_SHORT_NAME}" "DisplayName" "${PRODUCT_FULL_NAME} (${PRODUCT_ARCH})"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_SHORT_NAME}" "UninstallString" "$LOCALAPPDATA\${PRODUCT_SHORT_NAME}\uninstall_${PRODUCT_ARCH}.exe"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_SHORT_NAME}" "Publisher" "${PRODUCT_MANUFACTURER}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_SHORT_NAME}" "URLInfoAbout" "${PRODUCT_URL}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_SHORT_NAME}" "DisplayVersion" "${PRODUCT_VERSION}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_SHORT_NAME}" "DisplayIcon" "$LOCALAPPDATA\${PRODUCT_SHORT_NAME}\uninstall_${PRODUCT_ARCH}.exe"
${SetRegView32}
DetailPrint "Writing uninstaller..."
CreateDirectory "$LOCALAPPDATA\${PRODUCT_SHORT_NAME}"
WriteUninstaller "$LOCALAPPDATA\${PRODUCT_SHORT_NAME}\uninstall_${PRODUCT_ARCH}.exe"
SectionEnd SectionEnd
#------------------------------------------------------------------------------
# Before first page displayed
#------------------------------------------------------------------------------
# Workaround to allow ${IsVcRuntimeInstalled} work properly
!define WinSxS_HasAssembly `Call WinSxS_HasAssembly`
Function .onInit
System::Call 'kernel32::CreateMutexA(i 0, i 0, t "${PRODUCT_SHORT_NAME}_${PRODUCT_ARCH}_setup") i .r1 ?e'
Pop $R0
${If} $R0 != 0
MessageBox MB_OK|MB_ICONEXCLAMATION "The installer is already running."
Abort
${EndIf}
!if ${PRODUCT_ARCH} == "x64"
${IfNot} ${RunningX64}
MessageBox MB_OK|MB_ICONEXCLAMATION "This installation requires 64-bit OS."
Abort
${EndIf}
!endif
${SetRegView64}
# Get installation folder from registry if available
ReadRegStr $INSTDIR HKLM "Software\${PRODUCT_SHORT_NAME}" "InstallPath"
${SetRegView32}
${If} ${IsPythonInstalled}
!insertmacro UnselectSection ${sec_python}
SectionSetText ${sec_python} ""
${EndIf}
${If} ${IsVcRuntimeInstalled}
!insertmacro UnselectSection ${sec_vcruntime}
SectionSetText ${sec_vcruntime} ""
${EndIf}
FunctionEnd
#------------------------------------------------------------------------------
# Installer sections descriptions
#------------------------------------------------------------------------------
LangString DESC_sec_pykd ${LANG_ENGLISH} "${PRODUCT_FULL_NAME}"
LangString DESC_sec_snippets ${LANG_ENGLISH} "Useful code snippets. Will be installed in $DOCUMENTS\${PRODUCT_SHORT_NAME}"
LangString DESC_sec_python ${LANG_ENGLISH} "Let installer download and setup Python ${PYTHON_VERSION} ${PRODUCT_ARCH}"
LangString DESC_sec_vcruntime ${LANG_ENGLISH} "Let installer download and setup Microsoft Visual C++ 2005 SP1 (${PRODUCT_ARCH}) runtime library"
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${sec_pykd} $(DESC_sec_pykd)
!insertmacro MUI_DESCRIPTION_TEXT ${sec_snippets} $(DESC_sec_snippets)
!insertmacro MUI_DESCRIPTION_TEXT ${sec_python} $(DESC_sec_python)
!insertmacro MUI_DESCRIPTION_TEXT ${sec_vcruntime} $(DESC_sec_vcruntime)
!insertmacro MUI_FUNCTION_DESCRIPTION_END
#------------------------------------------------------------------------------
# Uninstaller sections
#------------------------------------------------------------------------------
Section "un.${PRODUCT_SHORT_NAME} ${PRODUCT_ARCH}" unsec_pykd
SectionIn RO
${SetRegView64}
DetailPrint "Retriving installation folder from registry..."
ReadRegStr $INSTDIR HKLM "Software\${PRODUCT_SHORT_NAME}" "InstallPath"
DetailPrint "Deleting extension dir and snippets dir from PYTHONPATH..."
DeleteRegKey HKLM "Software\Python\PythonCore\${PYTHON_VERSION}\PythonPath\${PRODUCT_SHORT_NAME}"
DetailPrint "Unregistering uninstaller..."
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_SHORT_NAME}"
${SetRegView32}
DetailPrint "Deleting extension..."
Delete "$INSTDIR\pykd.pyd"
# Let user delete snippets himself
#RMDir "$DOCUMENTS\${PRODUCT_SHORT_NAME}"
DetailPrint "Deleting uninstaller..."
Delete "$LOCALAPPDATA\${PRODUCT_SHORT_NAME}\uninstall_${PRODUCT_ARCH}.exe"
RMDir "$LOCALAPPDATA\${PRODUCT_SHORT_NAME}"
SectionEnd
Section /o "un.Python ${PYTHON_VERSION} ${PRODUCT_ARCH}" unsec_python
DetailPrint "Uninstalling Python..."
ExecWait '"msiexec" /x ${PYTHON_PRODUCT_CODE}'
SectionEnd
Section /o "un.Visual C++ 2005 SP1 (${PRODUCT_ARCH}) runtime" unsec_vcruntime
DetailPrint "Uninstalling Microsoft Visual C++ 2005 SP1 (${PRODUCT_ARCH}) runtime library..."
ExecWait '"msiexec" /x ${VCRUNTIME_PRODUCT_CODE}'
SectionEnd
#------------------------------------------------------------------------------
# Before first page displayed
#------------------------------------------------------------------------------
# Workaround to allow ${IsVcRuntimeInstalled} work properly
!undef WinSxS_HasAssembly
!define WinSxS_HasAssembly `Call un.WinSxS_HasAssembly`
Function un.onInit
${IfNot} ${IsPythonInstalled}
!insertmacro UnselectSection ${unsec_python}
SectionSetText ${unsec_python} ""
${EndIf}
${IfNot} ${IsVcRuntimeInstalled}
!insertmacro UnselectSection ${unsec_vcruntime}
SectionSetText ${unsec_vcruntime} ""
${EndIf}
FunctionEnd
#------------------------------------------------------------------------------
# Uninstaller sections descriptions
#------------------------------------------------------------------------------
LangString DESC_unsec_pykd ${LANG_ENGLISH} "${PRODUCT_FULL_NAME}"
LangString DESC_unsec_python ${LANG_ENGLISH} "Uninstall Python ${PYTHON_VERSION} ${PRODUCT_ARCH}"
LangString DESC_unsec_vcruntime ${LANG_ENGLISH} "Uninstall Microsoft Visual C++ 2005 SP1 (${PRODUCT_ARCH}) runtime library"
!insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${unsec_pykd} $(DESC_unsec_pykd)
!insertmacro MUI_DESCRIPTION_TEXT ${unsec_python} $(DESC_unsec_python)
!insertmacro MUI_DESCRIPTION_TEXT ${unsec_vcruntime} $(DESC_unsec_vcruntime)
!insertmacro MUI_UNFUNCTION_DESCRIPTION_END

View File

@ -4,6 +4,14 @@
# #
!define PRODUCT_ARCH "x64" !define PRODUCT_ARCH "x64"
# When changing Python vesion don't forget to update ProductCode appropriately
!define PYTHON_INSTALLER "python-2.6.6.amd64.msi" !define PYTHON_INSTALLER "python-2.6.6.amd64.msi"
!define VC_RUNTIME_URL "http://download.microsoft.com/download/6/B/B/6BB661D6-A8AE-4819-B79F-236472F6070C/vcredist_x64.exe" !define PYTHON_PRODUCT_CODE "{6151CF20-0BD8-4023-A4A0-6A86DCFE58E6}"
# Source http://www.microsoft.com/downloads/en/details.aspx?FamilyID=766a6af7-ec73-40ff-b072-9112bab119c2
# When changing VC runtime vesion don't forget to update ProductCode appropriately
!define VCRUNTIME_URL "http://download.microsoft.com/download/6/B/B/6BB661D6-A8AE-4819-B79F-236472F6070C/vcredist_x64.exe"
!define VCRUNTIME_PRODUCT_CODE "{6ce5bae9-d3ca-4b99-891a-1dc6c118a5fc}"
!include "pykd_setup_common.nsh" !include "pykd_setup_common.nsh"

View File

@ -4,6 +4,14 @@
# #
!define PRODUCT_ARCH "x86" !define PRODUCT_ARCH "x86"
# When changing Python vesion don't forget to update ProductCode appropriately
!define PYTHON_INSTALLER "python-2.6.6.msi" !define PYTHON_INSTALLER "python-2.6.6.msi"
!define VC_RUNTIME_URL "http://download.microsoft.com/download/6/B/B/6BB661D6-A8AE-4819-B79F-236472F6070C/vcredist_x86.exe" !define PYTHON_PRODUCT_CODE "{6151CF20-0BD8-4023-A4A0-6A86DCFE58E5}"
# Source http://www.microsoft.com/downloads/en/details.aspx?FamilyID=766a6af7-ec73-40ff-b072-9112bab119c2
# When changing VC runtime vesion don't forget to update ProductCode appropriately
!define VCRUNTIME_URL "http://download.microsoft.com/download/6/B/B/6BB661D6-A8AE-4819-B79F-236472F6070C/vcredist_x86.exe"
!define VCRUNTIME_PRODUCT_CODE "{837b34e3-7c30-493c-8f6a-2b0f04e2912c}"
!include "pykd_setup_common.nsh" !include "pykd_setup_common.nsh"