diff --git a/NsisDotNetChecker/DotNetChecker.dll b/NsisDotNetChecker/DotNetChecker.dll new file mode 100644 index 0000000..bf87a44 Binary files /dev/null and b/NsisDotNetChecker/DotNetChecker.dll differ diff --git a/NsisDotNetChecker/DotNetChecker.nsh b/NsisDotNetChecker/DotNetChecker.nsh new file mode 100644 index 0000000..ffbb761 --- /dev/null +++ b/NsisDotNetChecker/DotNetChecker.nsh @@ -0,0 +1,129 @@ +!macro CheckNetFramework FrameworkVersion + Var /GLOBAL dotNetUrl${FrameworkVersion} + Var /GLOBAL dotNetReadableVersion${FrameworkVersion} + + !ifndef DOTNET462_URL + !define DOTNET462_URL "http://go.microsoft.com/fwlink/p/?LinkId=780601" + !define DOTNET461_URL "http://go.microsoft.com/fwlink/p/?LinkId=671744" + !define DOTNET46_URL "http://go.microsoft.com/fwlink/?LinkId=528232" + !define DOTNET452_URL "http://go.microsoft.com/fwlink/?LinkId=397708" + !define DOTNET451_URL "http://go.microsoft.com/fwlink/?LinkId=322116" + !define DOTNET45_URL "http://go.microsoft.com/fwlink/?LinkId=225702" + !define DOTNET40Full_URL "http://www.microsoft.com/downloads/info.aspx?na=41&srcfamilyid=0a391abd-25c1-4fc0-919f-b21f31ab88b7&srcdisplaylang=en&u=http%3a%2f%2fdownload.microsoft.com%2fdownload%2f9%2f5%2fA%2f95A9616B-7A37-4AF6-BC36-D6EA96C8DAAE%2fdotNetFx40_Full_x86_x64.exe" + !define DOTNET40Client_URL "http://www.microsoft.com/downloads/info.aspx?na=41&srcfamilyid=e5ad0459-cbcc-4b4f-97b6-fb17111cf544&srcdisplaylang=en&u=http%3a%2f%2fdownload.microsoft.com%2fdownload%2f5%2f6%2f2%2f562A10F9-C9F4-4313-A044-9C94E0A8FAC8%2fdotNetFx40_Client_x86_x64.exe" + !define DOTNET35_URL "http://download.microsoft.com/download/2/0/e/20e90413-712f-438c-988e-fdaa79a8ac3d/dotnetfx35.exe" + !define DOTNET30_URL "http://download.microsoft.com/download/2/0/e/20e90413-712f-438c-988e-fdaa79a8ac3d/dotnetfx35.exe" + !define DOTNET20_URL "http://www.microsoft.com/downloads/info.aspx?na=41&srcfamilyid=0856eacb-4362-4b0d-8edd-aab15c5e04f5&srcdisplaylang=en&u=http%3a%2f%2fdownload.microsoft.com%2fdownload%2f5%2f6%2f7%2f567758a3-759e-473e-bf8f-52154438565a%2fdotnetfx.exe" + !define DOTNET11_URL "http://www.microsoft.com/downloads/info.aspx?na=41&srcfamilyid=262d25e3-f589-4842-8157-034d1e7cf3a3&srcdisplaylang=en&u=http%3a%2f%2fdownload.microsoft.com%2fdownload%2fa%2fa%2fc%2faac39226-8825-44ce-90e3-bf8203e74006%2fdotnetfx.exe" + !define DOTNET10_URL "http://www.microsoft.com/downloads/info.aspx?na=41&srcfamilyid=262d25e3-f589-4842-8157-034d1e7cf3a3&srcdisplaylang=en&u=http%3a%2f%2fdownload.microsoft.com%2fdownload%2fa%2fa%2fc%2faac39226-8825-44ce-90e3-bf8203e74006%2fdotnetfx.exe" + !endif + + ${If} ${FrameworkVersion} == "462" + StrCpy $dotNetUrl${FrameworkVersion} ${DOTNET462_URL} + StrCpy $dotNetReadableVersion${FrameworkVersion} "4.6.2" + ${ElseIf} ${FrameworkVersion} == "461" + StrCpy $dotNetUrl${FrameworkVersion} ${DOTNET461_URL} + StrCpy $dotNetReadableVersion${FrameworkVersion} "4.6.1" + ${ElseIf} ${FrameworkVersion} == "46" + StrCpy $dotNetUrl${FrameworkVersion} ${DOTNET46_URL} + StrCpy $dotNetReadableVersion${FrameworkVersion} "4.6" + ${ElseIf} ${FrameworkVersion} == "452" + StrCpy $dotNetUrl${FrameworkVersion} ${DOTNET452_URL} + StrCpy $dotNetReadableVersion${FrameworkVersion} "4.52" + ${ElseIf} ${FrameworkVersion} == "451" + StrCpy $dotNetUrl${FrameworkVersion} ${DOTNET451_URL} + StrCpy $dotNetReadableVersion${FrameworkVersion} "4.51" + ${ElseIf} ${FrameworkVersion} == "45" + StrCpy $dotNetUrl${FrameworkVersion} ${DOTNET45_URL} + StrCpy $dotNetReadableVersion${FrameworkVersion} "4.5" + ${ElseIf} ${FrameworkVersion} == "40Full" + StrCpy $dotNetUrl${FrameworkVersion} ${DOTNET40Full_URL} + StrCpy $dotNetReadableVersion${FrameworkVersion} "4.0 Full" + ${ElseIf} ${FrameworkVersion} == "40Client" + StrCpy $dotNetUrl${FrameworkVersion} ${DOTNET40Client_URL} + StrCpy $dotNetReadableVersion${FrameworkVersion} "4.0 Client" + ${ElseIf} ${FrameworkVersion} == "35" + StrCpy $dotNetUrl${FrameworkVersion} ${DOTNET35_URL} + StrCpy $dotNetReadableVersion${FrameworkVersion} "3.5" + ${ElseIf} ${FrameworkVersion} == "30" + StrCpy $dotNetUrl${FrameworkVersion} ${DOTNET30_URL} + StrCpy $dotNetReadableVersion${FrameworkVersion} "3.0" + ${ElseIf} ${FrameworkVersion} == "20" + StrCpy $dotNetUrl${FrameworkVersion} ${DOTNET20_URL} + StrCpy $dotNetReadableVersion${FrameworkVersion} "2.0" + ${ElseIf} ${FrameworkVersion} == "11" + StrCpy $dotNetUrl${FrameworkVersion} ${DOTNET11_URL} + StrCpy $dotNetReadableVersion${FrameworkVersion} "1.1" + ${ElseIf} ${FrameworkVersion} == "10" + StrCpy $dotNetUrl${FrameworkVersion} ${DOTNET10_URL} + StrCpy $dotNetReadableVersion${FrameworkVersion} "1.0" + ${EndIf} + + DetailPrint "Checking .NET Framework version..." + + Push $0 + Push $1 + Push $2 + Push $3 + Push $4 + Push $5 + Push $6 + Push $7 + + DotNetChecker::IsDotNet${FrameworkVersion}Installed + Pop $0 + + ${If} $0 == "false" +${OrIf} $0 == "f" ; if script is compiled in ANSI mode then we get only an "f" https://github.com/ReVolly/NsisDotNetChecker/issues/4 + DetailPrint ".NET Framework $dotNetReadableVersion${FrameworkVersion} not found, download is required for program to run." + Goto NoDotNET${FrameworkVersion} + ${Else} + DetailPrint ".NET Framework $dotNetReadableVersion${FrameworkVersion} found, no need to install." + Goto NewDotNET${FrameworkVersion} + ${EndIf} + +NoDotNET${FrameworkVersion}: + MessageBox MB_YESNOCANCEL|MB_ICONEXCLAMATION \ + ".NET Framework not installed. Required version: $dotNetReadableVersion${FrameworkVersion}.$\nDownload .NET Framework $dotNetReadableVersion${FrameworkVersion} from www.microsoft.com?" \ + /SD IDYES IDYES DownloadDotNET${FrameworkVersion} IDNO NewDotNET${FrameworkVersion} + goto GiveUpDotNET${FrameworkVersion} ;IDCANCEL + +DownloadDotNET${FrameworkVersion}: + DetailPrint "Beginning download of .NET Framework $dotNetReadableVersion${FrameworkVersion}." + NSISDL::download $dotNetUrl${FrameworkVersion} "$TEMP\dotnetfx.exe" + DetailPrint "Completed download." + + Pop $0 + ${If} $0 == "cancel" + MessageBox MB_YESNO|MB_ICONEXCLAMATION \ + "Download cancelled. Continue Installation?" \ + IDYES NewDotNET${FrameworkVersion} IDNO GiveUpDotNET${FrameworkVersion} + ${ElseIf} $0 != "success" + MessageBox MB_YESNO|MB_ICONEXCLAMATION \ + "Download failed:$\n$0$\n$\nContinue Installation?" \ + IDYES NewDotNET${FrameworkVersion} IDNO GiveUpDotNET${FrameworkVersion} + ${EndIf} + + DetailPrint "Pausing installation while downloaded .NET Framework installer runs." + ExecWait '$TEMP\dotnetfx.exe /q /c:"install /q"' + + DetailPrint "Completed .NET Framework install/update. Removing .NET Framework installer." + Delete "$TEMP\dotnetfx.exe" + DetailPrint ".NET Framework installer removed." + goto NewDotNet${FrameworkVersion} + +GiveUpDotNET${FrameworkVersion}: + Abort "Installation cancelled by user." + +NewDotNET${FrameworkVersion}: + DetailPrint "Proceeding with remainder of installation." + Pop $7 + Pop $6 + Pop $5 + Pop $4 + Pop $3 + Pop $2 + Pop $1 + Pop $0 + +!macroend diff --git a/NsisDotNetChecker/README.md b/NsisDotNetChecker/README.md new file mode 100644 index 0000000..0c6f4bd --- /dev/null +++ b/NsisDotNetChecker/README.md @@ -0,0 +1,95 @@ +# .NET Framework Checker NSIS plugin +The .NET Framework Checker NSIS plugin is used to detect if the required .NET Framework is installed and if it is not - plugin will download and install the required package. The plugin's C++ source code is based on the [work of Aaron Stebner](http://blogs.msdn.com/b/astebner/archive/2009/06/16/9763379.aspx). + +## Structure: + - `bin` - compiled NSIS plugin (ready-to-use) + - `plugin` - contains source code for building DotNetChecker plugin in Visual Studio 2010 + - `nsis` - contains CheckNetFramework macros (DotNetChecker.nsh) and example NSIS installation file + +## Installation + +### All Users +1. Copy `DotNetChecker.dll` to NSIS plugins directory (usually `C:\Program Files\Nsis\Plugins\` or `C:\Program Files (x86)\Nsis\Plugins\`) +2. Add to your installer project `DotNetChecker.nsh` file +3. Reference `DotNetChecker.nsh` in your main NSI file like this: + `!include "DotNetChecker.nsh"` +4. Insert macros with the version of required .NET framework. + +### Local +1. Copy the whole project in to the same folder as your NSIS Script. +2. Refrence the Plugin DLL like this: `!addplugindir "NsisDotNetChecker\bin"` +3. Reference `DotNetChecker.nsh` in your main NSI file like this: `!include "NsisDotNetChecker\nsis\DotNetChecker.nsh"` + +## Usage + +The Plugin and its Macro can be invoked by any Function or within any Section of the NSI script. + +### .NET 4.6.2 + + !insertmacro CheckNetFramework 462 + +### .NET 4.6.1 + + !insertmacro CheckNetFramework 461 + +### .NET 4.6 + + !insertmacro CheckNetFramework 46 + +### .NET 4.5.2 + + !insertmacro CheckNetFramework 452 + +### .NET 4.5.1 + + !insertmacro CheckNetFramework 451 + +### .NET 4.5 + + !insertmacro CheckNetFramework 45 + +### .NET 4.0 Client + + !insertmacro CheckNetFramework 40Client + +### .NET 4. Full + + !insertmacro CheckNetFramework 40Full + +### .NET 3.5 + + !insertmacro CheckNetFramework 35 ; if your application targets .NET 3.5 Framework + +### .NET 3.0 + + !insertmacro CheckNetFramework 30 ; if your application targets .NET 3.0 Framework + +### .NET 2.0 + + !insertmacro CheckNetFramework 20 ; if your application targets .NET 2.0 Framework + +### .NET 1.1 + + !insertmacro CheckNetFramework 11 ; if your application targets .NET 1.1 Framework + +### .NET 1.0 + + !insertmacro CheckNetFramework 10 ; if your application targets .NET 1.0 Framework + +--- + +*NB:* Script will download .NET 3.5 for both .NET 3.0 and .NET 3.5 requirements. The same rule applies to .NET 1.1 and .NET 1.0. If you want to change this behavior - feel free to edit DotNetChecker.nsh. + +*NB2:* Plugin is also capable of detecting Framework Service Pack Level. To use this functionality, just call one of the corresponding functions (i.e. DotNetChecker::GetDotNet11ServicePack). + +The return value (Pop $0) will be: + +- -2 if framework is not installed + +- -1 if no service pack installed for this framework + +- some positive int value otherwise + +*NB3:* Plugin works not only in UNICODE but also in ANSI scripts. + +*NB4:* The plugin can be called more than once for installing two (or more) different versions of framework. diff --git a/README b/README index 7aaa6c2..4b9ea81 100644 --- a/README +++ b/README @@ -1,11 +1,9 @@ -BizHawk is supported on operating systems as old as Windows XP 32-bit. +BizHawk is supported on operating systems as old as Windows 7 SP1 64-bit. If BizHawk crashes when you run it, it is probably because you are lacking some of the prerequisites -KB2999226 (prerequisite for installing C++ 2015 runtime on vista-win8.1) -Windows Imaging Component (.net 4.0 prerequisite for older OS) -Visual C++ 2010 SP1 Runtime +KB2999226 (prerequisite for installing C++ 2015 runtime on win7-win8.1) +.Net Framework v4.6.1 Visual C++ 2010 SP1 Runtime (x64) -Visual C++ 2015 Runtime +Visual C++ 2013 Runtime (x64) Visual C++ 2015 Runtime (x64) -.Net Framework v4.0.30319 DirectX Web Update (DirectX 9 is employed) diff --git a/bizhawk_prereqs.nsi b/bizhawk_prereqs.nsi index 4c5511f..848e31e 100644 --- a/bizhawk_prereqs.nsi +++ b/bizhawk_prereqs.nsi @@ -1,5 +1,8 @@ +!include "MUI2.nsh" +!include "NsisDotNetChecker\DotNetChecker.nsh" + ; The name of the installer -Name "Bizhawk Prerequisites" +Name "BizHawk Prerequisites" ; The file to write OutFile "bizhawk_prereqs.exe" @@ -15,56 +18,18 @@ LicenseData "dist\info.txt" Page license Page instfiles -Section "Windows Imaging Component (.net 4.0 prerequisite for older OS)" SEC_WIC - - SetOutPath "$TEMP" - File "dist\wic_x86_enu.exe" - DetailPrint "Running Windows Imaging Component Setup..." - ExecWait '"$TEMP\wic_x86_enu.exe" /passive /norestart' - DetailPrint "Finished Windows Imaging Component Setup" - - Delete "$TEMP\wic_x86_enu.exe" - -done: -SectionEnd - -Section "KB2999226 (prerequisite for installing C++ 2015 runtime on vista-win8.1)" SEC_KB2999226 +Section "KB2999226 (prerequisite for installing C++ 2015 runtime on win7-win8.1)" SEC_KB2999226 SetOutPath "$TEMP" - File "dist\UCRT\Windows6.0-KB2999226-x64.msu" - File "dist\UCRT\Windows6.0-KB2999226-x86.msu" File "dist\UCRT\Windows6.1-KB2999226-x64.msu" - File "dist\UCRT\Windows6.1-KB2999226-x86.msu" File "dist\UCRT\Windows8.1-KB2999226-x64.msu" - File "dist\UCRT\Windows8.1-KB2999226-x86.msu" File "dist\UCRT\Windows8-RT-KB2999226-x64.msu" - File "dist\UCRT\Windows8-RT-KB2999226-x86.msu" - DetailPrint "Trying to install 8x KB2999226 for various platforms." - ExecWait 'wusa.exe "dist\UCRT\Windows6.0-KB2999226-x64.msu" /quiet /norestart' - ExecWait 'wusa.exe "dist\UCRT\Windows6.0-KB2999226-x86.msu" /quiet /norestart' + DetailPrint "Trying to install 3x KB2999226 for various platforms." ExecWait 'wusa.exe "dist\UCRT\Windows6.1-KB2999226-x64.msu" /quiet /norestart' - ExecWait 'wusa.exe "dist\UCRT\Windows6.1-KB2999226-x86.msu" /quiet /norestart' ExecWait 'wusa.exe "dist\UCRT\Windows8.1-KB2999226-x64.msu" /quiet /norestart' - ExecWait 'wusa.exe "dist\UCRT\Windows8.1-KB2999226-x86.msu" /quiet /norestart' ExecWait 'wusa.exe "dist\UCRT\Windows8-RT-KB2999226-x64.msu" /quiet /norestart' - ExecWait 'wusa.exe "dist\UCRT\Windows8-RT-KB2999226-x86.msu" /quiet /norestart' DetailPrint "Finished KB2999226" -done: -SectionEnd - -Section "Microsoft Visual C++ 2010 SP1 Runtime" SEC_CRT2010_SP1 - - SetOutPath "$TEMP" - File "dist\vcredist_2010_sp1_x86.exe" - DetailPrint "Running Visual C++ 2010 SP1 Runtime Setup..." - DetailPrint "(And ordering it to attempt a repair since some user's DLLs are wrecked)" - ExecWait '"$TEMP\vcredist_2010_sp1_x86.exe" /repair /q /promptrestart' - DetailPrint "Finished Visual C++ 2010 SP1 Runtime Setup" - - Delete "$TEMP\vcredist_2010_sp1_x86.exe" - -done: SectionEnd Section "Microsoft Visual C++ 2010 SP1 Runtime (x64)" SEC_CRT2010_SP1_X64 @@ -77,20 +42,18 @@ Section "Microsoft Visual C++ 2010 SP1 Runtime (x64)" SEC_CRT2010_SP1_X64 Delete "$TEMP\vcredist_2010_sp1_x64.exe" -done: SectionEnd -Section "Microsoft Visual C++ 2015 Runtime" SEC_CRT2015 +Section "Microsoft Visual C++ 2013 Runtime (x64)" SEC_CRT2013_X64 SetOutPath "$TEMP" - File "dist\vcredist_2015_x86.exe" - DetailPrint "Running Visual C++ 2015 Runtime Setup..." - ExecWait '"$TEMP\vcredist_2015_x86.exe" /quiet' - DetailPrint "Finished Visual C++ 2015 SP1 Runtime Setup" + File "dist\vcredist_2013_x64.exe" + DetailPrint "Running Visual C++ 2013 Runtime (x64) Setup..." + ExecWait '"$TEMP\vcredist_2013_x64.exe" /q /promptrestart' + DetailPrint "Finished Visual C++ 2013 (x64) Runtime Setup" - Delete "$TEMP\vcredist_2015_x86.exe" + Delete "$TEMP\vcredist_2013_x64.exe" -done: SectionEnd Section "Microsoft Visual C++ 2015 Runtime (x64)" SEC_CRT2015_X64 @@ -103,21 +66,11 @@ Section "Microsoft Visual C++ 2015 Runtime (x64)" SEC_CRT2015_X64 Delete "$TEMP\vcredist_2015_x64.exe" -done: SectionEnd -!define NETVersion "4.0.30319" -!define NETInstaller "dotNetFx40_Full_setup.exe" -Section "MS .NET Framework v${NETVersion}" SecFramework - IfFileExists "$WINDIR\Microsoft.NET\Framework\v${NETVersion}\mscorlib.dll" NETFrameworkInstalled 0 - File /oname=$TEMP\${NETInstaller} dist\${NETInstaller} - - DetailPrint "Starting Microsoft .NET Framework v${NETVersion} Setup..." - ExecWait '"$TEMP\${NETInstaller}" /passive /norestart' - Return - - NETFrameworkInstalled: - DetailPrint "Microsoft .NET Framework is already installed!" +Section "MS .NET Framework 4.6.1" SecFramework + + !insertmacro CheckNetFramework 461 SectionEnd diff --git a/dist/UCRT/Windows6.0-KB2999226-x64.msu b/dist/UCRT/Windows6.0-KB2999226-x64.msu deleted file mode 100644 index 66497ec..0000000 Binary files a/dist/UCRT/Windows6.0-KB2999226-x64.msu and /dev/null differ diff --git a/dist/UCRT/Windows6.0-KB2999226-x86.msu b/dist/UCRT/Windows6.0-KB2999226-x86.msu deleted file mode 100644 index dbb26da..0000000 Binary files a/dist/UCRT/Windows6.0-KB2999226-x86.msu and /dev/null differ diff --git a/dist/UCRT/Windows6.1-KB2999226-x86.msu b/dist/UCRT/Windows6.1-KB2999226-x86.msu deleted file mode 100644 index fbf284b..0000000 Binary files a/dist/UCRT/Windows6.1-KB2999226-x86.msu and /dev/null differ diff --git a/dist/UCRT/Windows8-RT-KB2999226-x86.msu b/dist/UCRT/Windows8-RT-KB2999226-x86.msu deleted file mode 100644 index d1687ff..0000000 Binary files a/dist/UCRT/Windows8-RT-KB2999226-x86.msu and /dev/null differ diff --git a/dist/UCRT/Windows8.1-KB2999226-x86.msu b/dist/UCRT/Windows8.1-KB2999226-x86.msu deleted file mode 100644 index c012780..0000000 Binary files a/dist/UCRT/Windows8.1-KB2999226-x86.msu and /dev/null differ diff --git a/dist/UCRT/notes.txt b/dist/UCRT/notes.txt index 7af2b6b..bb58fe2 100644 --- a/dist/UCRT/notes.txt +++ b/dist/UCRT/notes.txt @@ -1,4 +1,4 @@ windows 8 rt is actual windows 8 -windows 8.1 is actual windows 8,1 -6.1 is 7 and 6.0 is vista +windows 8.1 is actual windows 8.1 +windows 6.1 is 7 installers are same for server OS \ No newline at end of file diff --git a/dist/dotNetFx40_Full_setup.exe b/dist/dotNetFx40_Full_setup.exe deleted file mode 100644 index 384fb83..0000000 Binary files a/dist/dotNetFx40_Full_setup.exe and /dev/null differ diff --git a/dist/info.txt b/dist/info.txt index 7f4ad29..79643cb 100644 --- a/dist/info.txt +++ b/dist/info.txt @@ -1,10 +1,8 @@ KB2999226 (prerequisite for installing C++ 2015 runtime on vista-win8.1) -Windows Imaging Component (.net 4.0 prerequisite for older OS) -Visual C++ 2010 SP1 Runtime Visual C++ 2010 SP1 Runtime (x64) -Visual C++ 2015 Runtime +Visual C++ 2013 Runtime (x64) Visual C++ 2015 Runtime (x64) -.Net Framework v4.0.30319 +.Net Framework v4.6.1 DirectX Installer (since the Web Update fails sometimes; (includes D3DX9 31 and 43, XInput, and XAudio) DirectX Web Update (installs dozens of packages, or maybe none, luck of the draw really) diff --git a/dist/vcredist_2010_sp1_x86.exe b/dist/vcredist_2010_sp1_x86.exe deleted file mode 100644 index d81f3f5..0000000 Binary files a/dist/vcredist_2010_sp1_x86.exe and /dev/null differ diff --git a/dist/vcredist_2013_x64.exe b/dist/vcredist_2013_x64.exe new file mode 100644 index 0000000..5473640 Binary files /dev/null and b/dist/vcredist_2013_x64.exe differ diff --git a/dist/vcredist_2015_x86.exe b/dist/vcredist_2015_x86.exe deleted file mode 100644 index caea04a..0000000 Binary files a/dist/vcredist_2015_x86.exe and /dev/null differ diff --git a/dist/wic_x86_enu.exe b/dist/wic_x86_enu.exe deleted file mode 100644 index 0d498cd..0000000 Binary files a/dist/wic_x86_enu.exe and /dev/null differ