summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Gaugler <thomas@dadie.net>2016-12-29 23:19:27 +0100
committerDidier Raboud <odyx@debian.org>2017-09-04 11:45:05 +0200
commitd4460653744795af7068ef5911970bf189013514 (patch)
treebb08d6631188dfa369a0e3220c8044ab33f6a926
parent2b0c5412940793ccd27c5f50cd01ead4a23f7c2a (diff)
Create boot entry via pre function of instfiles
This fixes the RPC_E_WRONG_THREAD (0x8001010E) error in case the function for adding a boot entry was called from the install section.
-rw-r--r--main.nsi2
-rw-r--r--s_install.nsi57
2 files changed, 33 insertions, 26 deletions
diff --git a/main.nsi b/main.nsi
index 7e3399c..42cf8bb 100644
--- a/main.nsi
+++ b/main.nsi
@@ -48,7 +48,7 @@ Page custom ShowGraphics ; graphics.nsi
Page custom ShowBranch ; download.nsi and branch.nsi
!endif
Page custom ShowCustom ; custom.nsi
-Page instfiles
+Page instfiles CreateBootEntry
UninstPage uninstConfirm
UninstPage instfiles
diff --git a/s_install.nsi b/s_install.nsi
index 71bb44a..c08d3f2 100644
--- a/s_install.nsi
+++ b/s_install.nsi
@@ -91,8 +91,34 @@ Function AddBootEntry
Pop $0
FunctionEnd
-Section "Installer Loader"
+Function CreateBootEntry
+ ${If} $windows_boot_method == bootmgr
+ ReadRegStr $0 HKLM "${REGSTR_WIN32}" "bootmgr"
+ ${If} $0 == ""
+ ${BOOTCFG_CreateGUID} $2
+ ${If} $2 != ""
+ Push "$2"
+!ifdef PXE
+ ${If} $pxe_mode == "true"
+ Push "$(pxe)"
+ ${Else}
+!endif ; PXE
+ Push "$(d-i)"
+!ifdef PXE
+ ${EndIf} ; $pxe_mode == "true"
+!endif ; PXE
+ Call AddBootEntry
+ WriteRegStr HKLM "${REGSTR_WIN32}" "bootmgr" "$2"
+ Call CleanUp
+ ${Else}
+ MessageBox MB_OK|MB_ICONSTOP "$(error_bcdedit_extract_id)"
+ Quit
+ ${EndIf}
+ ${Endif}
+ ${Endif}
+FunctionEnd
+Section "Installer Loader"
; ******************************************************************************
; ***************************************** THIS IS WHERE THE REAL ACTION STARTS
; ******************************************************************************
@@ -477,28 +503,11 @@ ${EndIf}
MessageBox MB_OK|MB_ICONSTOP "$(error_copyfiles)"
Quit
!endif
- DetailPrint "$(registering_bootmgr)"
- ReadRegStr $0 HKLM "${REGSTR_WIN32}" "bootmgr"
- ${If} $0 == ""
- ${BOOTCFG_CreateGUID} $2
- ${If} $2 != ""
- Push "$2"
-!ifdef PXE
- ${If} $pxe_mode == "true"
- Push "$(pxe)"
- ${Else}
-!endif ; PXE
- Push "$(d-i)"
-!ifdef PXE
- ${EndIf} ; $pxe_mode == "true"
-!endif ; PXE
- Call AddBootEntry
- WriteRegStr HKLM "${REGSTR_WIN32}" "bootmgr" "$2"
- ${Else}
- MessageBox MB_OK|MB_ICONSTOP "$(error_bcdedit_extract_id)"
- Quit
- ${EndIf}
- ${Endif}
+ ${If} $bcdstore != ""
+ Call CleanUp
+ ${Else}
+ DetailPrint "$(registering_bootmgr)"
+ ${EndIf}
${Endif}
; ********************************************** Needed for systems with compressed NTFS
@@ -517,6 +526,4 @@ ${EndIf}
nsExec::Exec '"compact" /u $INSTDIR\pxe.lkrn'
${EndIf}
!endif ;PXE
-
- Call CleanUp
SectionEnd