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