Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;Age of Empires II - The Conquerors Expansion (Portable Edition)
- ;by [#Ph4n70m]
- Name "AoE2ConquerorsPortable"
- SilentInstall silent
- ShowInstDetails nevershow
- OutFile "..\TheConquerors.exe"
- Icon "TheConquerors.ico"
- VIProductVersion "1.0.0.0"
- VIAddVersionKey FileVersion "1.0.0.0"
- VIAddVersionKey FileDescription "Age of Empires II - The Conquerors Expansion for portable devices."
- VIAddVersionKey LegalCopyright "[#Ph4n70m]"
- VIAddVersionKey ProductName "Age of Empires II - The Conquerors Expansion (Portable Edition)"
- VIAddVersionKey CompanyName "[#Ph4n70m]"
- !define KINGSHKLMREGKEY "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft Games\Age of Empires\2.0"
- !define KINGSHKCUREGKEY "HKEY_CURRENT_USER\Software\Microsoft\Microsoft Games\Age of Empires\2.0"
- !define CONQHKLMREGKEY "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft Games\Age of Empires II: The Conquerors Expansion\1.0"
- !define CONQHKCUREGKEY "HKEY_CURRENT_USER\Software\Microsoft\Microsoft Games\Age of Empires II: The Conquerors 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\AoE2"
- StrCpy $DEFAULTDATADIR "$EXEDIR\App\DefaultData"
- StrCpy $DATADIR "$EXEDIR\Data"
- FunctionEnd
- Function PrepareHost
- ; The Age of Kings part
- SetOutPath "$APPDIR"
- ${registry::KeyExists} "${KINGSHKLMREGKEY}" $0
- StrCmp $0 "-1" ContinueWithoutBackupKingsHKLM
- ${registry::MoveKey} "${KINGSHKLMREGKEY}" "${KINGSHKLMREGKEY} HostBackup" $0
- ContinueWithoutBackupKingsHKLM:
- ${registry::KeyExists} "${KINGSHKCUREGKEY}" $0
- StrCmp $0 "-1" ContinueWithoutBackupKingsHKCU
- ${registry::MoveKey} "${KINGSHKCUREGKEY}" "${KINGSHKCUREGKEY} HostBackup" $0
- ContinueWithoutBackupKingsHKCU:
- IfFileExists "$DATADIR\TheKings_HKLM_Registry.reg" ImportKingsHKLM
- CopyFiles /SILENT "$DEFAULTDATADIR\TheKings_HKLM_Default.reg" "$DATADIR\TheKings_HKLM_Registry.reg"
- ImportKingsHKLM:
- nsExec::Exec `"$WINDIR\system32\reg.exe" import "$DATADIR\TheKings_HKLM_Registry.reg"`
- IfFileExists "$DATADIR\TheKings_HKCU_Registry.reg" ImportKingsHKCU
- CopyFiles /SILENT "$DEFAULTDATADIR\TheKings_HKCU_Default.reg" "$DATADIR\TheKings_HKCU_Registry.reg"
- ImportKingsHKCU:
- nsExec::Exec `"$WINDIR\system32\reg.exe" import "$DATADIR\TheKings_HKCU_Registry.reg"`
- ${registry::Write} "${KINGSHKLMREGKEY}" "EXE Path" "$APPDIR" "REG_SZ" $0
- ${registry::Write} "${KINGSHKLMREGKEY}" "InstallationDirectory" "$APPDIR" "REG_SZ" $0
- ; The Conquerors part
- ${registry::KeyExists} "${CONQHKLMREGKEY}" $0
- StrCmp $0 "-1" ContinueWithoutBackupConqHKLM
- ${registry::MoveKey} "${CONQHKLMREGKEY}" "${CONQHKLMREGKEY} HostBackup" $0
- ContinueWithoutBackupConqHKLM:
- ${registry::KeyExists} "${CONQHKCUREGKEY}" $0
- StrCmp $0 "-1" ContinueWithoutBackupConqHKCU
- ${registry::MoveKey} "${CONQHKCUREGKEY}" "${CONQHKCUREGKEY} HostBackup" $0
- ContinueWithoutBackupConqHKCU:
- IfFileExists "$DATADIR\TheConquerors_HKLM_Registry.reg" ImportConqHKLM
- CopyFiles /SILENT "$DEFAULTDATADIR\TheConquerors_HKLM_Default.reg" "$DATADIR\TheConquerors_HKLM_Registry.reg"
- ImportConqHKLM:
- nsExec::Exec `"$WINDIR\system32\reg.exe" import "$DATADIR\TheConquerors_HKLM_Registry.reg"`
- IfFileExists "$DATADIR\TheConquerors_HKCU_Registry.reg" ImportConqHKCU
- CopyFiles /SILENT "$DEFAULTDATADIR\TheConquerors_HKCU_Default.reg" "$DATADIR\TheConquerors_HKCU_Registry.reg"
- ImportConqHKCU:
- nsExec::Exec `"$WINDIR\system32\reg.exe" import "$DATADIR\TheConquerors_HKCU_Registry.reg"`
- ${registry::Write} "${CONQHKLMREGKEY}" "EXE Path" "$APPDIR" "REG_SZ" $0
- FunctionEnd
- Function StartApplication
- ExecWait "$APPDIR\age2_x1\age2_x1.exe"
- FunctionEnd
- Function CleanHost
- ; The Age of Kings part
- ${registry::SaveKey} "${KINGSHKLMREGKEY}" "$DATADIR\TheKings_HKLM_Registry.reg" "" $0
- ${registry::SaveKey} "${KINGSHKCUREGKEY}" "$DATADIR\TheKings_HKCU_Registry.reg" "" $0
- ${registry::DeleteKey} "${KINGSHKLMREGKEY}" $0
- ${registry::DeleteKey} "${KINGSHKCUREGKEY}" $0
- ${registry::KeyExists} "${KINGSHKLMREGKEY} HostBackup" $0
- StrCmp $0 "-1" ContinueWithoutRestoreKingsHKLM
- ${registry::MoveKey} "${KINGSHKLMREGKEY} HostBackup" "${KINGSHKLMREGKEY}" $0
- ContinueWithoutRestoreKingsHKLM:
- ${registry::KeyExists} "${KINGSHKCUREGKEY} HostBackup" $0
- StrCmp $0 "-1" ContinueWithoutRestoreKingsHKCU
- ${registry::MoveKey} "${KINGSHKCUREGKEY} HostBackup" "${KINGSHKCUREGKEY}" $0
- ContinueWithoutRestoreKingsHKCU:
- DeleteRegKey /ifempty HKLM "SOFTWARE\Microsoft\Microsoft Games\Age of Empires"
- DeleteRegKey /ifempty HKCU "Software\Microsoft\Microsoft Games\Age of Empires"
- ; The Conquerors part
- ${registry::SaveKey} "${CONQHKLMREGKEY}" "$DATADIR\TheConquerors_HKLM_Registry.reg" "" $0
- ${registry::SaveKey} "${CONQHKCUREGKEY}" "$DATADIR\TheConquerors_HKCU_Registry.reg" "" $0
- ${registry::DeleteKey} "${CONQHKLMREGKEY}" $0
- ${registry::DeleteKey} "${CONQHKCUREGKEY}" $0
- ${registry::KeyExists} "${CONQHKLMREGKEY} HostBackup" $0
- StrCmp $0 "-1" ContinueWithoutRestoreConqHKLM
- ${registry::MoveKey} "${CONQHKLMREGKEY} HostBackup" "${CONQHKLMREGKEY}" $0
- ContinueWithoutRestoreConqHKLM:
- ${registry::KeyExists} "${CONQHKCUREGKEY} HostBackup" $0
- StrCmp $0 "-1" ContinueWithoutRestoreConqHKCU
- ${registry::MoveKey} "${CONQHKCUREGKEY} HostBackup" "${CONQHKCUREGKEY}" $0
- ContinueWithoutRestoreConqHKCU:
- ${registry::Unload}
- DeleteRegKey /ifempty HKLM "SOFTWARE\Microsoft\Microsoft Games\Age of Empires II: The Conquerors Expansion"
- DeleteRegKey /ifempty HKLM "SOFTWARE\Microsoft\Microsoft Games"
- DeleteRegKey /ifempty HKCU "Software\Microsoft\Microsoft Games\Age of Empires II: The Conquerors Expansion"
- DeleteRegKey /ifempty HKCU "Software\Microsoft\Microsoft Games"
- FunctionEnd
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement