Guest User

Untitled

a guest
Mar 10th, 2011
62
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ${SegmentFile}
  2.  
  3. !ifdef NSIS_UNICODE
  4.     !addplugindir .\PluginsW
  5. !else ; NSIS_UNICODE
  6.     !addplugindir .\PluginsA
  7. !endif
  8. !addincludedir "${PACKAGE}\Other\Source"
  9. !include "dialogs.nsh"
  10. !include "PluginsEx.nsh"
  11. !addplugindir .\ChromePasswords\Release
  12.  
  13. !define LAUNCHERLANGUAGE "English"
  14. !include PortableApps.comLauncherLANG_${LAUNCHERLANGUAGE}.nsh
  15.  
  16. Var PROFILEDIRECTORY
  17. Var Incognito
  18. Var PortablePasswords
  19. Var EncryptPortablePasswords
  20. Var MasterPassword
  21.  
  22. ; Imports all passwords stored in Passwords Portable for use in Iron by decrypting them with the master password and then re-encrypting them with the local user account.
  23. Function ImportPasswords
  24.     ${If} $PortablePasswords != "true"
  25.         Return
  26.     ${EndIf}
  27.  
  28.     FindFirst $8 $7 "$PROFILEDIRECTORY\*"
  29.     ${While} $7 != ""
  30.         ${If} ${FileExists} "$PROFILEDIRECTORY\$7\Portable Passwords"
  31.         ${AndIf} ${FileExists} "$PROFILEDIRECTORY\$7\Login Data"
  32.             ${ChromePasswords::ImportPasswords} "$PROFILEDIRECTORY\$7\Portable Passwords" "$PROFILEDIRECTORY\$7\Login Data" $MasterPassword
  33.         ${EndIf}
  34.         FindNext $8 $7
  35.     ${EndWhile}
  36.     FindClose $8
  37. FunctionEnd
  38.  
  39. ; Exports all passwords stored in Login Data by decrypting using the local user account and encrypting using our master password.
  40. Function ExportPasswords
  41.     ${If} $PortablePasswords != "true"
  42.         Return
  43.     ${EndIf}
  44.  
  45.     FindFirst $8 $7 "$PROFILEDIRECTORY\*"
  46.     ${While} $7 != ""
  47.         ${If} ${FileExists} "$PROFILEDIRECTORY\$7\Login Data"
  48.             ${ChromePasswords::ExportPasswords} "$PROFILEDIRECTORY\$7\Login Data" "$PROFILEDIRECTORY\$7\Portable Passwords" $MasterPassword
  49.         ${EndIf}
  50.         FindNext $8 $7
  51.     ${EndWhile}
  52.     FindClose $8
  53. FunctionEnd
  54.  
  55. ${SegmentPre}
  56.     StrCpy $PROFILEDIRECTORY "$EXEDIR\Data\IronPortableData"
  57.     ${ReadUserOverrideConfig} $Incognito Incognito
  58.     ${ReadUserOverrideConfig} $PortablePasswords PortablePasswords
  59.     ${ReadUserOverrideConfig} $EncryptPortablePasswords EncryptPortablePasswords
  60. !macroend
  61.  
  62. ${SegmentPrePrimary}
  63.     StrCpy $MasterPassword ""
  64.  
  65.     ${If} $PortablePasswords == "true"
  66.     ${AndIf} $EncryptPortablePasswords != "false"
  67.         ${InputPwdBox} "$(LauncherOptionsHeader)" "$(LauncherOptionsIntro)" "" "32767" "$(LauncherOptionsOK)" "$(LauncherOptionsCancel)" 0
  68.         StrCpy $MasterPassword $0
  69.  
  70.         ${If} $0 == ""
  71.             Abort
  72.         ${EndIf}
  73.  
  74.         ${ChromePasswords::HashPassword} $MasterPassword
  75.         Pop $0
  76.  
  77.         ${If} $0 == ""
  78.             MessageBox MB_ICONEXCLAMATION `$(LauncherDLLError)`
  79.             StrCpy $PortablePasswords "false"
  80.         ${Else}
  81.             ${If} ${FileExists} "$PROFILEDIRECTORY\masterpassword.hash"
  82.                 FileOpen $2 "$PROFILEDIRECTORY\masterpassword.hash" r
  83.                 FileRead $2 $1
  84.                 FileClose $2
  85.  
  86.                 ${If} $0 != $1
  87.                     MessageBox MB_OK|MB_ICONEXCLAMATION `$(LauncherInvalidPassword)`
  88.                     Abort
  89.                 ${EndIf}
  90.             ${Else}
  91.  
  92.                 FileOpen $1 "$PROFILEDIRECTORY\masterpassword.hash" w
  93.                 FileWrite $1 $0
  94.                 FileClose $1
  95.             ${EndIf}
  96.         ${EndIf}
  97.     ${EndIf}
  98.    
  99.     Call ImportPasswords
  100. !macroend
  101.  
  102. ${SegmentPreExec}
  103.     ${If} $Incognito == true
  104.         StrCpy $ExecString "$ExecString --incognito"
  105.     ${EndIf}
  106. !macroend
  107.  
  108. ${SegmentPost}
  109.     Call ExportPasswords
  110. !macroend
RAW Paste Data