From 121ca1b6bb56041e7f412ffc15f18ea74c822f74 Mon Sep 17 00:00:00 2001 From: Thomas Gaugler Date: Thu, 29 Dec 2016 23:28:12 +0100 Subject: Remove boot entry via pre function of uninstaller instfiles This fixes the RPC_E_WRONG_THREAD (0x8001010E) error in case the function for removing a boot entry was called from the uninstall section. --- main.nsi | 2 +- s_uninstall.nsi | 36 +++++++++++++++++++----------------- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/main.nsi b/main.nsi index 42cf8bb..d3b2885 100644 --- a/main.nsi +++ b/main.nsi @@ -51,7 +51,7 @@ Page custom ShowCustom ; custom.nsi Page instfiles CreateBootEntry UninstPage uninstConfirm -UninstPage instfiles +UninstPage instfiles un.RemoveBootEntry ;-------------------------------- Var /GLOBAL c diff --git a/s_uninstall.nsi b/s_uninstall.nsi index e1da2ea..a51d34e 100644 --- a/s_uninstall.nsi +++ b/s_uninstall.nsi @@ -20,6 +20,25 @@ ${un.BOOTCFG_DeleteObject} ${un.BOOTCFG_RemoveBootEntry} +Function un.RemoveBootEntry + ReadRegStr $0 HKLM "${REGSTR_WIN32}" "bootmgr" + ${If} $0 != "" + ${un.BOOTCFG_DeleteObject} $services $basebcdstore $bcdstore $0 $2 $1 + ${If} $1 != 0 + IntFmt $1 "0x%08X" $1 + MessageBox MB_OK "$2: $1" + ${EndIf} + ${un.BOOTCFG_RemoveBootEntry} $services $basebcdstore $bcdstore \ + $basebcdobject $0 $2 $1 + ${If} $1 != 0 + IntFmt $1 "0x%08X" $1 + MessageBox MB_OK "$2: $1" + ${EndIf} + ${Endif} + + Call un.CleanUp +FunctionEnd + Section "Uninstall" ; Initialise $c ReadRegStr $c HKLM "${REGSTR_WIN32}" "system_drive" @@ -37,26 +56,9 @@ Section "Uninstall" DeleteINIStr "$c\boot.ini" "boot loader" "old_timeout_win32-loader" no_saved_boot_ini_timeout: - ReadRegStr $0 HKLM "${REGSTR_WIN32}" "bootmgr" - ${If} $0 != "" - ${un.BOOTCFG_RemoveBootEntry} $services $basebcdstore $bcdstore \ - $basebcdobject $0 $2 $1 - ${If} $1 != 0 - IntFmt $1 "0x%08X" $1 - DetailPrint "$2: $1" - ${EndIf} - ${un.BOOTCFG_DeleteObject} $services $basebcdstore $bcdstore $0 $2 $1 - ${If} $1 != 0 - IntFmt $1 "0x%08X" $1 - DetailPrint "$2: $1" - ${EndIf} - ${Endif} - DeleteRegKey HKLM "${REGSTR_WIN32}" DeleteRegKey HKLM "${REGSTR_UNINST}" Delete $c\g2ldr Delete $c\g2ldr.mbr RMDir /r /REBOOTOK $INSTDIR - - Call ${BOOTCFG_UNFUNC}CleanUp SectionEnd -- cgit v1.2.3