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