forked from apk-spectrum/apk-scanner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.nsi
executable file
·215 lines (170 loc) · 6.6 KB
/
setup.nsi
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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
; Script generated with the Venis Install Wizard
; Define your application name
!define PROJECTNAME "APK Scanner"
!define PROJECTNAMEANDVERSION "APK Scanner 2.6"
; Main Install settings
Name "${PROJECTNAMEANDVERSION}"
InstallDir "$PROGRAMFILES64\APKScanner"
InstallDirRegKey HKLM "Software\${PROJECTNAME}" ""
OutFile "APKScanner.exe"
; Use compression
SetCompressor Zlib
; Modern interface settings
!include "MUI.nsh"
!define MUI_ABORTWARNING
!define MUI_FINISHPAGE_RUN "$INSTDIR\ApkScanner.exe"
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
; Set languages (first is default language)
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "Korean"
!insertmacro MUI_RESERVEFILE_LANGDLL
LangString APP_NAME ${LANG_ENGLISH} "APK Scanner"
LangString APP_NAME ${LANG_KOREAN} "APK 스캐너"
LangString APP_NAME_DESC ${LANG_ENGLISH} "APK Scanner"
LangString APP_NAME_DESC ${LANG_KOREAN} "APK 스캐너"
LangString ASSOCITATE_APK ${LANG_ENGLISH} "Associate APK File"
LangString ASSOCITATE_APK ${LANG_KOREAN} "APK파일 연결"
LangString ASSOCITATE_APK_DESC ${LANG_ENGLISH} "Associate APK File. Open apk file by double click."
LangString ASSOCITATE_APK_DESC ${LANG_KOREAN} "APK파일 연결합니다. APK 파일을 더블클릭하여 분석 할수 있습니다."
LangString ADD_STARTMENU ${LANG_ENGLISH} "Start Menu Shortcuts"
LangString ADD_STARTMENU ${LANG_KOREAN} "시작메뉴에 추가"
LangString ADD_STARTMENU_DESC ${LANG_ENGLISH} "Start Menu Shortcuts"
LangString ADD_STARTMENU_DESC ${LANG_KOREAN} "시작메뉴에 바로가기 아이콘을 추가 합니다."
LangString ADD_DESKTOP ${LANG_ENGLISH} "Desktop Shortcut"
LangString ADD_DESKTOP ${LANG_KOREAN} "바탕화면에 추가"
LangString ADD_DESKTOP_DESC ${LANG_ENGLISH} "Desktop Shortcut"
LangString ADD_DESKTOP_DESC ${LANG_KOREAN} "바탕화면에 바로가기 아이콘을 추가 합니다."
Section $(APP_NAME) Section1
; Set Section properties
SectionIn RO
SetOverwrite on
; Set Section Files and Shortcuts
SetOutPath "$INSTDIR\"
Delete "$INSTDIR\APKInfoDlg.jar"
File "release\ApkScanner.jar"
File "release\ApkScanner.exe"
SetOutPath "$INSTDIR\data\build-master-target-product-security\"
File "release\data\build-master-target-product-security\*"
SetOutPath "$INSTDIR\lib\"
File "release\lib\*.jar"
File "release\lib\*.dll"
SetOutPath "$INSTDIR\lib\proxy-vole"
File "release\lib\proxy-vole\*"
SetOutPath "$INSTDIR\plugin\"
File "release\plugin\*"
SetOutPath "$INSTDIR\security\"
File "release\security\*"
SetOutPath "$INSTDIR\tool\"
File "release\tool\*.exe"
File "release\tool\*.dll"
File "release\tool\*.jar"
File "release\tool\*.bat"
File "release\tool\*.png"
SetOutPath "$INSTDIR\tool\jadx\"
File "release\tool\jadx\*"
SetOutPath "$INSTDIR\tool\jadx\bin\"
File "release\tool\jadx\bin\*.bat"
SetOutPath "$INSTDIR\tool\jadx\lib\"
File "release\tool\jadx\lib\*"
SetOutPath "$INSTDIR\tool\lib\"
File "release\tool\lib\*"
Exec '"cmd.exe" /c icacls "$INSTDIR" /grant Users:(OI)(CI)F'
SectionEnd
Section $(ASSOCITATE_APK) Section2
; Set Section properties
SetOverwrite on
; Set Section Files and Shortcuts
WriteRegStr HKCR "ApkScanner.apk\CLSID" "" "{E88DCCE0-B7B3-11d1-A9F0-00AA0060FA31}"
WriteRegStr HKCR "ApkScanner.apk\DefaultIcon" "" "$INSTDIR\ApkScanner.exe,1"
WriteRegStr HKCR "ApkScanner.apk\OpenWithProgids" "CompressedFolder" ""
WriteRegExpandStr HKCR "ApkScanner.apk\Shell\Open\Command" "" "$\"$INSTDIR\ApkScanner.exe$\" $\"%1$\""
WriteRegExpandStr HKCR "ApkScanner.apk\Shell\Install\Command" "" "$\"$INSTDIR\ApkScanner.exe$\" install $\"%1$\""
WriteRegStr HKCR ".apk" "" "ApkScanner.apk"
Exec '"cmd.exe" /c assoc .apk=ApkScanner.apk'
SectionEnd
Section $(ADD_STARTMENU) Section3
; Set Section properties
SetOverwrite on
; Set Section Files and Shortcuts
CreateDirectory "$SMPROGRAMS\APK Scanner"
CreateShortCut "$SMPROGRAMS\APK Scanner\$(APP_NAME).lnk" "$INSTDIR\ApkScanner.exe"
CreateShortCut "$SMPROGRAMS\APK Scanner\Uninstall.lnk" "$INSTDIR\uninstall.exe"
SectionEnd
Section $(ADD_DESKTOP) Section4
; Set Section properties
SetOverwrite on
; Set Section Files and Shortcuts
CreateShortCut "$DESKTOP\$(APP_NAME).lnk" "$INSTDIR\ApkScanner.exe"
SectionEnd
Section -FinishSection
WriteRegStr HKLM "Software\${PROJECTNAME}" "" "$INSTDIR"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PROJECTNAME}" "DisplayName" "${PROJECTNAME}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PROJECTNAME}" "UninstallString" "$INSTDIR\uninstall.exe"
WriteUninstaller "$INSTDIR\uninstall.exe"
SectionEnd
; Modern install component descriptions
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${Section1} $(APP_NAME_DESC)
!insertmacro MUI_DESCRIPTION_TEXT ${Section2} $(ASSOCITATE_APK_DESC)
!insertmacro MUI_DESCRIPTION_TEXT ${Section3} $(ADD_STARTMENU_DESC)
!insertmacro MUI_DESCRIPTION_TEXT ${Section4} $(ADD_DESKTOP_DESC)
!insertmacro MUI_FUNCTION_DESCRIPTION_END
;Uninstall section
Section Uninstall
;Remove from registry...
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PROJECTNAME}"
DeleteRegKey HKLM "SOFTWARE\${PROJECTNAME}"
DeleteRegKey HKCR "ApkScanner.apk"
; Delete self
Delete "$INSTDIR\uninstall.exe"
; Delete Shortcuts
Delete "$SMPROGRAMS\APK Scanner\$(APP_NAME).lnk"
Delete "$SMPROGRAMS\APK Scanner\Uninstall.lnk"
Delete "$DESKTOP\$(APP_NAME).lnk"
; Clean up APK Scanner
Delete "$INSTDIR\*"
Delete "$INSTDIR\data\*"
Delete "$INSTDIR\data\build-master-target-product-security\*"
Delete "$INSTDIR\lib\*"
Delete "$INSTDIR\lib\proxy-vole\*"
Delete "$INSTDIR\plugin\*"
Delete "$INSTDIR\security\*"
Delete "$INSTDIR\tool\*"
Delete "$INSTDIR\tool\jadx\*"
Delete "$INSTDIR\tool\jadx\bin\*"
Delete "$INSTDIR\tool\jadx\lib\*"
Delete "$INSTDIR\tool\lib\*"
; Remove remaining directories
RMDir "$SMPROGRAMS\APK Scanner"
RMDir "$INSTDIR\tool\lib\"
RMDir "$INSTDIR\tool\jadx\lib\"
RMDir "$INSTDIR\tool\jadx\bin\"
RMDir "$INSTDIR\tool\jadx\"
RMDir "$INSTDIR\tool\"
RMDir "$INSTDIR\security\"
RMDir "$INSTDIR\plugin\"
RMDir "$INSTDIR\lib\proxy-vole\"
RMDir "$INSTDIR\lib\"
RMDir "$INSTDIR\data\build-master-target-product-security\"
RMDir "$INSTDIR\data\"
RMDir "$INSTDIR\"
Var /GLOBAL associate
ReadRegStr $associate HKCR .apk ""
DetailPrint "Associate .apk: $associate"
${If} $associate == "ApkScanner.apk"
WriteRegStr HKCR ".apk" "" ""
ExecWait '"cmd.exe" /c assoc .apk=.apk'
Exec '"cmd.exe" /c assoc .apk='
${EndIf}
SectionEnd
; On initialization
Function .onInit
!insertmacro MUI_LANGDLL_DISPLAY
FunctionEnd
; eof