diff options
author | OctaneSnail <os@v12pwr.com> | 2011-02-20 13:22:25 +0300 |
---|---|---|
committer | OctaneSnail <os@v12pwr.com> | 2011-02-20 13:22:25 +0300 |
commit | c61e64d8bdc13cc593da2b3d9d6a6db5b0bcf1be (patch) | |
tree | 9d6d3db59ab1a13a5e03a000198aa41889cefaff | |
parent | 217964abf9a6e3f9b43c961ba8643839d90c8e2c (diff) |
Update installer for VS2010 redist and add 64-bit target.
-rw-r--r-- | RFS.nsi | 102 |
1 files changed, 65 insertions, 37 deletions
@@ -16,18 +16,25 @@ !include MUI2.nsh !include Library.nsh +!include x64.nsh !define VERSION "v0.9.1" Name "RAR File Source" OutFile "RARFileSource-${VERSION}.exe" -InstallDir "$PROGRAMFILES\RARFileSource" !define REGKEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\RARFileSource" InstallDirRegKey HKLM ${REGKEY} "InstallLocation" +RequestExecutionLevel admin + !insertmacro MUI_PAGE_WELCOME + +!define MUI_PAGE_CUSTOMFUNCTION_PRE ComponentsPre +!define MUI_PAGE_CUSTOMFUNCTION_LEAVE ComponentsLeave +!insertmacro MUI_PAGE_COMPONENTS + !insertmacro MUI_PAGE_DIRECTORY !insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_PAGE_FINISH @@ -38,50 +45,38 @@ InstallDirRegKey HKLM ${REGKEY} "InstallLocation" !insertmacro MUI_LANGUAGE "English" -Section "Install" +!define LIBRARY_IGNORE_VERSION +!macro checkRedist TARGET + SetRegView 32 checkInstalled: - StrCpy $2 'Microsoft.VC90.CRT,version="9.0.21022.8",type="win32",processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b"' - - System::Call 'sxs::CreateAssemblyCache(*i .R0, i 0) i .r0' - IntCmp $0 0 cacOK checkRegistry checkRegistry - -cacOK: - # Allocate ASSEMBLY_INFO struct - System::Call '*(i 24, i 0, l, i 0, i 0) i .R1' - IntCmp $R1 0 checkRegistry - - # IAssemblyCache::QueryAssemblyInfo - System::Call "$R0->4(i 0, w '$2', i $R1) i .r0" - IntCmp $0 0 qaiOK freeMemErr freeMemErr - -qaiOK: - # Extract ASSEMBLY_INFO.dwAssemblyFlags - System::Call '*$R1(i, i .r0)' - - # Test ASSEMBLYINFO_FLAG_INSTALLED - IntOp $0 $0 & 1 - IntCmp $0 1 freeMem freeMemErr freeMemErr - -freeMem: - System::Free $R1 - Goto redistInstalled - -freeMemErr: - System::Free $R1 - -checkRegistry: - ReadRegDWORD $0 HKLM "Software\Microsoft\DevDiv\VC\Servicing\9.0\RED\1033" "Install" + ReadRegDWORD $0 HKLM "Software\Microsoft\VisualStudio\10.0\VC\VCRedist\${TARGET}" "Installed" + IntCmp $0 1 redistInstalled + ReadRegDWORD $0 HKLM "Software\Microsoft\VisualStudio\10.0\VC\Runtimes\${TARGET}" "Installed" IntCmp $0 1 redistInstalled - MessageBox MB_ABORTRETRYIGNORE "The Microsoft Visual C++ 2008 Redistributable Package is not installed.$\nWithout the necessary runtime DLLs the filter will not work.$\n$\nFind it at http://www.microsoft.com/downloads/ and try again." IDIGNORE redistInstalled IDRETRY checkInstalled + MessageBox MB_ABORTRETRYIGNORE "The Microsoft Visual C++ 2010 Redistributable Package (${TARGET}) is not installed.$\nWithout the necessary runtime DLLs the filter will not work.$\n$\nFind it at http://www.microsoft.com/downloads/ and try again." IDIGNORE redistInstalled IDRETRY checkInstalled Quit - redistInstalled: +!macroend + +Section "Install 32-bit filter" SEC_X86 + !insertmacro checkRedist x86 SetOutPath "$INSTDIR" - !define LIBRARY_IGNORE_VERSION !insertmacro InstallLib REGDLL NOTSHARED REBOOT_NOTPROTECTED "Release\RARFileSource.ax" "$INSTDIR\RARFileSource.ax" "$INSTDIR" +SectionEnd + +Section "Install 64-bit filter" SEC_X64 + !insertmacro checkRedist x64 + SetOutPath "$INSTDIR\x64" + !define LIBRARY_X64 + !insertmacro InstallLib REGDLL NOTSHARED REBOOT_NOTPROTECTED "x64\Release\RARFileSource.ax" "$INSTDIR\x64\RARFileSource.ax" "$INSTDIR\x64" +SectionEnd + +Section "-Uninstaller" + SetRegView 32 + SetOutPath "$INSTDIR" WriteUninstaller "$INSTDIR\Uninstall.exe" - WriteRegStr HKLM ${REGKEY} "DisplayName" "RAR File Source ${VERSION}" + WriteRegStr HKLM ${REGKEY} "DisplayName" "RAR File Source" WriteRegStr HKLM ${REGKEY} "DisplayVersion" "${VERSION}" WriteRegStr HKLM ${REGKEY} "HelpLink" "http://www.v12pwr.com/RARFileSource/" WriteRegStr HKLM ${REGKEY} "InstallLocation" "$INSTDIR" @@ -91,9 +86,42 @@ redistInstalled: WriteRegDWORD HKLM ${REGKEY} "NoRepair" 1 SectionEnd +Function ComponentsPre + ${IfNot} ${RunningX64} + !insertmacro UnselectSection ${SEC_X64} + Abort + ${EndIf} +FunctionEnd + +Function ComponentsLeave + !insertmacro SectionFlagIsSet ${SEC_X86} ${SF_SELECTED} ok_x86 check_x64 + +ok_x86: + StrCpy $INSTDIR "$PROGRAMFILES\RARFileSource" + Goto end + +check_x64: + !insertmacro SectionFlagIsSet ${SEC_X64} ${SF_SELECTED} ok_x64 abort + +ok_x64: + StrCpy $INSTDIR "$PROGRAMFILES64\RARFileSource" + Goto end + +abort: + MessageBox MB_OK|MB_ICONEXCLAMATION "You must select at least one component." + Abort + +end: +FunctionEnd + Section "Uninstall" + !undef LIBRARY_X64 !insertmacro UnInstallLib REGDLL NOTSHARED REBOOT_NOTPROTECTED "$INSTDIR\RARFileSource.ax" + !define LIBRARY_X64 + !insertmacro UnInstallLib REGDLL NOTSHARED REBOOT_NOTPROTECTED "$INSTDIR\x64\RARFileSource.ax" Delete "$INSTDIR\Uninstall.exe" + RMDir "$INSTDIR\x64" RMDir "$INSTDIR" + SetRegView 32 DeleteRegKey HKLM ${REGKEY} SectionEnd |