[+] add setup script.

git-svn-id: https://pykd.svn.codeplex.com/svn@62250 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
SND\air_max_cp 2011-03-05 20:19:18 +00:00
parent 06fb9c267a
commit 9f5a2ec9d4
6 changed files with 340 additions and 0 deletions

View File

@ -0,0 +1,43 @@
Function WinSxS_HasAssembly ;legacyDllName,(Strong)AssemblyName
/*
push 'msvcr80.dll'
push 'Microsoft.VC80.CRT,version="8.0.50727.42",type="win32",processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b"'
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)
*/
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"
${If} $0 == 0
System::Call '*(i 24,i0,l,i0,i0)i.R1' ;TODO,BUGBUG: check alloc success
System::Call `$R0->4(i 0,w '$8',i $R1)i.r0` ;IAssemblyCache::QueryAssemblyInfo
${If} $0 == 0
System::Call '*$R1(i,i.r0)'
IntOp $0 $0 & 1 ;ASSEMBLYINFO_FLAG_INSTALLED=1
${IfThen} $0 <> 0 ${|} StrCpy $9 1 ${|}
${EndIf}
System::Free $R1
System::Call $R0->2() ;IAssemblyCache::Release
${EndIf}
${Else}
System::Call kernel32::LoadLibrary(t"$7")i.r0
${If} $0 != 0
StrCpy $9 2
System::Call 'kernel32::FreeLibrary(i r0)'
${EndIf}
${EndIf}
pop $R1
pop $R0
pop $0
Exch 2
pop $8
pop $7
Exch $9
FunctionEnd

BIN
setup/Plugins/inetc.dll Normal file

Binary file not shown.

31
setup/pykd_license.txt Normal file
View File

@ -0,0 +1,31 @@
Microsoft Public License (Ms-PL)
This license governs use of the accompanying software. If you use the software, you accept this license. If you do not accept the license, do not use the software.
1. Definitions
The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning here as under U.S. copyright law.
A "contribution" is the original software, or any additions or changes to the software.
A "contributor" is any person that distributes its contribution under this license.
"Licensed patents" are a contributor's patent claims that read directly on its contribution.
2. Grant of Rights
(A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create.
(B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software.
3. Conditions and Limitations
(A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks.
(B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically.
(C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software.
(D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license.
(E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement.

248
setup/pykd_setup_common.nsh Normal file
View File

@ -0,0 +1,248 @@
#
# This is setup script for pykd project.
# Author: Maksim K. aka airmax
#
SetCompressor LZMA
# Modern interface settings
!include "MUI2.nsh"
!include "LogicLib.nsh"
!include "WinVer.nsh"
!include "FileFunc.nsh"
!include "x64.nsh"
!addincludedir .\Include
!addplugindir .\Plugins
!include "HasAssembly.nsh"
#------------------------------------------------------------------------------
# General
#------------------------------------------------------------------------------
!define PYTHON_VERSION "2.6"
!define PYTHON_URL_BASE "http://python.org/ftp/python/2.6.6/"
!define PRODUCT_SHORT_NAME "pykd"
!define PRODUCT_FULL_NAME "Python extension for WinDbg"
!define PRODUCT_VERSION "0.0.0.16"
!define PRODUCT_URL "http://pykd.codeplex.com/"
!define PRODUCT_NAME_AND_VERSION "${PRODUCT_FULL_NAME} ${PRODUCT_ARCH} ${PRODUCT_VERSION}"
!if ${PRODUCT_ARCH} == "x64"
!define ARCH "amd64"
!else
!define ARCH "x86"
!endif
# Main Install settings
Name "${PRODUCT_NAME_AND_VERSION}"
OutFile "${PRODUCT_SHORT_NAME}_${PRODUCT_ARCH}_${PRODUCT_VERSION}_setup.exe"
BrandingText "${PRODUCT_FULL_NAME}"
#Get installation folder from registry if available
InstallDirRegKey HKLM "Software\${PRODUCT_SHORT_NAME}" "${PRODUCT_ARCH}"
#Request application privileges for Windows Vista and 7
RequestExecutionLevel admin
ShowInstDetails show
#------------------------------------------------------------------------------
# Variables
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# Interface Settings
#------------------------------------------------------------------------------
!define MUI_ABORTWARNING
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\orange-install.ico"
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Header\orange.bmp"
!define MUI_WELCOMEPAGE_TITLE_3LINES
!define MUI_WELCOMEFINISHPAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Wizard\orange.bmp"
!define MUI_DIRECTORYPAGE_TEXT_TOP "Please specify path to $\"winext$\" subfolder of Debugging Tools for Windows (${PRODUCT_ARCH})."
!define MUI_DIRECTORYPAGE_TEXT_DESTINATION "Debugging Tools for Windows (${PRODUCT_ARCH})\winext folder"
!define MUI_FINISHPAGE_TITLE_3LINES
!define MUI_FINISHPAGE_TEXT_LARGE
!define MUI_FINISHPAGE_TEXT "${PRODUCT_NAME_AND_VERSION} was successfully installed.$\n$\n\
Run WinDbg and type $\".load pykd.pyd$\" to start using plugin."
!define MUI_FINISHPAGE_NOAUTOCLOSE
#------------------------------------------------------------------------------
# Pages
#------------------------------------------------------------------------------
# Installer Pages
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "pykd_license.txt"
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
#------------------------------------------------------------------------------
# Languages (first is default language)
#------------------------------------------------------------------------------
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_RESERVEFILE_LANGDLL
#------------------------------------------------------------------------------
# Installer file version information
#------------------------------------------------------------------------------
VIProductVersion "${PRODUCT_VERSION}"
VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductName" "${PRODUCT_SHORT_NAME}"
VIAddVersionKey /LANG=${LANG_ENGLISH} "Comments" "${PRODUCT_NAME_AND_VERSION}"
#VIAddVersionKey /LANG=${LANG_ENGLISH} "CompanyName" "${MANUFACTURER}"
#VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalTrademarks" "${PRODUCT_NAME} is a trademark of ${MANUFACTURER} company"
VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "© All rights reserved"
VIAddVersionKey /LANG=${LANG_ENGLISH} "FileDescription" "${PRODUCT_SHORT_NAME} setup"
VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "${PRODUCT_VERSION}"
#------------------------------------------------------------------------------
# Before first page displayed
#------------------------------------------------------------------------------
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
FunctionEnd
#------------------------------------------------------------------------------
# Check WinDbg executable presence in selected directory
#------------------------------------------------------------------------------
Function .onVerifyInstDir
${IfNotThen} ${FileExists} "$INSTDIR\..\WinDbg.exe" ${|} Abort ${|}
${GetFileName} "$INSTDIR" $R0
${IfThen} $R0 != "WinExt" ${|} Abort ${|}
FunctionEnd
#------------------------------------------------------------------------------
# Installer Sections
#------------------------------------------------------------------------------
Section "${PRODUCT_SHORT_NAME}" Section1
DetailPrint "Check Microsoft Visual C++ 2005 SP1 (${PRODUCT_ARCH}) runtime library..."
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
DetailPrint "Success"
${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\
Press YES to allow.$\n\
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 "Check Python ${PYTHON_VERSION} ${PRODUCT_ARCH}..."
!if ${PRODUCT_ARCH} == "x64"
${IfThen} ${RunningX64} ${|} SetRegView 64 ${|}
!endif
ReadRegStr $R0 HKLM "Software\Python\PythonCore\${PYTHON_VERSION}\InstallPath" ""
!if ${PRODUCT_ARCH} == "x64"
${IfThen} ${RunningX64} ${|} SetRegView 32 ${|}
!endif
${If} $R0 == ""
DetailPrint "Appropiate Python version was no not find in:"
DetailPrint "HKLM\Software\Python\PythonCore\${PYTHON_VERSION}\InstallPath"
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\
Press YES to allow.$\n\
Press NO to continue without Python.$\n\
Press CANCEL to exit from installer." IDYES DownloadAndInstallPython IDNO ContinueNoPython
DetailPrint "${PRODUCT_FULL_NAME} installation cancelled."
Abort
DownloadAndInstallPython:
DetailPrint "Downloading Python..."
inetc::get /CAPTION "${PRODUCT_SHORT_NAME}" /QUESTION "" /POPUP "" /TIMEOUT=30000 "${PYTHON_URL_BASE}${PYTHON_INSTALLER}" "$TEMP\${PYTHON_INSTALLER}" /END
Pop $0
${If} $0 == "OK"
DetailPrint "Successfully downloaded."
DetailPrint "Installing Python..."
IfErrors ClearErrorFlag1
ClearErrorFlag1:
ExecWait '"msiexec" /i "$TEMP\${PYTHON_INSTALLER}"'
IfErrors PythonInstallFailed
DetailPrint "Successfully installed."
${Else}
PythonInstallFailed:
DetailPrint "Operation failed. Installation will be continued without Python."
DetailPrint "Please download and install it manually:"
DetailPrint "${PYTHON_URL_BASE}${PYTHON_INSTALLER}"
${EndIf}
ContinueNoPython:
${Else}
DetailPrint "Python ${PYTHON_VERSION} ${PRODUCT_ARCH} location: $R0"
${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
Section -FinishSection
#Store installation folder
WriteRegStr HKLM "Software\${PRODUCT_SHORT_NAME}" "${PRODUCT_ARCH}" "$INSTDIR"
SectionEnd

9
setup/pykd_setup_x64.nsi Normal file
View File

@ -0,0 +1,9 @@
#
# This is setup script for pykd project.
# Author: Maksim K. aka airmax
#
!define PRODUCT_ARCH "x64"
!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"
!include "pykd_setup_common.nsh"

9
setup/pykd_setup_x86.nsi Normal file
View File

@ -0,0 +1,9 @@
#
# This is setup script for pykd project.
# Author: Maksim K. aka airmax
#
!define PRODUCT_ARCH "x86"
!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"
!include "pykd_setup_common.nsh"