!include "MUI.nsh" LangString AG_FAIL_NOT_ADMIN ${LANG_ENGLISH} "Administrator rights are needed to install the package. Rerun this installation as user with administrator privileges. This installation will be aborted." LangString AG_IPTD_BE_PEPARED ${LANG_ENGLISH} "This installation will now \ install a driver - this may cause a few popup messages from the system. \ $\r$\n$\r$\n For a successful installation please allow those to continue!" Function .onInit Call IsUserAdmin Pop $R2 StrCmp $R2 "true" +4 0 push $R3 push $(AG_FAIL_NOT_ADMIN) Call FailureMsg FunctionEnd Function IsUserAdmin Push $R0 Push $R1 Push $R2 ClearErrors UserInfo::GetName IfErrors Win9x Pop $R1 UserInfo::GetAccountType Pop $R2 StrCmp $R2 "Admin" 0 Continue ; Observation: I get here when running Win98SE. (Lilla) ; The functions UserInfo.dll looks for are there on Win98 too, ; but just don't work. So UserInfo.dll, knowing that admin isn't required ; on Win98, returns admin anyway. (per kichik) ; MessageBox MB_OK 'User "$R1" is in the Administrators group' StrCpy $R0 "true" Goto Done Continue: ; You should still check for an empty string because the functions ; UserInfo.dll looks for may not be present on Windows 95. (per kichik) StrCmp $R2 "" Win9x StrCpy $R0 "false" ;MessageBox MB_OK 'User "$R1" is in the "$R2" group' Goto Done Win9x: ; comment/message below is by UserInfo.nsi author: ; This one means you don't need to care about admin or ; not admin because Windows 9x doesn't either ;MessageBox MB_OK "Error! This DLL can't run under Windows 9x!" StrCpy $R0 "true" Done: ;MessageBox MB_OK 'User= "$R1" AccountType= "$R2" IsUserAdmin= "$R0"' Pop $R2 Pop $R1 Exch $R0 FunctionEnd Function FailureMsg Pop $R0 Pop $R1 StrCmp $R1 true +2 0 MessageBox MB_OK $R0 abort FunctionEnd Function CustomPage ;If not using Modern UI use InstallOptions::dialog "iofile.ini" !insertmacro MUI_HEADER_TEXT "text" "subtext" !insertmacro MUI_INSTALLOPTIONS_DISPLAY "iofile.ini" FunctionEnd ;-------------------------------- ;General ;Name and file Name "AppGate Package" OutFile "agpkg.exe" ;Default installation folder InstallDir "$PROGRAMFILES\AppGate" ;InstallDir "$TEMP\agpkg" ;-------------------------------- ;Interface Settings !define MUI_ICON "icon.ico" !define MUI_ABORTWARNING ;-------------------------------- ;Pages !insertmacro MUI_PAGE_WELCOME Page custom CustomPage !insertmacro MUI_PAGE_DIRECTORY !insertmacro MUI_PAGE_INSTFILES ;-------------------------------- ;Languages !insertmacro MUI_LANGUAGE "English" ;-------------------------------- ;Installer Sections Section "Package Section" SecPackage SetOutPath "$INSTDIR" ; Select the content you want to go into the package. ; Comment/uncomment the relevant lines bellow. ; ; File "agconnect.exe" File "agclient.exe" File "agiptd.exe" ; ExecWait '"$INSTDIR\agconnect.exe" /S /D="$INSTDIR"' ExecWait '"$INSTDIR\agclient.exe" /S /D="$INSTDIR"' ; Comment out the two lines bellow if agiptd.exe is NOT used. MessageBox MB_OK|MB_ICONINFORMATION $(AG_IPTD_BE_PEPARED) ExecWait '"$INSTDIR\agiptd.exe" /S /D="$INSTDIR\AppGate IP Tunneling Driver"' ; This line installs a agclient.properties template (7.0 or later) File "/oname=preinstalled\agclient.properties" "agclient.properties" ; This line installs a agclient.conf template (use this for versions prior to 7.0) ; File "/oname=preinstalled\agclient.conf" "agclient.conf" ; Delete $INSTDIR/agconnect.exe Delete $INSTDIR/agclient.exe Delete $INSTDIR/agiptd.exe SectionEnd