Custom.nsh 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. ${SegmentFile}
  2. ${Segment.OnInit}
  3. ; Borrowed the following from PAL 2.2, Remove on release of PAL 2.2
  4. ; Work out if it's 64-bit or 32-bit
  5. System::Call kernel32::GetCurrentProcess()i.s
  6. System::Call kernel32::IsWow64Process(is,*i.r0)
  7. ${If} $0 == 0
  8. StrCpy $Bits 32
  9. Rename "$EXEDIR\App\7-Zip64\Lang" "$EXEDIR\App\7-Zip\Lang"
  10. ${Else}
  11. StrCpy $Bits 64
  12. Rename "$EXEDIR\App\7-Zip\Lang" "$EXEDIR\App\7-Zip64\Lang"
  13. ${EndIf}
  14. !macroend
  15. ${SegmentInit}
  16. ${If} $Bits = 64
  17. ${SetEnvironmentVariablesPath} FullAppDir "$EXEDIR\App\7-Zip64"
  18. ${Else}
  19. ${SetEnvironmentVariablesPath} FullAppDir "$EXEDIR\App\7-Zip"
  20. ${EndIf}
  21. !macroend
  22. ${SegmentPre}
  23. ${Registry::StrToHex} ":" $9 ;$9 now contains the ASCII code for :
  24. ExpandEnvStrings $0 "%PAL:Drive%"
  25. ${Registry::StrToHex} $0 $1 ;$1 now contains the ASCII code for current drive
  26. ${WordReplace} $1 $9 "" "+" $2
  27. ExpandEnvStrings $3 "%PAL:LastDrive%"
  28. ${Registry::StrToHex} $3 $4 ;$4 now contains the ASCII code for last drive
  29. ${WordReplace} $4 $9 "" "+" $5
  30. System::Call 'Kernel32::SetEnvironmentVariable(t, t) i("PAL:DriveHex", "$2").r0'
  31. System::Call 'Kernel32::SetEnvironmentVariable(t, t) i("PAL:LastDriveHex", "$5").r0'
  32. !macroend