From 713a8e25106f7213b3fe34a703d90d487cacd6cc Mon Sep 17 00:00:00 2001 From: brain Date: Mon, 21 May 2007 21:23:49 +0000 Subject: Add .net framework version check git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7105 e03df62e-2008-0410-955e-edbf42e46eb7 --- win/inspircd.nsi | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/win/inspircd.nsi b/win/inspircd.nsi index 16c6dcd3e..25b97cd92 100644 --- a/win/inspircd.nsi +++ b/win/inspircd.nsi @@ -8,6 +8,8 @@ !define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\inspircd.exe" !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" !define PRODUCT_UNINST_ROOT_KEY "HKLM" +!define DOT_MAJOR "2" +!define DOT_MINOR "0" SetCompressor bzip2 @@ -53,7 +55,67 @@ InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" "" ShowInstDetails show ShowUnInstDetails show +Function IsDotNetInstalled + + StrCpy $0 "0" + StrCpy $1 "SOFTWARE\Microsoft\.NETFramework" ;registry entry to look in. + StrCpy $2 0 + + StartEnum: + ;Enumerate the versions installed. + EnumRegKey $3 HKLM "$1\policy" $2 + + ;If we don't find any versions installed, it's not here. + StrCmp $3 "" noDotNet notEmpty + + ;We found something. + notEmpty: + ;Find out if the RegKey starts with 'v'. + ;If it doesn't, goto the next key. + StrCpy $4 $3 1 0 + StrCmp $4 "v" +1 goNext + StrCpy $4 $3 1 1 + + ;It starts with 'v'. Now check to see how the installed major version + ;relates to our required major version. + ;If it's equal check the minor version, if it's greater, + ;we found a good RegKey. + IntCmp $4 ${DOT_MAJOR} +1 goNext yesDotNetReg + ;Check the minor version. If it's equal or greater to our requested + ;version then we're good. + StrCpy $4 $3 1 3 + IntCmp $4 ${DOT_MINOR} yesDotNetReg goNext yesDotNetReg + + goNext: + ;Go to the next RegKey. + IntOp $2 $2 + 1 + goto StartEnum + + yesDotNetReg: + ;Now that we've found a good RegKey, let's make sure it's actually + ;installed by getting the install path and checking to see if the + ;mscorlib.dll exists. + EnumRegValue $2 HKLM "$1\policy\$3" 0 + ;$2 should equal whatever comes after the major and minor versions + ;(ie, v1.1.4322) + StrCmp $2 "" noDotNet + ReadRegStr $4 HKLM $1 "InstallRoot" + ;Hopefully the install root isn't empty. + StrCmp $4 "" noDotNet + ;build the actuall directory path to mscorlib.dll. + StrCpy $4 "$4$3.$2\mscorlib.dll" + IfFileExists $4 yesDotNet noDotNet + + noDotNet: + MessageBox MB_OK "You do not have have v${DOT_MAJOR}.${DOT_MINOR} or greater of the .NET framework installed. This is required for the InspIRCd Monitor, however you can still launch the IRCd manually." + + yesDotNet: + ;Everything checks out. Go on with the rest of the installation. + +FunctionEnd + Section "Binary Executable" SEC01 + Call IsDotNetInstalled SetOutPath "$INSTDIR" SetOverwrite ifnewer File "..\bin\debug\InspGUI.exe" -- cgit v1.2.3