pyapp_msvcrt.nsi 969 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. [% extends "pyapp.nsi" %]
  2. [% block sections %]
  3. !include windowsversion.nsh
  4. !include x64.nsh
  5. Section "-msvcrt"
  6. ${GetWindowsVersion} $R0
  7. StrCpy $0 "--"
  8. ${If} ${RunningX64}
  9. ${If} $R0 == "8.1"
  10. StrCpy $0 "8.1 x64 URL"
  11. ${ElseIf} $R0 == "8"
  12. StrCpy $0 "8 x64 URL"
  13. ${ElseIf} $R0 == "7"
  14. StrCpy $0 "7 x64 URL"
  15. ${EndIf}
  16. ${Else}
  17. ${If} $R0 == "8.1"
  18. StrCpy $0 "8.1 x32 URL"
  19. ${ElseIf} $R0 == "8"
  20. StrCpy $0 "8 x32 URL"
  21. ${ElseIf} $R0 == "7"
  22. StrCpy $0 "7 x32 URL"
  23. ${EndIf}
  24. ${EndIf}
  25. IfFileExists "$SYSDIR\ucrtbase.dll" skip_msvcrt
  26. StrCmp $0 "--" skip_msvcrt
  27. DetailPrint "Downloading and installing MSVCRT from $0"
  28. NSISdl::download $0 msvcrt.msu
  29. ExecWait 'wusa /quiet /norestart "$INSTDIR\msvcrt.msu"' $1
  30. Delete "$INSTDIR\msvcrt.msu"
  31. # This WUSA exit code means a reboot is needed.
  32. ${If} $1 = 0x00240005
  33. SetRebootFlag true
  34. ${EndIf}
  35. skip_msvcrt:
  36. SectionEnd
  37. [% endblock sections %]