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