File tree Expand file tree Collapse file tree 6 files changed +46
-42
lines changed Expand file tree Collapse file tree 6 files changed +46
-42
lines changed Original file line number Diff line number Diff line change 1
1
!include UAC.nsh
2
+ !include StdUtils.nsh
2
3
3
4
!ifndef INSTALL_MODE_PER_ALL_USERS
4
5
!include multiUserUi.nsh
5
6
!endif
6
7
7
8
!ifndef BUILD_UNINSTALLER
8
9
Function StartApp
9
- !insertmacro UAC_AsUser_ExecShell " " " $SMPROGRAMS\${PRODUCT_FILENAME}.lnk" " " " " " "
10
+ ${StdUtils.ExecShellAsUser} $0 " $SMPROGRAMS\${PRODUCT_FILENAME}.lnk" " open " " "
10
11
FunctionEnd
11
12
12
13
!define MUI_FINISHPAGE_RUN
41
42
!insertmacro UAC_PageElevation_OnInit
42
43
43
44
${If} ${UAC_IsInnerInstance}
44
- ${AndIfNot} ${UAC_IsAdmin}
45
- # special return value for outer instance so it knows we did not have admin rights
46
- SetErrorLevel 0x666666
47
- Quit
45
+ ${If} ${UAC_IsAdmin}
46
+ !insertmacro setInstallModePerAllUsers
47
+ Goto functionEnd
48
+ ${else}
49
+ # special return value for outer instance so it knows we did not have admin rights
50
+ SetErrorLevel 0x666666
51
+ Quit
52
+ ${EndIf}
48
53
${EndIf}
49
54
50
55
!ifndef MULTIUSER_INIT_TEXT_ADMINREQUIRED
78
83
${GetOptions} $R0 " /allusers" $R1
79
84
${IfNot} ${Errors}
80
85
!insertmacro setInstallModePerAllUsers
81
- Goto FEnd
86
+ Goto functionEnd
82
87
${EndIf}
83
88
84
89
${GetOptions} $R0 " /currentuser" $R1
85
90
${IfNot} ${Errors}
86
91
!insertmacro setInstallModePerUser
87
- Goto FEnd
92
+ Goto functionEnd
88
93
${EndIf}
89
94
90
95
${if} $hasPerUserInstallation == " 1"
102
107
!endif
103
108
${endif}
104
109
105
- FEnd :
110
+ functionEnd :
106
111
!endif
107
112
!macroend
108
113
Original file line number Diff line number Diff line change 43
43
${endif}
44
44
!macroend
45
45
46
+ !macro registryAddInstallInfo
47
+ WriteRegStr SHCTX " ${INSTALL_REGISTRY_KEY}" InstallLocation " $INSTDIR"
48
+
49
+ ${if} $installMode == " all"
50
+ StrCpy $0 " /allusers"
51
+ StrCpy $1 " "
52
+ ${else}
53
+ StrCpy $0 " /currentuser"
54
+ StrCpy $1 " (only current user)"
55
+ ${endif}
56
+
57
+ WriteRegStr SHCTX " ${UNINSTALL_REGISTRY_KEY}" DisplayName " ${UNINSTALL_DISPLAY_NAME}$1"
58
+ # https://github.com/electron-userland/electron-builder/issues/750
59
+ StrCpy $2 " $INSTDIR\${UNINSTALL_FILENAME}"
60
+ WriteRegStr SHCTX " ${UNINSTALL_REGISTRY_KEY}" UninstallString ' "$2" $0'
61
+
62
+ WriteRegStr SHCTX " ${UNINSTALL_REGISTRY_KEY}" " DisplayVersion" " ${VERSION}"
63
+ WriteRegStr SHCTX " ${UNINSTALL_REGISTRY_KEY}" " DisplayIcon" " $appExe,0"
64
+ WriteRegStr SHCTX " ${UNINSTALL_REGISTRY_KEY}" " Publisher" " ${COMPANY_NAME}"
65
+ WriteRegDWORD SHCTX " ${UNINSTALL_REGISTRY_KEY}" NoModify 1
66
+ WriteRegDWORD SHCTX " ${UNINSTALL_REGISTRY_KEY}" NoRepair 1
67
+
68
+ ${GetSize} " $INSTDIR" " /S=0K" $0 $1 $2
69
+ IntFmt $0 " 0x%08X" $0
70
+ WriteRegDWORD SHCTX " ${UNINSTALL_REGISTRY_KEY}" " EstimatedSize" " $0"
71
+ !macroend
72
+
46
73
InitPluginsDir
47
74
48
75
!ifdef HEADER_ICO
Original file line number Diff line number Diff line change @@ -38,7 +38,6 @@ Function .onInit
38
38
!insertmacro quitSuccess
39
39
!else
40
40
!insertmacro check64BitAndSetRegView
41
- !insertmacro initMultiUser
42
41
43
42
!ifdef ONE_CLICK
44
43
!insertmacro ALLOW_ONLY_ONE_INSTALLER_INSTANCE
@@ -48,6 +47,8 @@ Function .onInit
48
47
${EndIf}
49
48
!endif
50
49
50
+ !insertmacro initMultiUser
51
+
51
52
!ifmacrodef customInit
52
53
!insertmacro customInit
53
54
!endif
Original file line number Diff line number Diff line change @@ -59,32 +59,4 @@ Var installMode
59
59
${endif}
60
60
!endif
61
61
!macroend
62
- !endif
63
-
64
- # SHCTX is the hive HKLM if SetShellVarContext all, or HKCU if SetShellVarContext user
65
- !macro registryAddInstallInfo
66
- WriteRegStr SHCTX " ${INSTALL_REGISTRY_KEY}" InstallLocation " $INSTDIR"
67
-
68
- ${if} $installMode == " all"
69
- StrCpy $0 " /allusers"
70
- StrCpy $1 " "
71
- ${else}
72
- StrCpy $0 " /currentuser"
73
- StrCpy $1 " (only current user)"
74
- ${endif}
75
-
76
- WriteRegStr SHCTX " ${UNINSTALL_REGISTRY_KEY}" DisplayName " ${UNINSTALL_DISPLAY_NAME}$1"
77
- # https://github.com/electron-userland/electron-builder/issues/750
78
- StrCpy $2 " $INSTDIR\${UNINSTALL_FILENAME}"
79
- WriteRegStr SHCTX " ${UNINSTALL_REGISTRY_KEY}" UninstallString ' "$2" $0'
80
-
81
- WriteRegStr SHCTX " ${UNINSTALL_REGISTRY_KEY}" " DisplayVersion" " ${VERSION}"
82
- WriteRegStr SHCTX " ${UNINSTALL_REGISTRY_KEY}" " DisplayIcon" " $appExe,0"
83
- WriteRegStr SHCTX " ${UNINSTALL_REGISTRY_KEY}" " Publisher" " ${COMPANY_NAME}"
84
- WriteRegDWORD SHCTX " ${UNINSTALL_REGISTRY_KEY}" NoModify 1
85
- WriteRegDWORD SHCTX " ${UNINSTALL_REGISTRY_KEY}" NoRepair 1
86
-
87
- ${GetSize} " $INSTDIR" " /S=0K" $0 $1 $2
88
- IntFmt $0 " 0x%08X" $0
89
- WriteRegDWORD SHCTX " ${UNINSTALL_REGISTRY_KEY}" " EstimatedSize" " $0"
90
- !macroend
62
+ !endif
Original file line number Diff line number Diff line change @@ -126,9 +126,8 @@ Var RadioButtonLabel1
126
126
SendMessage $MultiUser .InstallModePage.AllUsers ${BM_GETCHECK} 0 0 $MultiUser .InstallModePage.ReturnValue
127
127
128
128
${if} $MultiUser .InstallModePage.ReturnValue = ${BST_CHECKED}
129
- ${if} ${UAC_IsAdmin}
130
- !insertmacro setInstallModePerAllUsers
131
- ${else}
129
+ !insertmacro setInstallModePerAllUsers
130
+ ${IfNot} ${UAC_IsAdmin}
132
131
!ifdef MULTIUSER_INSTALLMODE_ALLOW_ELEVATION
133
132
GetDlgItem $9 $HWNDParent 1
134
133
System::Call user32::GetFocus ()i.s
Original file line number Diff line number Diff line change 1
1
!ifdef RUN_AFTER_FINISH
2
2
!ifndef BUILD_UNINSTALLER
3
+ !include StdUtils.nsh
3
4
Function StartApp
4
5
!ifdef INSTALL_MODE_PER_ALL_USERS
5
- !include StdUtils.nsh
6
6
${StdUtils.ExecShellAsUser} $0 " $SMPROGRAMS\${PRODUCT_FILENAME}.lnk" " open" " "
7
7
!else
8
8
ExecShell " " " $SMPROGRAMS\${PRODUCT_FILENAME}.lnk"
You can’t perform that action at this time.
0 commit comments