Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;Age of Empires - Rise of Rome(Portable Edition)
- ;by [#Ph4n70m]
- Name "RoRPortable"
- SilentInstall silent
- ShowInstDetails nevershow
- OutFile "..\RiseOfRome.exe"
- Icon "RiseOfRome.ico"
- VIProductVersion "1.0.0.0"
- VIAddVersionKey FileVersion "1.0.0.0"
- VIAddVersionKey FileDescription "Age of Empires - Rise of Rome for portable devices."
- VIAddVersionKey LegalCopyright "[#Ph4n70m]"
- VIAddVersionKey ProductName "Age of Empires - Rise of Rome (Portable Edition)"
- VIAddVersionKey CompanyName "[#Ph4n70m]"
- !define AOEHKLMREGKEY "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Games\Age of Empires\1.00"
- !define AOEHKCUREGKEY "HKEY_CURRENT_USER\Software\Microsoft\Games\Age of Empires\1.00"
- !define RORHKLMREGKEY "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft Games\Age of Empires Expansion\1.0"
- !define RORHKCUREGKEY "HKEY_CURRENT_USER\Software\Microsoft\Microsoft Games\Age of Empires Expansion\1.0"
- !include Registry.nsh
- Var APPDIR
- Var DEFAULTDATADIR
- Var DATADIR
- Section "Main"
- Call SetVariables
- Call PrepareHost
- Call StartApplication
- Call CleanHost
- SectionEnd
- Function SetVariables
- StrCpy $APPDIR "$EXEDIR\App\AoE"
- StrCpy $DEFAULTDATADIR "$EXEDIR\App\DefaultData"
- StrCpy $DATADIR "$EXEDIR\Data"
- FunctionEnd
- Function PrepareHost
- ; Age of Empires part:
- SetOutPath "$APPDIR"
- ${registry::KeyExists} "${AOEHKLMREGKEY}" $0
- StrCmp $0 "-1" ContinueWithoutBackupAoEHKLM
- ${registry::MoveKey} "${AOEHKLMREGKEY}" "${AOEHKLMREGKEY} HostBackup" $0
- ContinueWithoutBackupAoEHKLM:
- ${registry::KeyExists} "${AOEHKCUREGKEY}" $0
- StrCmp $0 "-1" ContinueWithoutBackupAoEHKCU
- ${registry::MoveKey} "${AOEHKCUREGKEY}" "${AOEHKCUREGKEY} HostBackup" $0
- ContinueWithoutBackupAoEHKCU:
- IfFileExists "$DATADIR\AgeOfEmpires_HKLM_Registry.reg" ImportAoEHKLM
- CopyFiles /SILENT "$DEFAULTDATADIR\AgeOfEmpires_HKLM_Default.reg" "$DATADIR\AgeOfEmpires_HKLM_Registry.reg"
- ImportAoEHKLM:
- nsExec::Exec `"$WINDIR\system32\reg.exe" import "$DATADIR\AgeOfEmpires_HKLM_Registry.reg"`
- IfFileExists "$DATADIR\AgeOfEmpires_HKCU_Registry.reg" ImportAoEHKCU
- CopyFiles /SILENT "$DEFAULTDATADIR\AgeOfEmpires_HKCU_Default.reg" "$DATADIR\AgeOfEmpires_HKCU_Registry.reg"
- ImportAoEHKCU:
- nsExec::Exec `"$WINDIR\system32\reg.exe" import "$DATADIR\AgeOfEmpires_HKCU_Registry.reg"`
- ${registry::Write} "${AOEHKLMREGKEY}" "InstallationDirectory" "$APPDIR" "REG_SZ" $0
- ; Rise of Rome part:
- ${registry::KeyExists} "${RORHKLMREGKEY}" $0
- StrCmp $0 "-1" ContinueWithoutBackupRoRHKLM
- ${registry::MoveKey} "${RORHKLMREGKEY}" "${RORHKLMREGKEY} HostBackup" $0
- ContinueWithoutBackupRoRHKLM:
- ${registry::KeyExists} "${RORHKCUREGKEY}" $0
- StrCmp $0 "-1" ContinueWithoutBackupRoRHKCU
- ${registry::MoveKey} "${RORHKCUREGKEY}" "${RORHKCUREGKEY} HostBackup" $0
- ContinueWithoutBackupRoRHKCU:
- IfFileExists "$DATADIR\RiseOfRome_HKLM_Registry.reg" ImportRoRHKLM
- CopyFiles /SILENT "$DEFAULTDATADIR\RiseOfRome_HKLM_Default.reg" "$DATADIR\RiseOfRome_HKLM_Registry.reg"
- ImportRoRHKLM:
- nsExec::Exec `"$WINDIR\system32\reg.exe" import "$DATADIR\RiseOfRome_HKLM_Registry.reg"`
- IfFileExists "$DATADIR\RiseOfRome_HKCU_Registry.reg" ImportRoRHKCU
- CopyFiles /SILENT "$DEFAULTDATADIR\RiseOfRome_HKCU_Default.reg" "$DATADIR\RiseOfRome_HKCU_Registry.reg"
- ImportRoRHKCU:
- nsExec::Exec `"$WINDIR\system32\reg.exe" import "$DATADIR\RiseOfRome_HKCU_Registry.reg"`
- ${registry::Write} "${RORHKLMREGKEY}" "EXE Path" "$APPDIR" "REG_SZ" $0
- FunctionEnd
- Function StartApplication
- ExecWait "$APPDIR\Empiresx.exe"
- FunctionEnd
- Function CleanHost
- ; Age of Empires part:
- ${registry::SaveKey} "${AOEHKLMREGKEY}" "$DATADIR\AgeOfEmpires_HKLM_Registry.reg" "" $0
- ${registry::SaveKey} "${AOEHKCUREGKEY}" "$DATADIR\AgeOfEmpires_HKCU_Registry.reg" "" $0
- ${registry::DeleteKey} "${AOEHKLMREGKEY}" $0
- ${registry::DeleteKey} "${AOEHKCUREGKEY}" $0
- ${registry::KeyExists} "${AOEHKLMREGKEY} HostBackup" $0
- StrCmp $0 "-1" ContinueWithoutRestoreAoEHKLM
- ${registry::MoveKey} "${AOEHKLMREGKEY} HostBackup" "${AOEHKLMREGKEY}" $0
- ContinueWithoutRestoreAoEHKLM:
- ${registry::KeyExists} "${AOEHKCUREGKEY} HostBackup" $0
- StrCmp $0 "-1" ContinueWithoutRestoreAoEHKCU
- ${registry::MoveKey} "${AOEHKCUREGKEY} HostBackup" "${AOEHKCUREGKEY}" $0
- ContinueWithoutRestoreAoEHKCU:
- ${registry::Unload}
- DeleteRegKey /ifempty HKLM "SOFTWARE\Microsoft\Games\Age of Empires"
- DeleteRegKey /ifempty HKLM "SOFTWARE\Microsoft\Games"
- DeleteRegKey /ifempty HKCU "Software\Microsoft\Games\Age of Empires"
- DeleteRegKey /ifempty HKCU "Software\Microsoft\Games"
- ; Rise of Rome part:
- ${registry::SaveKey} "${RORHKLMREGKEY}" "$DATADIR\RiseOfRome_HKLM_Registry.reg" "" $0
- ${registry::SaveKey} "${RORHKCUREGKEY}" "$DATADIR\RiseOfRome_HKCU_Registry.reg" "" $0
- ${registry::DeleteKey} "${RORHKLMREGKEY}" $0
- ${registry::DeleteKey} "${RORHKCUREGKEY}" $0
- ${registry::KeyExists} "${RORHKLMREGKEY} HostBackup" $0
- StrCmp $0 "-1" ContinueWithoutRestoreRoRHKLM
- ${registry::MoveKey} "${RORHKLMREGKEY} HostBackup" "${RORHKLMREGKEY}" $0
- ContinueWithoutRestoreRoRHKLM:
- ${registry::KeyExists} "${RORHKCUREGKEY} HostBackup" $0
- StrCmp $0 "-1" ContinueWithoutRestoreRoRHKCU
- ${registry::MoveKey} "${RORHKCUREGKEY} HostBackup" "${RORHKCUREGKEY}" $0
- ContinueWithoutRestoreRoRHKCU:
- ${registry::Unload}
- DeleteRegKey /ifempty HKLM "SOFTWARE\Microsoft\Microsoft Games\Age of Empires Expansion"
- DeleteRegKey /ifempty HKLM "SOFTWARE\Microsoft\Microsoft Games"
- DeleteRegKey /ifempty HKCU "Software\Microsoft\Microsoft Games\Age of Empires Expansion"
- DeleteRegKey /ifempty HKCU "Software\Microsoft\Microsoft Games"
- FunctionEnd
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement