| 1 | ; Written by redxii <redxii1234@hotmail.com>
|
|---|
| 2 | ; Codecs installer for SMPlayer
|
|---|
| 3 |
|
|---|
| 4 | ;--------------------------------
|
|---|
| 5 | ;Compressor
|
|---|
| 6 |
|
|---|
| 7 | SetCompressor /SOLID lzma
|
|---|
| 8 | SetCompressorDictSize 32
|
|---|
| 9 |
|
|---|
| 10 | ;--------------------------------
|
|---|
| 11 | ;Defines
|
|---|
| 12 |
|
|---|
| 13 | !define PRODUCT_VERSION "20071007"
|
|---|
| 14 |
|
|---|
| 15 | ;--------------------------------
|
|---|
| 16 | ;Include Modern UI and functions
|
|---|
| 17 |
|
|---|
| 18 | !include MUI2.nsh
|
|---|
| 19 |
|
|---|
| 20 | ;--------------------------------
|
|---|
| 21 | ;General
|
|---|
| 22 |
|
|---|
| 23 | ;Name and file
|
|---|
| 24 | Name "MPlayer Binary Codecs ${PRODUCT_VERSION}"
|
|---|
| 25 | OutFile "smplayer_codecs_${PRODUCT_VERSION}.exe"
|
|---|
| 26 |
|
|---|
| 27 | ;Show details
|
|---|
| 28 | ShowInstDetails show
|
|---|
| 29 |
|
|---|
| 30 | ;Get installation folder from registry if available
|
|---|
| 31 | InstallDirRegKey HKLM "Software\SMPlayer" "Path"
|
|---|
| 32 |
|
|---|
| 33 | ;Vista+ XML manifest, does not affect older OSes
|
|---|
| 34 | RequestExecutionLevel admin
|
|---|
| 35 |
|
|---|
| 36 | ;--------------------------------
|
|---|
| 37 | ;Variables
|
|---|
| 38 |
|
|---|
| 39 | Var IS_ADMIN
|
|---|
| 40 | Var USERNAME
|
|---|
| 41 |
|
|---|
| 42 | ;--------------------------------
|
|---|
| 43 | ;Interface Settings
|
|---|
| 44 |
|
|---|
| 45 | !define MUI_ABORTWARNING
|
|---|
| 46 | !define MUI_FINISHPAGE_NOREBOOTSUPPORT
|
|---|
| 47 | !define MUI_WELCOMEFINISHPAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Wizard\orange.bmp"
|
|---|
| 48 |
|
|---|
| 49 | ;Installer/Uninstaller icons
|
|---|
| 50 | !define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\orange-install.ico"
|
|---|
| 51 |
|
|---|
| 52 | ;--------------------------------
|
|---|
| 53 | ;Pages
|
|---|
| 54 |
|
|---|
| 55 | ;Install pages
|
|---|
| 56 | !insertmacro MUI_PAGE_WELCOME
|
|---|
| 57 | !insertmacro MUI_PAGE_DIRECTORY
|
|---|
| 58 | !insertmacro MUI_PAGE_INSTFILES
|
|---|
| 59 | !insertmacro MUI_PAGE_FINISH
|
|---|
| 60 |
|
|---|
| 61 | ;--------------------------------
|
|---|
| 62 | ; Languages
|
|---|
| 63 |
|
|---|
| 64 | !insertmacro MUI_LANGUAGE "English"
|
|---|
| 65 |
|
|---|
| 66 | ;--------------------------------
|
|---|
| 67 | ;Reserve Files
|
|---|
| 68 |
|
|---|
| 69 | ;These files should be inserted before other files in the data block
|
|---|
| 70 | ;Keep these lines before any File command
|
|---|
| 71 | ;Only for solid compression (by default, solid compression is enabled for BZIP2 and LZMA)
|
|---|
| 72 |
|
|---|
| 73 | ReserveFile "${NSISDIR}\Plugins\UserInfo.dll"
|
|---|
| 74 |
|
|---|
| 75 | ;------------------------------------------------------------------------------------------------
|
|---|
| 76 | ;Installer Sections
|
|---|
| 77 |
|
|---|
| 78 | ;--------------------------------
|
|---|
| 79 | ; Main SMPlayer files
|
|---|
| 80 | Section -Codecs
|
|---|
| 81 |
|
|---|
| 82 | Delete "$INSTDIR\mplayer\codecs\*"
|
|---|
| 83 |
|
|---|
| 84 | SetOutPath "$INSTDIR\mplayer\codecs"
|
|---|
| 85 | File "codecs\*"
|
|---|
| 86 |
|
|---|
| 87 | WriteRegDWORD HKLM Software\SMPlayer Installed_Codecs 0x1
|
|---|
| 88 |
|
|---|
| 89 | SectionEnd
|
|---|
| 90 |
|
|---|
| 91 | ;--------------------------------
|
|---|
| 92 | ;Installer Functions
|
|---|
| 93 |
|
|---|
| 94 | Function .onInit
|
|---|
| 95 |
|
|---|
| 96 | /* Privileges Check */
|
|---|
| 97 | Call CheckUserRights
|
|---|
| 98 |
|
|---|
| 99 | ;Check for admin (mimic old Inno Setup behavior)
|
|---|
| 100 | ${If} $IS_ADMIN == 0
|
|---|
| 101 | MessageBox MB_OK|MB_ICONSTOP "You must be logged in as an administrator when installing this program."
|
|---|
| 102 | Abort
|
|---|
| 103 | ${EndIf}
|
|---|
| 104 |
|
|---|
| 105 | ClearErrors
|
|---|
| 106 | ReadRegStr $0 HKLM Software\SMPlayer "Path"
|
|---|
| 107 | IfErrors 0 +2
|
|---|
| 108 | MessageBox MB_OK|MB_ICONEXCLAMATION "SMPlayer installation not found. You will have to manually locate your SMPlayer installation."
|
|---|
| 109 |
|
|---|
| 110 | FunctionEnd
|
|---|
| 111 |
|
|---|
| 112 | Function .onVerifyInstDir
|
|---|
| 113 |
|
|---|
| 114 | IfFileExists $INSTDIR\smplayer.exe PathGood
|
|---|
| 115 | Abort ; if $INSTDIR is not a smplayer directory, don't let us install there
|
|---|
| 116 | PathGood:
|
|---|
| 117 |
|
|---|
| 118 | FunctionEnd
|
|---|
| 119 |
|
|---|
| 120 | Function CheckUserRights
|
|---|
| 121 |
|
|---|
| 122 | ClearErrors
|
|---|
| 123 | UserInfo::GetName
|
|---|
| 124 | ${If} ${Errors}
|
|---|
| 125 | StrCpy $IS_ADMIN 1
|
|---|
| 126 | Return
|
|---|
| 127 | ${EndIf}
|
|---|
| 128 |
|
|---|
| 129 | Pop $USERNAME
|
|---|
| 130 | UserInfo::GetAccountType
|
|---|
| 131 | Pop $R0
|
|---|
| 132 | ${Switch} $R0
|
|---|
| 133 | ${Case} "Admin"
|
|---|
| 134 | ${Case} "Power"
|
|---|
| 135 | StrCpy $IS_ADMIN 1
|
|---|
| 136 | ${Break}
|
|---|
| 137 | ${Default}
|
|---|
| 138 | StrCpy $IS_ADMIN 0
|
|---|
| 139 | ${Break}
|
|---|
| 140 | ${EndSwitch}
|
|---|
| 141 |
|
|---|
| 142 | FunctionEnd
|
|---|
| 143 |
|
|---|
| 144 | ;End Installer Sections
|
|---|
| 145 | ;------------------------------------------------------------------------------------------------
|
|---|