/
SectionCore.nsh
168 lines (142 loc) · 4.89 KB
/
SectionCore.nsh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
!ifndef SECTION_CORE
!define SECTION_CORE
!include GetInQuotes.nsh
!include IndexOf.nsh
!include GetExecutablePath.nsh
!include BackupPersonal.nsh
!include Shell9x.nsh
!include ShellNT.nsh
!include GetWindowsVersion.nsh
!include SectionsInclude.nsh
Section "$(NAME_SecCore)" SecCore
${If} ${FileExists} "$INSTDIR\litestep.exe"
Push "$INSTDIR"
Call KillLS
Pop $R9
${EndIf}
SetOutPath "$SYSDIR"
SetOverwrite off
File ".\msvcp60.dll"
File ".\msvcrt.dll"
File ".\msvcp70.dll"
File ".\msvcp71.dll"
File ".\msvcr71.dll"
File ".\msvcr70.dll"
SetOverwrite on
SetOutPath "$INSTDIR"
Push $0
ReadINIStr $0 "$PLUGINSDIR\ioWhereProfiles.ini" "Field 4" "State" ;Field 4 is Documents and Settings
IntCmp $0 1 +3 0 0
ReadINIStr $0 "$PLUGINSDIR\ioWhereProfiles.ini" "Field 3" "State" ;Field 3 is LSDir\Profiles
IntCmp $0 1 profiles noprofiles
; Install to Documents and Settings
StrCpy $whereprofiles "$APPDATA\LiteStep"
!insertmacro UNINSTALL.LOG_OPEN_INSTALL
File ".\LS\step-das\step.rc" ;das = Documents and Settings :p
!insertmacro UNINSTALL.LOG_CLOSE_INSTALL
GoTo reg
; Install to LSDir\Profiles
profiles:
UserInfo::GetName
Pop $username
StrCmp $username "" +1 profilesok
; If we get here it means no username was found, probably due to installing on 9x when not logged in
MessageBox MB_OK $(MB_NO_USER)
GoTo noprofiles
profilesok:
StrCpy $whereprofiles "$INSTDIR\Profiles\$username"
!insertmacro UNINSTALL.LOG_OPEN_INSTALL
File ".\LS\step-lsdir\step.rc"
!insertmacro UNINSTALL.LOG_CLOSE_INSTALL
GoTo reg
; Don't install any profiles
noprofiles:
StrCpy $whereprofiles "$INSTDIR"
!insertmacro UNINSTALL.LOG_OPEN_INSTALL
File ".\LS\step-none\step.rc"
!insertmacro UNINSTALL.LOG_CLOSE_INSTALL
reg:
Pop $0
;; Store a few paths in the registry
WriteRegStr HKLM "Software\${PRODUCT_NAME}\Installer" "LitestepDir" $INSTDIR
; IF
StrCmp $whereprofiles "$INSTDIR\Profiles\$username" 0 +3
WriteRegStr HKLM "Software\${PRODUCT_NAME}\Installer" "ProfilesDir" "$INSTDIR\Profiles\%USERNAME%"
GoTo +5
; ELSE IF
StrCmp $whereprofiles "$APPDATA\LiteStep" 0 +3
WriteRegStr HKLM "Software\${PRODUCT_NAME}\Installer" "ProfilesDir" "%APPDATA%\Litestep"
GoTo +2
; ELSE
WriteRegStr HKLM "Software\${PRODUCT_NAME}\Installer" "ProfilesDir" $whereprofiles
WriteRegStr HKLM "Software\${PRODUCT_NAME}\Installer" "PersonalDir" "$whereprofiles\personal"
SetOutPath "$INSTDIR"
!insertmacro UNINSTALL.LOG_OPEN_INSTALL
File ".\LS\changes.txt"
File ".\LS\hook.dll"
File ".\LS\libpng13.dll"
File ".\LS\license.txt"
File ".\LS\litestep.exe"
File ".\LS\lsapi.dll"
File ".\LS\readme.txt"
File ".\LS\release_notes.txt"
File ".\LS\zlib1.dll"
File ".\LS\xPaintClass-1.0.dll"
!insertmacro UNINSTALL.LOG_CLOSE_INSTALL
SetOutPath "$INSTDIR\NLM"
SetOverwrite on
!insertmacro UNINSTALL.LOG_OPEN_INSTALL
File ".\LS\NLM\*"
!insertmacro UNINSTALL.LOG_CLOSE_INSTALL
; Get the current shell
ReadIniStr $0 "system.ini" "boot" "shell"
; Strip the path, so we keep only the .exe name
${ExePath} $0 $0
${RIndexOf} $R0 $0 '\' ; Macro expands to 4 lines
; IF
IntCmp $R0 -1 0 +3 +3
StrCpy $currentShell $0
GoTo +5
; ELSE
StrLen $R1 $0
IntOp $R0 $R1 - $R0
IntOp $R0 $R0 + 1
StrCpy $currentShell $0 "" $R0
; IF
StrCmp $currentShell "" 0 +2
ReadRegStr $currentShell HKLM "Software\Microsoft\Windows NT\CurrentVersion\Winlogon" "Shell"
; IF
StrCmp $currentShell "" 0 +2
StrCpy $currentShell "explorer.exe"
ReadINIStr $R0 "$PLUGINSDIR\ioHowLS.ini" "Field 4" "State" ;Field 4 is Don't set shell
${If} $R0 != 1
; Check whether we're installing on a 9x or NT based system
Call GetWindowsVersion
Pop $R0
${If} $R0 == "9x"
Call setShell9x
${Else}
Call setShellNT
${EndIf}
${EndIf}
Pop $0
CreateShortCut "$DESKTOP\Set Explorer as Shell.lnk" '"$INSTDIR\utilities\wxlua.exe"' '"$INSTDIR\utilities\LOSS.lua" explorer' "$INSTDIR\losi\SetShellExplorer.ico"
CreateShortCut "$DESKTOP\Set LiteStep as Shell.lnk" '"$INSTDIR\utilities\wxlua.exe"' '"$INSTDIR\utilities\LOSS.lua" litestep' "$INSTDIR\losi\SetShellLS.ico"
SetOverwrite on
; Install all the modules and their docs
SetOutPath "$INSTDIR\modules\"
!insertmacro UNINSTALL.LOG_OPEN_INSTALL
File /r /x ".svn" ".\LS\modules\*"
!insertmacro UNINSTALL.LOG_CLOSE_INSTALL
call backupPersonal
; Install the personal files
SetOutPath "$whereprofiles\personal"
; Don't log these files, they are removed the traditional way
;!insertmacro UNINSTALL.LOG_OPEN_INSTALL
File /r /x ".svn" ".\Personal\personal\*"
StrCmp $R9 "LSKilled" 0 wasntRunning
ExecShell open "$INSTDIR\litestep.exe" ;Launch LiteStep
StrCpy $hasStartedLS "true"
wasntRunning:
SectionEnd
!endif