Warning, /graphics/digikam/project/bundles/vcpkg/installer/reboot_required.nsh is written in an unsupported language. File is not indexed.
0001 ;; ============================================================
0002 ;
0003 ; This file is a part of digiKam project
0004 ; https://www.digikam.org
0005 ;
0006 ; Date : 2010-11-08
0007 ; Description : Functions to check if reboot is required.
0008 ; Note: NSIS >= 3 is required to be compatible with Windows 10.
0009 ;
0010 ; SPDX-FileCopyrightText: 2010-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0011 ;
0012 ; SPDX-License-Identifier: GPL-2.0-or-later
0013 ;
0014 ; ============================================================ ;;
0015
0016 !ifndef REBOOT_REQUIRED_INCLUDED
0017 !define REBOOT_REQUIRED_INCLUDED
0018
0019 Function DirectoryLeave
0020
0021 Call NotifyIfRebootRequired
0022
0023 FunctionEnd
0024
0025 ;-------------------------------------------
0026
0027 Function NotifyIfRebootRequired
0028
0029 Call IsRebootRequired
0030 Exch $0
0031
0032 ${If} $0 == 1
0033
0034 ;TODO: consider adding a RunOnce entry for the installer to HKCU instead of telling the user they need to run the installer
0035 ;themselves (can't add to HKLM because basic user wouldn't have access, only admins do).
0036 ;this would require using the UAC plugin to handle elevation by starting as a normal user, elevating, and then dropping back to normal when writing to HKCU
0037 ;TODO: need to internationalize string (see VLC / clementine / etc)
0038
0039 MessageBox MB_YESNO|MB_ICONSTOP|MB_TOPMOST|MB_SETFOREGROUND "You must reboot to complete uninstallation of a previous install of ${MY_PRODUCT} before ${MY_PRODUCT} ${VERSION} can be installed.$\r$\n$\r$\n\
0040 Would you like to reboot now?$\r$\n$\r$\n\
0041 (You will have to run the installer again after reboot to continue setup)" /SD IDNO IDNO noInstall
0042 Reboot
0043
0044 ${Else}
0045
0046 Goto done
0047
0048 ${EndIf}
0049
0050 noInstall:
0051 Abort
0052
0053 done:
0054 Pop $0
0055
0056 FunctionEnd
0057
0058 Function IsRebootRequired
0059
0060 Push $0
0061 Push $1
0062 Push $2
0063 Push $3
0064
0065 ReadRegStr $0 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager" "PendingFileRenameOperations"
0066
0067 ${If} $0 != ""
0068
0069 StrLen $2 "$INSTDIR"
0070 ${StrStr} $1 "$0" "$INSTDIR"
0071 StrCpy $3 $1 $2
0072 ${AndIf} $3 == "$INSTDIR"
0073 StrCpy $0 1
0074
0075 ${Else}
0076
0077 StrCpy $0 0
0078
0079 ${EndIf}
0080
0081 Pop $3
0082 Pop $2
0083 Pop $1
0084 Exch $0
0085
0086 FunctionEnd
0087
0088 !endif ;REBOOT_REQUIRED_INCLUDED