692a5a53b9cb7eb628497ff2d679fe0d0c36d2a0
[openafs.git] / src / WINNT / install / NSIS / OpenAFS.nsi
1 !define RELEASE 1
2 ; OpenAFS Install Script for NSIS
3 ; This version compiles with NSIS v2.07
4 ;
5 ; Originally written by Rob Murawski <rsm4@ieee.org>
6 ;
7 ;Redistribution and use in source and binary forms, with or without modification, are permitted
8 ;provided that the following conditions are met:
9 ;
10 ;  Redistributions of source code must retain the above copyright notice, this list of conditions
11 ;  and the following disclaimer. Redistributions in binary form must reproduce the above copyright
12 ;  notice, this list of conditions and the following disclaimer in the documentation and/or other
13 ;  materials provided with the distribution. The name of the author may not be used to endorse or
14 ;  promote products derived from this software without specific prior written permission.
15 ;
16 ;  THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
17 ;  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
18 ;  PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
19 ;  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
20 ;  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
21 ;  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
22 ;  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
23 ;  USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 ;
25 ;
26 ;     Some code originally based on:
27 ;     NSIS Modern User Interface version 1.63
28 ;     MultiLanguage Example Script
29 ;     Written by Joost Verburg
30
31 ; Read in the environment information
32 !include ${INCLUDEDIR}\nsi-includes.nsi
33
34 !ifndef RELEASE
35 !ifndef DEBUG
36 Name "OpenAFS ${AFS_VERSION} ${__DATE__} ${__TIME__}"
37 !else
38 Name "OpenAFS ${AFS_VERSION} ${__DATE__} ${__TIME__} Checked/Debug"
39 !endif               ; End DEBUG/!DEBUG
40 !else
41 !ifndef DEBUG
42 Name "OpenAFS ${AFS_VERSION}"
43 !else                ; DEBUG
44 Name "OpenAFS ${AFS_VERSION} Checked/Debug"
45 !endif               ; End DEBUG/!DEBUG
46 !endif
47 VIProductVersion "${AFS_VERSION}.00"
48 VIAddVersionKey "ProductName" "OpenAFS"
49 VIAddVersionKey "CompanyName" "OpenAFS.org"
50 VIAddVersionKey "ProductVersion" ${AFS_VERSION}
51 VIAddVersionKey "FileVersion" ${AFS_VERSION}
52 VIAddVersionKey "FileDescription" "OpenAFS for Windows Installer"
53 VIAddVersionKey "LegalCopyright" "(C)2000-2008"
54 !ifdef DEBUG
55 VIAddVersionKey "PrivateBuild" "Checked/Debug"
56 !endif               ; End DEBUG
57
58
59 !include "MUI.nsh"
60 !include Sections.nsh
61
62 ;--------------------------------
63 ;Configuration
64
65 !define REPLACEDLL_NOREGISTER
66
67   ;General
68 !ifndef AFSIFS
69 !ifndef DEBUG
70   OutFile "${AFS_DESTDIR}\WinInstall\OpenAFSforWindows.exe"
71 !else
72   OutFile "${AFS_DESTDIR}\WinInstall\OpenAFSforWindows-DEBUG.exe"
73 !endif
74 !else
75 !ifndef DEBUG
76   OutFile "${AFS_DESTDIR}\WinInstall\OpenAFSforWindows-IFS.exe"
77 !else
78   OutFile "${AFS_DESTDIR}\WinInstall\OpenAFSforWindows-IFS-DEBUG.exe"
79 !endif
80 !endif
81   SilentInstall normal
82   SetCompressor /solid lzma
83   !define MUI_ICON "..\..\client_config\OpenAFS.ico"
84   !define MUI_UNICON "..\..\client_config\OpenAFS.ico"
85   !define AFS_COMPANY_NAME "OpenAFS"
86   !define AFS_PRODUCT_NAME "OpenAFS"
87   !define AFS_REGKEY_ROOT "Software\TransarcCorporation"
88   !define NID_PLUGIN_MGR  "Software\MIT\NetIDMgr\PluginManager"
89   CRCCheck force
90
91   ;Folder selection page
92   InstallDir "$PROGRAMFILES\OpenAFS"      ; Install to shorter path
93   
94   ;Remember install folder
95   InstallDirRegKey HKCU ${AFS_REGKEY_ROOT} ""
96   
97   ;Remember the installer language
98   !define MUI_LANGDLL_REGISTRY_ROOT "HKCU" 
99   !define MUI_LANGDLL_REGISTRY_KEY ${AFS_REGKEY_ROOT}
100   !define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"
101   
102   ;Where are the files?
103   !define AFS_CLIENT_BUILDDIR "${AFS_DESTDIR}\root.client\usr\vice\etc"
104   !define AFS_WININSTALL_DIR "${AFS_DESTDIR}\WinInstall\Config"
105   !define AFS_BUILD_INCDIR "${AFS_DESTDIR}\include"
106   !define AFS_CLIENT_LIBDIR "${AFS_DESTDIR}\lib"
107   !define AFS_SERVER_BUILDDIR "${AFS_DESTDIR}\root.server\usr\afs\bin"
108   !define AFS_ETC_BUILDDIR "${AFS_DESTDIR}\etc"
109   !define SYSTEMDIR   "$%SystemRoot%\System32" 
110   
111 ;--------------------------------
112 ;Modern UI Configuration
113
114   !define MUI_LICENSEPAGE
115   !define MUI_CUSTOMPAGECOMMANDS
116   !define MUI_WELCOMEPAGE
117   !define MUI_COMPONENTSPAGE
118   !define MUI_COMPONENTSPAGE_SMALLDESC
119   !define MUI_DIRECTORYPAGE
120
121   !define MUI_ABORTWARNING
122   !define MUI_FINISHPAGE
123   
124   !define MUI_UNINSTALLER
125   !define MUI_UNCONFIRMPAGE
126   
127   
128   !insertmacro MUI_PAGE_WELCOME
129   !insertmacro MUI_PAGE_LICENSE "Licenses.rtf"
130   !insertmacro MUI_PAGE_COMPONENTS
131   !insertmacro MUI_PAGE_DIRECTORY
132   Page custom AFSPageGetCellServDB
133   Page custom AFSPageGetCellName
134   Page custom AFSPageConfigAFSCreds
135   !insertmacro MUI_PAGE_INSTFILES
136   !insertmacro MUI_PAGE_FINISH
137   
138 ;--------------------------------
139 ;Languages
140
141   !insertmacro MUI_LANGUAGE "English"
142   ;!insertmacro MUI_LANGUAGE "French"
143   !insertmacro MUI_LANGUAGE "German"
144   !insertmacro MUI_LANGUAGE "Spanish"
145   !insertmacro MUI_LANGUAGE "SimpChinese"
146   !insertmacro MUI_LANGUAGE "TradChinese"    
147   !insertmacro MUI_LANGUAGE "Japanese"
148   !insertmacro MUI_LANGUAGE "Korean"
149   ;!insertmacro MUI_LANGUAGE "Italian"
150   ;!insertmacro MUI_LANGUAGE "Dutch"
151   ;!insertmacro MUI_LANGUAGE "Danish"
152   ;!insertmacro MUI_LANGUAGE "Greek"
153   ;!insertmacro MUI_LANGUAGE "Russian"
154   !insertmacro MUI_LANGUAGE "PortugueseBR"
155   ;!insertmacro MUI_LANGUAGE "Polish"
156   ;!insertmacro MUI_LANGUAGE "Ukrainian"
157   ;!insertmacro MUI_LANGUAGE "Czech"
158   ;!insertmacro MUI_LANGUAGE "Slovak"
159   ;!insertmacro MUI_LANGUAGE "Croatian"
160   ;!insertmacro MUI_LANGUAGE "Bulgarian"
161   ;!insertmacro MUI_LANGUAGE "Hungarian"
162   ;!insertmacro MUI_LANGUAGE "Thai"
163   ;!insertmacro MUI_LANGUAGE "Romanian"
164   ;!insertmacro MUI_LANGUAGE "Macedonian"
165   ;!insertmacro MUI_LANGUAGE "Turkish"
166   
167 ;--------------------------------
168 ;Language Strings
169     
170   ;Descriptions
171   LangString DESC_SecCopyUI ${LANG_ENGLISH} "OpenAFS for Windows: English"
172   ;LangString DESC_SecCopyUI ${LANG_FRENCH} "OpenAFS for Windows: French"
173   LangString DESC_SecCopyUI ${LANG_GERMAN} "OpenAFS for Windows: German"
174   LangString DESC_SecCopyUI ${LANG_SPANISH} "OpenAFS for Windows: Spanish"
175   LangString DESC_SecCopyUI ${LANG_SIMPCHINESE} "OpenAFS for Windows: Simplified Chinese"
176   LangString DESC_SecCopyUI ${LANG_TRADCHINESE} "OpenAFS for Windows: Traditional Chinese description"
177   LangString DESC_SecCopyUI ${LANG_JAPANESE} "OpenAFS for Windows: Japanese description"
178   LangString DESC_SecCopyUI ${LANG_KOREAN} "OpenAFS for Windows: Korean description"
179   ;LangString DESC_SecCopyUI ${LANG_ITALIAN} "OpenAFS for Windows: Italian description"
180   ;LangString DESC_SecCopyUI ${LANG_DUTCH} "OpenAFS for Windows: Dutch description"
181   ;LangString DESC_SecCopyUI ${LANG_DANISH} "OpenAFS for Windows: Danish description"
182   ;LangString DESC_SecCopyUI ${LANG_GREEK} "OpenAFS for Windows: Greek description"
183   ;LangString DESC_SecCopyUI ${LANG_RUSSIAN} "OpenAFS for Windows: Russian description"
184   LangString DESC_SecCopyUI ${LANG_PORTUGUESEBR} "OpenAFS for Windows: Portuguese (Brasil) description"
185   ;LangString DESC_SecCopyUI ${LANG_POLISH} "OpenAFS for Windows: Polish description"
186   ;LangString DESC_SecCopyUI ${LANG_UKRAINIAN} "OpenAFS for Windows: Ukrainian description"
187   ;LangString DESC_SecCopyUI ${LANG_CZECH} "OpenAFS for Windows: Czechian description"
188   ;LangString DESC_SecCopyUI ${LANG_SLOVAK} "OpenAFS for Windows: Slovakian description"
189   ;LangString DESC_SecCopyUI ${LANG_CROATIAN} "OpenAFS for Windows: Slovakian description"
190   ;LangString DESC_SecCopyUI ${LANG_BULGARIAN} "OpenAFS for Windows: Bulgarian description"
191   ;LangString DESC_SecCopyUI ${LANG_HUNGARIAN} "OpenAFS for Windows: Hungarian description"
192   ;LangString DESC_SecCopyUI ${LANG_THAI} "OpenAFS for Windows: Thai description"
193   ;LangString DESC_SecCopyUI ${LANG_ROMANIAN} "OpenAFS for Windows: Romanian description"
194   ;LangString DESC_SecCopyUI ${LANG_MACEDONIAN} "OpenAFS for Windows: Macedonian description"
195   ;LangString DESC_SecCopyUI ${LANG_TURKISH} "OpenAFS for Windows: Turkish description"
196
197   LangString DESC_secClient ${LANG_ENGLISH} "OpenAFS Client: Allows you to access AFS from your Windows PC."
198   LangString DESC_secClient ${LANG_GERMAN} "OpenAFS Client: Allows you to access AFS from your Windows PC."
199   LangString DESC_secClient ${LANG_SPANISH} "OpenAFS Client: Allows you to access AFS from your Windows PC."
200   LangString DESC_secClient ${LANG_SIMPCHINESE} "OpenAFS Client: Allows you to access AFS from your Windows PC."
201   LangString DESC_secClient ${LANG_TRADCHINESE} "OpenAFS Client: Allows you to access AFS from your Windows PC."
202   LangString DESC_secClient ${LANG_JAPANESE} "OpenAFS Client: Allows you to access AFS from your Windows PC."
203   LangString DESC_secClient ${LANG_KOREAN} "OpenAFS Client: Allows you to access AFS from your Windows PC."
204   LangString DESC_secClient ${LANG_PORTUGUESEBR} "OpenAFS Client: Allows you to access AFS from your Windows PC."
205   
206   LangString DESC_secLoopback ${LANG_ENGLISH} "MS Loopback adapter: Installs the adapter for a more reliable AFS client."
207   LangString DESC_secLoopback ${LANG_GERMAN} "MS Loopback adapter: Installs the adapter for a more reliable AFS client."
208   LangString DESC_secLoopback ${LANG_SPANISH} "MS Loopback adapter: Installs the adapter for a more reliable AFS client."
209   LangString DESC_secLoopback ${LANG_SIMPCHINESE} "MS Loopback adapter: Installs the adapter for a more reliable AFS client."
210   LangString DESC_secLoopback ${LANG_TRADCHINESE} "MS Loopback adapter: Installs the adapter for a more reliable AFS client."
211   LangString DESC_secLoopback ${LANG_JAPANESE} "MS Loopback adapter: Installs the adapter for a more reliable AFS client."
212   LangString DESC_secLoopback ${LANG_KOREAN} "MS Loopback adapter: Installs the adapter for a more reliable AFS client."
213   LangString DESC_secLoopback ${LANG_PORTUGUESEBR} "MS Loopback adapter: Installs the adapter for a more reliable AFS client."
214
215   LangString DESC_secServer ${LANG_ENGLISH} "OpenAFS Server: Allows you to run an AFS file server. This option requires the AFS Client."
216   LangString DESC_secServer ${LANG_GERMAN} "OpenAFS Server: Allows you to run an AFS file server. This option requires the AFS Client."
217   LangString DESC_secServer ${LANG_SPANISH} "OpenAFS Server: Allows you to run an AFS file server. This option requires the AFS Client."
218   LangString DESC_secServer ${LANG_SIMPCHINESE} "OpenAFS Server: Allows you to run an AFS file server. This option requires the AFS Client."
219   LangString DESC_secServer ${LANG_TRADCHINESE} "OpenAFS Server: Allows you to run an AFS file server. This option requires the AFS Client."
220   LangString DESC_secServer ${LANG_JAPANESE} "OpenAFS Server: Allows you to run an AFS file server. This option requires the AFS Client."
221   LangString DESC_secServer ${LANG_KOREAN} "OpenAFS Server: Allows you to run an AFS file server. This option requires the AFS Client."
222   LangString DESC_secServer ${LANG_PORTUGUESEBR} "OpenAFS Server: Allows you to run an AFS file server. This option requires the AFS Client."
223   
224   LangString DESC_secControl ${LANG_ENGLISH} "Control Center: GUI utilities for managing and configuring AFS servers.  This option requires the AFS Client."
225   LangString DESC_secControl ${LANG_GERMAN} "Control Center: GUI utilities for managing and configuring AFS servers.  This option requires the AFS Client."
226   LangString DESC_secControl ${LANG_SPANISH} "Control Center: GUI utilities for managing and configuring AFS servers.  This option requires the AFS Client."
227   LangString DESC_secControl ${LANG_SIMPCHINESE} "Control Center: GUI utilities for managing and configuring AFS servers.  This option requires the AFS Client."
228   LangString DESC_secControl ${LANG_TRADCHINESE} "Control Center: GUI utilities for managing and configuring AFS servers.  This option requires the AFS Client."
229   LangString DESC_secControl ${LANG_JAPANESE} "Control Center: GUI utilities for managing and configuring AFS servers.  This option requires the AFS Client."
230   LangString DESC_secControl ${LANG_KOREAN} "Control Center: GUI utilities for managing and configuring AFS servers.  This option requires the AFS Client."
231   LangString DESC_secControl ${LANG_PORTUGUESEBR} "Control Center: GUI utilities for managing and configuring AFS servers.  This option requires the AFS Client."
232   
233   LangString DESC_secDocs ${LANG_ENGLISH} "Supplemental Documentation: Additional documentation for using OpenAFS."
234   LangString DESC_secDocs ${LANG_GERMAN} "Supplemental Documentation: Additional documentation for using OpenAFS."
235   LangString DESC_secDocs ${LANG_SPANISH} "Supplemental Documentation: Additional documentation for using OpenAFS."
236   LangString DESC_secDocs ${LANG_SIMPCHINESE} "Supplemental Documentation: Additional documentation for using OpenAFS."
237   LangString DESC_secDocs ${LANG_TRADCHINESE} "Supplemental Documentation: Additional documentation for using OpenAFS."
238   LangString DESC_secDocs ${LANG_JAPANESE} "Supplemental Documentation: Additional documentation for using OpenAFS."
239   LangString DESC_secDocs ${LANG_KOREAN} "Supplemental Documentation: Additional documentation for using OpenAFS."
240   LangString DESC_secDocs ${LANG_PORTUGUESEBR} "Supplemental Documentation: Additional documentation for using OpenAFS."
241   
242   LangString DESC_secSDK ${LANG_ENGLISH} "SDK: Header files and libraries for developing software with OpenAFS."
243   LangString DESC_secSDK ${LANG_GERMAN} "SDK: Header files and libraries for developing software with OpenAFS."
244   LangString DESC_secSDK ${LANG_SPANISH} "SDK: Header files and libraries for developing software with OpenAFS."
245   LangString DESC_secSDK ${LANG_SIMPCHINESE} "SDK: Header files and libraries for developing software with OpenAFS."
246   LangString DESC_secSDK ${LANG_TRADCHINESE} "SDK: Header files and libraries for developing software with OpenAFS."
247   LangString DESC_secSDK ${LANG_JAPANESE} "SDK: Header files and libraries for developing software with OpenAFS."
248   LangString DESC_secSDK ${LANG_KOREAN} "SDK: Header files and libraries for developing software with OpenAFS."
249   LangString DESC_secSDK ${LANG_PORTUGUESEBR} "SDK: Header files and libraries for developing software with OpenAFS."
250   
251   LangString DESC_secDEBUG ${LANG_ENGLISH} "Debug symbols: Used for debugging problems with OpenAFS."
252   LangString DESC_secDEBUG ${LANG_GERMAN} "Debug symbols: Used for debugging problems with OpenAFS."
253   LangString DESC_secDEBUG ${LANG_SPANISH} "Debug symbols: Used for debugging problems with OpenAFS."
254   LangString DESC_secDEBUG ${LANG_SIMPCHINESE} "Debug symbols: Used for debugging problems with OpenAFS."
255   LangString DESC_secDEBUG ${LANG_TRADCHINESE} "Debug symbols: Used for debugging problems with OpenAFS."
256   LangString DESC_secDEBUG ${LANG_JAPANESE} "Debug symbols: Used for debugging problems with OpenAFS."
257   LangString DESC_secDEBUG ${LANG_KOREAN} "Debug symbols: Used for debugging problems with OpenAFS."
258   LangString DESC_secDEBUG ${LANG_PORTUGUESEBR} "Debug symbols: Used for debugging problems with OpenAFS."
259
260 ; Popup error messages
261   LangString CellError ${LANG_ENGLISH} "You must specify a valid CellServDB file to copy during install"
262   LangString CellError ${LANG_GERMAN} "You must specify a valid CellServDB file to copy during the install"
263   LangString CellError ${LANG_SPANISH} "You must specify a valid CellServDB file to copy during the install"
264   LangString CellError ${LANG_SIMPCHINESE} "You must specify a valid CellServDB file to copy during the install"
265   LangString CellError ${LANG_TRADCHINESE} "You must specify a valid CellServDB file to copy during the install"
266   LangString CellError ${LANG_JAPANESE} "You must specify a valid CellServDB file to copy during the install"
267   LangString CellError ${LANG_KOREAN} "You must specify a valid CellServDB file to copy during the install"
268   LangString CellError ${LANG_PORTUGUESEBR} "You must specify a valid CellServDB file to copy during the install"
269   
270   LangString CellNameError ${LANG_ENGLISH} "You must specify a cell name for your client to use."
271   LangString CellNameError ${LANG_GERMAN} "You must specify a cell name for your client to use."
272   LangString CellNameError ${LANG_SPANISH} "You must specify a cell name for your client to use."
273   LangString CellNameError ${LANG_SIMPCHINESE} "You must specify a cell name for your client to use."
274   LangString CellNameError ${LANG_TRADCHINESE} "You must specify a cell name for your client to use."
275   LangString CellNameError ${LANG_JAPANESE} "You must specify a cell name for your client to use."
276   LangString CellNameError ${LANG_KOREAN} "You must specify a cell name for your client to use."
277   LangString CellNameError ${LANG_PORTUGUESEBR} "You must specify a cell name for your client to use."
278   
279   LangString URLError ${LANG_ENGLISH} "You must specify a URL if you choose the option to download the CellServDB."
280   LangString URLError ${LANG_GERMAN} "You must specify a URL if you choose the option to download the CellServDB."
281   LangString URLError ${LANG_SPANISH} "You must specify a URL if you choose the option to download the CellServDB."
282   LangString URLError ${LANG_SIMPCHINESE} "You must specify a URL if you choose the option to download the CellServDB."
283   LangString URLError ${LANG_TRADCHINESE} "You must specify a URL if you choose the option to download the CellServDB."
284   LangString URLError ${LANG_JAPANESE} "You must specify a URL if you choose the option to download the CellServDB."
285   LangString URLError ${LANG_KOREAN} "You must specify a URL if you choose the option to download the CellServDB."
286   LangString URLError ${LANG_PORTUGUESEBR} "You must specify a URL if you choose the option to download the CellServDB."
287
288   
289 ; Upgrade/re-install strings
290    LangString UPGRADE_CLIENT ${LANG_ENGLISH} "Upgrade AFS Client"
291    LangString UPGRADE_CLIENT ${LANG_GERMAN} "Upgrade AFS Client"
292    LangString UPGRADE_CLIENT ${LANG_SPANISH} "Upgrade AFS Client"
293    LangString UPGRADE_CLIENT ${LANG_SIMPCHINESE} "Upgrade AFS Client"
294    LangString UPGRADE_CLIENT ${LANG_TRADCHINESE} "Upgrade AFS Client"
295    LangString UPGRADE_CLIENT ${LANG_JAPANESE} "Upgrade AFS Client"
296    LangString UPGRADE_CLIENT ${LANG_KOREAN} "Upgrade AFS Client"
297    LangString UPGRADE_CLIENT ${LANG_PORTUGUESEBR} "Upgrade AFS Client"
298  
299    LangString REINSTALL_CLIENT ${LANG_ENGLISH} "Re-install AFS Client"
300    LangString REINSTALL_CLIENT ${LANG_GERMAN} "Re-install AFS Client"
301    LangString REINSTALL_CLIENT ${LANG_SPANISH} "Re-install AFS Client"
302    LangString REINSTALL_CLIENT ${LANG_SIMPCHINESE} "Re-install AFS Client"
303    LangString REINSTALL_CLIENT ${LANG_TRADCHINESE} "Re-install AFS Client"
304    LangString REINSTALL_CLIENT ${LANG_JAPANESE} "Re-install AFS Client"
305    LangString REINSTALL_CLIENT ${LANG_KOREAN} "Re-install AFS Client"
306    LangString REINSTALL_CLIENT ${LANG_PORTUGUESEBR} "Re-install AFS Client"
307   
308    LangString UPGRADE_SERVER ${LANG_ENGLISH} "Upgrade AFS Server"
309    LangString UPGRADE_SERVER ${LANG_GERMAN} "Upgrade AFS Server"
310    LangString UPGRADE_SERVER ${LANG_SPANISH} "Upgrade AFS Server"
311    LangString UPGRADE_SERVER ${LANG_SIMPCHINESE} "Upgrade AFS Server"
312    LangString UPGRADE_SERVER ${LANG_TRADCHINESE} "Upgrade AFS Server"
313    LangString UPGRADE_SERVER ${LANG_JAPANESE} "Upgrade AFS Server"
314    LangString UPGRADE_SERVER ${LANG_KOREAN} "Upgrade AFS Server"
315    LangString UPGRADE_SERVER ${LANG_PORTUGUESEBR} "Upgrade AFS Server"
316     
317    LangString REINSTALL_SERVER ${LANG_ENGLISH} "Re-install AFS Server"
318    LangString REINSTALL_SERVER ${LANG_GERMAN} "Re-install AFS Server"
319    LangString REINSTALL_SERVER ${LANG_SPANISH} "Re-install AFS Server"
320    LangString REINSTALL_SERVER ${LANG_SIMPCHINESE} "Re-install AFS Server"
321    LangString REINSTALL_SERVER ${LANG_TRADCHINESE} "Re-install AFS Server"
322    LangString REINSTALL_SERVER ${LANG_JAPANESE} "Re-install AFS Server"
323    LangString REINSTALL_SERVER ${LANG_KOREAN} "Re-install AFS Server"
324    LangString REINSTALL_SERVER ${LANG_PORTUGUESEBR} "Re-install AFS Server"
325   
326   ReserveFile "CellServPage.ini"
327   ReserveFile "AFSCell.ini"
328   !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS ;InstallOptions plug-in
329   !insertmacro MUI_RESERVEFILE_LANGDLL ;Language selection dialog
330
331   RequestExecutionLevel admin
332
333 ;--------------------------------
334 ; Macros
335 ; Macro - Upgrade DLL File
336 ; Written by Joost Verburg
337 ; ------------------------
338 ;
339 ; Parameters:
340 ; LOCALFILE   - Location of the new DLL file (on the compiler system)
341 ; DESTFILE    - Location of the DLL file that should be upgraded
342 ;              (on the user's system)
343 ; TEMPBASEDIR - Directory on the user's system to store a temporary file
344 ;               when the system has to be rebooted.
345 ;               For Win9x support, this should be on the same volume as the
346 ;               DESTFILE!
347 ;               The Windows temp directory could be located on any volume,
348 ;               so you cannot use  this directory.
349 ;
350 ; Define REPLACEDLL_NOREGISTER if you want to upgrade a DLL that does not
351 ; have to be registered.
352 ;
353 ; Note: If you want to support Win9x, you can only use
354 ;       short filenames (8.3).
355 ;
356 ; Example of usage:
357 ; !insertmacro ReplaceDLL "dllname.dll" "$SYSDIR\dllname.dll" "$SYSDIR"
358 ;
359
360 !macro ReplaceDLL LOCALFILE DESTFILE TEMPBASEDIR
361
362   Push $R0
363   Push $R1
364   Push $R2
365   Push $R3
366   Push $R4
367   Push $R5
368
369   ;------------------------
370   ;Unique number for labels
371
372   !define REPLACEDLL_UNIQUE ${__LINE__}
373
374   ;------------------------
375   ;Copy the parameters used on run-time to a variable
376   ;This allows the usage of variables as paramter
377
378   StrCpy $R4 "${DESTFILE}"
379   StrCpy $R5 "${TEMPBASEDIR}"
380
381   ;------------------------
382   ;Check file and version
383   ;
384   IfFileExists $R4 0 replacedll.copy_${REPLACEDLL_UNIQUE}
385   
386   ;ClearErrors
387   ;  GetDLLVersionLocal "${LOCALFILE}" $R0 $R1
388   ;  GetDLLVersion $R4 $R2 $R3
389   ;IfErrors replacedll.upgrade_${REPLACEDLL_UNIQUE}
390   ;
391   ;IntCmpU $R0 $R2 0 replacedll.done_${REPLACEDLL_UNIQUE} \
392   ;  replacedll.upgrade_${REPLACEDLL_UNIQUE}
393   ;IntCmpU $R1 $R3 replacedll.done_${REPLACEDLL_UNIQUE} \
394   ;  replacedll.done_${REPLACEDLL_UNIQUE} \
395   ;  replacedll.upgrade_${REPLACEDLL_UNIQUE}
396
397   ;------------------------
398   ;Let's replace the DLL!
399
400   SetOverwrite try
401
402   ;replacedll.upgrade_${REPLACEDLL_UNIQUE}:
403     !ifndef REPLACEDLL_NOREGISTER
404       ;Unregister the DLL
405       UnRegDLL $R4
406     !endif
407
408   ;------------------------
409   ;Try to copy the DLL directly
410
411   ClearErrors
412     StrCpy $R0 $R4
413     Call :replacedll.file_${REPLACEDLL_UNIQUE}
414   IfErrors 0 replacedll.noreboot_${REPLACEDLL_UNIQUE}
415
416   ;------------------------
417   ;DLL is in use. Copy it to a temp file and Rename it on reboot.
418
419   GetTempFileName $R0 $R5
420     Call :replacedll.file_${REPLACEDLL_UNIQUE}
421   Rename /REBOOTOK $R0 $R4
422
423   ;------------------------
424   ;Register the DLL on reboot
425
426   !ifndef REPLACEDLL_NOREGISTER
427     WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\RunOnce" \
428       "Register $R4" 'rundll32.exe "$R4",DllRegisterServer'
429   !endif
430
431   Goto replacedll.done_${REPLACEDLL_UNIQUE}
432
433   ;------------------------
434   ;DLL does not exist - just extract
435
436   replacedll.copy_${REPLACEDLL_UNIQUE}:
437     StrCpy $R0 $R4
438     Call :replacedll.file_${REPLACEDLL_UNIQUE}
439
440   ;------------------------
441   ;Register the DLL
442
443   replacedll.noreboot_${REPLACEDLL_UNIQUE}:
444     !ifndef REPLACEDLL_NOREGISTER
445       RegDLL $R4
446     !endif
447
448   ;------------------------
449   ;Done
450
451   replacedll.done_${REPLACEDLL_UNIQUE}:
452
453   Pop $R5
454   Pop $R4
455   Pop $R3
456   Pop $R2
457   Pop $R1
458   Pop $R0
459
460   ;------------------------
461   ;End
462
463   Goto replacedll.end_${REPLACEDLL_UNIQUE}
464
465   ;------------------------
466   ;Called to extract the DLL
467
468   replacedll.file_${REPLACEDLL_UNIQUE}:
469     File /oname=$R0 "${LOCALFILE}"
470     Return
471
472   replacedll.end_${REPLACEDLL_UNIQUE}:
473
474  ;------------------------
475  ;Restore settings
476
477  SetOverwrite lastused
478  
479  !undef REPLACEDLL_UNIQUE
480
481 !macroend
482
483
484 ;--------------------------------
485 ;Reserve Files
486   
487   ;Things that need to be extracted on first (keep these lines before any File command!)
488   ;Only useful for BZIP2 compression
489   !insertmacro MUI_RESERVEFILE_LANGDLL
490   
491 ;--------------------------------
492 ; User Variables
493
494 var REG_SUB_KEY
495 var REG_VALUE
496 var REG_DATA_1
497 var REG_DATA_2
498 var REG_DATA_3
499 var REG_DATA_4
500
501
502 ;--------------------------------
503 ;Installer Sections
504
505 ;----------------------
506 ; OpenAFS CLIENT
507 Section "!AFS Client" secClient
508
509   SetShellVarContext all
510
511   ; Check for bad previous installation (if we are doing a new install)
512   Call IsAnyAFSInstalled
513   Pop $R0
514   StrCmp $R0 "0" +1 skipCheck
515   Call CheckPathForAFS
516   skipCheck:
517
518   ; Stop any running services or we can't replace the files
519   ; Stop the running processes
520   GetTempFileName $R0
521   File /oname=$R0 "${AFS_WININSTALL_DIR}\Killer.exe"   ; Might not have the MSVCR71.DLL file to run
522   nsExec::Exec '$R0 afsd_service.exe'
523   nsExec::Exec '$R0 afscreds.exe'
524   Exec "afscreds.exe -z"
525   ; in case we are upgrading an old version that does not support -z
526   nsExec::Exec '$R0 afscreds.exe'
527 !IFDEF INSTALL_KFW
528   ;nsExec::Exec '$R0 krbcc32s.exe'
529 !ENDIF
530
531   nsExec::Exec "net stop TransarcAFSDaemon"
532   nsExec::Exec "net stop TransarcAFSServer"
533   
534   ; Install the Microsoft IDNM Redistributable
535   Call GetWindowsVersion
536   Pop $R1
537   StrCmp $R1 "XP" installIDN +1
538   StrCmp $R1 "2003" installIDN skipIDN
539   installIDN:
540   GetTempFileName $R0
541   File /oname=$R0 "${IDNMREDIST}"
542   nsExec::Exec '$R0 /quiet /norestart'
543   skipIDN:  
544
545    ; Do client components
546   SetOutPath "$INSTDIR\Client\Program"
547   File "${AFS_CLIENT_BUILDDIR}\afsshare.exe"
548   !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\libosi.dll" "$INSTDIR\Client\Program\libosi.dll" "$INSTDIR"
549   File "${AFS_CLIENT_BUILDDIR}\klog.exe"
550   File "${AFS_CLIENT_BUILDDIR}\tokens.exe"
551   File "${AFS_CLIENT_BUILDDIR}\unlog.exe"
552   File "${AFS_CLIENT_BUILDDIR}\fs.exe"
553   File "${AFS_CLIENT_BUILDDIR}\afsdacl.exe"
554   File "${AFS_CLIENT_BUILDDIR}\cmdebug.exe"
555   File "${AFS_CLIENT_BUILDDIR}\aklog.exe"
556   !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afscreds.exe"    "$INSTDIR\Client\Program\afscreds.exe"    "$INSTDIR"
557   !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afs_shl_ext.dll" "$INSTDIR\Client\Program\afs_shl_ext.dll" "$INSTDIR"
558   !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afsd_service.exe" "$INSTDIR\Client\Program\afsd_service.exe" "$INSTDIR"
559   File "${AFS_CLIENT_BUILDDIR}\symlink.exe"
560   File "${AFS_DESTDIR}\bin\kpasswd.exe"
561   File "${AFS_SERVER_BUILDDIR}\pts.exe"
562   File "${AFS_SERVER_BUILDDIR}\bos.exe"
563   File "${AFS_SERVER_BUILDDIR}\kas.exe"
564   File "${AFS_SERVER_BUILDDIR}\vos.exe"
565   File "${AFS_SERVER_BUILDDIR}\udebug.exe"
566   File "${AFS_DESTDIR}\bin\translate_et.exe"
567   File "${AFS_DESTDIR}\etc\rxdebug.exe"
568   File "${AFS_DESTDIR}\etc\backup.exe"
569   !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afs_cpa.cpl" "$INSTDIR\Client\Program\afs_cpa.cpl" "$INSTDIR"
570   !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afscred.dll" "$INSTDIR\Client\Program\afscred.dll" "$INSTDIR"
571   !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afscred_en_us.dll" "$INSTDIR\Client\Program\afscred_en_us.dll" "$INSTDIR"
572   File "${AFS_CLIENT_BUILDDIR}\afsplhlp.chm"
573   
574   !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afslogon.dll" "$INSTDIR\Client\Program\afslogon.dll" "$INSTDIR"
575   File "${AFS_CLIENT_BUILDDIR}\afscpcc.exe"
576
577   ; Remove the binaries from the old location if present
578   Delete /REBOOTOK "$INSTDIR\Client\Program\libafsconf.dll"
579   Delete "$INSTDIR\Client\Program\libafsconf.pdb"
580   Delete /REBOOTOK "$SYSDIR\afslogon.dll"
581   Delete "$SYSDIR\afscpcc.exe"
582   Delete "$SYSDIR\afslogon.pdb"
583   Delete "$SYSDIR\afscpcc.pdb"
584
585    Call AFSLangFiles
586
587   ; Get AFS CellServDB file
588   Call afs.GetCellServDB
589
590   GetTempFileName $R0
591   File /oname=$R0 "${AFS_WININSTALL_DIR}\AdminGroup.exe"
592   nsExec::Exec '$R0 -create'
593
594 !ifdef INSTALL_KFW
595   ; Include Kerberos for Windows files in the installer...
596   SetOutPath "$INSTDIR\kfw\bin\"
597   File "${KFW_SOURCE}\bin\*"
598   SetOutPath "$INSTDIR\kfw\doc"
599   File "${KFW_SOURCE}\doc\*"
600 !endif
601    
602   ;Store install folder
603   WriteRegStr HKCU "${AFS_REGKEY_ROOT}\Client" "" $INSTDIR
604   Call AFSCommon.Install
605   
606   ; Write registry entries
607   WriteRegStr HKCR "*\shellex\ContextMenuHandlers\AFS Client Shell Extension" "" "{DC515C27-6CAC-11D1-BAE7-00C04FD140D2}"
608   WriteRegStr HKCR "CLSID\{DC515C27-6CAC-11D1-BAE7-00C04FD140D2}" "" "AFS Client Shell Extension"
609   WriteRegStr HKCR "CLSID\{DC515C27-6CAC-11D1-BAE7-00C04FD140D2}\InprocServer32" "" "$INSTDIR\Client\Program\afs_shl_ext.dll"
610   WriteRegStr HKCR "CLSID\{DC515C27-6CAC-11D1-BAE7-00C04FD140D2}\InprocServer32" "ThreadingModel" "Apartment"
611   WriteRegStr HKCR "FOLDER\shellex\ContextMenuHandlers\AFS Client Shell Extension" "" "{DC515C27-6CAC-11D1-BAE7-00C04FD140D2}"
612   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved" "{DC515C27-6CAC-11D1-BAE7-00C04FD140D2}" "AFS Client Shell Extension"
613   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Control Panel\Cpls" "afs_cpa" "$INSTDIR\Client\Program\afs_cpa.cpl"
614
615   ; Support for apps that wrote submount data directly to afsdsbmt.ini
616   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\IniFileMapping\afsdsbmt.ini" "AFS Mappings" "USR:Software\OpenAFS\Client\mappings"
617   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\IniFileMapping\afsdsbmt.ini" "AFS Submounts" "SYS:OpenAFS\Client\Submounts"
618   
619   ; AFS Reg entries
620   DeleteRegKey HKLM "${AFS_REGKEY_ROOT}\AFS Client\CurrentVersion"
621   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Client\CurrentVersion" "VersionString" ${AFS_VERSION}
622   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Client\CurrentVersion" "Title" "AFS Client"
623   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Client\CurrentVersion" "Description" "AFS Client"
624   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Client\CurrentVersion" "PathName" "$INSTDIR\Client"
625   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Client\CurrentVersion" "Software Type" "File System"
626   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Client\CurrentVersion" "MajorVersion" ${AFS_MAJORVERSION}
627   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Client\CurrentVersion" "MinorVersion" ${AFS_MINORVERSION}
628   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Client\CurrentVersion" "PatchLevel" ${AFS_PATCHLEVEL}
629   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Client\${AFS_VERSION}" "VersionString" ${AFS_VERSION}
630   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Client\${AFS_VERSION}" "Title" "AFS Client"
631   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Client\${AFS_VERSION}" "Description" "AFS Client"
632   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Client\${AFS_VERSION}" "Software Type" "File System"
633   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Client\${AFS_VERSION}" "PathName" "$INSTDIR\Client\Program"
634   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Client\${AFS_VERSION}" "MajorVersion" ${AFS_MAJORVERSION}
635   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Client\${AFS_VERSION}" "MinorVersion" ${AFS_MINORVERSION}
636   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Client\${AFS_VERSION}" "PatchLevel" ${AFS_PATCHLEVEL}
637 !ifdef DEBUG
638   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Client\CurrentVersion" "Debug" 1
639   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Client\${AFS_VERSION}" "Debug" 1
640 !else
641    ; Delete the DEBUG string
642    DeleteRegValue HKLM "${AFS_REGKEY_ROOT}\AFS Client\CurrentVersion" "Debug"
643    DeleteRegValue HKLM "${AFS_REGKEY_ROOT}\AFS Client\${AFS_VERSION}" "Debug"
644 !endif
645
646   ;NetIDMgr Plug-in Reg Entries
647   WriteRegStr HKLM "${NID_PLUGIN_MGR}\Modules\OpenAFS" "ImagePath" "$INSTDIR\Client\Program\afscred.dll"
648   WriteRegStr HKLM "${NID_PLUGIN_MGR}\Modules\OpenAFS" "Description" "OpenAFS Module"
649   WriteRegStr HKLM "${NID_PLUGIN_MGR}\Modules\OpenAFS" "Vendor" "Secure Endpoints Inc."
650   WriteRegStr HKLM "${NID_PLUGIN_MGR}\Modules\OpenAFS" "PluginList" "AfsCred"
651   WriteRegDWORD HKLM "${NID_PLUGIN_MGR}\Modules\OpenAFS" "NoUnload" "1"
652   
653   WriteRegStr HKLM "${NID_PLUGIN_MGR}\Plugins\AfsCred" "Module" "OpenAFS"
654   WriteRegStr HKLM "${NID_PLUGIN_MGR}\Plugins\AfsCred" "Description" "AFS Credentials Provider"
655   WriteRegStr HKLM "${NID_PLUGIN_MGR}\Plugins\AfsCred" "Dependencies" "Krb5Cred"
656   WriteRegDWORD HKLM "${NID_PLUGIN_MGR}\Plugins\AfsCred" "Type" "1"
657
658    ; On Windows 2000 work around KB301673.  This is fixed in Windows XP and 2003
659    Call GetWindowsVersion
660    Pop $R1
661    StrCmp $R1 "2000" +1 +2
662    WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Services\NetBT\Parameters" "SmbDeviceEnabled" 0
663   
664   ;Write start menu entries
665   CreateDirectory "$SMPROGRAMS\OpenAFS\Client"
666   CreateShortCut "$SMPROGRAMS\OpenAFS\Uninstall OpenAFS.lnk" "$INSTDIR\Uninstall.exe"
667   
668   ; Create command line options for AFSCreds...
669   StrCpy $R2 ""
670   ReadINIStr $R1 $2 "Field 3" "State"
671   StrCmp $R1 "1" +1 +2
672   StrCpy $R2 "-A "
673   ReadINIStr $R1 $2 "Field 5" "State"
674   StrCmp $R1 "1" +1 +2
675   StrCpy $R2 "$R2-M "
676   ReadINIStr $R1 $2 "Field 7" "State"
677   StrCmp $R1 "1" +1 +2
678   StrCpy $R2 "$R2-N "
679   ReadINIStr $R1 $2 "Field 9" "State"
680   StrCmp $R1 "1" +1 +2
681   StrCpy $R2 "$R2-Q "
682   ReadINIStr $R1 $2 "Field 13" "State"
683   StrCmp $R1 "1" +1 +2
684   StrCpy $R2 "$R2-S"
685  
686   WriteRegStr HKLM "SOFTWARE\OpenAFS\Client" "AfscredsShortcutParams" "$R2"
687   
688   CreateShortCut "$SMPROGRAMS\OpenAFS\Client\Authentication.lnk" "$INSTDIR\Client\Program\afscreds.exe" "$R2"
689   
690   ReadINIStr $R1 $2 "Field 1" "State"
691   StrCmp $R1 "1" +1 +2
692   CreateShortCut "$SMSTARTUP\AFS Credentials.lnk" "$INSTDIR\Client\Program\afscreds.exe" "$R2"
693
694   Push "$INSTDIR\Client\Program"
695   Call AddToUniquePath
696   Push "$INSTDIR\Common"
697   Call AddToUniquePath
698   
699 !ifdef INSTALL_KFW
700   ; Add kfw to path too
701   Push "$INSTDIR\kfw\bin"
702   Call AddToUniquePath
703 !endif
704    
705   ; Create the AFS service
706   SetOutPath "$INSTDIR\Common"
707   File "${AFS_WININSTALL_DIR}\Service.exe"
708   nsExec::Exec "net stop TransarcAFSDaemon"
709   nsExec::Exec "net stop AfsRdr"
710   ;IMPORTANT!  If we are not refreshing the config files, do NOT remove the service
711   ;Don't re-install because it must be present or we wouldn't have passed the Reg check
712  
713   ReadRegStr $R2 HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" "Cell"
714   StrCmp $R2 "" +1 skipremove
715   nsExec::Exec '$INSTDIR\Common\Service.exe u TransarcAFSDaemon'
716   nsExec::Exec '$INSTDIR\Common\Service.exe TransarcAFSDaemon "$INSTDIR\Client\Program\afsd_service.exe" "OpenAFS Client Service"'
717   nsExec::Exec '$INSTDIR\Common\Service.exe u AfsRdr'
718 !ifdef AFSIFS
719   nsExec::Exec '$INSTDIR\Common\Service.exe AfsRdr "System32\DRIVERS\afsrdr.sys" "AFS Redirector"'
720 !endif
721 skipremove:
722   Delete "$INSTDIR\Common\service.exe"
723
724   ; Daemon entries
725   WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon" "" ""
726   WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" "ProviderPath" "$INSTDIR\Client\Program\afslogon.dll"
727   WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" "AuthentProviderPath" "$INSTDIR\Client\Program\afslogon.dll"
728   WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" "Class" 2
729   WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" "VerboseLogging" 10
730
731   ; Must also add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\NetworkProvider\HwOrder
732   ; and HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\NetworkProvider\Order
733   ; to also include the service name.
734   Call AddProvider
735   ReadINIStr $R0 $1 "Field 7" "State"
736   WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" "LogonOptions" $R0
737   WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" "LogonScript" "$INSTDIR\Client\Program\afscreds.exe -:%s -x -a -m -n -q"
738   WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" "Name" "OpenAFSDaemon"
739
740   ;Write cell name
741   ReadINIStr $R0 $1 "Field 2" "State"
742   WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" "Cell" $R0
743   ReadINIStr $R0 $1 "Field 3" "State"
744   WriteRegDWORD HKLM "SOFTWARE\OpenAFS\Client" "ShowTrayIcon" 1
745   WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" "SecurityLevel" $R0
746   ReadINIStr $R0 $1 "Field 5" "State"  
747   WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" "FreelanceClient" $R0
748   ReadINIStr $R0 $1 "Field 9" "State"
749   WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" "UseDNS" $R0
750   WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" "NetbiosName" "AFS"
751   WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" "MountRoot" "/afs"
752   WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" "RxMaxMTU" 0
753   WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" "IsGateway" 0
754   WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" "HideDotFiles" 1
755
756   ; Find Lana By Name appears to be causing grief for many people 
757   ; I do not have time to track this down so I am simply going to disable it
758   WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" "NoFindLanaByName" 1
759
760   strcpy $REG_SUB_KEY "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon" 
761   strcpy $REG_VALUE   "DependOnGroup" 
762   strcpy $REG_DATA_1  "PNP_TDI"
763   strcpy $REG_DATA_2  ""
764   strcpy $REG_DATA_3  ""
765   strcpy $REG_DATA_4  ""
766   Call RegWriteMultiStr
767   strcpy $REG_SUB_KEY "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon" 
768   strcpy $REG_VALUE   "DependOnService" 
769   strcpy $REG_DATA_1  "Tcpip"
770   strcpy $REG_DATA_2  "NETBIOS"
771   strcpy $REG_DATA_3  "RpcSs"
772 !ifdef AFSIFS
773   strcpy $REG_DATA_4  "AfsRdr"
774 !else
775   strcpy $REG_DATA_4  ""
776 !endif
777   Call RegWriteMultiStr
778 !ifdef AFSIFS
779   strcpy $REG_SUB_KEY "SYSTEM\CurrentControlSet\Services\AfsRdr" 
780   strcpy $REG_VALUE   "DependOnService" 
781   strcpy $REG_DATA_1  "Tcpip"
782   strcpy $REG_DATA_2  ""
783   strcpy $REG_DATA_3  ""
784   strcpy $REG_DATA_4  ""
785   Call RegWriteMultiStr
786 !endif
787
788   ; WinLogon Event Notification
789   WriteRegDWORD HKLM "Software\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\AfsLogon" "Asynchronous" 0
790   WriteRegDWORD HKLM "Software\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\AfsLogon" "Impersonate"  1
791   WriteRegStr HKLM "Software\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\AfsLogon" "DLLName" "$INSTDIR\Client\Program\afslogon.dll"
792   WriteRegStr HKLM "Software\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\AfsLogon" "Logon" "AFS_Logon_Event"
793   WriteRegStr HKLM "Software\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\AfsLogon" "Logoff" "AFS_Logoff_Event"
794   WriteRegStr HKLM "Software\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\AfsLogon" "Startup" "AFS_Startup_Event"
795
796 ; No longer install KFW Logon Handler - KFW 3.1 and above supports this functionality
797 ;  WriteRegDWORD HKLM "Software\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\KFWLogon" "Asynchronous" 0
798 ;  WriteRegDWORD HKLM "Software\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\KFWLogon" "Impersonate"  0
799 ;  WriteRegStr HKLM "Software\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\KFWLogon" "DLLName" "afslogon.dll"
800 ;  WriteRegStr HKLM "Software\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\KFWLogon" "Logon" "KFW_Logon_Event"
801
802   SetRebootFlag true
803   
804   WriteUninstaller "$INSTDIR\Uninstall.exe"
805   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenAFS" "DisplayIcon" "$INSTDIR\Uninstall.exe,0"  
806   Call CreateDesktopIni
807   
808 SectionEnd
809
810
811
812 ; MS Loopback adapter
813 Section "!MS Loopback Adapter" secLoopback
814
815 Call afs.InstallMSLoopback
816
817 SectionEnd
818
819
820 ;------------------------
821 ; OpenAFS SERVER  
822 Section /o "AFS Server" secServer
823
824   SetShellVarContext all
825
826   ; Check for bad previous installation (if we are doing a new install)
827   Call IsAnyAFSInstalled
828   Pop $R0
829   StrCmp $R0 "0" +1 skipCheck
830   Call CheckPathForAFS
831 skipCheck:
832
833   ; Stop any running services or we can't replace the files
834   ; Stop the running processes
835   GetTempFileName $R0
836   File /oname=$R0 "${AFS_WININSTALL_DIR}\Killer.exe"
837   nsExec::Exec '$R0 afscreds.exe'
838   Exec "afscreds.exe -z"
839   ; in case we are upgrading an old version that does not support -z
840   Sleep 2000
841   nsExec::Exec '$R0 afscreds.exe'
842 !IFDEF INSTALL_KFW
843   ;nsExec::Exec '$R0 krbcc32s.exe'
844 !ENDIF
845
846   Delete $R0
847   
848   nsExec::Exec "net stop TransarcAFSDaemon"
849   nsExec::Exec "net stop TransarcAFSServer"
850
851   CreateDirectory "$INSTDIR\Server\usr\afs\etc"
852   CreateDirectory "$INSTDIR\Server\usr\afs\local"
853   CreateDirectory "$INSTDIR\Server\usr\afs\etc\logs"
854   
855   SetOutPath "$INSTDIR\Server\usr\afs\bin"  
856   File "${AFS_SERVER_BUILDDIR}\afskill.exe"
857   File "${AFS_SERVER_BUILDDIR}\afssvrcfg.exe"
858   File "${AFS_SERVER_BUILDDIR}\asetkey.exe"
859   File "${AFS_SERVER_BUILDDIR}\bosctlsvc.exe"
860   File "${AFS_SERVER_BUILDDIR}\bosserver.exe"
861   File "${AFS_SERVER_BUILDDIR}\buserver.exe"
862   File "${AFS_ETC_BUILDDIR}\butc.exe"
863   File "${AFS_SERVER_BUILDDIR}\fileserver.exe"
864   File "${AFS_ETC_BUILDDIR}\fms.exe"
865   File "${AFS_SERVER_BUILDDIR}\kaserver.exe"
866   File "${AFS_SERVER_BUILDDIR}\ptserver.exe"
867   File "${AFS_SERVER_BUILDDIR}\salvager.exe"
868   File "${AFS_SERVER_BUILDDIR}\upclient.exe"
869   File "${AFS_SERVER_BUILDDIR}\upserver.exe"
870   File "${AFS_SERVER_BUILDDIR}\vlserver.exe"
871   File "${AFS_SERVER_BUILDDIR}\volinfo.exe"
872   File "${AFS_SERVER_BUILDDIR}\volserver.exe"
873  
874  ;AFS Server common files
875  SetOutPath "$INSTDIR\Common"
876  File "${AFS_SERVER_BUILDDIR}\afsvosadmin.dll"
877  File "${AFS_SERVER_BUILDDIR}\afsbosadmin.dll"
878  File "${AFS_SERVER_BUILDDIR}\afscfgadmin.dll"
879  File "${AFS_SERVER_BUILDDIR}\afskasadmin.dll"
880  File "${AFS_SERVER_BUILDDIR}\afsptsadmin.dll"
881
882  SetOutPath "$INSTDIR\Common"
883    Call AFSLangFiles
884    
885    SetOutPath "$SYSDIR"
886   !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afsserver.cpl" "$SYSDIR\afsserver.cpl" "$INSTDIR"
887    
888   ;Store install folder
889   WriteRegStr HKCU "${AFS_REGKEY_ROOT}\AFS Server" "" $INSTDIR
890   
891   DeleteRegKey HKLM "${AFS_REGKEY_ROOT}\AFS Server\CurrentVersion"
892   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Server\CurrentVersion" "VersionString" ${AFS_VERSION}
893   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Server\CurrentVersion" "Title" "AFS Server"
894   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Server\CurrentVersion" "Description" "AFS Server for Windows"
895   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Server\CurrentVersion" "PathName" "$INSTDIR\Server"
896   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Server\CurrentVersion" "Software Type" "File System"
897   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Server\CurrentVersion" "MajorVersion" ${AFS_MAJORVERSION}
898   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Server\CurrentVersion" "MinorVersion" ${AFS_MINORVERSION}
899   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Server\CurrentVersion" "PatchLevel" ${AFS_PATCHLEVEL}
900   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Server\${AFS_VERSION}" "VersionString" ${AFS_VERSION}
901   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Server\${AFS_VERSION}" "Title" "AFS Server"
902   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Server\${AFS_VERSION}" "Description" "AFS Server for Windows"
903   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Server\${AFS_VERSION}" "Software Type" "File System"
904   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Server\${AFS_VERSION}" "PathName" "$INSTDIR\Server"
905   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Server\${AFS_VERSION}" "MajorVersion" ${AFS_MAJORVERSION}
906   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Server\${AFS_VERSION}" "MinorVersion" ${AFS_MINORVERSION}
907   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Server\${AFS_VERSION}" "PatchLevel" ${AFS_PATCHLEVEL}
908 !ifdef DEBUG
909   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Server\CurrentVersion" "Debug" 1
910   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Server\${AFS_VERSION}" "Debug" 1
911 !else
912    ; Delete the DEBUG string
913    DeleteRegValue HKLM "${AFS_REGKEY_ROOT}\AFS Server\CurrentVersion" "Debug"
914    DeleteRegValue HKLM "${AFS_REGKEY_ROOT}\AFS Server\${AFS_VERSION}" "Debug"
915 !endif
916   ; Install the service
917   SetOutPath "$INSTDIR\Common"
918   File "${AFS_WININSTALL_DIR}\Service.exe"
919 !ifdef DEBUG
920   File "${AFS_WININSTALL_DIR}\Service.pdb"
921 !endif
922
923   ; Check if the service exists--if it does, this is an upgrade/re-install
924   ReadRegStr $R0 HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSServer" "ImagePath"
925   StrCmp $R0 "$INSTDIR\Server\usr\afs\bin\bosctlsvc.exe" SkipStartup
926   
927   ; If an uninstall was done, but we kept the config files, also skip
928   IfFileExists "$INSTDIR\Server\usr\afs\etc\ThisCell" SkipStartup
929
930   ; Make the server config wizard auto-start on bootup if this is an install (not an upgrade)
931   ; WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce" "AFS Server Wizard" '"$INSTDIR\Server\usr\afs\bin\afssvrcfg.exe" /wizard"'
932   
933   
934 SkipStartup:
935   ;Don't want to whack existing settings... Make users un-install and then re-install if they want that
936   ;nsExec::Exec '$INSTDIR\Common\service.exe u TransarcAFSServer'
937   nsExec::Exec '$INSTDIR\Common\service.exe TransarcAFSServer "$INSTDIR\Server\usr\afs\bin\bosctlsvc.exe" "OpenAFS AFS Server"'
938   Delete "$INSTDIR\Common\service.exe"
939
940   strcpy $REG_SUB_KEY "SYSTEM\CurrentControlSet\Services\TransarcAFSServer" 
941   strcpy $REG_VALUE   "DependOnGroup" 
942   strcpy $REG_DATA_1  "PNP_TDI"
943   strcpy $REG_DATA_2  ""
944   strcpy $REG_DATA_3  ""
945   strcpy $REG_DATA_4  ""
946   Call RegWriteMultiStr
947   strcpy $REG_SUB_KEY "SYSTEM\CurrentControlSet\Services\TransarcAFSServer" 
948   strcpy $REG_VALUE   "DependOnService" 
949   strcpy $REG_DATA_1  "Tcpip"
950   strcpy $REG_DATA_2  ""
951   strcpy $REG_DATA_3  ""
952   strcpy $REG_DATA_4  ""
953   Call RegWriteMultiStr
954   
955   ;CreateDirectory "$SMPROGRAMS\OpenAFS\Server"
956   ;CreateShortCut "$SMPROGRAMS\OpenAFS\Server\Server Configuration.lnk" "$INSTDIR\Server\usr\afs\bin\afssvrcfg.exe"
957   
958   WriteUninstaller "$INSTDIR\Uninstall.exe"
959   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenAFS" "DisplayIcon" "$INSTDIR\Uninstall.exe,0"  
960
961 SectionEnd
962
963
964 ;----------------------------
965 ; OpenAFS Control Center
966 Section /o "AFS Control Center" secControl
967
968   SetShellVarContext all
969
970    SetOutPath "$INSTDIR\Control Center"
971   File "${AFS_SERVER_BUILDDIR}\TaAfsAccountManager.exe"
972   File "${AFS_SERVER_BUILDDIR}\TaAfsAdmSvr.exe"
973   File "${AFS_SERVER_BUILDDIR}\TaAfsServerManager.exe"
974    
975
976  ;AFS Server common files
977  Call AFSCommon.Install
978  Call AFSLangFiles
979  SetOutPath "$INSTDIR\Common"
980
981    ;Store install folder
982   WriteRegStr HKCU "${AFS_REGKEY_ROOT}\AFS Control Center\CurrentVersion" "PathName" $INSTDIR
983   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Control Center\CurrentVersion" "VersionString" ${AFS_VERSION}
984   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Control Center\CurrentVersion" "MajorVersion" ${AFS_MAJORVERSION}
985   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Control Center\CurrentVersion" "MinorVersion" ${AFS_MINORVERSION}
986   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Control Center\CurrentVersion" "PatchLevel" ${AFS_PATCHLEVEL}
987   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Control Center\${AFS_VERSION}" "VersionString" ${AFS_VERSION}
988   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Control Center\${AFS_VERSION}" "MajorVersion" ${AFS_MAJORVERSION}
989   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Control Center\${AFS_VERSION}" "MinorVersion" ${AFS_MINORVERSION}
990   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Control Center\${AFS_VERSION}" "PatchLevel" ${AFS_PATCHLEVEL}
991 !ifdef DEBUG
992   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Control Center\CurrentVersion" "Debug" 1
993   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Control Center\${AFS_VERSION}" "Debug" 1
994 !else
995    ; Delete the DEBUG string
996    DeleteRegValue HKLM "${AFS_REGKEY_ROOT}\AFS Control Center\CurrentVersion" "Debug"
997    DeleteRegValue HKLM "${AFS_REGKEY_ROOT}\AFS Control Center\${AFS_VERSION}" "Debug"
998 !endif
999
1000   ;Write start menu entries
1001   CreateDirectory "$SMPROGRAMS\OpenAFS\Control Center"
1002   CreateShortCut "$SMPROGRAMS\OpenAFS\Control Center\Account Manager.lnk" "$INSTDIR\Control Center\TaAfsAccountManager.exe"
1003   CreateShortCut "$SMPROGRAMS\OpenAFS\Control Center\Server Manager.lnk" "$INSTDIR\Control Center\TaAfsServerManager.exe"
1004   
1005   WriteUninstaller "$INSTDIR\Uninstall.exe"
1006   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenAFS" "DisplayIcon" "$INSTDIR\Uninstall.exe,0"  
1007
1008 SectionEnd   
1009
1010
1011 ;----------------------------
1012 ; OpenAFS Supplemental Documentation
1013 Section /o "Supplemental Documentation" secDocs
1014   SetShellVarContext all
1015
1016    StrCmp $LANGUAGE ${LANG_ENGLISH} DoEnglish
1017    StrCmp $LANGUAGE ${LANG_GERMAN} DoGerman
1018    StrCmp $LANGUAGE ${LANG_SPANISH} DoSpanish
1019    StrCmp $LANGUAGE ${LANG_JAPANESE} DoJapanese
1020    StrCmp $LANGUAGE ${LANG_KOREAN} DoKorean
1021    StrCmp $LANGUAGE ${LANG_PORTUGUESEBR} DoPortugueseBR
1022    StrCmp $LANGUAGE ${LANG_SIMPCHINESE} DoSimpChinese
1023    StrCmp $LANGUAGE ${LANG_TRADCHINESE} DoTradChinese
1024    
1025    
1026 DoEnglish:
1027    SetOutPath "$INSTDIR\Documentation\html\CmdRef"
1028    File "..\..\..\..\doc\man-pages\html\*"
1029    SetOutPath "$INSTDIR\Documentation\html\CmdRef\1"
1030    File "..\..\..\..\doc\man-pages\html\1\*"
1031    SetOutPath "$INSTDIR\Documentation\html\CmdRef\5"
1032    File "..\..\..\..\doc\man-pages\html\5\*"
1033    SetOutPath "$INSTDIR\Documentation\html\CmdRef\8"
1034    File "..\..\..\..\doc\man-pages\html\8\*"
1035    SetOutPath "$INSTDIR\Documentation\"
1036    File /oname=AdminGuide.chm "..\..\..\..\doc\xml\AdminGuide\htmlhelp.chm"
1037    File /oname=UserGuide.chm "..\..\..\..\doc\xml\AdminGuide\htmlhelp.chm"
1038    goto DoneLanguage
1039    
1040 DoGerman:
1041    SetOutPath "$INSTDIR\Documentation\html"
1042    File "..\..\doc\install\Documentation\de_DE\html\*"
1043    SetOutPath "$INSTDIR\Documentation\html\CmdRef"
1044    ;File "..\..\doc\install\Documentation\de_DE\html\CmdRef\*"
1045    ;SetOutPath "$INSTDIR\Documentation\html\SysAdminGd"
1046    ;File "..\..\doc\install\Documentation\de_DE\html\SysAdminGd\*"
1047    goto DoneLanguage
1048    
1049 DoSpanish:
1050    SetOutPath "$INSTDIR\Documentation\html"
1051    File "..\..\doc\install\Documentation\es_ES\html\*"
1052    SetOutPath "$INSTDIR\Documentation\html\CmdRef"
1053    ;File "..\..\doc\install\Documentation\es_ES\html\CmdRef\*"
1054    SetOutPath "$INSTDIR\Documentation\html\SysAdminGd"
1055    ;File "..\..\doc\install\Documentation\es_ES\html\SysAdminGd\*"
1056    goto DoneLanguage
1057
1058 DoJapanese:
1059    SetOutPath "$INSTDIR\Documentation\html"
1060    File "..\..\doc\install\Documentation\ja_JP\html\*"
1061    SetOutPath "$INSTDIR\Documentation\html\CmdRef"
1062    File "..\..\doc\install\Documentation\ja_JP\html\CmdRef\*"
1063    SetOutPath "$INSTDIR\Documentation\html\SysAdminGd"
1064    ;File "..\..\doc\install\Documentation\ja_JP\html\SysAdminGd\*"
1065    goto DoneLanguage
1066    
1067 DoKorean:
1068    SetOutPath "$INSTDIR\Documentation\html"
1069    File "..\..\doc\install\Documentation\ko_KR\html\*"
1070    ;SetOutPath "$INSTDIR\Documentation\html\CmdRef"
1071    ;File "..\..\doc\install\Documentation\ko_KR\html\CmdRef\*"
1072    SetOutPath "$INSTDIR\Documentation\html\SysAdminGd"
1073    File "..\..\doc\install\Documentation\ko_KR\html\SysAdminGd\*"
1074    goto DoneLanguage
1075    
1076 DoPortugueseBR:
1077    SetOutPath "$INSTDIR\Documentation\html"
1078    File "..\..\doc\install\Documentation\pt_BR\html\*"
1079    ;SetOutPath "$INSTDIR\Documentation\html\CmdRef"
1080    ;File "..\..\doc\install\Documentation\pt_BR\html\CmdRef\*"
1081    ;SetOutPath "$INSTDIR\Documentation\html\SysAdminGd"
1082    ;File "..\..\doc\install\Documentation\pt_BR\html\SysAdminGd\*"
1083    goto DoneLanguage
1084
1085 DoSimpChinese:
1086    SetOutPath "$INSTDIR\Documentation\html"
1087    File "..\..\doc\install\Documentation\zh_CN\html\*"
1088    ;SetOutPath "$INSTDIR\Documentation\html\CmdRef"
1089    ;File "..\..\doc\install\Documentation\zh_CN\html\CmdRef\*"
1090    ;SetOutPath "$INSTDIR\Documentation\html\SysAdminGd"
1091    ;File "..\..\doc\install\Documentation\zh_CN\html\SysAdminGd\*"
1092    goto DoneLanguage
1093    
1094 DoTradChinese:
1095    SetOutPath "$INSTDIR\Documentation\html"
1096    File "..\..\doc\install\Documentation\zh_TW\html\*"
1097    ;SetOutPath "$INSTDIR\Documentation\html\CmdRef"
1098    ;File "..\..\doc\install\Documentation\zh_TW\html\CmdRef\*"
1099    ;SetOutPath "$INSTDIR\Documentation\html\SysAdminGd"
1100    ;File "..\..\doc\install\Documentation\zh_TW\html\SysAdminGd\*"
1101    goto DoneLanguage
1102    
1103    
1104 DoneLanguage:
1105    ;Store install folder
1106   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Supplemental Documentation" "" $INSTDIR
1107   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Supplemental Documentation\CurrentVersion" "VersionString" ${AFS_VERSION}
1108   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Supplemental Documentation\CurrentVersion" "MajorVersion" ${AFS_MAJORVERSION}
1109   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Supplemental Documentation\CurrentVersion" "MinorVersion" ${AFS_MINORVERSION}
1110   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Supplemental Documentation\CurrentVersion" "PatchLevel" ${AFS_PATCHLEVEL}
1111   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Supplemental Documentation\${AFS_VERSION}" "VersionString" ${AFS_VERSION}
1112   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Supplemental Documentation\${AFS_VERSION}" "MajorVersion" ${AFS_MAJORVERSION}
1113   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Supplemental Documentation\${AFS_VERSION}" "MinorVersion" ${AFS_MINORVERSION}
1114   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Supplemental Documentation\${AFS_VERSION}" "PatchLevel" ${AFS_PATCHLEVEL}
1115
1116   WriteUninstaller "$INSTDIR\Uninstall.exe"
1117   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenAFS" "DisplayIcon" "$INSTDIR\Uninstall.exe,0"  
1118   CreateShortCut "$SMPROGRAMS\OpenAFS\Uninstall OpenAFS.lnk" "$INSTDIR\Uninstall.exe"
1119   Call AFSCommon.Install
1120 SectionEnd  
1121   
1122
1123 Section /o "Software Development Kit (SDK)" secSDK
1124
1125    SetOutPath "$INSTDIR\SDK\lib"
1126    File /r "${AFS_CLIENT_LIBDIR}\*.*"
1127
1128    SetOutPath "$INSTDIR\SDK\Include"
1129    File /r "${AFS_BUILD_INCDIR}\*.*"    
1130
1131    ; Client Sample
1132    SetOutPath "$INSTDIR\SDK\Sample"
1133    File "..\..\afsd\sample\token.c"
1134
1135    ;Store install folder
1136   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS SDK" "" $INSTDIR
1137   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS SDK\CurrentVersion" "VersionString" ${AFS_VERSION}
1138   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS SDK\CurrentVersion" "MajorVersion" ${AFS_MAJORVERSION}
1139   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS SDK\CurrentVersion" "MinorVersion" ${AFS_MINORVERSION}
1140   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS SDK\CurrentVersion" "PatchLevel" ${AFS_PATCHLEVEL}
1141   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS SDK\${AFS_VERSION}" "VersionString" ${AFS_VERSION}
1142   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS SDK\${AFS_VERSION}" "MajorVersion" ${AFS_MAJORVERSION}
1143   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS SDK\${AFS_VERSION}" "MinorVersion" ${AFS_MINORVERSION}
1144   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS SDK\${AFS_VERSION}" "PatchLevel" ${AFS_PATCHLEVEL}
1145
1146   WriteUninstaller "$INSTDIR\Uninstall.exe"
1147   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenAFS" "DisplayIcon" "$INSTDIR\Uninstall.exe,0"  
1148
1149   SetOutPath "$SMPROGRAMS\OpenAFS"
1150   CreateShortCut "$SMPROGRAMS\OpenAFS\Uninstall OpenAFS.lnk" "$INSTDIR\Uninstall.exe"
1151
1152   Call AFSCommon.Install
1153 SectionEnd
1154
1155
1156 Section /o "Debug symbols" secDebug
1157    SectionGetFlags ${secClient} $R0
1158    IntOp $R0 $R0 & ${SF_SELECTED}
1159    IntCmp $R0 ${SF_SELECTED} +1 DoServer
1160   
1161   ; Do client components
1162   SetOutPath "$INSTDIR\Client\Program"
1163   File "${AFS_CLIENT_BUILDDIR}\afsshare.pdb"
1164   File "${AFS_CLIENT_BUILDDIR}\libosi.pdb"
1165   ; remove old location if present
1166   Delete "$INSTDIR\Client\Program\libafsconf.pdb"
1167   File "${AFS_CLIENT_BUILDDIR}\klog.pdb"
1168   File "${AFS_CLIENT_BUILDDIR}\tokens.pdb"
1169   File "${AFS_CLIENT_BUILDDIR}\unlog.pdb"
1170   File "${AFS_CLIENT_BUILDDIR}\fs.pdb"
1171   File "${AFS_CLIENT_BUILDDIR}\afsdacl.pdb"
1172   File "${AFS_CLIENT_BUILDDIR}\cmdebug.pdb"
1173   File "${AFS_CLIENT_BUILDDIR}\aklog.pdb"
1174   File "${AFS_CLIENT_BUILDDIR}\afscreds.pdb"
1175   File "${AFS_CLIENT_BUILDDIR}\afs_shl_ext.pdb"
1176   File "${AFS_CLIENT_BUILDDIR}\afsd_service.pdb"
1177   File "${AFS_CLIENT_BUILDDIR}\symlink.pdb"
1178   File "${AFS_DESTDIR}\bin\kpasswd.pdb"
1179   File "${AFS_DESTDIR}\bin\pts.pdb"
1180   File "${AFS_SERVER_BUILDDIR}\bos.pdb"
1181   File "${AFS_SERVER_BUILDDIR}\kas.pdb"
1182   File "${AFS_SERVER_BUILDDIR}\vos.pdb"
1183   File "${AFS_SERVER_BUILDDIR}\udebug.pdb"
1184   File "${AFS_DESTDIR}\bin\translate_et.pdb"
1185   File "${AFS_DESTDIR}\etc\rxdebug.pdb"
1186   File "${AFS_DESTDIR}\etc\backup.pdb"
1187   File "${AFS_CLIENT_BUILDDIR}\afs_cpa.pdb"
1188   File "${AFS_CLIENT_BUILDDIR}\afscred.pdb"
1189   File "${AFS_CLIENT_BUILDDIR}\afslogon.pdb"
1190   File "${AFS_CLIENT_BUILDDIR}\afscpcc.pdb"
1191
1192   SetOutPath "$SYSDIR"
1193   
1194 DoServer:
1195    SectionGetFlags ${secServer} $R0
1196    IntOp $R0 $R0 & ${SF_SELECTED}
1197    IntCmp $R0 ${SF_SELECTED} +1 DoControl
1198
1199   ; Do server components
1200   SetOutPath "$INSTDIR\Server\usr\afs\bin"  
1201   File "${AFS_SERVER_BUILDDIR}\afskill.pdb"
1202   File "${AFS_SERVER_BUILDDIR}\afssvrcfg.pdb"
1203   File "${AFS_SERVER_BUILDDIR}\asetkey.pdb"
1204   File "${AFS_SERVER_BUILDDIR}\bosctlsvc.pdb"
1205   File "${AFS_SERVER_BUILDDIR}\bosserver.pdb"
1206   File "${AFS_SERVER_BUILDDIR}\buserver.pdb"
1207   File "${AFS_ETC_BUILDDIR}\butc.pdb"
1208   File "${AFS_SERVER_BUILDDIR}\fileserver.pdb"
1209   File "${AFS_ETC_BUILDDIR}\fms.pdb"
1210   File "${AFS_SERVER_BUILDDIR}\kaserver.pdb"
1211   File "${AFS_SERVER_BUILDDIR}\ptserver.pdb"
1212   File "${AFS_SERVER_BUILDDIR}\salvager.pdb"
1213   File "${AFS_SERVER_BUILDDIR}\upclient.pdb"
1214   File "${AFS_SERVER_BUILDDIR}\upserver.pdb"
1215   File "${AFS_SERVER_BUILDDIR}\vlserver.pdb"
1216   File "${AFS_SERVER_BUILDDIR}\volinfo.pdb"
1217   File "${AFS_SERVER_BUILDDIR}\volserver.pdb"
1218
1219   ; Do server common components
1220  File "${AFS_SERVER_BUILDDIR}\afsvosadmin.pdb"
1221  File "${AFS_SERVER_BUILDDIR}\afsbosadmin.pdb"
1222  File "${AFS_SERVER_BUILDDIR}\afscfgadmin.pdb"
1223  File "${AFS_SERVER_BUILDDIR}\afskasadmin.pdb"
1224  File "${AFS_SERVER_BUILDDIR}\afsptsadmin.pdb"
1225  
1226    SetOutPath "$SYSDIR"
1227    File "${AFS_SERVER_BUILDDIR}\afsserver.pdb"
1228
1229    ; Do control center components
1230 DoControl:
1231    SectionGetFlags ${secControl} $R0
1232    IntOp $R0 $R0 & ${SF_SELECTED}
1233    IntCmp $R0 ${SF_SELECTED} +1 DoCommon
1234
1235    SetOutPath "$INSTDIR\Control Center"   
1236   File "${AFS_SERVER_BUILDDIR}\TaAfsAccountManager.pdb"
1237   File "${AFS_SERVER_BUILDDIR}\TaAfsAdmSvr.pdb"
1238   File "${AFS_SERVER_BUILDDIR}\TaAfsServerManager.pdb"
1239
1240 DoCommon:
1241   SetOutPath "$INSTDIR\Common"
1242 !IFDEF CL_1500
1243   ; Do nothing
1244 !ELSE
1245 !IFDEF CL_1400
1246   ; Do nothing
1247 !ELSE
1248 !IFDEF CL_1310
1249    File "${SYSTEMDIR}\msvcr71d.pdb"
1250    File "${SYSTEMDIR}\msvcp71d.pdb"
1251    File "${SYSTEMDIR}\mfc71d.pdb"
1252 !ELSE
1253 !IFDEF CL_1300
1254    File "${SYSTEMDIR}\msvcr70d.pdb"
1255    File "${SYSTEMDIR}\msvcp70d.pdb"
1256    File "${SYSTEMDIR}\mfc70d.pdb"
1257 !ELSE
1258    File "${SYSTEMDIR}\mfc42d.pdb"
1259    File "${SYSTEMDIR}\msvcp60d.pdb"
1260    File "${SYSTEMDIR}\msvcrtd.pdb"
1261 !ENDIF
1262 !ENDIF
1263 !ENDIF
1264 !ENDIF
1265   
1266 ; Common Areas
1267    SetOutPath "$INSTDIR\Common"
1268    File "${AFS_CLIENT_BUILDDIR}\afs_config.pdb"
1269    File "${AFS_SERVER_BUILDDIR}\afsadminutil.pdb"
1270    File "${AFS_DESTDIR}\lib\afsauthent.pdb"
1271    File "${AFS_DESTDIR}\lib\afspthread.pdb"
1272    File "${AFS_DESTDIR}\lib\afsrpc.pdb"
1273    File "${AFS_DESTDIR}\lib\libafsconf.pdb"
1274    File "${AFS_SERVER_BUILDDIR}\afsclientadmin.pdb"
1275    File "${AFS_SERVER_BUILDDIR}\afsprocmgmt.pdb"
1276    File "${AFS_SERVER_BUILDDIR}\afsvosadmin.pdb"
1277    File "${AFS_SERVER_BUILDDIR}\TaAfsAppLib.pdb"
1278    File "${AFS_SERVER_BUILDDIR}\afsvosadmin.pdb"
1279    File "${AFS_SERVER_BUILDDIR}\afsbosadmin.pdb"
1280    File "${AFS_SERVER_BUILDDIR}\afscfgadmin.pdb"
1281    File "${AFS_SERVER_BUILDDIR}\afskasadmin.pdb"
1282    File "${AFS_SERVER_BUILDDIR}\afsptsadmin.pdb"
1283
1284 SectionEnd
1285
1286
1287 ;Display the Finish header
1288 ;Insert this macro after the sections if you are not using a finish page
1289 ;!insertmacro MUI_SECTIONS_FINISHHEADER
1290
1291 ;--------------------------------
1292 ;Installer Functions
1293
1294 Function .onInit
1295
1296   !insertmacro MUI_LANGDLL_DISPLAY
1297   
1298   ; Set the default install options
1299         Push $0
1300
1301    Call IsUserAdmin
1302    Pop $R0
1303    StrCmp $R0 "true" contInstall
1304
1305    MessageBox MB_OK|MB_ICONSTOP|MB_TOPMOST "You must be an administrator of this machine to install this software."
1306    Abort
1307    
1308 contInstall:
1309
1310    ; Set Install Type text
1311    InstTypeSetText 0 "AFS Client"
1312    InstTypeSetText 1 "AFS Administrator"
1313    InstTypeSetText 2 "AFS Server"
1314    InstTypeSetText 3 "AFS Developer Tools"
1315
1316    ; Set sections in each install type
1317    SectionSetInstTypes 0 15             ; AFS Client
1318    SectionSetInstTypes 1 15             ; Loopback adapter
1319    SectionSetInstTypes 2 4              ; AFS Server
1320    SectionSetInstTypes 3 6              ; AFS Control Center
1321    SectionSetInstTypes 4 14             ; Documentation
1322    SectionSetInstTypes 5 8              ; SDK
1323 !ifndef DEBUG
1324    SectionSetInstTypes 6 8              ; Debug symbols
1325 !else
1326    SectionSetInstTypes 6 15             ; Debug symbols
1327 !endif
1328
1329    ; Check that RPC functions are installed (I believe any one of these can be present for
1330    ; OpenAFS to work)
1331    ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\RPC\ClientProtocols" "ncacn_np"
1332    StrCmp $R0 "rpcrt4.dll" contInstall2
1333    ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\RPC\ClientProtocols" "ncacn_ip_tcp"
1334    StrCmp $R0 "rpcrt4.dll" contInstall2
1335    ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\RPC\ClientProtocols" "ncadg_ip_udp"
1336    StrCmp $R0 "rpcrt4.dll" contInstall2
1337    ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\RPC\ClientProtocols" "ncacn_http"
1338    StrCmp $R0 "rpcrt4.dll" contInstall2
1339    
1340    MessageBox MB_OK|MB_ICONSTOP|MB_TOPMOST "An error was detected with your Windows RPC installation. Please make sure Windows RPC is installed before installing OpenAFS."
1341    Abort
1342
1343
1344 contInstall2:
1345    ; If the Loopback is already installed, we mark the option OFF and Read Only
1346    ; so the user can not select it.
1347    Call afs.isLoopbackInstalled
1348    IntCmp $R1 0 SkipLoop
1349    SectionGetFlags ${secLoopback} $0
1350    IntOp $0 $0 & ${SECTION_OFF}
1351    IntOp $0 $0 | ${SF_RO}
1352    SectionSetFlags ${secLoopback} $0
1353    ; And disable the loopback in the types
1354    SectionSetInstTypes 1 0              ; Loopback adapter
1355    
1356 SkipLoop:
1357    ; Never install debug symbols unless explicitly selected, except in DEBUG mode
1358         !IFNDEF DEBUG
1359    SectionGetFlags ${secDebug} $0
1360         IntOp $0 $0 & ${SECTION_OFF}
1361         SectionSetFlags ${secDebug} $0
1362    !ELSE
1363    SectionGetFlags ${secDebug} $0
1364         IntOp $0 $0 | ${SF_SELECTED}
1365         SectionSetFlags ${secDebug} $0
1366    !ENDIF
1367    ; Our logic should be like this.
1368    ;     1) If no AFS components are installed, we do a clean install with default options. (Client/Docs)
1369    ;     2) If existing modules are installed, we keep them selected
1370    ;     3) If it is an upgrade, we set the text accordingly, else we mark it as a re-install
1371    ;  TODO: Downgrade?
1372    Call IsAnyAFSInstalled
1373    Pop $R0
1374    StrCmp $R0 "0" DefaultOptions
1375    
1376    Call ShouldClientInstall
1377    Pop $R2
1378    
1379    ; Check if it was an IBM/Transarc version
1380    ReadRegStr $R0 HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon" "DisplayName"
1381    StrCmp $R0 "IBM AFS Client" DoIBM
1382    StrCmp $R0 "Transarc AFS Client" DoIBM
1383 NotIBM:
1384    StrCpy $R9 ""
1385    StrCmp $R2 "0" NoClient
1386    StrCmp $R2 "1" ReinstallClient
1387    StrCmp $R2 "2" UpgradeClient
1388    StrCmp $R2 "3" DowngradeClient
1389    goto Continue
1390 DoIBM:
1391    ReadRegDWORD $R0 HKLM "Software\TransarcCorporation\AFS Client\CurrentVersion" "MajorVersion"
1392    StrCmp $R0 "3" +1 NotIBM
1393    StrCpy $R9 "IBM"
1394    goto UpgradeClient
1395
1396 Continue:
1397         SectionGetFlags ${secClient} $0
1398         IntOp $0 $0 | ${SF_SELECTED}
1399         SectionSetFlags ${secClient} $0
1400     ;# !insertmacro SelectSection ${secClient}
1401    goto skipClient
1402 NoClient:
1403         ;StrCpy $1 ${secClient} ; Gotta remember which section we are at now...
1404         SectionGetFlags ${secClient} $0
1405         IntOp $0 $0 & ${SECTION_OFF}
1406         SectionSetFlags ${secClient} $0
1407    goto skipClient
1408 UpgradeClient:
1409         SectionGetFlags ${secClient} $0
1410         IntOp $0 $0 | ${SF_SELECTED}
1411         SectionSetFlags ${secClient} $0
1412    SectionSetText ${secClient} $(UPGRADE_CLIENT)
1413    goto skipClient
1414 ReinstallClient:
1415         SectionGetFlags ${secClient} $0
1416         IntOp $0 $0 | ${SF_SELECTED}
1417         SectionSetFlags ${secClient} $0
1418    SectionSetText ${secClient} $(REINSTALL_CLIENT)
1419    goto skipClient
1420 DowngradeClient:
1421         SectionGetFlags ${secClient} $0
1422         IntOp $0 $0 | ${SF_SELECTED}
1423         SectionSetFlags ${secClient} $0
1424    SectionSetText ${secClient} $(REINSTALL_CLIENT)
1425    goto skipClient
1426
1427    
1428 skipClient:   
1429    
1430    Call ShouldServerInstall
1431    Pop $R2
1432    StrCmp $R2 "0" NoServer
1433    StrCmp $R2 "1" ReinstallServer
1434    StrCmp $R2 "2" UpgradeServer
1435    StrCmp $R2 "3" DowngradeServer
1436    
1437    SectionGetFlags ${secServer} $0
1438    IntOp $0 $0 | ${SF_SELECTED}
1439    SectionSetFlags ${secServer} $0
1440    ;# !insertmacro UnselectSection ${secServer}
1441    goto skipServer
1442
1443 UpgradeServer:
1444    SectionGetFlags ${secServer} $0
1445    IntOp $0 $0 | ${SF_SELECTED}
1446    SectionSetFlags ${secServer} $0
1447    SectionSetText ${secServer} $(UPGRADE_SERVER)
1448    goto skipServer
1449
1450 ReinstallServer:
1451    SectionGetFlags ${secServer} $0
1452    IntOp $0 $0 | ${SF_SELECTED}
1453    SectionSetFlags ${secServer} $0
1454    SectionSetText ${secServer} $(REINSTALL_SERVER)
1455    goto skipServer
1456
1457 DowngradeServer:
1458    SectionGetFlags ${secServer} $0
1459    IntOp $0 $0 | ${SF_SELECTED}
1460    SectionSetFlags ${secServer} $0
1461    SectionSetText ${secServer} $(REINSTALL_SERVER)
1462    goto skipServer
1463    
1464 NoServer:
1465    SectionGetFlags ${secServer} $0
1466    IntOp $0 $0 & ${SECTION_OFF}
1467    SectionSetFlags ${secServer} $0
1468    ;# !insertmacro UnselectSection ${secServer}
1469    goto skipServer
1470    
1471 skipServer:
1472    ; Check control center
1473    Call IsControlInstalled
1474    Pop $R2
1475    StrCmp $R2 "0" NoControl
1476
1477    SectionGetFlags ${secControl} $0
1478    IntOp $0 $0 | ${SF_SELECTED}
1479    SectionSetFlags ${secControl} $0
1480    goto CheckDocs
1481    
1482 NoControl:   
1483    SectionGetFlags ${secControl} $0
1484    IntOp $0 $0 & ${SECTION_OFF}
1485    SectionSetFlags ${secControl} $0
1486    ;# !insertmacro UnselectSection ${secControl}
1487
1488 CheckDocs:
1489    ; Check Documentation
1490    Call IsDocumentationInstalled
1491    Pop $R2
1492    StrCmp $R2 "0" NoDocs
1493    SectionGetFlags ${secDocs} $0
1494    IntOp $0 $0 | ${SF_SELECTED}
1495    SectionSetFlags ${secDocs} $0
1496    goto CheckSDK
1497    
1498 NoDocs:
1499    SectionGetFlags ${secDocs} $0
1500    IntOp $0 $0 & ${SECTION_OFF}
1501    SectionSetFlags ${secDocs} $0
1502    goto CheckSDK
1503    
1504 ; To check the SDK, we simply look to see if the files exist.  If they do,
1505 ; the SDK is installed.  If not, we don't need to push it on the user.
1506 ; If they are there, we want to make sure they match the installed version.
1507 CheckSDK:
1508    IfFileExists "$INSTDIR\SDK\Include\main.h" +1 NoSDK
1509    SectionGetFlags ${secSDK} $0
1510    IntOp $0 $0 | ${SF_SELECTED}
1511    SectionSetFlags ${secSDK} $0
1512    goto end
1513    
1514 NoSDK:
1515    SectionGetFlags ${secSDK} $0
1516    IntOp $0 $0 & ${SECTION_OFF}
1517    SectionSetFlags ${secSDK} $0
1518    goto end
1519    
1520 DefaultOptions:
1521    ; Client Selected
1522    SectionGetFlags ${secClient} $0
1523    IntOp $0 $0 | ${SF_SELECTED}
1524    SectionSetFlags ${secClient} $0
1525
1526    ; Server NOT selected
1527    SectionGetFlags ${secServer} $0
1528    IntOp $0 $0 & ${SECTION_OFF}
1529    SectionSetFlags ${secServer} $0
1530    
1531    ; Control Center NOT selected
1532    SectionGetFlags ${secControl} $0
1533    IntOp $0 $0 & ${SECTION_OFF}
1534    SectionSetFlags ${secControl} $0
1535    ;# !insertmacro UnselectSection ${secControl}
1536
1537    ; Documentation NOT selected
1538    SectionGetFlags ${secDocs} $0
1539    IntOp $0 $0 & ${SECTION_OFF}
1540    SectionSetFlags ${secDocs} $0
1541    ;# !insertmacro UnselectSection ${secDocs}
1542    
1543    ; SDK not selected
1544    SectionGetFlags ${secSDK} $0
1545    IntOp $0 $0 & ${SECTION_OFF}
1546    SectionSetFlags ${secSDK} $0
1547    ;# !insertmacro UnselectSection ${secSDK}
1548    
1549    goto end
1550
1551 end:
1552    Pop $0
1553   
1554    Push $R0
1555   
1556   ; See if we can set a default installation path...
1557   ReadRegStr $R0 HKLM "${AFS_REGKEY_ROOT}\AFS Client\CurrentVersion" "PathName"
1558   StrCmp $R0 "" TryServer
1559   Push $R0
1560   Call GetParent
1561   
1562   ; Work around bug in 1.3.5000, 1.3.5100, 1.3.5200, 1.3.5201, 1.3.5299 installers...
1563   ReadRegStr $R0 HKLM "${AFS_REGKEY_ROOT}\AFS Client\CurrentVersion" "MajorVersion"
1564   StrCmp $R0 "1" +1 SkipParent
1565   ReadRegStr $R0 HKLM "${AFS_REGKEY_ROOT}\AFS Client\CurrentVersion" "MinorVersion"
1566   StrCmp $R0 "3" +1 SkipParent
1567   ReadRegStr $R0 HKLM "${AFS_REGKEY_ROOT}\AFS Client\CurrentVersion" "PatchLevel"
1568   StrCmp $R0 "5000" UpParent
1569   StrCmp $R0 "5100" UpParent
1570   StrCmp $R0 "5200" UpParent
1571   StrCmp $R0 "5201" UpParent
1572   StrCmp $R0 "5299" UpParent
1573   goto SkipParent
1574   
1575 UpParent:
1576    Call GetParent
1577   
1578 SkipParent:
1579   Pop $R0
1580   StrCpy $INSTDIR $R0
1581   goto Nope
1582   
1583 TryServer:
1584   ReadRegStr $R0 HKLM "${AFS_REGKEY_ROOT}\AFS Server\CurrentVersion" "PathName"
1585   StrCmp $R0 "" TryControl
1586   Push $R0
1587   Call GetParent
1588   Pop $R0
1589   StrCpy $INSTDIR $R0
1590   goto Nope
1591    
1592 TryControl:
1593   ReadRegStr $R0 HKLM "${AFS_REGKEY_ROOT}\AFS Control Center\CurrentVersion" "PathName"
1594   StrCmp $R0 "" Nope
1595   StrCpy $INSTDIR $R0
1596   
1597 Nope:
1598   Pop $R0
1599   
1600   GetTempFilename $0
1601   File /oname=$0 CellServPage.ini
1602   GetTempFilename $1
1603   File /oname=$1 AFSCell.ini
1604   GetTempFilename $2
1605   File /oname=$2 AFSCreds.ini
1606   ;File /oname=$1 ConfigURL.ini
1607   
1608 FunctionEnd
1609
1610
1611 ;--------------------------------
1612 ; These are our cleanup functions
1613 Function .onInstFailed
1614 Delete $0
1615 Delete $1
1616 FunctionEnd
1617
1618 Function .onInstSuccess
1619 Delete $0
1620 Delete $1
1621 FunctionEnd
1622
1623
1624 ;--------------------------------
1625 ;Descriptions
1626
1627   !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
1628   !insertmacro MUI_DESCRIPTION_TEXT ${secServer} $(DESC_secServer)
1629   !insertmacro MUI_DESCRIPTION_TEXT ${secClient} $(DESC_secClient)
1630   !insertmacro MUI_DESCRIPTION_TEXT ${secControl} $(DESC_secControl)
1631   !insertmacro MUI_DESCRIPTION_TEXT ${secDocs} $(DESC_secDocs)
1632   !insertmacro MUI_DESCRIPTION_TEXT ${secSDK} $(DESC_secSDK)
1633   !insertmacro MUI_DESCRIPTION_TEXT ${secLoopback} $(DESC_secLoopback)
1634   !insertmacro MUI_DESCRIPTION_TEXT ${secDebug} $(DESC_secDebug)
1635   !insertmacro MUI_FUNCTION_DESCRIPTION_END
1636  
1637 ;--------------------------------
1638 ;Uninstaller Section
1639
1640 Section "Uninstall"
1641   ; Make sure the user REALLY wants to do this, unless they did a silent uninstall, in which case...let them!
1642   IfSilent StartRemove     ; New in v2.0b4
1643   MessageBox MB_YESNO "Are you sure you want to remove OpenAFS from this machine?" IDYES StartRemove
1644   abort
1645   
1646 StartRemove:
1647   
1648   SetShellVarContext all
1649   ; Stop the running processes
1650   GetTempFileName $R0
1651   File /oname=$R0 "${AFS_WININSTALL_DIR}\Killer.exe"
1652   nsExec::Exec '$R0 afscreds.exe'
1653   Exec "afscreds.exe -z"
1654   ; in case we are upgrading an old version that does not support -z
1655   Sleep 2000
1656   nsExec::Exec '$R0 afscreds.exe'
1657 !IFDEF INSTALL_KFW
1658   nsExec::Exec '$R0 krbcc32s.exe'
1659 !ENDIF
1660
1661   ; Delete the AFS service
1662   GetTempFileName $R0
1663   File /oname=$R0 "${AFS_WININSTALL_DIR}\Service.exe"
1664   nsExec::Exec "net stop TransarcAFSDaemon"
1665   nsExec::Exec "net stop TransarcAFSServer"
1666   nsExec::Exec '$R0 u TransarcAFSDaemon'
1667   ; After we stop the service, but before we delete it, we have to remove the volume data
1668   ; This is because the storage locations are in the registry under the service key.
1669   ; Call un.RemoveAFSVolumes
1670   nsExec::Exec '$R0 u TransarcAFSServer'
1671   Delete $R0
1672   
1673   Call un.RemoveProvider
1674
1675   Push "$INSTDIR\Client\Program"
1676   Call un.RemoveFromPath
1677   Push "$INSTDIR\Common"
1678   Call un.RemoveFromPath
1679 !ifdef INSTALL_KFW
1680   Push "$INSTDIR\kfw\bin"
1681   Call un.RemoveFromPath
1682 !endif
1683   
1684   ; Delete documentation
1685   Delete "$INSTDIR\Documentation\README.TXT"
1686   Delete "$INSTDIR\Documentation\html\*"
1687   Delete "$INSTDIR\Documentation\html\index_files\*"
1688   Delete "$INSTDIR\Documentation\html\CmdRef\1\*"
1689   Delete "$INSTDIR\Documentation\html\CmdRef\5\*"
1690   Delete "$INSTDIR\Documentation\html\CmdRef\8\*"
1691   Delete "$INSTDIR\Documentation\html\CmdRef\*"
1692
1693    Delete /REBOOTOK "$INSTDIR\Common\afs_config.exe"
1694    Delete /REBOOTOK "$INSTDIR\Common\afs_shl_ext.dll"
1695    Delete /REBOOTOK "$INSTDIR\Common\afsadminutil.dll"
1696    Delete /REBOOTOK "$INSTDIR\Common\lib\afsauthent.dll"
1697    Delete /REBOOTOK "$INSTDIR\Common\lib\afspthread.dll"
1698    Delete /REBOOTOK "$INSTDIR\Common\lib\afsrpc.dll"
1699    Delete /REBOOTOK "$INSTDIR\Common\afsclientadmin.dll"
1700    Delete /REBOOTOK "$INSTDIR\Common\afsprocmgmt.dll"
1701    Delete /REBOOTOK "$INSTDIR\Common\afsvosadmin.dll"
1702    Delete /REBOOTOK "$INSTDIR\Common\TaAfsAppLib.dll"
1703    Delete /REBOOTOK "$INSTDIR\Common\afsvosadmin.dll"
1704    Delete /REBOOTOK "$INSTDIR\Common\afsbosadmin.dll"
1705    Delete /REBOOTOK "$INSTDIR\Common\afscfgadmin.dll"
1706    Delete /REBOOTOK "$INSTDIR\Common\afskasadmin.dll"
1707    Delete /REBOOTOK "$INSTDIR\Common\afsptsadmin.dll"
1708
1709    Delete /REBOOTOK "$INSTDIR\Common\afs_config.pdb"
1710    Delete /REBOOTOK "$INSTDIR\Common\afs_shl_ext.pdb"
1711    Delete /REBOOTOK "$INSTDIR\Common\afsadminutil.pdb"
1712    Delete /REBOOTOK "$INSTDIR\Common\lib\afsauthent.pdb"
1713    Delete /REBOOTOK "$INSTDIR\Common\lib\afspthread.pdb"
1714    Delete /REBOOTOK "$INSTDIR\Common\lib\afsrpc.pdb"
1715    Delete /REBOOTOK "$INSTDIR\Common\afsclientadmin.pdb"
1716    Delete /REBOOTOK "$INSTDIR\Common\afsprocmgmt.pdb"
1717    Delete /REBOOTOK "$INSTDIR\Common\afsvosadmin.pdb"
1718    Delete /REBOOTOK "$INSTDIR\Common\TaAfsAppLib.pdb"
1719    Delete /REBOOTOK "$INSTDIR\Common\afsvosadmin.pdb"
1720    Delete /REBOOTOK "$INSTDIR\Common\afsbosadmin.pdb"
1721    Delete /REBOOTOK "$INSTDIR\Common\afscfgadmin.pdb"
1722    Delete /REBOOTOK "$INSTDIR\Common\afskasadmin.pdb"
1723    Delete /REBOOTOK "$INSTDIR\Common\afsptsadmin.pdb"
1724 !IFDEF DEBUG
1725 !IFDEF CL_1500
1726    SetOutPath "$INSTDIR\Common"
1727    File /oname=vcruntime.msi "${MSVCMSI}"
1728    nsExec::Exec 'msiexec /x "$INSTDIR\Common\vcruntime.msi" /passive /norestart'
1729    Delete "$INSTDIR\Common\vcruntime.msi"
1730 !ELSE
1731 !IFDEF CL_1400
1732    SetOutPath "$INSTDIR\Common"
1733    File /oname=vcruntime.msi "${MSVCMSI}"
1734    nsExec::Exec 'msiexec /x "$INSTDIR\Common\vcruntime.msi" /passive /norestart'
1735    Delete "$INSTDIR\Common\vcruntime.msi"
1736 !ELSE
1737 !IFDEF CL_1310
1738    Delete /REBOOTOK "$INSTDIR\Common\msvcr71d.dll"
1739    Delete /REBOOTOK "$INSTDIR\Common\msvcr71d.pdb"
1740    Delete /REBOOTOK "$INSTDIR\Common\msvcp71d.dll"
1741    Delete /REBOOTOK "$INSTDIR\Common\msvcp71d.pdb"
1742    Delete /REBOOTOK "$INSTDIR\Common\mfc71d.dll"
1743    Delete /REBOOTOK "$INSTDIR\Common\mfc71d.pdb"
1744 !ELSE
1745 !IFDEF CL_1300
1746    Delete /REBOOTOK "$INSTDIR\Common\msvcr70d.dll"
1747    Delete /REBOOTOK "$INSTDIR\Common\msvcr70d.pdb"
1748    Delete /REBOOTOK "$INSTDIR\Common\msvcp70d.dll"
1749    Delete /REBOOTOK "$INSTDIR\Common\msvcp70d.pdb"
1750    Delete /REBOOTOK "$INSTDIR\Common\mfc70d.dll"
1751    Delete /REBOOTOK "$INSTDIR\Common\mfc70d.pdb"
1752 !ELSE
1753    Delete /REBOOTOK "$INSTDIR\Common\mfc42d.dll"
1754    Delete /REBOOTOK "$INSTDIR\Common\mfc42d.pdb"
1755    Delete /REBOOTOK "$INSTDIR\Common\msvcp60d.dll"
1756    Delete /REBOOTOK "$INSTDIR\Common\msvcp60d.pdb"
1757    Delete /REBOOTOK "$INSTDIR\Common\msvcrtd.dll"
1758    Delete /REBOOTOK "$INSTDIR\Common\msvcrtd.pdb"
1759 !ENDIF
1760 !ENDIF
1761 !ENDIF
1762 !ENDIF
1763 !ELSE
1764 !IFDEF CL_1500
1765    SetOutPath "$INSTDIR\Common"
1766    File /oname=vcruntime.msi "${MSVCMSI}"
1767    nsExec::Exec 'msiexec /x "$INSTDIR\Common\vcruntime.msi" /passive /norestart'
1768    Delete "$INSTDIR\Common\vcruntime.msi"
1769 !ELSE
1770 !IFDEF CL_1400
1771    SetOutPath "$INSTDIR\Common"
1772    File /oname=vcruntime.msi "${MSVCMSI}"
1773    nsExec::Exec 'msiexec /x "$INSTDIR\Common\vcruntime.msi" /passive /norestart'
1774    Delete "$INSTDIR\Common\vcruntime.msi"
1775 !ELSE
1776 !IFDEF CL_1310
1777    Delete /REBOOTOK "$INSTDIR\Common\mfc71.dll"
1778    Delete /REBOOTOK "$INSTDIR\Common\msvcr71.dll"
1779    Delete /REBOOTOK "$INSTDIR\Common\msvcp71.dll"
1780    Delete /REBOOTOK "$INSTDIR\Common\MFC71CHS.DLL"
1781    Delete /REBOOTOK "$INSTDIR\Common\MFC71CHT.DLL"
1782    Delete /REBOOTOK "$INSTDIR\Common\MFC71DEU.DLL"
1783    Delete /REBOOTOK "$INSTDIR\Common\MFC71ENU.DLL"
1784    Delete /REBOOTOK "$INSTDIR\Common\MFC71ESP.DLL"
1785    Delete /REBOOTOK "$INSTDIR\Common\MFC71FRA.DLL"
1786    Delete /REBOOTOK "$INSTDIR\Common\MFC71ITA.DLL"
1787    Delete /REBOOTOK "$INSTDIR\Common\MFC71JPN.DLL"
1788    Delete /REBOOTOK "$INSTDIR\Common\MFC71KOR.DLL"
1789 !ELSE
1790 !IFDEF CL_1300
1791    Delete /REBOOTOK "$INSTDIR\Common\mfc70.dll"
1792    Delete /REBOOTOK "$INSTDIR\Common\msvcr70.dll"
1793    Delete /REBOOTOK "$INSTDIR\Common\msvcp70.dll"
1794    Delete /REBOOTOK "$INSTDIR\Common\MFC70CHS.DLL"
1795    Delete /REBOOTOK "$INSTDIR\Common\MFC70CHT.DLL"
1796    Delete /REBOOTOK "$INSTDIR\Common\MFC70DEU.DLL"
1797    Delete /REBOOTOK "$INSTDIR\Common\MFC70ENU.DLL"
1798    Delete /REBOOTOK "$INSTDIR\Common\MFC70ESP.DLL"
1799    Delete /REBOOTOK "$INSTDIR\Common\MFC70FRA.DLL"
1800    Delete /REBOOTOK "$INSTDIR\Common\MFC70ITA.DLL"
1801    Delete /REBOOTOK "$INSTDIR\Common\MFC70JPN.DLL"
1802    Delete /REBOOTOK "$INSTDIR\Common\MFC70KOR.DLL"
1803 !ELSE
1804    Delete /REBOOTOK "$INSTDIR\Common\mfc42.dll"
1805    Delete /REBOOTOK "$INSTDIR\Common\msvcp60.dll"
1806    Delete /REBOOTOK "$INSTDIR\Common\msvcrt.dll"
1807 !ENDIF
1808 !ENDIF
1809 !ENDIF
1810 !ENDIF
1811 !ENDIF
1812   
1813    IfSilent SkipDel
1814 ;  IfFileExists "$INSTDIR\Client\CellServDB" CellExists SkipDelAsk
1815 ;  CellExists:
1816   MessageBox MB_YESNO "Would you like to keep your configuration information?" IDYES SkipDel
1817   Delete "$INSTDIR\Client\CellServDB"
1818
1819 ; Only remove krb5.ini if KfW was installed
1820 !IFDEF INSTALL_KFW
1821   Delete "$WINDIR\krb5.ini"
1822 !ENDIF
1823   Delete "$INSTDIR\Client\afsdns.ini"
1824   
1825   GetTempFileName $R0
1826   File /oname=$R0 "${AFS_WININSTALL_DIR}\AdminGroup.exe"
1827   nsExec::Exec '$R0 -remove'
1828
1829   SkipDel:
1830   Delete "$WINDIR\afsd_init.log"
1831   Delete "$INSTDIR\Uninstall.exe"
1832
1833   ; Remove server
1834   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\afskill.exe"
1835   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\afssvrcfg.exe"
1836   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\bosctlsvc.exe"
1837   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\bosserver.exe"
1838   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\buserver.exe"
1839   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\butc.exe"
1840   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\fileserver.exe"
1841   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\fms.exe"
1842   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\kaserver.exe"
1843   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\ptserver.exe"
1844   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\salvager.exe"
1845   Delete "$INSTDIR\Server\usr\afs\bin\ServerUninst.dll"
1846   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\upclient.exe"
1847   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\upserver.exe"
1848   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\vlserver.exe"
1849   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\volinfo.exe"
1850   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\volserver.exe"
1851
1852   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\afskill.pdb"
1853   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\afssvrcfg.pdb"
1854   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\bosctlsvc.pdb"
1855   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\bosserver.pdb"
1856   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\buserver.pdb"
1857   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\butc.pdb"
1858   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\fileserver.pdb"
1859   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\fms.pdb"
1860   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\kaserver.pdb"
1861   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\ptserver.pdb"
1862   Delete "$INSTDIR\Server\usr\afs\bin\salvager.pdb"
1863   Delete "$INSTDIR\Server\usr\afs\bin\ServerUninst.pdb"
1864   Delete "$INSTDIR\Server\usr\afs\bin\upclient.pdb"
1865   Delete "$INSTDIR\Server\usr\afs\bin\upserver.pdb"
1866   Delete "$INSTDIR\Server\usr\afs\bin\vlserver.pdb"
1867   Delete "$INSTDIR\Server\usr\afs\bin\volinfo.pdb"
1868   Delete "$INSTDIR\Server\usr\afs\bin\volserver.pdb"
1869
1870   RMDir /r "$INSTDIR\Server\usr\afs\bin"
1871   ; do not delete the server configuration files
1872   ; or we will lose the volumes and authentication
1873   ; databases
1874   ;RmDir /r "$INSTDIR\Server\usr\afs\etc\logs"
1875   ;RmDir /r "$INSTDIR\Server\usr\afs\etc"
1876   ;RmDir /r "$INSTDIR\Server\usr\afs\local"
1877   ;RMDIR /r "$INSTDIR\Server\usr\afs\logs"
1878   
1879   Delete /REBOOTOK "$SYSDIR\afsserver.cpl"
1880   Delete /REBOOTOK "$INSTDIR\Client\Program\afs_cpa.cpl"
1881   Delete /REBOOTOK "$INSTDIR\Client\Program\afslogon.dll"
1882   Delete /REBOOTOK "$INSTDIR\Client\Program\afscpcc.exe"
1883
1884   Delete /REBOOTOK "$SYSDIR\afsserver.pdb"
1885   Delete /REBOOTOK "$INSTDIR\Client\Program\afs_cpa.pdb"
1886   Delete /REBOOTOK "$INSTDIR\Client\Program\afslogon.pdb"
1887   Delete /REBOOTOK "$INSTDIR\Client\Program\afscpcc.pdb"
1888
1889   RMDir /r "$INSTDIR\Documentation\html\CmdRef"
1890   RMDIr /r "$INSTDIR\Documentation\html"
1891   
1892   RMDir "$INSTDIR\Documentation"
1893   ; Delete DOC short cut
1894   Delete /REBOOTOK "$INSTDIR\Client\Program\afscreds.exe"
1895   Delete /REBOOTOK "$INSTDIR\Client\Program\afscreds.pdb"
1896
1897   Delete /REBOOTOK "$INSTDIR\SDK\Include\*"
1898   Delete /REBOOTOK "$INSTDIR\SDK\Include\afs\*"
1899   Delete /REBOOTOK "$INSTDIR\SDK\Include\rx\*"
1900   Delete /REBOOTOK "$INSTDIR\SDK\Sample\*"
1901   Delete /REBOOTOK "$INSTDIR\SDK\*"
1902
1903   RMDir  "$INSTDIR\SDK\Sample"
1904   RMDir  "$INSTDIR\SDK\Include\afs"
1905   RMDir  "$INSTDIR\SDK\Include\rx"
1906   RMDir  "$INSTDIR\SDK\Include"
1907   RMDir  "$INSTDIR\SDK"
1908
1909   Delete /REBOOTOK "$INSTDIR\Client\Program\*"
1910   Delete /REBOOTOK "$INSTDIR\Client\*"
1911
1912   RMDir  "$INSTDIR\Client\Program"
1913   RMDir  "$INSTDIR\Client"
1914
1915 !IFDEF DEBUG  
1916 !IFDEF CL_1500
1917    SetOutPath "$INSTDIR\Common"
1918    File /oname=vcruntime.msi "${MSVCMSI}"
1919    nsExec::Exec 'msiexec /x "$INSTDIR\Common\vcruntime.msi" /passive /norestart'
1920    Delete "$INSTDIR\Common\vcruntime.msi"
1921 !ELSE
1922 !IFDEF CL_1400
1923    SetOutPath "$INSTDIR\Common"
1924    File /oname=vcruntime.msi "${MSVCMSI}"
1925    nsExec::Exec 'msiexec /x "$INSTDIR\Common\vcruntime.msi" /passive /norestart'
1926    Delete "$INSTDIR\Common\vcruntime.msi"
1927 !ELSE
1928 !IFDEF CL_1310
1929    Delete /REBOOTOK "$INSTDIR\Common\msvcr71d.dll"
1930    Delete /REBOOTOK "$INSTDIR\Common\msvcr71d.pdb"
1931    Delete /REBOOTOK "$INSTDIR\Common\msvcp71d.dll"
1932    Delete /REBOOTOK "$INSTDIR\Common\msvcp71d.pdb"
1933    Delete /REBOOTOK "$INSTDIR\Common\mfc71d.dll"
1934    Delete /REBOOTOK "$INSTDIR\Common\mfc71d.pdb"
1935 !ELSE
1936 !IFDEF CL_1300
1937    Delete /REBOOTOK "$INSTDIR\Common\msvcr70d.dll"
1938    Delete /REBOOTOK "$INSTDIR\Common\msvcr70d.pdb"
1939    Delete /REBOOTOK "$INSTDIR\Common\msvcp70d.dll"
1940    Delete /REBOOTOK "$INSTDIR\Common\msvcp70d.pdb"
1941    Delete /REBOOTOK "$INSTDIR\Common\mfc70d.dll"
1942    Delete /REBOOTOK "$INSTDIR\Common\mfc70d.pdb"
1943 !ELSE
1944    Delete /REBOOTOK "$INSTDIR\Common\mfc42d.dll"
1945    Delete /REBOOTOK "$INSTDIR\Common\mfc42d.pdb"
1946    Delete /REBOOTOK "$INSTDIR\Common\msvcp60d.dll"
1947    Delete /REBOOTOK "$INSTDIR\Common\msvcp60d.pdb"
1948    Delete /REBOOTOK "$INSTDIR\Common\msvcrtd.dll"
1949    Delete /REBOOTOK "$INSTDIR\Common\msvcrtd.pdb"
1950 !ENDIF
1951 !ENDIF
1952 !ENDIF
1953 !ENDIF
1954 !ELSE
1955 !IFDEF CL_1500
1956    SetOutPath "$INSTDIR\Common"
1957    File /oname=vcruntime.msi "${MSVCMSI}"
1958    nsExec::Exec 'msiexec /x "$INSTDIR\Common\vcruntime.msi" /passive /norestart'
1959    Delete "$INSTDIR\Common\vcruntime.msi"
1960 !ELSE
1961 !IFDEF CL_1400
1962    SetOutPath "$INSTDIR\Common"
1963    File /oname=vcruntime.msi "${MSVCMSI}"
1964    nsExec::Exec 'msiexec /x "$INSTDIR\Common\vcruntime.msi" /passive /norestart'
1965    Delete "$INSTDIR\Common\vcruntime.msi"
1966 !ELSE
1967 !IFDEF CL_1310
1968    Delete /REBOOTOK "$INSTDIR\Common\mfc71.dll"
1969    Delete /REBOOTOK "$INSTDIR\Common\msvcr71.dll"
1970    Delete /REBOOTOK "$INSTDIR\Common\msvcp71.dll"
1971    Delete /REBOOTOK "$INSTDIR\Common\MFC71CHS.DLL"
1972    Delete /REBOOTOK "$INSTDIR\Common\MFC71CHT.DLL"
1973    Delete /REBOOTOK "$INSTDIR\Common\MFC71DEU.DLL"
1974    Delete /REBOOTOK "$INSTDIR\Common\MFC71ENU.DLL"
1975    Delete /REBOOTOK "$INSTDIR\Common\MFC71ESP.DLL"
1976    Delete /REBOOTOK "$INSTDIR\Common\MFC71FRA.DLL"
1977    Delete /REBOOTOK "$INSTDIR\Common\MFC71ITA.DLL"
1978    Delete /REBOOTOK "$INSTDIR\Common\MFC71JPN.DLL"
1979    Delete /REBOOTOK "$INSTDIR\Common\MFC71KOR.DLL"
1980 !ELSE
1981 !IFDEF CL_1300
1982    Delete /REBOOTOK "$INSTDIR\Common\mfc70.dll"
1983    Delete /REBOOTOK "$INSTDIR\Common\msvcr70.dll"
1984    Delete /REBOOTOK "$INSTDIR\Common\msvcp70.dll"
1985    Delete /REBOOTOK "$INSTDIR\Common\MFC70CHS.DLL"
1986    Delete /REBOOTOK "$INSTDIR\Common\MFC70CHT.DLL"
1987    Delete /REBOOTOK "$INSTDIR\Common\MFC70DEU.DLL"
1988    Delete /REBOOTOK "$INSTDIR\Common\MFC70ENU.DLL"
1989    Delete /REBOOTOK "$INSTDIR\Common\MFC70ESP.DLL"
1990    Delete /REBOOTOK "$INSTDIR\Common\MFC70FRA.DLL"
1991    Delete /REBOOTOK "$INSTDIR\Common\MFC70ITA.DLL"
1992    Delete /REBOOTOK "$INSTDIR\Common\MFC70JPN.DLL"
1993    Delete /REBOOTOK "$INSTDIR\Common\MFC70KOR.DLL"
1994 !ELSE
1995    Delete /REBOOTOK "$INSTDIR\Common\mfc42.dll"
1996    Delete /REBOOTOK "$INSTDIR\Common\msvcp60.dll"
1997    Delete /REBOOTOK "$INSTDIR\Common\msvcrt.dll"
1998 !ENDIF
1999 !ENDIF
2000 !ENDIF
2001 !ENDIF
2002 !ENDIF
2003
2004   Delete /REBOOTOK "$INSTDIR\Common\*"
2005   RMDir "$INSTDIR\Common"
2006
2007 !ifdef INSTALL_KFW
2008   ;Remove KfW files
2009   Delete /REBOOTOK "$INSTDIR\kfw\bin\*"
2010   RMDIR  /r "$INSTDIR\kfw\bin"
2011   Delete /REBOOTOK "$INSTDIR\kfw\doc\*"
2012   RMDIR  /r "$INSTDIR\kfw\doc"
2013   RMDIR  /r "$INSTDIR\kfw"
2014 !endif
2015
2016   Delete "$SMPROGRAMS\OpenAFS\Documentation.lnk"
2017
2018   ; Remove control center
2019   Delete /REBOOTOK "$INSTDIR\Control Center\TaAfsAccountManager.exe"
2020   Delete /REBOOTOK "$INSTDIR\Control Center\TaAfsAdmSvr.exe"
2021   Delete /REBOOTOK "$INSTDIR\Control Center\TaAfsServerManager.exe"
2022   Delete /REBOOTOK "$INSTDIR\Control Center\CCUninst.dll"
2023   Delete /REBOOTOK "$INSTDIR\Control Center\TaAfsAccountManager.pdb"
2024   Delete /REBOOTOK "$INSTDIR\Control Center\TaAfsAdmSvr.pdb"
2025   Delete /REBOOTOK "$INSTDIR\Control Center\TaAfsServerManager.pdb"
2026   RMDir  "$INSTDIR\Control Center"
2027   
2028   Delete "$SMPROGRAMS\OpenAFS\Uninstall OpenAFS.lnk"
2029   Delete "$SMPROGRAMS\OpenAFS\Client\Authentication.lnk"
2030   Delete "$SMPROGRAMS\OpenAFS\Control Center\Account Manager.lnk"
2031   Delete "$SMPROGRAMS\OpenAFS\Control Center\Server Manager.lnk"
2032   RMDIR "$SMPROGRAMS\OpenAFS\Control Center"
2033   RMDir /r "$SMPROGRAMS\OpenAFS\Documentation"
2034   RMDir /r "$SMPROGRAMS\OpenAFS\Client"
2035   RMDir /r "$SMPROGRAMS\OpenAFS"
2036   Delete "$SMSTARTUP\AFS Credentials.lnk"
2037   
2038   ReadRegStr $R0 HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon" "CachePath"
2039   IfErrors +2
2040   Delete "$R0\AFSCache"
2041   Delete "C:\AFSCache"
2042
2043   DeleteRegKey HKCR "*\shellex\ContextMenuHandlers\AFS Client Shell Extension"
2044   DeleteRegKey HKCR "CLSID\{DC515C27-6CAC-11D1-BAE7-00C04FD140D2}\InprocServer32"
2045   DeleteRegKey HKCR "CLSID\{DC515C27-6CAC-11D1-BAE7-00C04FD140D2}"
2046   DeleteRegKey HKCR "FOLDER\shellex\ContextMenuHandlers\AFS Client Shell Extension"
2047   DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved" "{DC515C27-6CAC-11D1-BAE7-00C04FD140D2}"
2048   DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Control Panel\Cpls" "afs_cpa"
2049
2050   ; WinLogon Event Notification
2051   DeleteRegKey HKLM "Software\Microsoft\Windows NT\CurrentVersion\Winlogon\Notify\AfsLogon"
2052
2053   DeleteRegKey HKLM "${AFS_REGKEY_ROOT}\AFS Client\CurrentVersion"
2054   DeleteRegKey HKLM "${AFS_REGKEY_ROOT}\AFS Client"
2055   DeleteRegKey HKLM "${AFS_REGKEY_ROOT}\AFS Supplemental Documentation\CurrentVersion"
2056   DeleteRegKey HKLM "${AFS_REGKEY_ROOT}\AFS Supplemental Documentation"
2057   DeleteRegKey HKLM "${AFS_REGKEY_ROOT}\AFS Control Center\CurrentVersion"
2058   DeleteRegKey HKLM "${AFS_REGKEY_ROOT}\AFS Control Center"
2059   DeleteRegKey HKLM "${AFS_REGKEY_ROOT}\AFS Server\CurrentVersion"
2060   DeleteRegKey HKLM "${AFS_REGKEY_ROOT}\AFS Server"
2061   DeleteRegKey /ifempty HKLM "${AFS_REGKEY_ROOT}"
2062   DeleteRegKey HKLM "${NID_PLUGIN_MGR}\Modules\OpenAFS"
2063   DeleteRegKey HKLM "${NID_PLUGIN_MGR}\Plugins\AfsCred"
2064   DeleteRegKey /ifempty HKLM "Software\MIT\NetIDMgr"
2065   DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenAFS"
2066   DeleteRegValue HKLM "SYSTEM\CurrentControlSet\Services\NetBT\Parameters" "SmbDeviceEnabled"
2067
2068   ; Support for apps that wrote submount data directly to afsdsbmt.ini
2069   DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\IniFileMapping\afsdsbmt.ini"
2070
2071   RMDir  "$INSTDIR"
2072
2073 SectionEnd
2074
2075 ;--------------------------------
2076 ;Uninstaller Functions
2077
2078 Function un.onInit
2079
2080   ;Get language from registry
2081   ReadRegStr $LANGUAGE HKCU "Software\OpenAFS\AFS" "Installer Language"
2082
2083 FunctionEnd
2084
2085 Function un.onUninstSuccess
2086
2087   IfSilent SkipAsk
2088   MessageBox MB_OK "Please reboot your machine to complete uninstallation of the software"
2089   SkipAsk:
2090
2091 FunctionEnd
2092
2093 ;------------------------------
2094 ; Get the CellServDB file from the Internet
2095
2096 Function afs.GetCellServDB
2097
2098 ;Check if we should download CellServDB
2099 ReadINIStr $R0 $0 "Field 4" "State"
2100 StrCmp $R0 "1" DoDownload
2101
2102 ;Do nothing if we're keeping the existing file
2103 ReadINIStr $R0 $0 "Field 2" "State"
2104 StrCmp $R0 "1" done
2105
2106 ReadINIStr $R0 $0 "Field 6" "State"
2107 StrCmp $R0 "1" CheckOther
2108
2109 ReadINIStr $R0 $0 "Field 3" "State"
2110 StrCmp $R0 "1" UsePackaged
2111
2112 ; If none of these, grab file from other location
2113 goto UsePackaged
2114
2115 DoDownload:
2116    ReadINIStr $R0 $0 "Field 5" "State"
2117    NSISdl::download $R0 "$INSTDIR\Client\CellServDB"
2118    Pop $R0 ;Get the return value
2119    StrCmp $R0 "success" +2
2120       MessageBox MB_OK|MB_ICONSTOP "Download failed: $R0"
2121    goto done
2122
2123 UsePackaged:
2124    SetOutPath "$INSTDIR\Client"
2125    File "CellServDB"
2126    goto done
2127    
2128 CheckOther:
2129    ReadINIStr $R0 $0 "Field 7" "State"
2130    StrCmp $R0 "" done
2131    CopyFiles $R0 "$INSTDIR\Client\CellServDB"
2132    
2133 done:
2134
2135 FunctionEnd
2136
2137 Function AddProvider
2138    Push $R0
2139    Push $R1
2140    ReadRegStr $R0 HKLM "SYSTEM\CurrentControlSet\Control\NetworkProvider\HWOrder" "ProviderOrder"
2141    Push $R0
2142    StrCpy $R0 "TransarcAFSDaemon"
2143    Push $R0
2144    Call StrStr
2145    Pop $R0
2146    StrCmp $R0 "" +1 DoOther
2147    ReadRegStr $R1 HKLM "SYSTEM\CurrentControlSet\Control\NetworkProvider\HWOrder" "ProviderOrder"   
2148    StrCpy $R0 "$R1,TransarcAFSDaemon"
2149    WriteRegStr HKLM "SYSTEM\CurrentControlSet\Control\NetworkProvider\HWOrder" "ProviderOrder" $R0
2150 DoOther:
2151    ReadRegStr $R0 HKLM "SYSTEM\CurrentControlSet\Control\NetworkProvider\Order" "ProviderOrder"
2152    Push $R0
2153    StrCpy $R0 "TransarcAFSDaemon"
2154    Push $R0
2155    Call StrStr
2156    Pop $R0
2157    StrCmp $R0 "" +1 End
2158    ReadRegStr $R1 HKLM "SYSTEM\CurrentControlSet\Control\NetworkProvider\Order" "ProviderOrder"   
2159    StrCpy $R0 "$R1,TransarcAFSDaemon"
2160    WriteRegStr HKLM "SYSTEM\CurrentControlSet\Control\NetworkProvider\Order" "ProviderOrder" $R0   
2161 End:
2162    Pop $R1
2163    Pop $R0
2164 FunctionEnd
2165
2166 Function un.RemoveProvider
2167    Push $R0
2168    StrCpy $R0 "TransarcAFSDaemon"
2169    Push $R0
2170    StrCpy $R0 "SYSTEM\CurrentControlSet\Control\NetworkProvider\HWOrder"
2171    Call un.RemoveFromProvider
2172    StrCpy $R0 "TransarcAFSDaemon"
2173    Push $R0
2174    StrCpy $R0 "SYSTEM\CurrentControlSet\Control\NetworkProvider\Order"
2175    Call un.RemoveFromProvider
2176    Pop $R0
2177 FunctionEnd
2178
2179 Function un.RemoveFromProvider
2180   Exch $0
2181   Push $1
2182   Push $2
2183   Push $3
2184   Push $4
2185   Push $5
2186   Push $6
2187
2188   ReadRegStr $1 HKLM "$R0" "ProviderOrder"
2189     StrCpy $5 $1 1 -1 # copy last char
2190     StrCmp $5 "," +2 # if last char != ,
2191       StrCpy $1 "$1," # append ,
2192     Push $1
2193     Push "$0,"
2194     Call un.StrStr ; Find `$0,` in $1
2195     Pop $2 ; pos of our dir
2196     StrCmp $2 "" unRemoveFromPath_done
2197       ; else, it is in path
2198       # $0 - path to add
2199       # $1 - path var
2200       StrLen $3 "$0,"
2201       StrLen $4 $2
2202       StrCpy $5 $1 -$4 # $5 is now the part before the path to remove
2203       StrCpy $6 $2 "" $3 # $6 is now the part after the path to remove
2204       StrCpy $3 $5$6
2205
2206       StrCpy $5 $3 1 -1 # copy last char
2207       StrCmp $5 "," 0 +2 # if last char == ,
2208         StrCpy $3 $3 -1 # remove last char
2209
2210       WriteRegStr HKLM "$R0" "ProviderOrder" $3
2211       
2212   unRemoveFromPath_done:
2213     Pop $6
2214     Pop $5
2215     Pop $4
2216     Pop $3
2217     Pop $2
2218     Pop $1
2219     Pop $0
2220 FunctionEnd
2221
2222 Function CheckPathForAFS
2223    Push $0
2224    Push $1
2225    Push $2
2226    Push $3
2227    ReadRegStr $1 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH"
2228    StrCpy $1 "$1;"
2229 loop:
2230    Push $1
2231    Push ";"
2232    Call StrStr
2233    Pop $0
2234    StrLen $2 $0
2235    StrCpy $3 $1 -$2
2236    IfFileExists "$3\afsd_service.exe" Error
2237    StrCpy $1 $0 32768 1
2238    StrLen $2 $1
2239    IntCmp $2 0 Done Done loop
2240    goto Done
2241 Error:
2242    MessageBox MB_ICONSTOP|MB_OK|MB_TOPMOST "This installer is unable to upgrade the previous version of AFS. Please uninstall the current AFS version before continuing."
2243    Abort "Unable to install OpenAFS"
2244 Done:
2245    Pop $3
2246    Pop $2
2247    Pop $1
2248    Pop $0
2249 FunctionEnd
2250
2251 Function AddToUniquePath
2252    Pop $R0
2253    Push $R0
2254    Push "$R0;"
2255    ReadRegStr $R0 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH"
2256    Push "$R0;"
2257    Call StrStr
2258    Pop $R0
2259    StrCmp $R0 "" +1 Done
2260    Call AddToPath
2261 Done:
2262 FunctionEnd
2263
2264
2265 ;-------------------------------
2266 ;Do the page to get the CellServDB
2267
2268 Function AFSPageGetCellServDB
2269   ; Skip this page if we are not installing the client
2270   SectionGetFlags ${secClient} $R0
2271   IntOp $R0 $R0 & ${SF_SELECTED}
2272   StrCmp $R0 "0" Skip
2273   
2274   ; Set the install options here
2275   
2276 startOver:
2277   WriteINIStr $0 "Field 2" "Flags" "DISABLED"
2278   WriteINIStr $0 "Field 3" "State" "1"
2279   WriteINISTR $0 "Field 4" "State" "0"
2280   WriteINIStr $0 "Field 6" "State" "0"
2281   
2282   ; If there is an existing afsdcell.ini file, migrate it to CellServDB
2283   IfFileExists "$WINDIR\afsdcell.ini" +1 +3
2284   CopyFiles /SILENT "$WINDIR\afsdcell.ini" "$INSTDIR\Client\CellServDB"
2285   Delete "$WINDIR\afsdcell.ini"
2286   ; If there is an existing CellServDB file, allow the user to choose it and make it default
2287   IfFileExists "$INSTDIR\Client\CellServDB" +1 notpresent
2288   WriteINIStr $0 "Field 2" "Flags" "ENABLED"
2289   WriteINIStr $0 "Field 2" "State" "1"
2290   WriteINIStr $0 "Field 3" "State" "0"
2291   
2292   notpresent:
2293   
2294   !insertmacro MUI_HEADER_TEXT "CellServDB Configuration" "Please choose a method for installing the CellServDB file:" 
2295   InstallOptions::dialog $0
2296   Pop $R1
2297   StrCmp $R1 "cancel" exit
2298   StrCmp $R1 "back" done
2299   StrCmp $R1 "success" done
2300 exit: Quit
2301 done:
2302
2303    ; Check that if a file is set, a valid filename is entered...
2304    ReadINIStr $R0 $0 "Field 6" "State"
2305    StrCmp $R0 "1" CheckFileName
2306    
2307    ;Check if a URL is specified, one *IS* specified
2308    ReadINIStr $R0 $0 "Field 4" "State"
2309    StrCmp $R0 "1" CheckURL Skip
2310    
2311    CheckURL:
2312    ReadINIStr $R0 $0 "Field 5" "State"
2313    StrCmp $R0 "" +1 Skip
2314    MessageBox MB_OK|MB_ICONSTOP $(URLError)
2315    WriteINIStr $0 "Field 4" "State" "0"
2316    goto startOver
2317    
2318    CheckFileName:
2319    ReadINIStr $R0 $0 "Field 7" "State"
2320    IfFileExists $R0 Skip
2321
2322    MessageBox MB_OK|MB_ICONSTOP $(CellError)
2323    WriteINIStr $0 "Field 6" "State" "0"
2324    goto startOver
2325    
2326    Skip:
2327    
2328 FunctionEnd
2329
2330
2331 Function AFSPageGetCellName
2332    IfSilent good
2333   ; Skip this page if we are not installing the client
2334   SectionGetFlags ${secClient} $R0
2335   IntOp $R0 $R0 & ${SF_SELECTED}
2336   StrCmp $R0 "0" good
2337   
2338 startOver:
2339    ; We want to read in the existing parameters and make them the defaults
2340    
2341    ;AFS Crypt security
2342    ReadRegDWORD $R1 HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" "SecurityLevel"
2343    StrCmp $R1 "" +3
2344    WriteINIStr $1 "Field 3" "State" $R1
2345    goto +2
2346    WriteINIStr $1 "Field 3" "State" "1"
2347    
2348    ;Use DNS
2349    ReadRegDWORD $R1 HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" "UseDNS"
2350    StrCmp $R1 "" +3
2351    WriteINIStr $1 "Field 9" "State" $R1
2352    goto +2
2353    WriteINIStr $1 "Field 9" "State" "1"
2354    
2355    ; Use integrated logon
2356    ReadRegDWORD $R1 HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" "LogonOptions"
2357    StrCmp $R1 "" +3
2358    WriteINIStr $1 "Field 7" "State" $R1
2359    goto +2
2360    WriteINIStr $1 "Field 7" "State" "0"
2361    
2362    ; If this is a server install, we do NOT want to recommend the Freelance client
2363    ; And we do not need to ask for the cell name.
2364    SectionGetFlags ${secServer} $R1
2365    IntOp $R1 $R1 & ${SF_SELECTED}
2366    StrCmp $R1 "1" +1 NotServer
2367    WriteINIStr $1 "Field 6" "Text" "Enable AFS Freelance client (Not Recommended for servers)"
2368    ReadRegDWORD $R1 HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" "FreelanceClient"
2369    StrCmp $R1 "" +3
2370    WriteINIStr $1 "Field 5" "State" $R1
2371    goto +2
2372    WriteINIStr $1 "Field 5" "State" "0"
2373    WriteINIStr $1 "Field 1" "Flags" "DISABLED"
2374    WriteINIStr $1 "Field 2" "Flags" "DISABLED"
2375    goto SkipServerTest
2376 NotServer:
2377    WriteINIStr $1 "Field 6" "Text" "Enable AFS Freelance client (Recommended)"
2378    ReadRegDWORD $R1 HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" "FreelanceClient"
2379    StrCmp $R1 "" +3
2380    WriteINIStr $1 "Field 5" "State" $R1
2381    goto +2
2382    WriteINIStr $1 "Field 5" "State" "1"
2383    WriteINIStr $1 "Field 1" "Flags" ""
2384    WriteINIStr $1 "Field 2" "Flags" ""
2385 SkipServerTest:
2386    ; Get the current cell name, if any
2387    ReadRegStr $R1 HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" "Cell"
2388    StrCmp $R1 "" +2
2389    WriteINIStr $1 "Field 2" "State" $R1
2390   !insertmacro MUI_HEADER_TEXT "Client Cell Name Configuration" "Please enter the name for your default cell:" 
2391   InstallOptions::dialog $1
2392   Pop $R1
2393   StrCmp $R1 "cancel" exit
2394   StrCmp $R1 "back" done
2395   StrCmp $R1 "success" done
2396 exit: Quit
2397 done:
2398    ReadINIStr $R0 $1 "Field 2" "State"
2399    StrCmp $R0 "" +1 good
2400    
2401    MessageBox MB_OK|MB_ICONSTOP $(CellNameError)
2402    goto startOver
2403 good:
2404 FunctionEnd
2405
2406
2407 ;---------------------------------------------------------
2408 ;Do the page to get the afscreds.exe startup configuration
2409
2410 Function AFSPageConfigAFSCreds
2411   ; Skip this page if we are not installing the client
2412   SectionGetFlags ${secClient} $R0
2413   IntOp $R0 $R0 & ${SF_SELECTED}
2414   StrCmp $R0 "0" done
2415   
2416   ; Set the install options here
2417   
2418   !insertmacro MUI_HEADER_TEXT "AFS Credentials Configuration" "Please choose default options for configuring the AFS Credentials program:" 
2419   InstallOptions::dialog $2
2420   Pop $R1
2421   StrCmp $R1 "cancel" exit
2422   StrCmp $R1 "back" done
2423   StrCmp $R1 "success" done
2424 exit: Quit
2425 done:
2426    
2427 FunctionEnd
2428
2429
2430 ;-------------
2431 ; Common install routines for each module
2432 Function AFSCommon.Install
2433
2434 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenAFS" "DisplayName" "OpenAFS for Windows"
2435 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenAFS" "UninstallString" "$INSTDIR\uninstall.exe"
2436 !ifndef DEBUG
2437 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenAFS" "DisplayVersion" "${AFS_VERSION}"
2438 !else
2439 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenAFS" "DisplayVersion" "${AFS_VERSION} Checked/Debug"
2440 !endif
2441 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenAFS" "URLInfoAbout" "http://www.openafs.org/"
2442
2443 FunctionEnd
2444
2445
2446 ;-------------------
2447 ; Get the currently installed version and place it on the stack
2448 ; Modifies: Nothing
2449 Function GetInstalledVersion
2450    Push $R0
2451    Push $R1
2452    Push $R4
2453    
2454    ReadRegStr $R0 HKLM "Software\TransarcCorporation\$R2\CurrentVersion" "VersionString"
2455    StrCmp $R0 "" NotTransarc done
2456    
2457    
2458 NotTransarc:
2459    ReadRegStr $R0 HKLM "${AFS_REGKEY_ROOT}\$R2\CurrentVersion" "VersionString"
2460    StrCmp $R0 "" done
2461    
2462 done:
2463    Pop $R4
2464    Pop $R1
2465    Exch $R0
2466 FunctionEnd
2467
2468 ; Functions to get each component of the version number
2469 Function GetInstalledVersionMajor
2470    Push $R0
2471    Push $R1
2472    Push $R4
2473    
2474    ReadRegDWORD $R0 HKLM "Software\TransarcCorporation\$R2\CurrentVersion" "MajorVersion"
2475    StrCmp $R0 "" NotTransarc done
2476    
2477    
2478 NotTransarc:
2479    ReadRegDWORD $R0 HKLM "${AFS_REGKEY_ROOT}\$R2\CurrentVersion" "MajorVersion"
2480    StrCmp $R0 "" done
2481    
2482 done:
2483    Pop $R4
2484    Pop $R1
2485    Exch $R0
2486 FunctionEnd
2487
2488 Function GetInstalledVersionMinor
2489    Push $R0
2490    Push $R1
2491    Push $R4
2492    
2493    ReadRegDWORD $R0 HKLM "Software\TransarcCorporation\$R2\CurrentVersion" "MinorVersion"
2494    StrCmp $R0 "" NotTransarc done
2495    
2496    
2497 NotTransarc:
2498    ReadRegDWORD $R0 HKLM "${AFS_REGKEY_ROOT}\$R2\CurrentVersion" "MinorVersion"
2499    StrCmp $R0 "" done
2500    
2501 done:
2502    Pop $R4
2503    Pop $R1
2504    Exch $R0
2505 FunctionEnd
2506
2507 Function GetInstalledVersionPatch
2508    Push $R0
2509    Push $R1
2510    Push $R4
2511    
2512    ReadRegDWORD $R0 HKLM "Software\TransarcCorporation\$R2\CurrentVersion" "PatchLevel"
2513    StrCmp $R0 "" NotTransarc done
2514    
2515    
2516 NotTransarc:
2517    ReadRegDWORD $R0 HKLM "${AFS_REGKEY_ROOT}\$R2\CurrentVersion" "PatchLevel"
2518    StrCmp $R0 "" done
2519    
2520 done:
2521    Pop $R4
2522    Pop $R1
2523    Exch $R0
2524 FunctionEnd
2525
2526
2527
2528 ;-------------------------------
2529 ; Check if the client should be checked for default install
2530 Function ShouldClientInstall
2531    Push $R0
2532    StrCpy $R2 "AFS Client"
2533    Call GetInstalledVersion
2534    Pop $R0
2535    
2536    StrCmp $R0 "" NotInstalled
2537    ; Now we see if it's an older or newer version
2538    
2539    Call GetInstalledVersionMajor
2540    Pop $R0
2541    IntCmpU $R0 ${AFS_MAJORVERSION} +1 Upgrade Downgrade
2542
2543    Call GetInstalledVersionMinor
2544    Pop $R0
2545    IntCmpU $R0 ${AFS_MINORVERSION} +1 Upgrade Downgrade
2546    
2547    Call GetInstalledVersionPatch
2548    Pop $R0
2549    IntCmpU $R0 ${AFS_PATCHLEVEL} Reinstall Upgrade Downgrade
2550    
2551 Reinstall:
2552    StrCpy $R0 "1"
2553    Exch $R0
2554    goto end
2555    
2556 Upgrade:
2557    StrCpy $R0 "2"
2558    Exch $R0
2559    goto end
2560    
2561 Downgrade:
2562    StrCpy $R0 "3"
2563    Exch $R0
2564    goto end
2565    
2566 NotInstalled:
2567    StrCpy $R0 "0"
2568    Exch $R0
2569 end:   
2570 FunctionEnd
2571
2572 ;-------------------------------
2573 ; Check how the server options should be set
2574 Function ShouldServerInstall
2575    Push $R0
2576    StrCpy $R2 "AFS Server"
2577    Call GetInstalledVersion
2578    Pop $R0
2579    
2580    StrCmp $R0 "" NotInstalled
2581    ; Now we see if it's an older or newer version
2582
2583    Call GetInstalledVersionMajor
2584    Pop $R0
2585    IntCmpU $R0 ${AFS_MAJORVERSION} +1 Upgrade Downgrade
2586
2587    Call GetInstalledVersionMinor
2588    Pop $R0
2589    IntCmpU $R0 ${AFS_MINORVERSION} +1 Upgrade Downgrade
2590    
2591    Call GetInstalledVersionPatch
2592    Pop $R0
2593    IntCmpU $R0 ${AFS_PATCHLEVEL} Reinstall Upgrade Downgrade
2594    
2595 Reinstall:
2596    StrCpy $R0 "1"
2597    Exch $R0
2598    goto end
2599    
2600 Upgrade:
2601    StrCpy $R0 "2"
2602    Exch $R0
2603    goto end
2604    
2605 Downgrade:
2606    StrCpy $R0 "3"
2607    Exch $R0
2608    goto end
2609    
2610    
2611 NotInstalled:
2612    StrCpy $R0 "0"
2613    Exch $R0
2614 end:   
2615 FunctionEnd
2616
2617
2618 ; See if AFS Server is installed
2619 ; Returns: "1" if it is, 0 if it is not (on the stack)
2620 Function IsServerInstalled
2621    Push $R0
2622    StrCpy $R2 "AFS Server"
2623    Call GetInstalledVersion
2624    Pop $R0
2625    
2626    StrCmp $R0 "" NotInstalled
2627    
2628    StrCpy $R0 "1"
2629    Exch $R0
2630    goto end
2631    
2632 NotInstalled:
2633    StrCpy $R0 "0"
2634    Exch $R0
2635 end:   
2636 FunctionEnd
2637
2638
2639 ; See if AFS Client is installed
2640 ; Returns: "1" if it is, 0 if it is not (on the stack)
2641 Function IsClientInstalled
2642    Push $R0
2643    StrCpy $R2 "AFS Client"
2644    Call GetInstalledVersion
2645    Pop $R0
2646    
2647    StrCmp $R0 "" NotInstalled
2648    
2649    StrCpy $R0 "1"
2650    Exch $R0
2651    goto end
2652    
2653 NotInstalled:
2654    StrCpy $R0 "0"
2655    Exch $R0
2656 end:   
2657 FunctionEnd
2658
2659
2660
2661 ; See if AFS Documentation is installed
2662 ; Returns: "1" if it is, 0 if it is not (on the stack)
2663 Function IsDocumentationInstalled
2664    Push $R0
2665    StrCpy $R2 "AFS Supplemental Documentation"
2666    Call GetInstalledVersion
2667    Pop $R0
2668    
2669    StrCmp $R0 "" NotInstalled
2670    
2671    StrCpy $R0 "1"
2672    Exch $R0
2673    goto end
2674    
2675 NotInstalled:
2676    StrCpy $R0 "0"
2677    Exch $R0
2678 end:   
2679 FunctionEnd
2680
2681
2682 ; See if Control Center is installed
2683 ; Returns: "1" if it is, 0 if it is not (on the stack)
2684 Function IsControlInstalled
2685    Push $R0
2686    StrCpy $R2 "AFS Control Center"
2687    Call GetInstalledVersion
2688    Pop $R0
2689    
2690    StrCmp $R0 "" NotInstalled
2691    
2692    StrCpy $R0 "1"
2693    Exch $R0
2694    goto end
2695    
2696 NotInstalled:
2697    StrCpy $R0 "0"
2698    Exch $R0
2699 end:   
2700 FunctionEnd
2701
2702
2703 !ifdef USE_GETPARAMETERS
2704 ; GetParameters
2705 ; input, none
2706 ; output, top of stack (replaces, with e.g. whatever)
2707 ; modifies no other variables.
2708
2709 Function GetParameters
2710   Push $R0
2711   Push $R1
2712   Push $R2
2713   StrCpy $R0 $CMDLINE 1
2714   StrCpy $R1 '"'
2715   StrCpy $R2 1
2716   StrCmp $R0 '"' loop
2717     StrCpy $R1 ' ' ; we're scanning for a space instead of a quote
2718   loop:
2719     StrCpy $R0 $CMDLINE 1 $R2
2720     StrCmp $R0 $R1 loop2
2721     StrCmp $R0 "" loop2
2722     IntOp $R2 $R2 + 1
2723     Goto loop
2724   loop2:
2725     IntOp $R2 $R2 + 1
2726     StrCpy $R0 $CMDLINE 1 $R2
2727     StrCmp $R0 " " loop2
2728   StrCpy $R0 $CMDLINE "" $R2
2729   Pop $R2
2730   Pop $R1
2731   Exch $R0
2732 FunctionEnd
2733 !endif
2734
2735
2736 ;Check to see if any AFS component is installed
2737 ;Returns: Value on stack: "1" if it is, "0" if it is not
2738 Function IsAnyAFSInstalled
2739    Push $R0
2740    Push $R1
2741    Push $R2
2742    Push $R3
2743    Call IsClientInstalled
2744    Pop $R0
2745    Call IsServerInstalled
2746    Pop $R1
2747    Call IsControlInstalled
2748    Pop $R2
2749    Call IsDocumentationInstalled
2750    Pop $R3
2751    ; Now we must see if ANY of the $Rn values are 1
2752    StrCmp $R0 "1" SomethingInstalled
2753    StrCmp $R1 "1" SomethingInstalled
2754    StrCmp $R2 "1" SomethingInstalled
2755    StrCmp $R3 "1" SomethingInstalled
2756    ;Nothing installed
2757    StrCpy $R0 "0"
2758    goto end
2759 SomethingInstalled:
2760    StrCpy $R0 "1"
2761 end:
2762    Pop $R3
2763    Pop $R2
2764    Pop $R1
2765    Exch $R0
2766 FunctionEnd
2767
2768
2769 ;Install English Language Files
2770 Function AFSLangFiles
2771    ; Common files
2772    SetOutPath "$INSTDIR\Common"
2773    File "${AFS_CLIENT_BUILDDIR}\afs_config.exe"
2774   !insertmacro ReplaceDLL "${AFS_DESTDIR}\lib\afsauthent.dll" "$INSTDIR\Common\afsauthent.dll" "$INSTDIR"
2775   !insertmacro ReplaceDLL "${AFS_DESTDIR}\lib\afspthread.dll" "$INSTDIR\Common\afspthread.dll" "$INSTDIR"
2776   !insertmacro ReplaceDLL "${AFS_DESTDIR}\lib\afsrpc.dll"     "$INSTDIR\Common\afsrpc.dll"     "$INSTDIR"
2777   !insertmacro ReplaceDLL "${AFS_DESTDIR}\lib\libafsconf.dll" "$INSTDIR\Common\libafsconf.dll" "$INSTDIR"
2778   !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afsadminutil.dll"    "$INSTDIR\Common\afsadminutil.dll"    "$INSTDIR"
2779   !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afsclientadmin.dll"  "$INSTDIR\Common\afsclientadmin.dll"  "$INSTDIR" 
2780   !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afsprocmgmt.dll"     "$INSTDIR\Common\afsprocmgmt.dll"     "$INSTDIR" 
2781   !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afsvosadmin.dll"     "$INSTDIR\Common\afsvosadmin.dll"     "$INSTDIR" 
2782   !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\TaAfsAppLib.dll"     "$INSTDIR\Common\TaAfsAppLib.dll"     "$INSTDIR" 
2783   !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afsvosadmin.dll"     "$INSTDIR\Common\afsvosadmin.dll"     "$INSTDIR" 
2784   !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afsbosadmin.dll"     "$INSTDIR\Common\afsbosadmin.dll"     "$INSTDIR" 
2785   !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afscfgadmin.dll"     "$INSTDIR\Common\afscfgadmin.dll"     "$INSTDIR" 
2786   !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afskasadmin.dll"     "$INSTDIR\Common\afskasadmin.dll"     "$INSTDIR" 
2787   !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afsptsadmin.dll"     "$INSTDIR\Common\afsptsadmin.dll"     "$INSTDIR" 
2788
2789  SetOutPath "$INSTDIR\Common"
2790
2791 !IFDEF DEBUG
2792 !IFDEF CL_1500
2793    File /oname=vcruntime.msi "${MSVCMSI}"
2794    nsExec::Exec 'msiexec /i "$INSTDIR\Common\vcruntime.msi" /passive /norestart'
2795    Delete "$INSTDIR\Common\vcruntime.msi"
2796 !ELSE
2797 !IFDEF CL_1400
2798    File /oname=vcruntime.msi "${MSVCMSI}"
2799    nsExec::Exec 'msiexec /i "$INSTDIR\Common\vcruntime.msi" /passive /norestart'
2800    Delete "$INSTDIR\Common\vcruntime.msi"
2801 !ELSE
2802 !IFDEF CL_1310
2803    !insertmacro ReplaceDLL "${SYSTEMDIR}\msvcr71d.dll" "$INSTDIR\Common\msvcr71d.dll" "$INSTDIR"
2804    !insertmacro ReplaceDLL "${SYSTEMDIR}\msvcp71d.dll" "$INSTDIR\Common\msvcp71d.dll" "$INSTDIR"
2805    !insertmacro ReplaceDLL "${SYSTEMDIR}\mfc71d.dll" "$INSTDIR\Common\mfc71d.dll" "$INSTDIR"
2806    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71CHS.DLL" "$INSTDIR\Common\MFC71CHS.DLL" "$INSTDIR"
2807    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71CHT.DLL" "$INSTDIR\Common\MFC71CHT.DLL" "$INSTDIR"
2808    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71DEU.DLL" "$INSTDIR\Common\MFC71DEU.DLL" "$INSTDIR"
2809    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71ENU.DLL" "$INSTDIR\Common\MFC71ENU.DLL" "$INSTDIR"
2810    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71ESP.DLL" "$INSTDIR\Common\MFC71ESP.DLL" "$INSTDIR"
2811    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71FRA.DLL" "$INSTDIR\Common\MFC71FRA.DLL" "$INSTDIR"
2812    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71ITA.DLL" "$INSTDIR\Common\MFC71ITA.DLL" "$INSTDIR"
2813    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71JPN.DLL" "$INSTDIR\Common\MFC71JPN.DLL" "$INSTDIR"
2814    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71KOR.DLL" "$INSTDIR\Common\MFC71KOR.DLL" "$INSTDIR"
2815 !ELSE
2816 !IFDEF CL_1300
2817    !insertmacro ReplaceDLL "${SYSTEMDIR}\msvcr70d.dll" "$INSTDIR\Common\msvcr70d.dll" "$INSTDIR"
2818    !insertmacro ReplaceDLL "${SYSTEMDIR}\msvcp70d.dll" "$INSTDIR\Common\msvcp70d.dll" "$INSTDIR"
2819    !insertmacro ReplaceDLL "${SYSTEMDIR}\mfc70d.dll" "$INSTDIR\Common\mfc70d.dll" "$INSTDIR"
2820    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70CHS.DLL" "$INSTDIR\Common\MFC70CHS.DLL" "$INSTDIR"
2821    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70CHT.DLL" "$INSTDIR\Common\MFC70CHT.DLL" "$INSTDIR"
2822    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70DEU.DLL" "$INSTDIR\Common\MFC70DEU.DLL" "$INSTDIR"
2823    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70ENU.DLL" "$INSTDIR\Common\MFC70ENU.DLL" "$INSTDIR"
2824    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70ESP.DLL" "$INSTDIR\Common\MFC70ESP.DLL" "$INSTDIR"
2825    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70FRA.DLL" "$INSTDIR\Common\MFC70FRA.DLL" "$INSTDIR"
2826    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70ITA.DLL" "$INSTDIR\Common\MFC70ITA.DLL" "$INSTDIR"
2827    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70JPN.DLL" "$INSTDIR\Common\MFC70JPN.DLL" "$INSTDIR"
2828    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70KOR.DLL" "$INSTDIR\Common\MFC70KOR.DLL" "$INSTDIR"
2829 !ELSE
2830    !insertmacro ReplaceDLL "${SYSTEMDIR}\mfc42d.dll" "$INSTDIR\Common\mfc42d.dll" "$INSTDIR"
2831    !insertmacro ReplaceDLL "${SYSTEMDIR}\msvcp60d.dll" "$INSTDIR\Common\msvcp60d.dll" "$INSTDIR"
2832    !insertmacro ReplaceDLL "${SYSTEMDIR}\msvcrtd.dll" "$INSTDIR\Common\msvcrtd.dll" "$INSTDIR"
2833 !ENDIF
2834 !ENDIF
2835 !ENDIF
2836 !ENDIF
2837 !ELSE
2838 !IFDEF CL_1500
2839    File /oname=vcruntime.msi "${MSVCMSI}"
2840    nsExec::Exec 'msiexec /i "$INSTDIR\Common\vcruntime.msi" /passive /norestart'
2841    Delete "$INSTDIR\Common\vcruntime.msi"
2842 !ELSE
2843 !IFDEF CL_1400
2844    File /oname=vcruntime.msi "${MSVCMSI}"
2845    nsExec::Exec 'msiexec /i "$INSTDIR\Common\vcruntime.msi" /passive /norestart'
2846    Delete "$INSTDIR\Common\vcruntime.msi"
2847 !ELSE
2848 !IFDEF CL_1310
2849    !insertmacro ReplaceDLL "${SYSTEMDIR}\mfc71.dll" "$INSTDIR\Common\mfc71.dll" "$INSTDIR"
2850    !insertmacro ReplaceDLL "${SYSTEMDIR}\msvcr71.dll" "$INSTDIR\Common\msvcr71.dll" "$INSTDIR"
2851    !insertmacro ReplaceDLL "${SYSTEMDIR}\msvcp71.dll" "$INSTDIR\Common\msvcp71.dll" "$INSTDIR"
2852    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71CHS.DLL" "$INSTDIR\Common\MFC71CHS.DLL" "$INSTDIR"
2853    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71CHT.DLL" "$INSTDIR\Common\MFC71CHT.DLL" "$INSTDIR"
2854    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71DEU.DLL" "$INSTDIR\Common\MFC71DEU.DLL" "$INSTDIR"
2855    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71ENU.DLL" "$INSTDIR\Common\MFC71ENU.DLL" "$INSTDIR"
2856    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71ESP.DLL" "$INSTDIR\Common\MFC71ESP.DLL" "$INSTDIR"
2857    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71FRA.DLL" "$INSTDIR\Common\MFC71FRA.DLL" "$INSTDIR"
2858    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71ITA.DLL" "$INSTDIR\Common\MFC71ITA.DLL" "$INSTDIR"
2859    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71JPN.DLL" "$INSTDIR\Common\MFC71JPN.DLL" "$INSTDIR"
2860    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71KOR.DLL" "$INSTDIR\Common\MFC71KOR.DLL" "$INSTDIR"
2861 !ELSE
2862 !IFDEF CL_1300
2863    !insertmacro ReplaceDLL "${SYSTEMDIR}\mfc70.dll" "$INSTDIR\Common\mfc70.dll" "$INSTDIR"
2864    !insertmacro ReplaceDLL "${SYSTEMDIR}\msvcr70.dll" "$INSTDIR\Common\msvcr70.dll" "$INSTDIR"
2865    !insertmacro ReplaceDLL "${SYSTEMDIR}\msvcp70.dll" "$INSTDIR\Common\msvcp70.dll" "$INSTDIR"
2866    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70CHS.DLL" "$INSTDIR\Common\MFC70CHS.DLL" "$INSTDIR"
2867    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70CHT.DLL" "$INSTDIR\Common\MFC70CHT.DLL" "$INSTDIR"
2868    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70DEU.DLL" "$INSTDIR\Common\MFC70DEU.DLL" "$INSTDIR"
2869    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70ENU.DLL" "$INSTDIR\Common\MFC70ENU.DLL" "$INSTDIR"
2870    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70ESP.DLL" "$INSTDIR\Common\MFC70ESP.DLL" "$INSTDIR"
2871    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70FRA.DLL" "$INSTDIR\Common\MFC70FRA.DLL" "$INSTDIR"
2872    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70ITA.DLL" "$INSTDIR\Common\MFC70ITA.DLL" "$INSTDIR"
2873    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70JPN.DLL" "$INSTDIR\Common\MFC70JPN.DLL" "$INSTDIR"
2874    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70KOR.DLL" "$INSTDIR\Common\MFC70KOR.DLL" "$INSTDIR"
2875 !ELSE
2876    !insertmacro ReplaceDLL "${SYSTEMDIR}\mfc42.dll" "$INSTDIR\Common\mfc42.dll" "$INSTDIR"
2877    !insertmacro ReplaceDLL "${SYSTEMDIR}\msvcp60.dll" "$INSTDIR\Common\msvcp60.dll" "$INSTDIR"
2878    !insertmacro ReplaceDLL "${SYSTEMDIR}\msvcrt.dll" "$INSTDIR\Common\msvcrt.dll" "$INSTDIR"
2879 !ENDIF
2880 !ENDIF
2881 !ENDIF   
2882 !ENDIF
2883 !ENDIF
2884
2885    ; Cleanup old documentation as the file names may have changed
2886    DELETE "$SMPROGRAMS\OpenAFS\Documentation.lnk"
2887    RMDIR /R "$INSTDIR\Documentation"
2888
2889    StrCmp $LANGUAGE ${LANG_ENGLISH} DoEnglish
2890    StrCmp $LANGUAGE ${LANG_GERMAN} DoGerman
2891    StrCmp $LANGUAGE ${LANG_SPANISH} DoSpanish
2892    StrCmp $LANGUAGE ${LANG_JAPANESE} DoJapanese
2893    StrCmp $LANGUAGE ${LANG_KOREAN} DoKorean
2894    StrCmp $LANGUAGE ${LANG_PORTUGUESEBR} DoPortugueseBR
2895    StrCmp $LANGUAGE ${LANG_SIMPCHINESE} DoSimpChinese
2896    StrCmp $LANGUAGE ${LANG_TRADCHINESE} DoTradChinese
2897    
2898 DoEnglish:
2899
2900    SetOutPath "$INSTDIR\Documentation"
2901    File /oname=ReleaseNotes.chm "..\..\..\..\doc\xml\ReleaseNotesWindows\htmlhelp.chm"
2902
2903    CreateDirectory "$SMPROGRAMS\OpenAFS\Documentation"
2904    CreateShortCut "$SMPROGRAMS\OpenAFS\Documentation\Release Notes.lnk" "$INSTDIR\Documentation\ReleaseNotes.chm"
2905
2906    SetOutPath "$INSTDIR\Client\Program"
2907    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afscreds_1033.dll"    "$INSTDIR\Client\Program\afscreds_1033.dll" "$INSTDIR"
2908    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afs_shl_ext_1033.dll" "$INSTDIR\Client\Program\afs_shl_ext_1033.dll" "$INSTDIR"
2909 !ifdef DEBUG
2910    ;File "${AFS_CLIENT_BUILDDIR}\afs_shl_ext_1033.pdb"
2911    ;File "${AFS_CLIENT_BUILDDIR}\afscreds_1033.pdb"
2912 !endif
2913
2914    File "..\..\doc\help\en_US\afs-light.CNT"
2915    File "..\..\doc\help\en_US\afs-light.hlp"
2916    File "..\..\doc\help\en_US\afs-nt.CNT"
2917    File "..\..\doc\help\en_US\afs-nt.HLP"
2918
2919    SetOutPath "$INSTDIR\Common"
2920    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afs_config_1033.dll"           "$INSTDIR\Common\afs_config_1033.dll" "$INSTDIR"
2921    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afs_cpa_1033.dll"              "$INSTDIR\Common\afs_cpa_1033.dll" "$INSTDIR"
2922    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afseventmsg_1033.dll"          "$INSTDIR\Common\afseventmsg_1033.dll" "$INSTDIR"
2923   ;!insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afs_setup_utils_1033.dll"      "$INSTDIR\Common\afs_setup_utils_1033.dll" "$INSTDIR"
2924    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afsserver_1033.dll"            "$INSTDIR\Common\afsserver_1033.dll" "$INSTDIR"
2925    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afssvrcfg_1033.dll"            "$INSTDIR\Common\afssvrcfg_1033.dll" "$INSTDIR"
2926    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\TaAfsAccountManager_1033.dll"  "$INSTDIR\Common\TaAfsAccountManager_1033.dll" "$INSTDIR"
2927    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\TaAfsAppLib_1033.dll"          "$INSTDIR\Common\TaAfsAppLib_1033.dll" "$INSTDIR"
2928    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\TaAfsServerManager_1033.dll"   "$INSTDIR\Common\TaAfsServerManager_1033.dll" "$INSTDIR"
2929    File "..\..\doc\help\en_US\afs-cc.CNT"
2930    File "..\..\doc\help\en_US\afs-cc.hlp"
2931    File "..\..\doc\help\en_US\taafscfg.CNT"
2932    File "..\..\doc\help\en_US\taafscfg.hlp"
2933    File "..\..\doc\help\en_US\taafssvrmgr.CNT"
2934    File "..\..\doc\help\en_US\taafssvrmgr.hlp"
2935    File "..\..\doc\help\en_US\taafsusrmgr.CNT"
2936    File "..\..\doc\help\en_US\taafsusrmgr.hlp"
2937
2938 !ifdef DEBUG
2939    ;File "${AFS_CLIENT_BUILDDIR}\afs_config_1033.pdb"
2940    ;File "${AFS_CLIENT_BUILDDIR}\afs_cpa_1033.pdb"
2941    ;File "${AFS_SERVER_BUILDDIR}\afseventmsg_1033.pdb"
2942    ;File "${AFS_SERVER_BUILDDIR}\afsserver_1033.pdb"
2943    ;File "${AFS_SERVER_BUILDDIR}\afssvrcfg_1033.pdb"
2944    ;File "${AFS_SERVER_BUILDDIR}\TaAfsAccountManager_1033.pdb"
2945    ;File "${AFS_SERVER_BUILDDIR}\TaAfsAppLib_1033.pdb"
2946    ;File "${AFS_SERVER_BUILDDIR}\TaAfsServerManager_1033.pdb"
2947 !ENDIF
2948    goto done
2949
2950 DoGerman:
2951
2952    SetOutPath "$INSTDIR\Documentation"
2953    File "..\..\doc\install\Documentation\de_DE\README.TXT"
2954    SetOutPath "$INSTDIR\Documentation\html"
2955    File "..\..\doc\install\Documentation\de_DE\html\*"
2956    SetOutPath "$INSTDIR\Documentation\html\index_files"
2957    ;File "..\..\doc\install\Documentation\de_DE\html\index_files\*"
2958    SetOutPath "$INSTDIR\Documentation\html\InstallGd"
2959    File "..\..\doc\install\Documentation\de_DE\html\InstallGd\*"
2960    ;SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes"
2961    ;File "..\..\doc\install\Documentation\de_DE\html\ReleaseNotes\*"
2962    ;SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes\logo_files"
2963    ;File "..\..\doc\install\Documentation\de_DE\html\ReleaseNotes\logo_files\*"
2964    ;SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes\relnotes_files"
2965    ;File "..\..\doc\install\Documentation\de_DE\html\ReleaseNotes\relnotes_files\*"
2966
2967    SetOutPath "$INSTDIR\Client\Program"
2968   !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afscreds_1032.dll"                      "$INSTDIR\Client\Program\afscreds_1032.dll" "$INSTDIR"
2969   !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afs_shl_ext_1032.dll" "$INSTDIR\Client\Program\afs_shl_ext_1032.dll" "$INSTDIR"
2970 !ifdef DEBUG
2971    ;File "${AFS_CLIENT_BUILDDIR}\afs_shl_ext_1032.pdb"
2972    ;File "${AFS_CLIENT_BUILDDIR}\afscreds_1032.pdb"
2973 !endif
2974
2975    File "..\..\doc\help\de_DE\afs-light.CNT"
2976    File "..\..\doc\help\de_DE\afs-light.hlp"
2977    File "..\..\doc\help\de_DE\afs-nt.CNT"
2978    File "..\..\doc\help\de_DE\afs-nt.HLP"
2979
2980    SetOutPath "$INSTDIR\Common"
2981    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afs_config_1032.dll"           "$INSTDIR\Common\afs_config_1032.dll" "$INSTDIR"
2982    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afs_cpa_1032.dll"              "$INSTDIR\Common\afs_cpa_1032.dll" "$INSTDIR" 
2983    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afseventmsg_1032.dll"          "$INSTDIR\Common\afseventmsg_1032.dll" "$INSTDIR" 
2984   ;!insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afs_setup_utils_1032.dll"      "$INSTDIR\Common\afs_setup_utils_1032.dll" "$INSTDIR" 
2985    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afsserver_1032.dll"            "$INSTDIR\Common\afsserver_1032.dll" "$INSTDIR" 
2986    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afssvrcfg_1032.dll"            "$INSTDIR\Common\afssvrcfg_1032.dll" "$INSTDIR" 
2987    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\TaAfsAccountManager_1032.dll"  "$INSTDIR\Common\TaAfsAccountManager_1032.dll" "$INSTDIR" 
2988    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\TaAfsAppLib_1032.dll"          "$INSTDIR\Common\TaAfsAppLib_1032.dll" "$INSTDIR" 
2989    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\TaAfsServerManager_1032.dll"   "$INSTDIR\Common\TaAfsServerManager_1032.dll" "$INSTDIR" 
2990    File "..\..\doc\help\de_DE\afs-cc.CNT"
2991    File "..\..\doc\help\de_DE\afs-cc.hlp"
2992    File "..\..\doc\help\de_DE\taafscfg.CNT"
2993    File "..\..\doc\help\de_DE\taafscfg.hlp"
2994    File "..\..\doc\help\de_DE\taafssvrmgr.CNT"
2995    File "..\..\doc\help\de_DE\taafssvrmgr.hlp"
2996    File "..\..\doc\help\de_DE\taafsusrmgr.CNT"
2997    File "..\..\doc\help\de_DE\taafsusrmgr.hlp"
2998
2999 !ifdef DEBUG
3000    ;File "${AFS_CLIENT_BUILDDIR}\afs_config_1032.pdb"
3001    ;File "${AFS_CLIENT_BUILDDIR}\afs_cpa_1032.pdb"
3002    ;File "${AFS_SERVER_BUILDDIR}\afseventmsg_1032.pdb"
3003    ;File "${AFS_SERVER_BUILDDIR}\afsserver_1032.pdb"
3004    ;File "${AFS_SERVER_BUILDDIR}\afssvrcfg_1032.pdb"
3005    ;File "${AFS_SERVER_BUILDDIR}\TaAfsAccountManager_1032.pdb"
3006    ;File "${AFS_SERVER_BUILDDIR}\TaAfsAppLib_1032.pdb"
3007    ;File "${AFS_SERVER_BUILDDIR}\TaAfsServerManager_1032.pdb"
3008 !ENDIF
3009    goto done   
3010
3011 DoSpanish:
3012
3013    SetOutPath "$INSTDIR\Documentation"
3014    File "..\..\doc\install\Documentation\es_ES\README.TXT"
3015    SetOutPath "$INSTDIR\Documentation\html"
3016    ;File "..\..\doc\install\Documentation\es_ES\html\*"
3017    SetOutPath "$INSTDIR\Documentation\html\index_html"
3018    ;File "..\..\doc\install\Documentation\es_ES\html\index_files\*"
3019    SetOutPath "$INSTDIR\Documentation\html\InstallGd"
3020    ;File "..\..\doc\install\Documentation\es_ES\html\InstallGd\*"
3021    SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes"
3022    ;File "..\..\doc\install\Documentation\es_ES\html\ReleaseNotes\*"
3023    SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes\logo_files"
3024    ;File "..\..\doc\install\Documentation\es_ES\html\ReleaseNotes\logo_files\*"
3025    SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes\relnotes_files"
3026    ;File "..\..\doc\install\Documentation\es_ES\html\ReleaseNotes\relnotes_files\*"
3027
3028    SetOutPath "$INSTDIR\Client\Program"
3029    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afscreds_1034.dll"     "$INSTDIR\Client\Program\afscreds_1034.dll" "$INSTDIR" 
3030    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afs_shl_ext_1034.dll" "$INSTDIR\Client\Program\afs_shl_ext_1034.dll" "$INSTDIR"
3031 !ifdef DEBUG
3032    ;File "${AFS_CLIENT_BUILDDIR}\afscreds_1034.pdb"
3033    ;File "${AFS_CLIENT_BUILDDIR}\afs_shl_ext_1034.pdb"
3034 !endif
3035
3036    File "..\..\doc\help\es_ES\afs-light.CNT"
3037    File "..\..\doc\help\es_ES\afs-light.hlp"
3038    File "..\..\doc\help\es_ES\afs-nt.CNT"
3039    File "..\..\doc\help\es_ES\afs-nt.HLP"
3040
3041    SetOutPath "$INSTDIR\Common"
3042    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afs_config_1034.dll"          "$INSTDIR\Common\afs_config_1034.dll" "$INSTDIR"  
3043    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afs_cpa_1034.dll"             "$INSTDIR\Common\afs_cpa_1034.dll" "$INSTDIR"  
3044    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afseventmsg_1034.dll"         "$INSTDIR\Common\afseventmsg_1034.dll" "$INSTDIR"  
3045   ;!insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afs_setup_utils_1034.dll"     "$INSTDIR\Common\afs_setup_utils_1034.dll" "$INSTDIR"  
3046    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afsserver_1034.dll"           "$INSTDIR\Common\afsserver_1034.dll" "$INSTDIR"  
3047    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afssvrcfg_1034.dll"           "$INSTDIR\Common\afssvrcfg_1034.dll" "$INSTDIR"  
3048    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\TaAfsAccountManager_1034.dll" "$INSTDIR\Common\TaAfsAccountManager_1034.dll" "$INSTDIR"  
3049    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\TaAfsAppLib_1034.dll"         "$INSTDIR\Common\TaAfsAppLib_1034.dll" "$INSTDIR"  
3050    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\TaAfsServerManager_1034.dll"  "$INSTDIR\Common\TaAfsServerManager_1034.dll" "$INSTDIR"  
3051    File "..\..\doc\help\es_ES\afs-cc.CNT"
3052    File "..\..\doc\help\es_ES\afs-cc.hlp"
3053    File "..\..\doc\help\es_ES\taafscfg.CNT"
3054    File "..\..\doc\help\es_ES\taafscfg.hlp"
3055    File "..\..\doc\help\es_ES\taafssvrmgr.CNT"
3056    File "..\..\doc\help\es_ES\taafssvrmgr.hlp"
3057    File "..\..\doc\help\es_ES\taafsusrmgr.CNT"
3058    File "..\..\doc\help\es_ES\taafsusrmgr.hlp"
3059
3060 !ifdef DEBUG
3061    ;File "${AFS_CLIENT_BUILDDIR}\afs_config_1034.pdb"
3062    ;File "${AFS_CLIENT_BUILDDIR}\afs_cpa_1034.pdb"
3063    ;File "${AFS_SERVER_BUILDDIR}\afseventmsg_1034.pdb"
3064    ;File "${AFS_SERVER_BUILDDIR}\afsserver_1034.pdb"
3065    ;File "${AFS_SERVER_BUILDDIR}\afssvrcfg_1034.pdb"
3066    ;File "${AFS_SERVER_BUILDDIR}\TaAfsAccountManager_1034.pdb"
3067    ;File "${AFS_SERVER_BUILDDIR}\TaAfsAppLib_1034.pdb"
3068    ;File "${AFS_SERVER_BUILDDIR}\TaAfsServerManager_1034.pdb"
3069 !ENDIF
3070    goto done
3071
3072 DoJapanese:
3073
3074    SetOutPath "$INSTDIR\Documentation"
3075    File "..\..\doc\install\Documentation\ja_JP\README.TXT"
3076    SetOutPath "$INSTDIR\Documentation\html"
3077    File "..\..\doc\install\Documentation\ja_JP\html\*"
3078    SetOutPath "$INSTDIR\Documentation\html\index_files"
3079    ;File "..\..\doc\install\Documentation\ja_JP\html\index_files\*"
3080    SetOutPath "$INSTDIR\Documentation\html\InstallGd"
3081    File "..\..\doc\install\Documentation\ja_JP\html\InstallGd\*"
3082    SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes"
3083    ;File "..\..\doc\install\Documentation\ja_JP\html\ReleaseNotes\*"
3084    SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes\logo_files"
3085    ;File "..\..\doc\install\Documentation\ja_JP\html\ReleaseNotes\logo_files\*"
3086    SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes\relnotes_files"
3087    ;File "..\..\doc\install\Documentation\ja_JP\html\ReleaseNotes\relnotes_files\*"
3088
3089    SetOutPath "$INSTDIR\Client\Program"
3090    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afscreds_1041.dll"  "$INSTDIR\Client\Program\afscreds_1041.dll" "$INSTDIR"  
3091    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afs_shl_ext_1041.dll" "$INSTDIR\Client\Program\afs_shl_ext_1041.dll" "$INSTDIR"
3092 !ifdef DEBUG
3093    ;File "${AFS_CLIENT_BUILDDIR}\afscreds_1041.pdb"
3094    ;File "${AFS_CLIENT_BUILDDIR}\afs_shl_ext_1041.pdb"
3095 !endif
3096
3097    File "..\..\doc\help\ja_JP\afs-light.CNT"
3098    File "..\..\doc\help\ja_JP\afs-light.hlp"
3099    File "..\..\doc\help\ja_JP\afs-nt.CNT"
3100    File "..\..\doc\help\ja_JP\afs-nt.HLP"
3101
3102    SetOutPath "$INSTDIR\Common"
3103    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afs_config_1041.dll"           "$INSTDIR\Common\afs_config_1041.dll" "$INSTDIR"   
3104    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afs_cpa_1041.dll"              "$INSTDIR\Common\afs_cpa_1041.dll" "$INSTDIR"   
3105    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afseventmsg_1041.dll"          "$INSTDIR\Common\afseventmsg_1041.dll" "$INSTDIR"   
3106   ;!insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afs_setup_utils_1041.dll"      "$INSTDIR\Common\afs_setup_utils_1041.dll" "$INSTDIR"   
3107    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afsserver_1041.dll"            "$INSTDIR\Common\afsserver_1041.dll" "$INSTDIR"   
3108    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afssvrcfg_1041.dll"            "$INSTDIR\Common\afssvrcfg_1041.dll" "$INSTDIR"   
3109    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\TaAfsAccountManager_1041.dll"  "$INSTDIR\Common\TaAfsAccountManager_1041.dll" "$INSTDIR"   
3110    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\TaAfsAppLib_1041.dll"          "$INSTDIR\Common\TaAfsAppLib_1041.dll" "$INSTDIR"   
3111    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\TaAfsServerManager_1041.dll"   "$INSTDIR\Common\TaAfsServerManager_1041.dll" "$INSTDIR"   
3112    File "..\..\doc\help\ja_JP\afs-cc.CNT"
3113    File "..\..\doc\help\ja_JP\afs-cc.hlp"
3114    File "..\..\doc\help\ja_JP\taafscfg.CNT"
3115    File "..\..\doc\help\ja_JP\taafscfg.hlp"
3116    File "..\..\doc\help\ja_JP\taafssvrmgr.CNT"
3117    File "..\..\doc\help\ja_JP\taafssvrmgr.hlp"
3118    File "..\..\doc\help\ja_JP\taafsusrmgr.CNT"
3119    File "..\..\doc\help\ja_JP\taafsusrmgr.hlp"
3120
3121 !ifdef DEBUG
3122    ;File "${AFS_CLIENT_BUILDDIR}\afs_config_1041.pdb"
3123    ;File "${AFS_CLIENT_BUILDDIR}\afs_cpa_1041.pdb"
3124    ;File "${AFS_SERVER_BUILDDIR}\afseventmsg_1041.pdb"
3125    ;File "${AFS_SERVER_BUILDDIR}\afsserver_1041.pdb"
3126    ;File "${AFS_SERVER_BUILDDIR}\afssvrcfg_1041.pdb"
3127    ;File "${AFS_SERVER_BUILDDIR}\TaAfsAccountManager_1041.pdb"
3128    ;File "${AFS_SERVER_BUILDDIR}\TaAfsAppLib_1041.pdb"
3129    ;File "${AFS_SERVER_BUILDDIR}\TaAfsServerManager_1041.pdb"
3130 !ENDIF
3131    goto done
3132    
3133 DoKorean:
3134
3135    SetOutPath "$INSTDIR\Documentation"
3136    File "..\..\doc\install\Documentation\ko_KR\README.TXT"
3137    SetOutPath "$INSTDIR\Documentation\html"
3138    File "..\..\doc\install\Documentation\ko_KR\html\*"
3139    SetOutPath "$INSTDIR\Documentation\html\index_files"
3140    ;File "..\..\doc\install\Documentation\ko_KR\html\index_files\*"
3141    SetOutPath "$INSTDIR\Documentation\html\InstallGd"
3142    File "..\..\doc\install\Documentation\ko_KR\html\InstallGd\*"
3143    SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes"
3144    File "..\..\doc\install\Documentation\ko_KR\html\ReleaseNotes\*"
3145    SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes\logo_files"
3146    ;File "..\..\doc\install\Documentation\ko_KR\html\ReleaseNotes\logo_files\*"
3147    SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes\relnotes_files"
3148    ;File "..\..\doc\install\Documentation\ko_KR\html\ReleaseNotes\relnotes_files\*"
3149
3150    SetOutPath "$INSTDIR\Client\Program"
3151    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afscreds_1042.dll"  "$INSTDIR\Client\Program\afscreds_1042.dll" "$INSTDIR"   
3152    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afs_shl_ext_1042.dll" "$INSTDIR\Client\Program\afs_shl_ext_1042.dll" "$INSTDIR"
3153 !ifdef DEBUG
3154    ;File "${AFS_CLIENT_BUILDDIR}\afscreds_1042.pdb"
3155    ;File "${AFS_CLIENT_BUILDDIR}\afs_shl_ext_1042.pdb"
3156 !endif
3157
3158    File "..\..\doc\help\ko_KR\afs-light.CNT"
3159    File "..\..\doc\help\ko_KR\afs-light.hlp"
3160    File "..\..\doc\help\ko_KR\afs-nt.CNT"
3161    File "..\..\doc\help\ko_KR\afs-nt.HLP"
3162
3163    SetOutPath "$INSTDIR\Common"
3164    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afs_config_1042.dll"           "$INSTDIR\Common\afs_config_1042.dll" "$INSTDIR"    
3165    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afs_cpa_1042.dll"              "$INSTDIR\Common\afs_cpa_1042.dll" "$INSTDIR"    
3166    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afseventmsg_1042.dll"          "$INSTDIR\Common\afseventmsg_1042.dll" "$INSTDIR"    
3167   ;!insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afs_setup_utils_1042.dll"      "$INSTDIR\Common\afs_setup_utils_1042.dll" "$INSTDIR"    
3168    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afsserver_1042.dll"            "$INSTDIR\Common\afsserver_1042.dll" "$INSTDIR"    
3169    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afssvrcfg_1042.dll"            "$INSTDIR\Common\afssvrcfg_1042.dll" "$INSTDIR"    
3170    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\TaAfsAccountManager_1042.dll"  "$INSTDIR\Common\TaAfsAccountManager_1042.dll" "$INSTDIR"    
3171    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\TaAfsAppLib_1042.dll"          "$INSTDIR\Common\TaAfsAppLib_1042.dll" "$INSTDIR"    
3172    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\TaAfsServerManager_1042.dll"   "$INSTDIR\Common\TaAfsServerManager_1042.dll" "$INSTDIR"    
3173    File "..\..\doc\help\ko_KR\afs-cc.CNT"
3174    File "..\..\doc\help\ko_KR\afs-cc.hlp"
3175    File "..\..\doc\help\ko_KR\taafscfg.CNT"
3176    File "..\..\doc\help\ko_KR\taafscfg.hlp"
3177    File "..\..\doc\help\ko_KR\taafssvrmgr.CNT"
3178    File "..\..\doc\help\ko_KR\taafssvrmgr.hlp"
3179    File "..\..\doc\help\ko_KR\taafsusrmgr.CNT"
3180    File "..\..\doc\help\ko_KR\taafsusrmgr.hlp"
3181
3182 !ifdef DEBUG
3183    ;File "${AFS_CLIENT_BUILDDIR}\afs_config_1042.pdb"
3184    ;File "${AFS_CLIENT_BUILDDIR}\afs_cpa_1042.pdb"
3185    ;File "${AFS_SERVER_BUILDDIR}\afseventmsg_1042.pdb"
3186    ;File "${AFS_SERVER_BUILDDIR}\afsserver_1042.pdb"
3187    ;File "${AFS_SERVER_BUILDDIR}\afssvrcfg_1042.pdb"
3188    ;File "${AFS_SERVER_BUILDDIR}\TaAfsAccountManager_1042.pdb"
3189    ;File "${AFS_SERVER_BUILDDIR}\TaAfsAppLib_1042.pdb"
3190    ;File "${AFS_SERVER_BUILDDIR}\TaAfsServerManager_1042.pdb"
3191 !ENDIF
3192    goto done
3193
3194
3195 DoPortugueseBR:
3196
3197    SetOutPath "$INSTDIR\Documentation"
3198    File "..\..\doc\install\Documentation\pt_BR\README.TXT"
3199    SetOutPath "$INSTDIR\Documentation\html"
3200    File "..\..\doc\install\Documentation\pt_BR\html\*"
3201    SetOutPath "$INSTDIR\Documentation\html\index_files"
3202    ;File "..\..\doc\install\Documentation\pt_BR\html\index_files\*"
3203    SetOutPath "$INSTDIR\Documentation\html\InstallGd"
3204    File "..\..\doc\install\Documentation\pt_BR\html\InstallGd\*"
3205    SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes"
3206    File "..\..\doc\install\Documentation\pt_BR\html\ReleaseNotes\*"
3207    SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes\logo_files"
3208    ;File "..\..\doc\install\Documentation\pt_BR\html\ReleaseNotes\logo_files\*"
3209    SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes\relnotes_files"
3210    ;File "..\..\doc\install\Documentation\pt_BR\html\ReleaseNotes\relnotes_files\*"
3211
3212    SetOutPath "$INSTDIR\Client\Program"
3213    !insertmacro ReplaceDLL  "${AFS_CLIENT_BUILDDIR}\afscreds_1046.dll"  "$INSTDIR\Client\Program\afscreds_1046.dll" "$INSTDIR"    
3214    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afs_shl_ext_1046.dll" "$INSTDIR\Client\Program\afs_shl_ext_1046.dll" "$INSTDIR"
3215 !ifdef DEBUG
3216    ;File "${AFS_CLIENT_BUILDDIR}\afscreds_1046.pdb"
3217    ;File "${AFS_CLIENT_BUILDDIR}\afs_shl_ext_1046.pdb"
3218 !endif
3219
3220    File "..\..\doc\help\pt_BR\afs-light.CNT"
3221    File "..\..\doc\help\pt_BR\afs-light.hlp"
3222    File "..\..\doc\help\pt_BR\afs-nt.CNT"
3223    File "..\..\doc\help\pt_BR\afs-nt.HLP"
3224
3225    SetOutPath "$INSTDIR\Common"
3226    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afs_config_1046.dll"           "$INSTDIR\Common\afs_config_1046.dll" "$INSTDIR"     
3227    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afs_cpa_1046.dll"              "$INSTDIR\Common\afs_cpa_1046.dll" "$INSTDIR"     
3228    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afseventmsg_1046.dll"          "$INSTDIR\Common\afseventmsg_1046.dll" "$INSTDIR"     
3229   ;!insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afs_setup_utils_1046.dll"      "$INSTDIR\Common\afs_setup_utils_1046.dll" "$INSTDIR"     
3230    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afsserver_1046.dll"            "$INSTDIR\Common\afsserver_1046.dll" "$INSTDIR"     
3231    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afssvrcfg_1046.dll"            "$INSTDIR\Common\afssvrcfg_1046.dll" "$INSTDIR"     
3232    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\TaAfsAccountManager_1046.dll"  "$INSTDIR\Common\TaAfsAccountManager_1046.dll" "$INSTDIR"     
3233    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\TaAfsAppLib_1046.dll"          "$INSTDIR\Common\TaAfsAppLib_1046.dll" "$INSTDIR"     
3234    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\TaAfsServerManager_1046.dll"   "$INSTDIR\Common\TaAfsServerManager_1046.dll" "$INSTDIR"     
3235    File "..\..\doc\help\pt_BR\afs-cc.CNT"
3236    File "..\..\doc\help\pt_BR\afs-cc.hlp"
3237    File "..\..\doc\help\pt_BR\taafscfg.CNT"
3238    File "..\..\doc\help\pt_BR\taafscfg.hlp"
3239    File "..\..\doc\help\pt_BR\taafssvrmgr.CNT"
3240    File "..\..\doc\help\pt_BR\taafssvrmgr.hlp"
3241    File "..\..\doc\help\pt_BR\taafsusrmgr.CNT"
3242    File "..\..\doc\help\pt_BR\taafsusrmgr.hlp"
3243
3244 !ifdef DEBUG
3245    ;File "${AFS_CLIENT_BUILDDIR}\afs_config_1046.pdb"
3246    ;File "${AFS_CLIENT_BUILDDIR}\afs_cpa_1046.pdb"
3247    ;File "${AFS_SERVER_BUILDDIR}\afseventmsg_1046.pdb"
3248    ;File "${AFS_SERVER_BUILDDIR}\afsserver_1046.pdb"
3249    ;File "${AFS_SERVER_BUILDDIR}\afssvrcfg_1046.pdb"
3250    ;File "${AFS_SERVER_BUILDDIR}\TaAfsAccountManager_1046.pdb"
3251    ;File "${AFS_SERVER_BUILDDIR}\TaAfsAppLib_1046.pdb"
3252    ;File "${AFS_SERVER_BUILDDIR}\TaAfsServerManager_1046.pdb"
3253 !ENDIF
3254    goto done
3255    
3256 DoSimpChinese:
3257
3258    SetOutPath "$INSTDIR\Documentation"
3259    File "..\..\doc\install\Documentation\zh_CN\README.TXT"
3260    SetOutPath "$INSTDIR\Documentation\html"
3261    File "..\..\doc\install\Documentation\zh_CN\html\*"
3262    SetOutPath "$INSTDIR\Documentation\html\index_files"
3263    ;File "..\..\doc\install\Documentation\zh_CN\html\index_files\*"
3264    SetOutPath "$INSTDIR\Documentation\html\InstallGd"
3265    File "..\..\doc\install\Documentation\zh_CN\html\InstallGd\*"
3266    SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes"
3267    File "..\..\doc\install\Documentation\zh_CN\html\ReleaseNotes\*"
3268    SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes\logo_files"
3269    ;File "..\..\doc\install\Documentation\zh_CN\html\ReleaseNotes\logo_files\*"
3270    SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes\relnotes_files"
3271    ;File "..\..\doc\install\Documentation\zh_CN\html\ReleaseNotes\relnotes_files\*"
3272
3273    SetOutPath "$INSTDIR\Client\Program"
3274    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afscreds_2052.dll"   "$INSTDIR\Client\Program\afscreds_2052.dll" "$INSTDIR"     
3275    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afs_shl_ext_2052.dll" "$INSTDIR\Client\Program\afs_shl_ext_2052.dll" "$INSTDIR"
3276 !ifdef DEBUG
3277    ;File "${AFS_CLIENT_BUILDDIR}\afscreds_2052.pdb"
3278    ;File "${AFS_CLIENT_BUILDDIR}\afs_shl_ext_2052.pdb"
3279 !endif
3280
3281    File "..\..\doc\help\zh_CN\afs-light.CNT"
3282    File "..\..\doc\help\zh_CN\afs-light.hlp"
3283    File "..\..\doc\help\zh_CN\afs-nt.CNT"
3284    File "..\..\doc\help\zh_CN\afs-nt.HLP"
3285
3286    SetOutPath "$INSTDIR\Common"
3287    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afs_config_2052.dll"           "$INSTDIR\Common\afs_config_2052.dll" "$INSTDIR"      
3288    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afs_cpa_2052.dll"              "$INSTDIR\Common\afs_cpa_2052.dll" "$INSTDIR"      
3289    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afseventmsg_2052.dll"          "$INSTDIR\Common\afseventmsg_2052.dll" "$INSTDIR"      
3290   ;!insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afs_setup_utils_2052.dll"      "$INSTDIR\Common\afs_setup_utils_2052.dll" "$INSTDIR"      
3291    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afsserver_2052.dll"            "$INSTDIR\Common\afsserver_2052.dll" "$INSTDIR"      
3292    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afssvrcfg_2052.dll"            "$INSTDIR\Common\afssvrcfg_2052.dll" "$INSTDIR"      
3293    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\TaAfsAccountManager_2052.dll"  "$INSTDIR\Common\TaAfsAccountManager_2052.dll" "$INSTDIR"      
3294    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\TaAfsAppLib_2052.dll"          "$INSTDIR\Common\TaAfsAppLib_2052.dll" "$INSTDIR"      
3295    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\TaAfsServerManager_2052.dll"   "$INSTDIR\Common\TaAfsServerManager_2052.dll" "$INSTDIR"      
3296    File "..\..\doc\help\zh_CN\afs-cc.CNT"
3297    File "..\..\doc\help\zh_CN\afs-cc.hlp"
3298    File "..\..\doc\help\zh_CN\taafscfg.CNT"
3299    File "..\..\doc\help\zh_CN\taafscfg.hlp"
3300    File "..\..\doc\help\zh_CN\taafssvrmgr.CNT"
3301    File "..\..\doc\help\zh_CN\taafssvrmgr.hlp"
3302    File "..\..\doc\help\zh_CN\taafsusrmgr.CNT"
3303    File "..\..\doc\help\zh_CN\taafsusrmgr.hlp"
3304
3305 !ifdef DEBUG
3306    ;File "${AFS_CLIENT_BUILDDIR}\afs_config_2052.pdb"
3307    ;File "${AFS_CLIENT_BUILDDIR}\afs_cpa_2052.pdb"
3308    ;File "${AFS_SERVER_BUILDDIR}\afseventmsg_2052.pdb"
3309    ;File "${AFS_SERVER_BUILDDIR}\afsserver_2052.pdb"
3310    ;File "${AFS_SERVER_BUILDDIR}\afssvrcfg_2052.pdb"
3311    ;File "${AFS_SERVER_BUILDDIR}\TaAfsAccountManager_2052.pdb"
3312    ;File "${AFS_SERVER_BUILDDIR}\TaAfsAppLib_2052.pdb"
3313    ;File "${AFS_SERVER_BUILDDIR}\TaAfsServerManager_2052.pdb"
3314 !ENDIF
3315    goto done
3316    
3317 DoTradChinese:
3318
3319    SetOutPath "$INSTDIR\Documentation"
3320    File "..\..\doc\install\Documentation\zh_TW\README.TXT"
3321    SetOutPath "$INSTDIR\Documentation\html"
3322    File "..\..\doc\install\Documentation\zh_TW\html\*"
3323    SetOutPath "$INSTDIR\Documentation\html\index_files"
3324    ;File "..\..\doc\install\Documentation\zh_TW\html\index_files\*"
3325    SetOutPath "$INSTDIR\Documentation\html\InstallGd"
3326    File "..\..\doc\install\Documentation\zh_TW\html\InstallGd\*"
3327    SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes"
3328    File "..\..\doc\install\Documentation\zh_TW\html\ReleaseNotes\*"
3329    SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes\logo_files"
3330    ;File "..\..\doc\install\Documentation\zh_TW\html\ReleaseNotes\logo_files\*"
3331    SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes\relnotes_files"
3332    ;File "..\..\doc\install\Documentation\zh_TW\html\ReleaseNotes\relnotes_files\*"
3333
3334    SetOutPath "$INSTDIR\Client\Program"
3335    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afscreds_1028.dll"  "$INSTDIR\Client\Program\_1028.dll" "$INSTDIR"      
3336    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afs_shl_ext_1028.dll" "$INSTDIR\Client\Program\afs_shl_ext_1028.dll" "$INSTDIR"
3337 !ifdef DEBUG
3338    ;File "${AFS_CLIENT_BUILDDIR}\afscreds_1028.pdb"
3339    ;File "${AFS_CLIENT_BUILDDIR}\afs_shl_ext_1028.pdb"
3340 !endif
3341
3342    File "..\..\doc\help\zh_TW\afs-light.CNT"
3343    File "..\..\doc\help\zh_TW\afs-light.hlp"
3344    File "..\..\doc\help\zh_TW\afs-nt.CNT"
3345    File "..\..\doc\help\zh_TW\afs-nt.HLP"
3346
3347    SetOutPath "$INSTDIR\Common"
3348    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afs_config_1028.dll"           "$INSTDIR\Common\afs_config_1028.dll" "$INSTDIR"       
3349    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afs_cpa_1028.dll"              "$INSTDIR\Common\afs_cpa_1028.dll" "$INSTDIR"       
3350    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afseventmsg_1028.dll"          "$INSTDIR\Common\afseventmsg_1028.dll" "$INSTDIR"       
3351   ;!insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afs_setup_utils_1028.dll"      "$INSTDIR\Common\afs_setup_utils_1028.dll" "$INSTDIR"       
3352    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afsserver_1028.dll"            "$INSTDIR\Common\afsserver_1028.dll" "$INSTDIR"       
3353    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afssvrcfg_1028.dll"            "$INSTDIR\Common\afssvrcfg_1028.dll" "$INSTDIR"       
3354    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\TaAfsAccountManager_1028.dll"  "$INSTDIR\Common\TaAfsAccountManager_1028.dll" "$INSTDIR"       
3355    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\TaAfsAppLib_1028.dll"          "$INSTDIR\Common\TaAfsAppLib_1028.dll" "$INSTDIR"       
3356    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\TaAfsServerManager_1028.dll"   "$INSTDIR\Common\TaAfsServerManager_1028.dll" "$INSTDIR"       
3357    File "..\..\doc\help\zh_TW\afs-cc.CNT"
3358    File "..\..\doc\help\zh_TW\afs-cc.hlp"
3359    File "..\..\doc\help\zh_TW\taafscfg.CNT"
3360    File "..\..\doc\help\zh_TW\taafscfg.hlp"
3361    File "..\..\doc\help\zh_TW\taafssvrmgr.CNT"
3362    File "..\..\doc\help\zh_TW\taafssvrmgr.hlp"
3363    File "..\..\doc\help\zh_TW\taafsusrmgr.CNT"
3364    File "..\..\doc\help\zh_TW\taafsusrmgr.hlp"
3365
3366 !ifdef DEBUG
3367    ;File "${AFS_CLIENT_BUILDDIR}\afs_config_1028.pdb"
3368    ;File "${AFS_CLIENT_BUILDDIR}\afs_cpa_1028.pdb"
3369    ;File "${AFS_SERVER_BUILDDIR}\afseventmsg_1028.pdb"
3370    ;File "${AFS_SERVER_BUILDDIR}\afsserver_1028.pdb"
3371    ;File "${AFS_SERVER_BUILDDIR}\afssvrcfg_1028.pdb"
3372    ;File "${AFS_SERVER_BUILDDIR}\TaAfsAccountManager_1028.pdb"
3373    ;File "${AFS_SERVER_BUILDDIR}\TaAfsAppLib_1028.pdb"
3374    ;File "${AFS_SERVER_BUILDDIR}\TaAfsServerManager_1028.pdb"
3375 !ENDIF
3376    goto done
3377    
3378 done:
3379
3380    ; Write start menu shortcut
3381    SetOutPath "$SMPROGRAMS\OpenAFS"
3382    CreateDirectory "$SMPROGRAMS\OpenAFS\Documentation"
3383    CreateShortCut "$SMPROGRAMS\OpenAFS\Documentation\Reference Manual.lnk" "$INSTDIR\Documentation\html\CmdRef\index.html"
3384    CreateShortCut "$SMPROGRAMS\OpenAFS\Documentation\Administrator Guide.lnk" "$INSTDIR\Documentation\AdminGuide.chm"
3385    CreateShortCut "$SMPROGRAMS\OpenAFS\Documentation\User Guide.lnk" "$INSTDIR\Documentation\UserGuide.chm"
3386
3387 FunctionEnd
3388
3389
3390
3391 ;====================================================
3392 ; AddToPath - Adds the given dir to the search path.
3393 ;        Input - head of the stack
3394 ;        Note - Win9x systems requires reboot
3395 ;====================================================
3396 Function AddToPath
3397   Exch $0
3398   Push $1
3399   Push $2
3400   Push $3
3401
3402   # don't add if the path doesn't exist
3403   IfFileExists $0 "" AddToPath_done
3404
3405   ReadEnvStr $1 PATH
3406   Push "$1;"
3407   Push "$0;"
3408   Call StrStr
3409   Pop $2
3410   StrCmp $2 "" "" AddToPath_done
3411   Push "$1;"
3412   Push "$0\;"
3413   Call StrStr
3414   Pop $2
3415   StrCmp $2 "" "" AddToPath_done
3416   GetFullPathName /SHORT $3 $0
3417   Push "$1;"
3418   Push "$3;"
3419   Call StrStr
3420   Pop $2
3421   StrCmp $2 "" "" AddToPath_done
3422   Push "$1;"
3423   Push "$3\;"
3424   Call StrStr
3425   Pop $2
3426   StrCmp $2 "" "" AddToPath_done
3427
3428   Call IsNT
3429   Pop $1
3430   StrCmp $1 1 AddToPath_NT
3431     ; Not on NT
3432     StrCpy $1 $WINDIR 2
3433     FileOpen $1 "$1\autoexec.bat" a
3434     FileSeek $1 -1 END
3435     FileReadByte $1 $2
3436     IntCmp $2 26 0 +2 +2 # DOS EOF
3437       FileSeek $1 -1 END # write over EOF
3438     FileWrite $1 "$\r$\nSET PATH=%PATH%;$3$\r$\n"
3439     FileClose $1
3440     SetRebootFlag true
3441     Goto AddToPath_done
3442
3443   AddToPath_NT:
3444     ReadRegStr $1 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH"
3445     StrCpy $2 $1 1 -1 # copy last char
3446     StrCmp $2 ";" 0 +2 # if last char == ;
3447       StrCpy $1 $1 -1 # remove last char
3448     StrCmp $1 "" AddToPath_NTdoIt
3449       StrCpy $0 "$1;$0"
3450     AddToPath_NTdoIt:
3451       WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH" $0
3452       SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
3453
3454   AddToPath_done:
3455     Pop $3
3456     Pop $2
3457     Pop $1
3458     Pop $0
3459 FunctionEnd
3460
3461 ;====================================================
3462 ; RemoveFromPath - Remove a given dir from the path
3463 ;     Input: head of the stack
3464 ;====================================================
3465 Function un.RemoveFromPath
3466   Exch $0
3467   Push $1
3468   Push $2
3469   Push $3
3470   Push $4
3471   Push $5
3472   Push $6
3473
3474   IntFmt $6 "%c" 26 # DOS EOF
3475
3476   Call un.IsNT
3477   Pop $1
3478   StrCmp $1 1 unRemoveFromPath_NT
3479     ; Not on NT
3480     StrCpy $1 $WINDIR 2
3481     FileOpen $1 "$1\autoexec.bat" r
3482     GetTempFileName $4
3483     FileOpen $2 $4 w
3484     GetFullPathName /SHORT $0 $0
3485     StrCpy $0 "SET PATH=%PATH%;$0"
3486     Goto unRemoveFromPath_dosLoop
3487
3488     unRemoveFromPath_dosLoop:
3489       FileRead $1 $3
3490       StrCpy $5 $3 1 -1 # read last char
3491       StrCmp $5 $6 0 +2 # if DOS EOF
3492         StrCpy $3 $3 -1 # remove DOS EOF so we can compare
3493       StrCmp $3 "$0$\r$\n" unRemoveFromPath_dosLoopRemoveLine
3494       StrCmp $3 "$0$\n" unRemoveFromPath_dosLoopRemoveLine
3495       StrCmp $3 "$0" unRemoveFromPath_dosLoopRemoveLine
3496       StrCmp $3 "" unRemoveFromPath_dosLoopEnd
3497       FileWrite $2 $3
3498       Goto unRemoveFromPath_dosLoop
3499       unRemoveFromPath_dosLoopRemoveLine:
3500         SetRebootFlag true
3501         Goto unRemoveFromPath_dosLoop
3502
3503     unRemoveFromPath_dosLoopEnd:
3504       FileClose $2
3505       FileClose $1
3506       StrCpy $1 $WINDIR 2
3507       Delete "$1\autoexec.bat"
3508       CopyFiles /SILENT $4 "$1\autoexec.bat"
3509       Delete $4
3510       Goto unRemoveFromPath_done
3511
3512   unRemoveFromPath_NT:
3513     ReadRegStr $1 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH"
3514     StrCpy $5 $1 1 -1 # copy last char
3515     StrCmp $5 ";" +2 # if last char != ;
3516       StrCpy $1 "$1;" # append ;
3517     Push $1
3518     Push "$0;"
3519     Call un.StrStr ; Find `$0;` in $1
3520     Pop $2 ; pos of our dir
3521     StrCmp $2 "" unRemoveFromPath_done
3522       ; else, it is in path
3523       # $0 - path to add
3524       # $1 - path var
3525       StrLen $3 "$0;"
3526       StrLen $4 $2
3527       StrCpy $5 $1 -$4 # $5 is now the part before the path to remove
3528       StrCpy $6 $2 "" $3 # $6 is now the part after the path to remove
3529       StrCpy $3 $5$6
3530
3531       StrCpy $5 $3 1 -1 # copy last char
3532       StrCmp $5 ";" 0 +2 # if last char == ;
3533         StrCpy $3 $3 -1 # remove last char
3534
3535       WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH" $3
3536       SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
3537
3538   unRemoveFromPath_done:
3539     Pop $6
3540     Pop $5
3541     Pop $4
3542     Pop $3
3543     Pop $2
3544     Pop $1
3545     Pop $0
3546 FunctionEnd
3547
3548 ;====================================================
3549 ; IsNT - Returns 1 if the current system is NT, 0
3550 ;        otherwise.
3551 ;     Output: head of the stack
3552 ;====================================================
3553 !macro IsNT un
3554 Function ${un}IsNT
3555   Push $0
3556   ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
3557   StrCmp $0 "" 0 IsNT_yes
3558   ; we are not NT.
3559   Pop $0
3560   Push 0
3561   Return
3562
3563   IsNT_yes:
3564     ; NT!!!
3565     Pop $0
3566     Push 1
3567 FunctionEnd
3568 !macroend
3569 !insertmacro IsNT ""
3570 !insertmacro IsNT "un."
3571
3572 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3573 ; Uninstall stuff
3574 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3575 ;====================================================
3576 ; StrStr - Finds a given string in another given string.
3577 ;               Returns -1 if not found and the pos if found.
3578 ;          Input: head of the stack - string to find
3579 ;                      second in the stack - string to find in
3580 ;          Output: head of the stack
3581 ;====================================================
3582 !macro StrStr un
3583 Function ${un}StrStr
3584 Exch $R1 ; st=haystack,old$R1, $R1=needle
3585   Exch    ; st=old$R1,haystack
3586   Exch $R2 ; st=old$R1,old$R2, $R2=haystack
3587   Push $R3
3588   Push $R4
3589   Push $R5
3590   StrLen $R3 $R1
3591   StrCpy $R4 0
3592   ; $R1=needle
3593   ; $R2=haystack
3594   ; $R3=len(needle)
3595   ; $R4=cnt
3596   ; $R5=tmp
3597   loop:
3598     StrCpy $R5 $R2 $R3 $R4
3599     StrCmp $R5 $R1 done
3600     StrCmp $R5 "" done
3601     IntOp $R4 $R4 + 1
3602     Goto loop
3603 done:
3604   StrCpy $R1 $R2 "" $R4
3605   Pop $R5
3606   Pop $R4
3607   Pop $R3
3608   Pop $R2
3609   Exch $R1
3610 FunctionEnd
3611 !macroend
3612 !insertmacro StrStr ""
3613 !insertmacro StrStr "un."
3614
3615
3616 !ifdef ADDSHAREDDLLUSED
3617 ; AddSharedDLL
3618  ;
3619  ; Increments a shared DLLs reference count.
3620  ; Use by passing one item on the stack (the full path of the DLL).
3621  ;
3622  ; Usage:
3623  ;   Push $SYSDIR\myDll.dll
3624  ;   Call AddSharedDLL
3625  ;
3626
3627  Function AddSharedDLL
3628    Exch $R1
3629    Push $R0
3630    ReadRegDword $R0 HKLM Software\Microsoft\Windows\CurrentVersion\SharedDLLs $R1
3631    IntOp $R0 $R0 + 1
3632    WriteRegDWORD HKLM Software\Microsoft\Windows\CurrentVersion\SharedDLLs $R1 $R0
3633    Pop $R0
3634    Pop $R1
3635  FunctionEnd
3636
3637  
3638 ; un.RemoveSharedDLL
3639  ;
3640  ; Decrements a shared DLLs reference count, and removes if necessary.
3641  ; Use by passing one item on the stack (the full path of the DLL).
3642  ; Note: for use in the main installer (not the uninstaller), rename the
3643  ; function to RemoveSharedDLL.
3644  ;
3645  ; Usage:
3646  ;   Push $SYSDIR\myDll.dll
3647  ;   Call un.RemoveSharedDLL
3648  ;
3649
3650  Function un.RemoveSharedDLL
3651    Exch $R1
3652    Push $R0
3653    ReadRegDword $R0 HKLM Software\Microsoft\Windows\CurrentVersion\SharedDLLs $R1
3654    StrCmp $R0 "" remove
3655      IntOp $R0 $R0 - 1
3656      IntCmp $R0 0 rk rk uk
3657      rk:
3658        DeleteRegValue HKLM Software\Microsoft\Windows\CurrentVersion\SharedDLLs $R1
3659      goto Remove
3660      uk:
3661        WriteRegDWORD HKLM Software\Microsoft\Windows\CurrentVersion\SharedDLLs $R1 $R0
3662      Goto noremove
3663    remove:
3664      Delete /REBOOTOK $R1
3665    noremove:
3666    Pop $R0
3667    Pop $R1
3668  FunctionEnd
3669 !endif
3670
3671
3672 ; Installs the loopback adpater and disables it on Windows 2000
3673 Function afs.InstallMSLoopback
3674    GetTempFileName $R0
3675    File /oname=$R0 "${AFS_WININSTALL_DIR}\afsloopback.dll"
3676    nsExec::Exec "rundll32.exe $R0 doLoopBackEntry AFS 10.254.254.253 255.255.255.252"
3677    Delete $R0
3678 FunctionEnd
3679
3680 Function afs.isLoopbackInstalled
3681    SetOutPath $TEMP
3682    File "${AFS_WININSTALL_DIR}\afsloopback.dll"
3683    System::Call "$TEMP\afsloopback.dll::IsLoopbackInstalled() i().r11"
3684    Delete "$TEMP\afsloopback.dll"
3685 FunctionEnd
3686
3687
3688 ; GetWindowsVersion
3689 ;
3690 ; Based on Yazno's function, http://yazno.tripod.com/powerpimpit/
3691 ; Updated by Joost Verburg
3692 ;
3693 ; Returns on top of stack
3694 ;
3695 ; Windows Version (95, 98, ME, NT x.x, 2000, XP, 2003, Vista/2008)
3696 ; or
3697 ; '' (Unknown Windows Version)
3698 ;
3699 ; Usage:
3700 ;   Call GetWindowsVersion
3701 ;   Pop $R0
3702 ;   ; at this point $R0 is "NT 4.0" or whatnot
3703
3704 Function GetWindowsVersion
3705
3706   Push $R0
3707   Push $R1
3708
3709   ClearErrors
3710
3711   ReadRegStr $R0 HKLM \
3712   "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
3713
3714   IfErrors 0 lbl_winnt
3715   
3716   ; we are not NT
3717   ReadRegStr $R0 HKLM \
3718   "SOFTWARE\Microsoft\Windows\CurrentVersion" VersionNumber
3719
3720   StrCpy $R1 $R0 1
3721   StrCmp $R1 '4' 0 lbl_error
3722
3723   StrCpy $R1 $R0 3
3724
3725   StrCmp $R1 '4.0' lbl_win32_95
3726   StrCmp $R1 '4.9' lbl_win32_ME lbl_win32_98
3727
3728   lbl_win32_95:
3729     StrCpy $R0 '95'
3730   Goto lbl_done
3731
3732   lbl_win32_98:
3733     StrCpy $R0 '98'
3734   Goto lbl_done
3735
3736   lbl_win32_ME:
3737     StrCpy $R0 'ME'
3738   Goto lbl_done
3739
3740   lbl_winnt:
3741
3742   StrCpy $R1 $R0 1
3743
3744   StrCmp $R1 '3' lbl_winnt_x
3745   StrCmp $R1 '4' lbl_winnt_x
3746
3747   StrCpy $R1 $R0 3
3748
3749   StrCmp $R1 '5.0' lbl_winnt_2000
3750   StrCmp $R1 '5.1' lbl_winnt_XP
3751   StrCmp $R1 '5.2' lbl_winnt_2003
3752   StrCmp $R1 '6.0' lbl_winnt_vista lbl_error
3753
3754   lbl_winnt_x:
3755     StrCpy $R0 "NT $R0" 6
3756   Goto lbl_done
3757
3758   lbl_winnt_2000:
3759     Strcpy $R0 '2000'
3760   Goto lbl_done
3761
3762   lbl_winnt_XP:
3763     Strcpy $R0 'XP'
3764   Goto lbl_done
3765
3766   lbl_winnt_2003:
3767     Strcpy $R0 '2003'
3768   Goto lbl_done
3769
3770   lbl_winnt_vista:
3771     Strcpy $R0 'Vista'
3772   Goto lbl_done
3773
3774   lbl_error:
3775     Strcpy $R0 ''
3776   lbl_done:
3777
3778   Pop $R1
3779   Exch $R0
3780
3781 FunctionEnd
3782
3783
3784 ; Author: Lilla (lilla@earthlink.net) 2003-06-13
3785 ; function IsUserAdmin uses plugin \NSIS\PlusgIns\UserInfo.dll
3786 ; This function is based upon code in \NSIS\Contrib\UserInfo\UserInfo.nsi
3787 ; This function was tested under NSIS 2 beta 4 (latest CVS as of this writing).
3788 ;
3789 ; Usage:
3790 ;   Call IsUserAdmin
3791 ;   Pop $R0   ; at this point $R0 is "true" or "false"
3792 ;
3793 Function IsUserAdmin
3794 Push $R0
3795 Push $R1
3796 Push $R2
3797
3798 ClearErrors
3799 UserInfo::GetName
3800 IfErrors Win9x
3801 Pop $R1
3802 UserInfo::GetAccountType
3803 Pop $R2
3804
3805 StrCmp $R2 "Admin" 0 Continue
3806 ; Observation: I get here when running Win98SE. (Lilla)
3807 ; The functions UserInfo.dll looks for are there on Win98 too, 
3808 ; but just don't work. So UserInfo.dll, knowing that admin isn't required
3809 ; on Win98, returns admin anyway. (per kichik)
3810 ; MessageBox MB_OK 'User "$R1" is in the Administrators group'
3811 StrCpy $R0 "true"
3812 Goto Done
3813
3814 Continue:
3815 ; You should still check for an empty string because the functions
3816 ; UserInfo.dll looks for may not be present on Windows 95. (per kichik)
3817 StrCmp $R2 "" Win9x
3818 StrCpy $R0 "false"
3819 ;MessageBox MB_OK 'User "$R1" is in the "$R2" group'
3820 Goto Done
3821
3822 Win9x:
3823 ; comment/message below is by UserInfo.nsi author:
3824 ; This one means you don't need to care about admin or
3825 ; not admin because Windows 9x doesn't either
3826 ;MessageBox MB_OK "Error! This DLL can't run under Windows 9x!"
3827 StrCpy $R0 "false"
3828
3829 Done:
3830 ;MessageBox MB_OK 'User= "$R1"  AccountType= "$R2"  IsUserAdmin= "$R0"'
3831
3832 Pop $R2
3833 Pop $R1
3834 Exch $R0
3835 FunctionEnd
3836
3837 ; GetParent
3838  ; input, top of stack  (e.g. C:\Program Files\Poop)
3839  ; output, top of stack (replaces, with e.g. C:\Program Files)
3840  ; modifies no other variables.
3841  ;
3842  ; Usage:
3843  ;   Push "C:\Program Files\Directory\Whatever"
3844  ;   Call GetParent
3845  ;   Pop $R0
3846  ;   ; at this point $R0 will equal "C:\Program Files\Directory"
3847
3848 Function GetParent
3849
3850   Exch $R0
3851   Push $R1
3852   Push $R2
3853   Push $R3
3854   
3855   StrCpy $R1 0
3856   StrLen $R2 $R0
3857   
3858   loop:
3859     IntOp $R1 $R1 + 1
3860     IntCmp $R1 $R2 get 0 get
3861     StrCpy $R3 $R0 1 -$R1
3862     StrCmp $R3 "\" get
3863   Goto loop
3864   
3865   get:
3866     StrCpy $R0 $R0 -$R1
3867     
3868     Pop $R3
3869     Pop $R2
3870     Pop $R1
3871     Exch $R0
3872     
3873 FunctionEnd
3874
3875
3876 ;--------------------------------
3877 ;Handle what must and what must not be installed
3878 Function .onSelChange
3879    ; If they install the server, they MUST install the client
3880    SectionGetFlags ${secServer} $R0
3881    IntOp $R0 $R0 & ${SF_SELECTED}
3882    StrCmp $R0 "1" MakeClientSelected
3883    
3884    ; If they install the control center, we'll give them the client.
3885    ; It may not be required, but it's a bit more useful
3886    SectionGetFlags ${secControl} $R0
3887    IntOp $R0 $R0 & ${SF_SELECTED}
3888    StrCmp $R0 "1" MakeClientSelected
3889    goto end
3890    
3891 MakeClientSelected:
3892    SectionGetFlags ${secClient} $R0
3893    IntOp $R0 $R0 | ${SF_SELECTED}
3894    SectionSetFlags ${secClient} $R0
3895    
3896 end:
3897 FunctionEnd
3898
3899 Function RegWriteMultiStr
3900 !define HKEY_CLASSES_ROOT        0x80000000
3901 !define HKEY_CURRENT_USER        0x80000001
3902 !define HKEY_LOCAL_MACHINE       0x80000002
3903 !define HKEY_USERS               0x80000003
3904 !define HKEY_PERFORMANCE_DATA    0x80000004
3905 !define HKEY_PERFORMANCE_TEXT    0x80000050
3906 !define HKEY_PERFORMANCE_NLSTEXT 0x80000060
3907 !define HKEY_CURRENT_CONFIG      0x80000005
3908 !define HKEY_DYN_DATA            0x80000006
3909
3910 !define KEY_QUERY_VALUE          0x0001
3911 !define KEY_SET_VALUE            0x0002
3912 !define KEY_CREATE_SUB_KEY       0x0004
3913 !define KEY_ENUMERATE_SUB_KEYS   0x0008
3914 !define KEY_NOTIFY               0x0010
3915 !define KEY_CREATE_LINK          0x0020
3916
3917 !define REG_NONE                 0
3918 !define REG_SZ                   1
3919 !define REG_EXPAND_SZ            2
3920 !define REG_BINARY               3
3921 !define REG_DWORD                4
3922 !define REG_DWORD_LITTLE_ENDIAN  4
3923 !define REG_DWORD_BIG_ENDIAN     5
3924 !define REG_LINK                 6
3925 !define REG_MULTI_SZ             7
3926
3927 !define RegCreateKey             "Advapi32::RegCreateKeyA(i, t, *i) i"
3928 !define RegSetValueEx            "Advapi32::RegSetValueExA(i, t, i, i, i, i) i"
3929 !define RegCloseKey              "Advapi32::RegCloseKeyA(i) i"
3930
3931   Exch $R0
3932   Push $1
3933   Push $2
3934   Push $9
3935
3936   SetPluginUnload alwaysoff
3937   ; Create a buffer for the multi_sz value
3938   System::Call "*(&t${NSIS_MAX_STRLEN}) i.r1"
3939   ; Open/create the registry key
3940   System::Call "${RegCreateKey}(${HKEY_LOCAL_MACHINE}, '$REG_SUB_KEY', .r0) .r9"
3941   ; Failed?
3942   IntCmp $9 0 write
3943     MessageBox MB_OK|MB_ICONSTOP "Can't create registry key! ($9)"
3944     Goto noClose
3945
3946   write:
3947     ; Fill in the buffer with our strings
3948     StrCpy $2 $1                            ; Initial position
3949
3950     StrLen $9 '$REG_DATA_1'                 ; Length of first string
3951     IntOp $9 $9 + 1                         ; Plus null
3952     System::Call "*$2(&t$9 '$REG_DATA_1')"  ; Place the string
3953     IntOp $2 $2 + $9                        ; Advance to the next position
3954
3955     StrCmp '$REG_DATA_2' "" terminate
3956     StrLen $9 '$REG_DATA_2'                 ; Length of second string
3957     IntOp $9 $9 + 1                         ; Plus null
3958     System::Call "*$2(&t$9 '$REG_DATA_2')"  ; Place the string
3959     IntOp $2 $2 + $9                        ; Advance to the next position
3960
3961     StrCmp '$REG_DATA_3' "" terminate
3962     StrLen $9 '$REG_DATA_3'                 ; Length of third string
3963     IntOp $9 $9 + 1                         ; Plus null
3964     System::Call "*$2(&t$9 '$REG_DATA_3')"  ; Place the string
3965     IntOp $2 $2 + $9                        ; Advance to the next position
3966
3967     StrCmp '$REG_DATA_4' "" terminate
3968     StrLen $9 '$REG_DATA_4'                 ; Length of third string
3969     IntOp $9 $9 + 1                         ; Plus null
3970     System::Call "*$2(&t$9 '$REG_DATA_4')"  ; Place the string
3971     IntOp $2 $2 + $9                        ; Advance to the next position
3972
3973   terminate:
3974     System::Call "*$2(&t1 '')"              ; Place the terminating null
3975     IntOp $2 $2 + 1                         ; Advance to the next position
3976
3977     ; Create/write the value
3978     IntOp $2 $2 - $1                        ; Total length
3979     System::Call "${RegSetValueEx}(r0, '$REG_VALUE', 0, ${REG_MULTI_SZ}, r1, r2) .r9"
3980     ; Failed?
3981     IntCmp $9 0 done
3982       MessageBox MB_OK|MB_ICONSTOP "Can't set key value! ($9)"
3983       Goto done
3984
3985   done:
3986     ; Close the registry key
3987     System::Call "${RegCloseKey}(r0)"
3988
3989 noClose:
3990   ; Clear the buffer
3991   SetPluginUnload manual
3992   System::Free $1
3993
3994   Pop $9
3995   Pop $2
3996   Pop $1
3997   Exch $R0
3998 FunctionEnd
3999
4000 Function CreateDesktopIni
4001    WriteIniStr "$INSTDIR\Desktop.ini" ".ShellClassInfo" "IconFile" "client\program\afsd_service.exe"
4002    WriteIniStr "$INSTDIR\Desktop.ini" ".ShellClassInfo" "IconIndex" "0"
4003    SetFileAttributes "$INSTDIR\Desktop.ini" HIDDEN|SYSTEM
4004    SetFileAttributes "$INSTDIR\" READONLY
4005 FunctionEnd