/* ======================= UAC helper include file ....................... Macros starting with UAC.I should only be called from the installer and vice versa for UAC.U macros. */ !ifndef UAC_HDR__INC !define UAC_HDR__INC !include LogicLib.nsh !define UAC.RunElevatedAndProcessMessages 'UAC::RunElevated ' !define UAC.Unload 'UAC::Unload ' !define UAC.StackPush 'UAC::StackPush ' /*!macro _UAC.BuildOnInitElevationFunc _funcprefix Function ${_funcprefix}onInit !ifmacrodef FunctionEnd !macroend*/ !macro _UAC.GenerateSimpleFunction _funcprefix _funcName _funcCode Function ${_funcprefix}${_funcName} ${_funcCode} #messagebox mb_ok "${_funcprefix}${_funcName}" FunctionEnd !macroend !macro _UAC.TryDef _d _v !ifndef ${_d} !define ${_d} "${_v}" !endif !macroend !macro _UAC.InitStrings _modeprefix !insertmacro _UAC.TryDef UACSTR.UnDataFile "UAC.dat" !insertmacro _UAC.TryDef UACSTR.${_modeprefix}ElvWinErr "Unable to elevate , error $0" !ifNdef __UNINSTALL__ !insertmacro _UAC.TryDef UACSTR.${_modeprefix}ElvAbortReqAdmin "This installer requires admin access, aborting!" !insertmacro _UAC.TryDef UACSTR.${_modeprefix}ElvMustTryAgain "This installer requires admin access, try again" !else !insertmacro _UAC.TryDef UACSTR.${_modeprefix}ElvAbortReqAdmin "This uninstaller requires admin access, aborting!" !insertmacro _UAC.TryDef UACSTR.${_modeprefix}ElvMustTryAgain "This uninstaller requires admin access, try again" !endif !macroend !ifmacroNdef _UAC.GenerateUninstallerTango !macro _UAC.GenerateUninstallerTango UninstallerFileName !ifdef __GLOBAL__ !error "UAC: Needs to be called inside a function" !endif !ifNdef __UNINSTALL__ !error "UAC: _UAC.GenerateUninstallerTango should only be called by uninstaller, see http://forums.winamp.com/showthread.php?threadid=280330" !endif !ifNdef UAC_UNINSTALLERTANGOFORALLPLATFORMS !include WinVer.nsh !endif !insertmacro _UAC.InitStrings 'U.' ReadIniStr $0 "$ExeDir\${UACSTR.UnDataFile}" UAC "Un.Ready" ${IF} $0 != 1 !ifNdef UAC_UNINSTALLERTANGOFORALLPLATFORMS ${AndIf} ${AtLeastWinVista} !endif InitPluginsDir WriteIniStr "$PluginsDir\${UACSTR.UnDataFile}" UAC "Un.Ready" 1 CopyFiles /SILENT "$EXEPATH" "$PluginsDir\${UninstallerFileName}" StrCpy $0 "" ${IfThen} ${Silent} ${|} StrCpy $0 "/S " ${|} ExecWait '"$PluginsDir\${UninstallerFileName}" $0/NCRC _?=$INSTDIR' $0 SetErrorLevel $0 Quit ${EndIf} !macroend !endif !ifmacroNdef _UAC.GenerateOnInitElevationCode !macro _UAC.GenerateOnInitElevationCode _modeprefix !ifndef __FUNCTION__ !error "UAC: Needs to be called inside a function" !endif !insertmacro _UAC.InitStrings ${_modeprefix} !define _UAC.GOIECUniq L${__LINE__} UAC_Elevate_${_UAC.GOIECUniq}: UAC::RunElevated StrCmp 1223 $0 UAC_ElevationAborted_${_UAC.GOIECUniq} ; UAC dialog aborted by user? StrCmp 0 $0 0 UAC_Err_${_UAC.GOIECUniq} ; Error? StrCmp 1 $1 0 UAC_Success_${_UAC.GOIECUniq} ;Are we the real deal or just the wrapper? Quit UAC_Err_${_UAC.GOIECUniq}: MessageBox mb_iconstop "${UACSTR.${_modeprefix}ElvWinErr}" Abort UAC_ElevationAborted_${_UAC.GOIECUniq}: MessageBox mb_iconstop "${UACSTR.${_modeprefix}ElvAbortReqAdmin}" Abort UAC_Success_${_UAC.GOIECUniq}: # if $0==0 && $3==1, we are a member of the admin group (Any OS) # if $0==0 && $1==0, UAC not supported (Probably