;Copyright (C) 2006 Steve Topletz ;Portions Copyright 2004-2006 John T. Haller ;Portions Copyright 2004 Gerard Balagué ;Website: http://PortableApps.com/Portableclient ;This software is OSI Certified Open Source Software. ;OSI Certified is a certification mark of the Open Source Initiative. ;This program is free software; you can redistribute it and/or ;modify it under the terms of the GNU General Public License ;as published by the Free Software Foundation; either version 2 ;of the License, or (at your option) any later version. ;This program is distributed in the hope that it will be useful, ;but WITHOUT ANY WARRANTY; without even the implied warranty of ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;GNU General Public License for more details. ;You should have received a copy of the GNU General Public License ;along with this program; if not, write to the Free Software ;Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. !define FULLNAME "Torpark" !define NAME "Torpark" !define APP "firefox" !define VER "1.5.0.8" !define WEBSITE "www.Torrify.com" !define DEFAULTAPPDIR "${APP}" !define DEFAULTEXE "${APP}.exe" !define DEFAULTTORDIR "tor" !define DEFAULTTEMPDIR "temp" !define DEFAULTPROFILEDIR "profile" !define DEFAULTPLUGINSDIR "plugins" !define DEFAULTUSERPROFILEDIR "userprofile" !define SERVICENAME "Torpark Pro" ;=== Program Details Name "${NAME}" OutFile "${NAME}.exe" Caption "${FULLNAME} - Turn any terminal into a secure connection." VIProductVersion "${VER}" VIAddVersionKey FileDescription "${FULLNAME}" VIAddVersionKey LegalCopyright "2006 Steve Topletz, 2004-2006 John T. Haller, portions 2004 by Gerard Balagué" VIAddVersionKey Comments "${NAME} turns any internet terminal into an anonymous connection. For additional details, visit ${WEBSITE}" VIAddVersionKey CompanyName "Steve Topletz, John T. Haller, portions by Gerard Balagué." VIAddVersionKey OriginalFilename "${NAME}.exe" VIAddVersionKey FileVersion "${VER}" ;=== Runtime Switches CRCCheck On WindowIcon Off SilentInstall Silent AutoCloseWindow True SetCompressor /SOLID LZMA ;=== Includes !include "Time.nsh" !include "FileFunc.nsh" !insertmacro GetParameters ;=== Program Icon Icon "${NAME}.ico" Var PROGRAMEXECUTABLE Var PROGRAMDIRECTORY Var PROFILEDIRECTORY Var PLUGINSDIRECTORY Var TORRIFYSERVICE Var SERVICELEVEL ;0 = Tor, 1 = Torrify Var USERPROFILEDIRECTORY Var SKIPCHROMEFIX Var SKIPCOMPREGFIX Var EXECSTRING Var INIPATH Var ISFILELINE Var DISABLESPLASHSCREEN Var DISABLEWARNING Var ISDEFAULTDIRECTORY Var TORDIRECTORY Var TEMPDIR Var CIRCUITTIMER Var OutPath Var NUMCIRCUITS Var DEBUGON Var LaunchedExecutable Var TIMERMAX Var CYCLEPOS Var LAUNCHTIME Var CONNECTIONCLIENT Var CONNECTIONCLIENTNAME Var CONNECTIONSTRING Var LOCALHOMEPAGE Var PROCEDURE Var AUTHSTRING Var AUTHURL Var AUTHRETURN Function .onInit ;This function allows Torpark to change $PLUGINSDIR to a different directory. That way, the dll's aren't writtent to the hard drive. And it checks if Torpark is already running. StrCpy $9 "$EXEDIR\App\torpark\${DEFAULTTEMPDIR}" ;This is the path you want $PLUGINSDIR to be SetOutPath $9 File /oname=$9\chngvrbl.dll "${NSISDIR}\Plugins\chngvrbl.dll" File /oname=$9\skin.skf "skin.skf" ;skin (which adds about 1.5MB to exec size! The cost of looking cool.) NSIS_SkinCrafter_Plugin::skin /NOUNLOAD $9\skin.skf ;skin Delete $9\skin.skf ;skin Push $9 Push 26 ; $PLUGINSDIR CallInstDLL "$9\chngvrbl.dll" changeVariable FunctionEnd Section "Main" Goto Mutex Mutex: System::Call 'kernel32::CreateMutexA(i 0, i 0, t "TorparkMutex") i .r1 ?e' Pop $R5 StrCmp $R5 0 +2 MessageBox MB_YESNO|MB_ICONQUESTION|MB_TOPMOST `It appears that Torpark is already running. Would you like to shut down Torpark?` IDYES UnloadTorparkandClient Goto SetVars SetVars: StrCpy $LaunchedExecutable 0 ;ProgramExecutable has not been launched StrCpy $DEBUGON 0 ;Debug is off by default Goto ReadParameters ReadParameters: ${GetParameters} $1 ;Get the stuff that was typed after the command line. StrCmp $1 "/debug" DebugMode "" ;If it was /debug then go to DebugMode StrCmp $1 "/log" DebugMode "" ;If it was /debugsilent then go to DebugMode StrCmp $1 "/DEADBEEF" EasterEgg "" Goto FindINI FindINI: ;=== Find the INI file, if there is one StrCpy $PROCEDURE "FindINI" Call DebugHeader IfFileExists "$EXEDIR\${NAME}.ini" "" NoINI ; If there is an INI file, it has to be in the EXEDIR with the main program. StrCpy $PROCEDURE "INI File Found" Call DebugHeader StrCpy "$INIPATH" "$EXEDIR\" Goto ReadINI ReadINI: StrCpy $PROCEDURE "ReadINI" Call DebugHeader ;Begin Reading the INI File ReadINIStr $0 "$INIPATH\${NAME}.ini" "${NAME}" "TorDirectory" StrCpy "$TORDIRECTORY" "$EXEDIR\$0" IfErrors 0 +2 MessageBox MB_OK|MB_ICONINFORMATION `INI Error in TorDirectory` ReadINIStr $0 "$INIPATH\${NAME}.ini" "${NAME}" "OutPath" StrCpy "$OutPath" "$EXEDIR\$0" IfErrors 0 +2 MessageBox MB_OK|MB_ICONINFORMATION `INI Error in OutPath` ReadINIStr $0 "$INIPATH\${NAME}.ini" "${NAME}" "ProgramDirectory" StrCpy "$PROGRAMDIRECTORY" "$EXEDIR\$0" IfErrors 0 +2 MessageBox MB_OK|MB_ICONINFORMATION `INI Error in ProgramDirectory` ReadINIStr $0 "$INIPATH\${NAME}.ini" "${NAME}" "ProgramExecutable" StrCpy "$PROGRAMEXECUTABLE" "$0" IfErrors 0 +2 MessageBox MB_OK|MB_ICONINFORMATION `INI Error in ProgramExecutable` ReadINIStr $0 "$INIPATH\${NAME}.ini" "${NAME}" "ProfileDirectory" StrCpy "$PROFILEDIRECTORY" "$EXEDIR\$0" IfErrors 0 +2 MessageBox MB_OK|MB_ICONINFORMATION `INI Error in ProfileDirectory` ReadINIStr $0 "$INIPATH\${NAME}.ini" "${NAME}" "PluginsDirectory" StrCpy "$PLUGINSDIRECTORY" "$EXEDIR\$0" IfErrors 0 +2 MessageBox MB_OK|MB_ICONINFORMATION `INI Error in PluginsDirectory` ReadINIStr $0 "$INIPATH\${NAME}.ini" "${NAME}" "TempDirectory" StrCpy "$TEMPDIR" "$EXEDIR\$0" IfErrors 0 +2 MessageBox MB_OK|MB_ICONINFORMATION `INI Error in TempDirectory` ReadINIStr $0 "$INIPATH\${NAME}.ini" "${NAME}" "UserProfileDirectory" StrCpy "$USERPROFILEDIRECTORY" "$EXEDIR\$0" IfErrors 0 +2 MessageBox MB_OK|MB_ICONINFORMATION `INI Error in UserProfileDirectory` ReadINIStr $0 "$INIPATH\${NAME}.ini" "${NAME}" "TimerMax" StrCpy "$TIMERMAX" $0 IfErrors 0 +2 MessageBox MB_OK|MB_ICONINFORMATION `INI Error in TimerMax` ReadINIStr $0 "$INIPATH\${NAME}.ini" "${NAME}" "TorrifyService" StrCpy "$TORRIFYSERVICE" "$0" IfErrors 0 +2 MessageBox MB_OK|MB_ICONINFORMATION `INI Error in TorrifyService` ReadINIStr $0 "$INIPATH\${NAME}.ini" "${NAME}" "DisableSplashScreen" StrCpy "$DISABLESPLASHSCREEN" $0 IfErrors 0 +2 MessageBox MB_OK|MB_ICONINFORMATION `INI Error in DisableSplashScreen` ReadINIStr $0 "$INIPATH\${NAME}.ini" "${NAME}" "DisableWarning" StrCpy "$DISABLEWARNING" $0 IfErrors 0 +2 MessageBox MB_OK|MB_ICONINFORMATION `INI Error in DisableWarning` ReadINIStr $0 "$INIPATH\${NAME}.ini" "${NAME}" "SkipChromeFix" StrCpy "$DISABLEWARNING" $0 IfErrors 0 +2 MessageBox MB_OK|MB_ICONINFORMATION `INI Error in SkipChromeFix` ReadINIStr $0 "$INIPATH\${NAME}.ini" "${NAME}" "SkipCompregFix" StrCpy "$DISABLEWARNING" $0 IfErrors 0 +2 MessageBox MB_OK|MB_ICONINFORMATION `INI Error in SkipCompregFix` ReadINIStr $0 "$INIPATH\${NAME}.ini" "${NAME}" "DisableWarning" StrCpy "$DISABLEWARNING" $0 IfErrors 0 +2 MessageBox MB_OK|MB_ICONINFORMATION `INI Error in DisableWarning` ReadINIStr $0 "$INIPATH\${NAME}.ini" "${NAME}" "LocalHomePage" StrCpy "$LOCALHOMEPAGE" $0 IfErrors 0 +2 MessageBox MB_OK|MB_ICONINFORMATION `INI Error in LocalHomePage` ;And now to send the data to debug: StrCmp $DEBUGON 2 "" +17 ${time::GetLocalTime} $R0 FileWrite $6 "$R7 TORDIRECTORY: $TORDIRECTORY$\n" FileWrite $6 "$R7 OUTPATH: $OUTPATH$\n" FileWrite $6 "$R7 PROGRAMDIRECORY: $PROGRAMDIRECTORY$\n" FileWrite $6 "$R7 PROGRAMEXECUTABLE: $PROGRAMEXECUTABLE$\n" FileWrite $6 "$R7 PROFILEDIRECTORY: $PROFILEDIRECTORY$\n" FileWrite $6 "$R7 PLUGINSDIRECTORY: $PLUGINSDIRECTORY$\n" FileWrite $6 "$R7 TEMPDIR: $TEMPDIR$\n" FileWrite $6 "$R7 USERPROFILEDIRECTORY: $USERPROFILEDIRECTORY$\n" FileWrite $6 "$R7 TIMERMAX: $TIMERMAX$\n" FileWrite $6 "$R7 TORRIFYSERVICE: $TORRIFYSERVICE$\n" FileWrite $6 "$R7 DISABLESPLASHSCREEN: $DISABLESPLASHSCREEN$\n" FileWrite $6 "$R7 SKIPCHROMEFIX: $SKIPCHROMEFIX$\n" FileWrite $6 "$R7 SKIPCOMPREGFIX: $SKIPCOMPREGFIX$\n" FileWrite $6 "$R7 ISDEFAULTDIRECTORY: $ISDEFAULTDIRECTORY$\n" FileWrite $6 "$R7 LOCALHOMEPAGE: $LOCALHOMEPAGE$\n" ;We have now read the INI, time to continue to load. Goto DetermineService NoINI: StrCpy $PROCEDURE "NoINI" Call DebugHeader ;=== No INI file, so we'll use the defaults StrCpy "$TORDIRECTORY" "$EXEDIR\App\${DEFAULTTORDIR}" StrCpy "$OutPath" "$EXEDIR\App" StrCpy "$PROGRAMDIRECTORY" "$EXEDIR\App\torpark\${DEFAULTAPPDIR}" StrCpy "$PROGRAMEXECUTABLE" "${DEFAULTEXE}" StrCpy "$PROFILEDIRECTORY" "$EXEDIR\Data\torpark\${DEFAULTPROFILEDIR}" StrCpy "$PLUGINSDIRECTORY" "$EXEDIR\Data\torpark\${DEFAULTPLUGINSDIR}" StrCpy "$TEMPDIR" "$EXEDIR\App\torpark\${DEFAULTTEMPDIR}" StrCpy "$USERPROFILEDIRECTORY" "$EXEDIR\Data\torpark\userprofile" StrCpy "$TIMERMAX" 90 StrCpy "$TORRIFYSERVICE" "false" StrCpy "$DISABLESPLASHSCREEN" "false" StrCpy "$DISABLEWARNING" "false" StrCpy "$SKIPCHROMEFIX" "false" StrCpy "$SKIPCOMPREGFIX" "false" StrCpy "$ISDEFAULTDIRECTORY" "true" StrCpy "$LOCALHOMEPAGE" "" GoTo DetermineService DetermineService: ;Are we trying to run the torrify service? StrCpy $PROCEDURE "DetermineService" Call DebugHeader StrCmp $TORRIFYSERVICE "false" SetToTor "" ; The T/F is set up this way incase there is no INI file StrCmp $TORRIFYSERVICE "true" SetToTorrify "" IfFileExists "$EXEDIR\Data\torrify\*.key" SetToTorrify SetToTor SetToTorrify: StrCpy $PROCEDURE "SetToTorrify" Call DebugHeader ;Check authorization md5dll::GetMD5File "$EXEDIR\Data\torrify\torrify.key" Pop $0 StrCpy $AUTHURL "https://www.metropipe.net/torrify/check.php?md5=" StrCpy $AUTHSTRING `"$AUTHURL$0"` StrCpy $PROCEDURE " Authorization String = $AUTHSTRING" Call DebugHeader Delete "$TEMPDIR\auth.chk" InetLoad::load /SILENT /RESUME "$AUTHSTRING" "$TEMPDIR\auth.chk" /END Call CheckAuth ;First disable FlushTorCircuit IfFileExists "$PROFILEDIRECTORY\extensions\{65f3d609-18c1-4f62-bcef-1973b6abeab4}" +4 "" ;If the FlushTorCircuit extension is installed then uninstall, else IfFileExists "$PROFILEDIRECTORY\extensions\FlushTorCircuit" +4 "" ;If the FlushTorCircuit extension is gone, rebuild it. If it was already renamed, skip the renaming. Call RebuildFlushTorCircuit Goto SetToTorrify Rename "$PROFILEDIRECTORY\extensions\{65f3d609-18c1-4f62-bcef-1973b6abeab4}" "$PROFILEDIRECTORY\extensions\FlushTorCircuit" ;Uninstall the FlushTorCircuit extension temporarily. ;Now disable Torbutton IfFileExists "$PROFILEDIRECTORY\extensions\{e0204bd5-9d31-402b-a99d-a6aa8ffebdca}" +4 "" ;If the TorButton extension is installed then uninstall, else IfFileExists "$PROFILEDIRECTORY\extensions\TorButton" +4 "" ;If the TorButton extension is gone, rebuild it. If it was already renamed, skip the renaming. Call RebuildTorButton Goto SetToTorrify Rename "$PROFILEDIRECTORY\extensions\{e0204bd5-9d31-402b-a99d-a6aa8ffebdca}" "$PROFILEDIRECTORY\extensions\TorButton" ;Uninstall the TorButton extension temporarily. ;Now switch out the prefs the Tor button to uses the Torrify settings IfFileExists "$PROFILEDIRECTORY\torrify_prefs.js" +4 "" ;Make sure a torrify preference profile exists. StrCpy $PROCEDURE "Restoring torrify_prefs.js from $EXEDIR\Data\torpark\backups\torrify_prefs_default.js" Call DebugHeader CopyFiles /SILENT "$EXEDIR\Data\torpark\backups\torrify_prefs_default.js" "$PROFILEDIRECTORY\torrify_prefs.js" ;If one doesn't exist, restore it from the backup. CopyFiles /SILENT "$PROFILEDIRECTORY\torrify_prefs.js" "$PROFILEDIRECTORY\prefs.js" ;Copy it to be the current profile used for the client. StrCpy "$CONNECTIONCLIENT" "stunnel.exe" StrCpy "$CONNECTIONCLIENTNAME" ${SERVICENAME} StrCpy "$CONNECTIONSTRING" `"$EXEDIR\App\torrify\stunnel.exe" $EXEDIR\Data\torrify\torrify.cfg` StrCpy $PROCEDURE " Connection String = $CONNECTIONSTRING" Call DebugHeader StrCpy "$SERVICELEVEL" 1 Goto EndINI SetToTor: StrCpy $PROCEDURE "SetToTor" Call DebugHeader ;First enable FlushTorCircuit IfFileExists "$PROFILEDIRECTORY\extensions\FlushTorCircuit" +4 "" ;If the FlushTorCircuit extension is unstalled then install, else IfFileExists "$PROFILEDIRECTORY\extensions\{65f3d609-18c1-4f62-bcef-1973b6abeab4}" +4 "" ;If the FlushTorCircuit extension is gone, rebuild it. If it was already renamed, skip the renaming. Call RebuildFlushTorCircuit Goto SetToTor Rename "$PROFILEDIRECTORY\extensions\FlushTorCircuit" "$PROFILEDIRECTORY\extensions\{65f3d609-18c1-4f62-bcef-1973b6abeab4}" ;Uninstall the FlushTorCircuit extension temporarily. ;First enable TorButton IfFileExists "$PROFILEDIRECTORY\extensions\TorButton" +4 "" ;If the TorButton extension is unstalled then install, else IfFileExists "$PROFILEDIRECTORY\extensions\{e0204bd5-9d31-402b-a99d-a6aa8ffebdca}" +4 "" ;If the TorButton extension is gone, rebuild it. If it was already renamed, skip the renaming. Call RebuildTorButton Goto SetToTor Rename "$PROFILEDIRECTORY\extensions\TorButton" "$PROFILEDIRECTORY\extensions\{e0204bd5-9d31-402b-a99d-a6aa8ffebdca}" ;Uninstall the TorButton extension temporarily. ;Now switch out the prefs the Tor button to uses the Torrify settings IfFileExists "$PROFILEDIRECTORY\tor_prefs.js" +4 "" ;Make sure a tor preference profile exists. StrCpy $PROCEDURE "Restoring tor_prefs.js from $EXEDIR\Data\torpark\backups\tor_prefs_default.js" Call DebugHeader CopyFiles /SILENT "$EXEDIR\Data\torpark\backups\tor_prefs_default.js" "$PROFILEDIRECTORY\tor_prefs.js" ;If one doesn't exist, restore it from the backup. CopyFiles /SILENT "$PROFILEDIRECTORY\tor_prefs.js" "$PROFILEDIRECTORY\prefs.js" ;Copy it to be the current profile used for the client. StrCpy "$CONNECTIONCLIENT" "tor.exe" StrCpy "$CONNECTIONCLIENTNAME" "Tor" StrCpy "$CONNECTIONSTRING" `"$TORDIRECTORY\tor.exe" -f "$TORDIRECTORY\torrc"` StrCpy "$SERVICELEVEL" 0 Goto EndINI EndINI: StrCpy $PROCEDURE "EndINI" Call DebugHeader IfFileExists "$PROGRAMDIRECTORY\$PROGRAMEXECUTABLE" FoundProgramEXE NoProgramEXE NoProgramEXE: ;=== Program executable not where expected StrCpy $PROCEDURE "NoProgramExe" Call DebugHeader MessageBox MB_OK|MB_ICONEXCLAMATION `$PROGRAMEXECUTABLE was not found. Please check your configuration. $PROGRAMEXECUTABLE should be located in $PROGRAMDIRECTORY` Goto UnloadTorpark FoundProgramEXE: ;Check and see if client is running StrCpy $PROCEDURE "FoundProgramEXE" Call DebugHeader FindProcDLL::FindProc $PROGRAMEXECUTABLE StrCmp $R0 "1" "" ProfileWork ;=== client is already running, check if it is using the portable profile MessageBox MB_YESNO|MB_ICONQUESTION|MB_TOPMOST `${APP} is already running. Close ${APP} and continue starting ${FULLNAME}?` IDNO UnloadTorpark IDYES KeepLoadingTorpark KeepLoadingTorpark: StrCpy $PROCEDURE "KeepLoadingTorpark" Call DebugHeader KillProcDLL::KillProc $PROGRAMEXECUTABLE ;Kill client Sleep 1000 Goto ProfileWork ProfileWork: ;Check for an existing profile StrCpy $PROCEDURE "ProfileWork" Call DebugHeader IfFileExists "$PROFILEDIRECTORY\prefs.js" ProfileFound ;=== No profile was found StrCmp $ISDEFAULTDIRECTORY "true" CopyDefaultProfile MessageBox MB_YESNO|MB_ICONQUESTION `No profile was found. Create a new profile here? $\n$PROFILEDIRECTORY\` IDYES CreateProfile MessageBox MB_OK|MB_ICONINFORMATION `${NAME} can not run without a profile directory. Please check your configuration.` Goto UnloadTorpark CopyDefaultProfile: StrCpy $PROCEDURE "CopyDefaultProfile" Call DebugHeader CreateDirectory "$EXEDIR\Data" CreateDirectory "$EXEDIR\Data\torpark\plugins" CreateDirectory "$EXEDIR\Data\torpark\profile" CopyFiles /SILENT $EXEDIR\App\torpark\DefaultData\torpark\plugins\*.* $EXEDIR\Data\torpark\plugins CopyFiles /SILENT $EXEDIR\App\torpark\DefaultData\torpark\profile\*.* $EXEDIR\Data\torpark\profile GoTo ProfileFound CreateProfile: StrCpy $PROCEDURE "CreateProfile" Call DebugHeader IfFileExists "$PROFILEDIRECTORY\*.*" ProfileFound CreateDirectory "$PROFILEDIRECTORY" ProfileFound: ;=== Check for read/write StrCpy $PROCEDURE "ProfileFound" Call DebugHeader ClearErrors FileOpen $R0 "$PROFILEDIRECTORY\writetest.temp" w IfErrors "" WriteSuccessful ;== Write failed, so we're read-only MessageBox MB_OK|MB_ICONINFORMATION `Errors IfErrors .${FULLNAME} can not run directly from a read-only location and will now close.` Goto UnloadTorpark WriteSuccessful: StrCpy $PROCEDURE "WriteSuccessful" Call DebugHeader FileClose $R0 Delete "$PROFILEDIRECTORY\writetest.temp" Goto DisplaySplash DisplaySplash: StrCpy $PROCEDURE "DisplaySplash" Call DebugHeader StrCmp $DISABLEWARNING "true" +7 MessageBox::show MB_DEFBUTTON2|MB_TOPMOST "WARNING" \ "0,103" \ "Torpark secures the anonymity of your connection, but not the data you send. $\nDO NOT use identity compromising information such as your name, login, password, etc. $\nunless you see a closed padlock icon at the bottom status bar of the browser. Torpark $\nshould not be run on untrusted computers, as they may have malware or keystroke $\nlogging software secrectly installed." \ "Continue" "Quit ${NAME}" Pop $0 StrCmp $0 1 "" UnloadTorparkandClient StrCmp $DISABLESPLASHSCREEN "true" AdjustChrome ;=== Show the splash screen before processing the files StrCmp $DEBUGON 0 "" +3 ;If in Debug Mode, skip to three lines down so we don't show the splash. File /oname=$PLUGINSDIR\splash.gif "${NAME}.gif" newadvsplash::show /NOUNLOAD 4000 400 400 0x000000 /NOCANCEL $PLUGINSDIR\splash.gif GoTo AdjustChrome AdjustChrome: ;=== Adjust the chrome.rdf StrCpy $PROCEDURE "AdjustChrome" Call DebugHeader StrCmp $SKIPCHROMEFIX "true" RunProgram IfFileExists "$PROFILEDIRECTORY\chrome\chrome.rdf" "" FixCalendarManager FileOpen $0 "$PROFILEDIRECTORY\chrome\chrome.rdf" r FileOpen $R0 "$PROFILEDIRECTORY\chrome\chrome.rdf.new" w ClearErrors ; if there's an error, we're done with the file NextLine: FileWrite $R0 $4 FileRead $0 $4 IfErrors NoMoreLines ;== we've reached the end of the file StrCpy $5 $4 35 StrCmp $5 ` c:baseURL="jar:f` FoundJarLine StrCmp $5 ` c:baseURL="file:` FoundFileLine NextLine FoundJarLine: StrCpy $R4 40 StrCpy $ISFILELINE "0" GoTo NotYet FoundFileLine: StrCpy $R4 40 StrCpy $ISFILELINE "1" NotYet: IntOp $R4 $R4 + 1 StrCpy $7 $4 10 $R4 ;=== looking for the point to strip the extension path StrCmp $7 "extensions" PathFound NotYet PathFound: StrCpy $5 $4 "" $R4 StrCmp $ISFILELINE "0" MakeJarLine MakeFileLine MakeJarLine: StrCpy $4 ` c:baseURL="jar:file:///$PROFILEDIRECTORY/$5` GoTo NextLine MakeFileLine: StrCpy $4 ` c:baseURL="file:///$PROFILEDIRECTORY/$5` GoTo NextLine NoMoreLines: FileClose $0 FileClose $R0 ;=== Backup the chrome.rdf CopyFiles /SILENT "$PROFILEDIRECTORY\chrome\chrome.rdf" "$PROFILEDIRECTORY\chrome\chrome.rdf.old" CopyFiles /SILENT "$PROFILEDIRECTORY\chrome\chrome.rdf.new" "$PROFILEDIRECTORY\chrome\chrome.rdf" FixCalendarManager: StrCpy $PROCEDURE "FixCalendarManager" Call DebugHeader IfFileExists "$PROFILEDIRECTORY\Calendar\CalendarManager.rdf" "" FixPrefsJs FileOpen $0 "$PROFILEDIRECTORY\Calendar\CalendarManager.rdf" r FileOpen $R0 "$PROFILEDIRECTORY\Calendar\CalendarManager.rdf.new" w ClearErrors ; if there's an error, we're done with the file CMNextLine: FileWrite $R0 $4 FileRead $0 $4 IfErrors CMNoMoreLines ;== we've reached the end of the file StrCpy $5 $4 28 StrCmp $5 ` NC:path="` "" CMNextLine StrCpy $R4 28 CMNotYet: IntOp $R4 $R4 + 1 StrCpy $7 $4 9 $R4 ; looking for the point to strip the calendar path StrCmp $7 "Calendar\" "" CMNotYet StrCpy $5 $4 "" $R4 StrCpy $4 ` NC:path="$PROFILEDIRECTORY\$5` ;=== the adjusted extension path GoTo CMNextLine CMNoMoreLines: FileClose $0 FileClose $R0 ;=== Backup the Calendar\CalendarManager.rdf just in case CopyFiles /SILENT "$PROFILEDIRECTORY\Calendar\CalendarManager.rdf" "$PROFILEDIRECTORY\Calendar\CalendarManager.rdf.old" CopyFiles /SILENT "$PROFILEDIRECTORY\Calendar\CalendarManager.rdf.new" "$PROFILEDIRECTORY\Calendar\CalendarManager.rdf" FixPrefsJs: StrCpy $PROCEDURE "FixPrefsJs" Call DebugHeader IfFileExists "$PROFILEDIRECTORY\prefs.js" "" RunProgram ;=== Be sure the xul cache is enabled and default browser check is disabled FileOpen $0 "$PROFILEDIRECTORY\prefs.js" a FileSeek $0 0 END FileWriteByte $0 "13" FileWriteByte $0 "10" FileWrite $0 `user_pref("browser.shell.checkDefaultBrowser", false);` FileWriteByte $0 "13" FileWriteByte $0 "10" StrCmp "$LOCALHOMEPAGE" "" FixPrefsJsClose FileWrite $0 `user_pref("browser.startup.homepage", "file:///$EXEDIR/$LOCALHOMEPAGE");` FileWriteByte $0 "13" FileWriteByte $0 "10" FixPrefsJsClose: FileClose $0 RunProgram: StrCpy $PROCEDURE "RunProgram" Call DebugHeader StrCmp $SKIPCOMPREGFIX "true" GetPassedParameters ;=== Delete component registry to ensure compatibility with all extensions Delete $PROFILEDIRECTORY\compreg.dat GetPassedParameters: ;=== Get any passed parameters StrCpy $PROCEDURE "GetPassedParameters" Call DebugHeader Call GetParameters Pop $0 StrCmp "'$0'" "''" "" LaunchProgramParameters ;=== No parameters StrCpy $EXECSTRING `"$PROGRAMDIRECTORY\$PROGRAMEXECUTABLE" -profile "$PROFILEDIRECTORY"` Goto PluginsEnvironment LaunchProgramParameters: StrCpy $PROCEDURE "LaunchProgramParameters" Call DebugHeader StrCpy $EXECSTRING `"$PROGRAMDIRECTORY\$PROGRAMEXECUTABLE" -profile "$PROFILEDIRECTORY" $0` PluginsEnvironment: ;=== Set the plugins directory if we have a path StrCpy $PROCEDURE "PluginsEnvironment" Call DebugHeader StrCmp $PLUGINSDIRECTORY "" UserProfileEnvironment IfFileExists "$PLUGINSDIRECTORY\*.*" "" UserProfileEnvironment System::Call 'Kernel32::SetEnvironmentVariableA(t, t) i("MOZ_PLUGIN_PATH", "$PLUGINSDIRECTORY").r0' UserProfileEnvironment: ;=== Set the %USERPROFILE% directory if we have a path StrCpy $PROCEDURE "UserProfileEnvironment" Call DebugHeader StrCmp $USERPROFILEDIRECTORY "" LaunchConnection IfFileExists "$USERPROFILEDIRECTORY\*.*" "" LaunchConnection System::Call 'Kernel32::SetEnvironmentVariableA(t, t) i("USERPROFILE", "$USERPROFILEDIRECTORY").r0' ;***************************************** BEGINNING MAIN FUNCTION ******************************************** LaunchConnection: StrCpy $PROCEDURE "LaunchConnection. Service Level = $SERVICELEVEL" Call DebugHeader Call CheckForBadclient ;Make sure no client is running before Torpark has called it. FindProcDLL::FindProc $CONNECTIONCLIENT ;Find out if tor is running StrCmp $R0 1 CheckForCircuit ""; If connectionclient (tor/torrify) process is not running, keep going, else goto CheckForCircuit StrCmp $SERVICELEVEL 0 "" +3 ;If we are running Tor, follow the next two lines. If not, skip them. Delete $TORDIRECTORY\debug.log RMDir /r $TORDIRECTORY\data Call LaunchConnectionClient ;Launch the connection client StrCmp $SERVICELEVEL 0 "" +4 ;If we are running Tor, follow the next three lines. If not, skip them. nxs::Show /NOUNLOAD `$(^Name)` /top `Establishing Tor circuit...` /h 1 /can 1 /end /pos 0 /sub "Users on dialup and poor connections will take longer to establish circuits.$\nIt may also take a few minutes if you are running ${NAME} from a USB Drive." nxs::Update /NOUNLOAD `$(^Name)` /pos 0 ;Sometimes the sub dialog doesn't show up if you don't put this on. The update is needed I think. nxs::Update /NOUNLOAD `$(^Name)` /pos 0 ;This is to make sure the title gets in there. nxs plugin is kind of crappy, but thank god for it. Goto RestartTimer RestartTimer: StrCpy $PROCEDURE "RestartTimer" Call DebugHeader Call CheckForBadclient ${time::GetLocalTime} $LAUNCHTIME Goto LaunchConnection ;Rinse and repeat CheckForCircuit: ;Checking to see if there is a Tor circuit currently active. If not, we'll wait before launching the browser. StrCpy $PROCEDURE "CheckForCircuit" Call DebugHeader Call CheckForBadclient FindProcDLL::FindProc $CONNECTIONCLIENT StrCmp $R0 1 "" LaunchConnection ClearErrors Call CheckTheTime IntCmp $CIRCUITTIMER $TIMERMAX CONNECTIONTIMEOUT "" CONNECTIONTIMEOUT ;If the circuittimer equals X time, then go to CONNECTIONTIMEOUT, else follow the lines below StrCmp $SERVICELEVEL 1 LaunchGUIClient "" ;If the service is not tor, skip the window and tor circuit status program Call CycleBar ;Make the bar cycle so the user knows the program is running. nxs::HasUserAborted /NOUNLOAD ;Check to see if the user hit cancel. Pop $R0 ;Pop the cancel value off the stack StrCmp $R0 1 UnloadTorpark "" ;If the user hit cancel, quit Torpark SetOutPath $OutPath ExecDos::exec /NOUNLOAD /TIMEOUT=10000 '"$TORDIRECTORY\TorCircuitStatus" 9051' "" "" ;Using new bloated torcircuitstatus with 10k timeout. Pop $NUMCIRCUITS ;Get the error code off the stack Goto FlagCheck FlagCheck: ;Check and see what the error code is returned from TorCircuitStatus StrCpy $PROCEDURE "FlagCheck: $NUMCIRCUITS" Call DebugHeader Call CheckForBadclient IntCmp $NUMCIRCUITS 0 CheckForCircuit +2 "" ;If error flag is 0 then checkforcircuit, if it is a negative number start looking though the flags, if it is positive goto next line IntCmp $NUMCIRCUITS 249 LaunchGUIClient LaunchGUIClient "" ;If error flag is less than or equal to 249, assume it is # of circuits and LaunchGUIClient, else check the error codes. StrCmp $DEBUGON 1 "" +2 Call ProcessFlags FindProcDLL::FindProc $CONNECTIONCLIENT StrCmp $R0 "1" "" LaunchConnection Goto CheckForCircuit CONNECTIONTIMEOUT: ;This procedure will tell Tor users if it is taking too long to get a circuit. StrCpy $PROCEDURE "ConnectionTimeout: $CIRCUITTIMER / $TIMERMAX seconds" Call DebugHeader nxs::Destroy Call CheckForBadclient newadvsplash::stop ;kill the splash screen if it is still here somehow messagebox::show MB_DEFBUTTON4|MB_TOPMOST "Tor Timeout" \ "0,103" \ "It appears that the $CONNECTIONCLIENTNAME process has been unable to establish a connection after $TIMERMAX seconds.$\nWould you like to keep waiting for a circuit, restart the $CONNECTIONCLIENTNAME process, or quit ${NAME}? $\n $\n Connections to the Tor netork can be very slow at times, taking up to 10 minutes to establish a circuit. $\nIf you are behind a firewall or proxy, and trying to use the Tor network, you must edit the torrc file as advised on the Torrify forum. $\n$\nIf you are unsatisfied with the speed or connectivity of the Tor network but do not wish to run a Tor server, you can upgrade to Torpark Pro, which provides a private high-speed anonymized network.$\nYou can upgrade by visiting ${WEBSITE}" \ "Wait Another $TIMERMAX Seconds" "Wait Silently" "Restart Connection" "Quit ${NAME}" Pop $0 StrCmp $0 1 RestartTimer "" ;Button #1 StrCmp $0 2 NoTimeout "" ;Button #2 StrCmp $0 4 UnloadTorparkandClient "" ; This handles the last two buttons. If we aren't q uitting, then we must be relaunching tor. Call KillConnectionClientProcess Goto LaunchConnection LaunchGUIClient: ;Launching client such as the browser or email program StrCpy $PROCEDURE "LaunchGUIClient" Call DebugHeader nxs::Destroy Call CheckForBadclient FindProcDLL::FindProc $PROGRAMEXECUTABLE ;find out if client is running StrCmp $R0 1 StillRunning "" ;If client is already running (we killed tor and looped back here), then don't try to run client again. else, keep going. StrCpy $EXECSTRING `"$PROGRAMDIRECTORY\$PROGRAMEXECUTABLE" -profile "$PROFILEDIRECTORY"` IntOp $LaunchedExecutable 0 + 1 ;This is to know if we actually launched the client process. This will be referenced in CheckForCircuit so someone doesn't start client while we are looking for a circuit. newadvsplash::stop ;Stop the splash screen if it is still up Exec $EXECSTRING ; Launch client Goto Passoff Passoff: ;Because from a USB stick it might take a while to load ff, we want to make sure it doesn't go to stillrunning and quit. StrCpy $PROCEDURE "Passoff" Call DebugHeader FindProcDLL::FindProc $PROGRAMEXECUTABLE StrCmp $R0 0 "" StillRunning Sleep 1000 Goto Passoff StillRunning: ;This process is necessary since client respawns its own process and falsely appears to terminate. This is why there is a lag between the exit of the browser and Torpark.exe termination StrCpy $PROCEDURE "StillRunning" Call DebugHeaderLogOnly FindProcDLL::FindProc $CONNECTIONCLIENT StrCmp $R0 1 "" LaunchConnection Sleep 2000 FindProcDLL::FindProc $PROGRAMEXECUTABLE StrCmp $R0 "1" StillRunning UnloadTorpark ; If client is running, check back in 2 seconds, otherwise goto KillTor UnloadTorpark: ;Kill Torpark, StrCpy $PROCEDURE "UnloadTorpark" Call DebugHeader FindProcDLL::FindProc "Torbird.exe" StrCmp $R0 1 +2 "" ;If Torbird is running, don't shut down the connection client, just the torpark stuff Call KillConnectionClientProcess ;Kill the ConnectionClient Call CleanUpProfilePrefs ;Save preference settings. FileClose $6 NSIS_SkinCrafter_Plugin::destroy Quit ;Bye bye UnloadTorparkandClient: ;Kill Torpark and the GUIClient ie firefox, thunderbird, iceweasel, etc. StrCpy $PROCEDURE "UnloadTorparkandClient" Call DebugHeader FindProcDLL::FindProc "Torbird.exe" StrCmp $R0 1 +2 "" ;If Torbird is running, don't shut down the connection client, just the torpark stuff Call KillConnectionClientProcess ;Kill the ConnectionClient KillProcDLL::KillProc "$PROGRAMEXECUTABLE" ;Kill the GUIClient ;Do not call CleanUpProfilePrefs from here. This is used typically if the GUI was never properly opened. Sleep 50 FileClose $6 NSIS_SkinCrafter_Plugin::destroy Quit ;Bye bye EasterEgg: File /oname=$PLUGINSDIR\torpark.thx "torpark.thx" newadvsplash::show /NOUNLOAD 23000 400 400 0xff0000 /NOCANCEL $PLUGINSDIR\torpark.thx Quit DebugMode: ;Alas, we always needed a debug mode. StrCmp $1 "/debug" "" +2 IntOp $DEBUGON 0 + 1 ; Trip the debug flag StrCmp $1 "/log" "" +3 IntOp $DEBUGON 0 + 2 FileOpen $6 "$EXEDIR\${NAME}.log" w MessageBox MB_OK `Debug Mode Activated` newadvsplash::stop Goto FindINI NoTimeout: StrCpy $PROCEDURE "NoTimeout" Call DebugHeader IntOp $TIMERMAX 0 + 9999999999 Goto CheckForCircuit SectionEnd Function LaunchConnectionClient ;Launch whatever the connection should be, tor, torrify, etc. StrCpy $PROCEDURE "LaunchConnectionClient" Call DebugHeader SetOutPath $OUTPATH ;Required, otherwise connectionclient won't launch correctly ExecDos::exec /NOUNLOAD /ASYNC $CONNECTIONSTRING "" "" FunctionEnd Function CheckForBadclient StrCpy $PROCEDURE "CheckForBadClient" Call DebugHeader StrCmp $DEBUGON 1 "" +2 MessageBox MB_OK|MB_TOPMOST `Running CheckForBadclient. LaunchedExecutable = $LaunchedExecutable` StrCmp $DEBUGON 2 "" +3 ${time::GetLocalTime} $R0 FileWrite $4 "$R0 CheckForBadclient: LaunchedExecutable = $LaunchedExecutable$\n" FindProcDLL::FindProc $PROGRAMEXECUTABLE ;See if client application is running. StrCmp $R0 1 "" +5 ;If client application is running... StrCmp $LaunchedExecutable 0 "" +5 ;And we haven't ever called it to run... newadvsplash::stop MessageBox MB_OK|MB_TOPMOST `Do not start $PROGRAMEXECUTABLE while ${NAME} is loading. $PROGRAMEXECUTABLE will now terminate and ${NAME} will continue to load.` KillProcDLL::KillProc $PROGRAMEXECUTABLE Sleep 2000 FunctionEnd Function CheckTheTime ${time::GetLocalTime} $R1 ;Get the current time ${time::MathTime} "second($R1) - second($LAUNCHTIME) =" $CIRCUITTIMER ;Current time in seconds - launch time = circuittimer (time passed in seconds) FunctionEnd Function ProcessFlags ;Here is a list of what it means when torcircuitstatus.exe returns a value. It naturally uses the errorlevel as the return medium. StrCpy $PROCEDURE "ProcessFlags" Call DebugHeader IntCmp $NUMCIRCUITS 0 +2 "" +2 MessageBox MB_OK|MB_ICONINFORMATION `Error Flag: $NUMCIRCUITS $\nSystem: Runtime Error` StrCmp $NUMCIRCUITS 250 "" +2 MessageBox MB_OK|MB_ICONINFORMATION `Error Flag: $NUMCIRCUITS $\nTor: OK` StrCmp $NUMCIRCUITS 251 "" +2 MessageBox MB_OK|MB_ICONINFORMATION `Error Flag: $NUMCIRCUITS $\nTor: UNNECESSARY OPERATION` StrCmp $NUMCIRCUITS 451 "" +2 MessageBox MB_OK|MB_ICONINFORMATION `Error Flag: $NUMCIRCUITS $\nTor: RESOURCE EXHAUSTED` StrCmp $NUMCIRCUITS 500 "" +2 MessageBox MB_OK|MB_ICONINFORMATION `Error Flag: $NUMCIRCUITS $\nTor: PROTOCOL SYNTAX ERROR` StrCmp $NUMCIRCUITS 510 "" +2 MessageBox MB_OK|MB_ICONINFORMATION `Error Flag: $NUMCIRCUITS $\nTor: UNRECOGNIZED COMMAND` StrCmp $NUMCIRCUITS 511 "" +2 MessageBox MB_OK|MB_ICONINFORMATION `Error Flag: $NUMCIRCUITS $\nTor: UNIMPLEMENTED COMMAND` StrCmp $NUMCIRCUITS 512 "" +2 MessageBox MB_OK|MB_ICONINFORMATION `Error Flag: $NUMCIRCUITS $\nTor: COMMAND ARGUMENT SYNTAX ERROR` StrCmp $NUMCIRCUITS 513 "" +2 MessageBox MB_OK|MB_ICONINFORMATION `Error Flag: $NUMCIRCUITS $\nTor: UNRECOGNIZED COMMAND ARGUMENT` StrCmp $NUMCIRCUITS 514 "" +2 MessageBox MB_OK|MB_ICONINFORMATION `Error Flag: $NUMCIRCUITS $\nTor: AUTHENTICATION REQUIRED` StrCmp $NUMCIRCUITS 515 "" +2 MessageBox MB_OK|MB_ICONINFORMATION `Error Flag: $NUMCIRCUITS $\nTor: BAD AUTHENTICATION` StrCmp $NUMCIRCUITS 550 "" +2 MessageBox MB_OK|MB_ICONINFORMATION `Error Flag: $NUMCIRCUITS $\nTor: UNSPECIFIED ERROR` StrCmp $NUMCIRCUITS 551 "" +2 MessageBox MB_OK|MB_ICONINFORMATION `Error Flag: $NUMCIRCUITS $\nTor: INTERNAL ERROR` StrCmp $NUMCIRCUITS 552 "" +2 MessageBox MB_OK|MB_ICONINFORMATION `Error Flag: $NUMCIRCUITS $\nTor: UNRECOGNIZED ENTITY` StrCmp $NUMCIRCUITS 553 "" +2 MessageBox MB_OK|MB_ICONINFORMATION `Error Flag: $NUMCIRCUITS $\nTor: INVALID CONFIG VALUE` StrCmp $NUMCIRCUITS 554 "" +2 MessageBox MB_OK|MB_ICONINFORMATION `Error Flag: $NUMCIRCUITS $\nTor: INVALID DESCRIPTOR` StrCmp $NUMCIRCUITS 555 "" +2 MessageBox MB_OK|MB_ICONINFORMATION `Error Flag: $NUMCIRCUITS $\nTor: UNMANAGED ENTITY` StrCmp $NUMCIRCUITS 650 "" +2 MessageBox MB_OK|MB_ICONINFORMATION `Error Flag: $NUMCIRCUITS $\nTor: ASYNC EVENT NOTIFICATION` StrCmp $NUMCIRCUITS 1501 "" +2 MessageBox MB_OK|MB_ICONINFORMATION `Error Flag: $NUMCIRCUITS $\nTorCircuitStatus: INVALID CONTROL PORT` StrCmp $NUMCIRCUITS 1502 "" +2 MessageBox MB_OK|MB_ICONINFORMATION `Error Flag: $NUMCIRCUITS $\nTorCircuitStatus: UNABLE TO CONNECT` StrCmp $NUMCIRCUITS 1503 "" +2 MessageBox MB_OK|MB_ICONINFORMATION `Error Flag: $NUMCIRCUITS $\nTorCircuitStatus: UNABLE TO COMMUNICATE` StrCmp $NUMCIRCUITS 1504 "" +2 MessageBox MB_OK|MB_ICONINFORMATION `Error Flag: $NUMCIRCUITS $\nTorCircuitStatus: RESPONSE TIMED OUT` StrCmp $NUMCIRCUITS 1505 "" +2 MessageBox MB_OK|MB_ICONINFORMATION `Error Flag: $NUMCIRCUITS $\nTorCircuitStatus: RESPONSE UNKNOWN` FunctionEnd Function KillConnectionClientProcess StrCpy $PROCEDURE "KillConnectionClientProcess" Call DebugHeader KillProcDLL::KillProc $CONNECTIONCLIENT ;Kill tor Sleep 50 ;a little sleep is needed at the end. If you try to execute too many of these at once, you get a memory error after the program closes. ExecDos::exec `"$TORDIRECTORY\tor_resolve.exe"` "" "";Run execdos (any program will do) without NOUNLOAD so that ExecDos.dll isn't left behind Sleep 50 ;a little sleep is needed at the end. If you try to execute too many of these at once, you get a memory error after the program closes. Delete $TORDIRECTORY\debug.log ;Delete the tor debug.log we have unfortunately come to rely on. Sleep 50 ;a little sleep is needed at the end. If you try to execute too many of these at once, you get a memory error after the program closes. RMDir /r $TORDIRECTORY\data ;Remove the tor cache Sleep 50 ;a little sleep is needed at the end. If you try to execute too many of these at once, you get a memory error after the program closes. RMDir /r $TEMPDIR ;Remove temp dir, this typically doesn't work for some reason, probably because it is $PLUGINSDIR Sleep 50 FunctionEnd Function RebuildFlushTorCircuit StrCpy $PROCEDURE "RebuildFlushTorCircuit" Call DebugHeader RMDir /r "$PROFILEDIRECTORY\extensions\{65f3d609-18c1-4f62-bcef-1973b6abeab4}" CreateDirectory "$PROFILEDIRECTORY\extensions\{65f3d609-18c1-4f62-bcef-1973b6abeab4}" CopyFiles /SILENT "$EXEDIR\Data\torpark\backups\FTC_BACKUP\*.*" "$PROFILEDIRECTORY\extensions\{65f3d609-18c1-4f62-bcef-1973b6abeab4}" FunctionEnd Function RebuildTorButton StrCpy $PROCEDURE "RebuildTorButton" Call DebugHeader RMDir /r "$PROFILEDIRECTORY\extensions\{e0204bd5-9d31-402b-a99d-a6aa8ffebdca}" CreateDirectory "$PROFILEDIRECTORY\extensions\{e0204bd5-9d31-402b-a99d-a6aa8ffebdca}" CopyFiles /SILENT "$EXEDIR\Data\torpark\backups\TB_BACKUP\*.*" "$PROFILEDIRECTORY\extensions\{e0204bd5-9d31-402b-a99d-a6aa8ffebdca}" FunctionEnd Function CycleBar StrCpy $PROCEDURE "CycleBar" Call DebugHeader IntCmp $CYCLEPOS 100 +5 "" +5 IntOp $CYCLEPOS $CYCLEPOS + 1 nxs::Update /NOUNLOAD `$(^Name)` /pos $CYCLEPOS Sleep 25 Call CycleBar IntOp $CYCLEPOS 0 + 0 FunctionEnd Function CleanUpProfilePrefs ;Copy the pref.js file back to in order to store the user settings. StrCmp $SERVICELEVEL 1 "" +5 ;If we are running Torrify service, save profile to the torrify preferences. StrCpy $PROCEDURE "CleanUpProfilePrefs: Saving to torrify_prefs.js" Call DebugHeader CopyFiles /SILENT "$PROFILEDIRECTORY\prefs.js" "$PROFILEDIRECTORY\torrify_prefs.js" StrCmp $SERVICELEVEL 0 "" +5 ;If we are running Tor, save the profile to the tor preferences. StrCpy $PROCEDURE "CleanUpProfilePrefs: Saving to tor_prefs.js" Call DebugHeader CopyFiles /SILENT "$PROFILEDIRECTORY\prefs.js" "$PROFILEDIRECTORY\tor_prefs.js" Delete "$PROFILEDIRECTORY\prefs.js" ;Don't leave a profile just lying around. It could accidently overwrite a legit preference file. FunctionEnd Function CheckAuth IfFileExists "$TEMPDIR\auth.chk" +3 "" ;Wait till the auth file exists Sleep 50 Call CheckAuth FileOpen $8 "$TEMPDIR\auth.chk" r ;Open the auth.chk FileRead $8 $0 1 ;Read the first character FileClose $8 ;Close the file StrCmp $0 "" "" +3 ;If there was nothing read restart the function. Sleep 200 Call CheckAuth StrCpy $AUTHRETURN $0 StrCpy $PROCEDURE " Authorization Value = $AUTHRETURN" Call DebugHeader FunctionEnd Function DebugHeader StrCmp $DEBUGON 1 "" +2 MessageBox MB_OK|MB_ICONINFORMATION `Running $PROCEDURE` StrCmp $DEBUGON 2 "" +4 ${time::GetLocalTime} $R7 FileWrite $6 "$R7 $PROCEDURE$\n" ClearErrors FunctionEnd Function DebugHeaderLogOnly StrCmp $DEBUGON 2 "" +4 ${time::GetLocalTime} $R7 FileWrite $6 "$R7 $PROCEDURE$\n" ClearErrors FunctionEnd Function .onGUIEnd ;Things to do when we shut down RMDir /r $PLUGINSDIR FunctionEnd