windows-nsis-vs2008-runtime-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_1500
1243   ; Do nothing
1244 !ELSE
1245 !IFDEF CL_1400
1246   ; Do nothing
1247 !ELSE
1248 !IFDEF CL_1310
1249    File "${SYSTEMDIR}\msvcr71d.pdb"
1250    File "${SYSTEMDIR}\msvcp71d.pdb"
1251    File "${SYSTEMDIR}\mfc71d.pdb"
1252 !ELSE
1253 !IFDEF CL_1300
1254    File "${SYSTEMDIR}\msvcr70d.pdb"
1255    File "${SYSTEMDIR}\msvcp70d.pdb"
1256    File "${SYSTEMDIR}\mfc70d.pdb"
1257 !ELSE
1258    File "${SYSTEMDIR}\mfc42d.pdb"
1259    File "${SYSTEMDIR}\msvcp60d.pdb"
1260    File "${SYSTEMDIR}\msvcrtd.pdb"
1261 !ENDIF
1262 !ENDIF
1263 !ENDIF
1264 !ENDIF
1265   
1266 ; Common Areas
1267    SetOutPath "$INSTDIR\Common"
1268    File "${AFS_CLIENT_BUILDDIR}\afs_config.pdb"
1269    File "${AFS_SERVER_BUILDDIR}\afsadminutil.pdb"
1270    File "${AFS_DESTDIR}\lib\afsauthent.pdb"
1271    File "${AFS_DESTDIR}\lib\afspthread.pdb"
1272    File "${AFS_DESTDIR}\lib\afsrpc.pdb"
1273    File "${AFS_SERVER_BUILDDIR}\afsclientadmin.pdb"
1274    File "${AFS_SERVER_BUILDDIR}\afsprocmgmt.pdb"
1275    File "${AFS_SERVER_BUILDDIR}\afsvosadmin.pdb"
1276    File "${AFS_SERVER_BUILDDIR}\TaAfsAppLib.pdb"
1277    File "${AFS_SERVER_BUILDDIR}\afsvosadmin.pdb"
1278    File "${AFS_SERVER_BUILDDIR}\afsbosadmin.pdb"
1279    File "${AFS_SERVER_BUILDDIR}\afscfgadmin.pdb"
1280    File "${AFS_SERVER_BUILDDIR}\afskasadmin.pdb"
1281    File "${AFS_SERVER_BUILDDIR}\afsptsadmin.pdb"
1282
1283 SectionEnd
1284
1285
1286 ;Display the Finish header
1287 ;Insert this macro after the sections if you are not using a finish page
1288 ;!insertmacro MUI_SECTIONS_FINISHHEADER
1289
1290 ;--------------------------------
1291 ;Installer Functions
1292
1293 Function .onInit
1294
1295   !insertmacro MUI_LANGDLL_DISPLAY
1296   
1297   ; Set the default install options
1298         Push $0
1299
1300    Call IsUserAdmin
1301    Pop $R0
1302    StrCmp $R0 "true" contInstall
1303
1304    MessageBox MB_OK|MB_ICONSTOP|MB_TOPMOST "You must be an administrator of this machine to install this software."
1305    Abort
1306    
1307 contInstall:
1308
1309    ; Set Install Type text
1310    InstTypeSetText 0 "AFS Client"
1311    InstTypeSetText 1 "AFS Administrator"
1312    InstTypeSetText 2 "AFS Server"
1313    InstTypeSetText 3 "AFS Developer Tools"
1314
1315    ; Set sections in each install type
1316    SectionSetInstTypes 0 15             ; AFS Client
1317    SectionSetInstTypes 1 15             ; Loopback adapter
1318    SectionSetInstTypes 2 4              ; AFS Server
1319    SectionSetInstTypes 3 6              ; AFS Control Center
1320    SectionSetInstTypes 4 14             ; Documentation
1321    SectionSetInstTypes 5 8              ; SDK
1322 !ifndef DEBUG
1323    SectionSetInstTypes 6 8              ; Debug symbols
1324 !else
1325    SectionSetInstTypes 6 15             ; Debug symbols
1326 !endif
1327
1328    ; Check that RPC functions are installed (I believe any one of these can be present for
1329    ; OpenAFS to work)
1330    ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\RPC\ClientProtocols" "ncacn_np"
1331    StrCmp $R0 "rpcrt4.dll" contInstall2
1332    ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\RPC\ClientProtocols" "ncacn_ip_tcp"
1333    StrCmp $R0 "rpcrt4.dll" contInstall2
1334    ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\RPC\ClientProtocols" "ncadg_ip_udp"
1335    StrCmp $R0 "rpcrt4.dll" contInstall2
1336    ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\RPC\ClientProtocols" "ncacn_http"
1337    StrCmp $R0 "rpcrt4.dll" contInstall2
1338    
1339    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."
1340    Abort
1341
1342
1343 contInstall2:
1344    ; If the Loopback is already installed, we mark the option OFF and Read Only
1345    ; so the user can not select it.
1346    Call afs.isLoopbackInstalled
1347    IntCmp $R1 0 SkipLoop
1348    SectionGetFlags ${secLoopback} $0
1349    IntOp $0 $0 & ${SECTION_OFF}
1350    IntOp $0 $0 | ${SF_RO}
1351    SectionSetFlags ${secLoopback} $0
1352    ; And disable the loopback in the types
1353    SectionSetInstTypes 1 0              ; Loopback adapter
1354    
1355 SkipLoop:
1356    ; Never install debug symbols unless explicitly selected, except in DEBUG mode
1357         !IFNDEF DEBUG
1358    SectionGetFlags ${secDebug} $0
1359         IntOp $0 $0 & ${SECTION_OFF}
1360         SectionSetFlags ${secDebug} $0
1361    !ELSE
1362    SectionGetFlags ${secDebug} $0
1363         IntOp $0 $0 | ${SF_SELECTED}
1364         SectionSetFlags ${secDebug} $0
1365    !ENDIF
1366    ; Our logic should be like this.
1367    ;     1) If no AFS components are installed, we do a clean install with default options. (Client/Docs)
1368    ;     2) If existing modules are installed, we keep them selected
1369    ;     3) If it is an upgrade, we set the text accordingly, else we mark it as a re-install
1370    ;  TODO: Downgrade?
1371    Call IsAnyAFSInstalled
1372    Pop $R0
1373    StrCmp $R0 "0" DefaultOptions
1374    
1375    Call ShouldClientInstall
1376    Pop $R2
1377    
1378    ; Check if it was an IBM/Transarc version
1379    ReadRegStr $R0 HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon" "DisplayName"
1380    StrCmp $R0 "IBM AFS Client" DoIBM
1381    StrCmp $R0 "Transarc AFS Client" DoIBM
1382 NotIBM:
1383    StrCpy $R9 ""
1384    StrCmp $R2 "0" NoClient
1385    StrCmp $R2 "1" ReinstallClient
1386    StrCmp $R2 "2" UpgradeClient
1387    StrCmp $R2 "3" DowngradeClient
1388    goto Continue
1389 DoIBM:
1390    ReadRegDWORD $R0 HKLM "Software\TransarcCorporation\AFS Client\CurrentVersion" "MajorVersion"
1391    StrCmp $R0 "3" +1 NotIBM
1392    StrCpy $R9 "IBM"
1393    goto UpgradeClient
1394
1395 Continue:
1396         SectionGetFlags ${secClient} $0
1397         IntOp $0 $0 | ${SF_SELECTED}
1398         SectionSetFlags ${secClient} $0
1399     ;# !insertmacro SelectSection ${secClient}
1400    goto skipClient
1401 NoClient:
1402         ;StrCpy $1 ${secClient} ; Gotta remember which section we are at now...
1403         SectionGetFlags ${secClient} $0
1404         IntOp $0 $0 & ${SECTION_OFF}
1405         SectionSetFlags ${secClient} $0
1406    goto skipClient
1407 UpgradeClient:
1408         SectionGetFlags ${secClient} $0
1409         IntOp $0 $0 | ${SF_SELECTED}
1410         SectionSetFlags ${secClient} $0
1411    SectionSetText ${secClient} $(UPGRADE_CLIENT)
1412    goto skipClient
1413 ReinstallClient:
1414         SectionGetFlags ${secClient} $0
1415         IntOp $0 $0 | ${SF_SELECTED}
1416         SectionSetFlags ${secClient} $0
1417    SectionSetText ${secClient} $(REINSTALL_CLIENT)
1418    goto skipClient
1419 DowngradeClient:
1420         SectionGetFlags ${secClient} $0
1421         IntOp $0 $0 | ${SF_SELECTED}
1422         SectionSetFlags ${secClient} $0
1423    SectionSetText ${secClient} $(REINSTALL_CLIENT)
1424    goto skipClient
1425
1426    
1427 skipClient:   
1428    
1429    Call ShouldServerInstall
1430    Pop $R2
1431    StrCmp $R2 "0" NoServer
1432    StrCmp $R2 "1" ReinstallServer
1433    StrCmp $R2 "2" UpgradeServer
1434    StrCmp $R2 "3" DowngradeServer
1435    
1436    SectionGetFlags ${secServer} $0
1437    IntOp $0 $0 | ${SF_SELECTED}
1438    SectionSetFlags ${secServer} $0
1439    ;# !insertmacro UnselectSection ${secServer}
1440    goto skipServer
1441
1442 UpgradeServer:
1443    SectionGetFlags ${secServer} $0
1444    IntOp $0 $0 | ${SF_SELECTED}
1445    SectionSetFlags ${secServer} $0
1446    SectionSetText ${secServer} $(UPGRADE_SERVER)
1447    goto skipServer
1448
1449 ReinstallServer:
1450    SectionGetFlags ${secServer} $0
1451    IntOp $0 $0 | ${SF_SELECTED}
1452    SectionSetFlags ${secServer} $0
1453    SectionSetText ${secServer} $(REINSTALL_SERVER)
1454    goto skipServer
1455
1456 DowngradeServer:
1457    SectionGetFlags ${secServer} $0
1458    IntOp $0 $0 | ${SF_SELECTED}
1459    SectionSetFlags ${secServer} $0
1460    SectionSetText ${secServer} $(REINSTALL_SERVER)
1461    goto skipServer
1462    
1463 NoServer:
1464    SectionGetFlags ${secServer} $0
1465    IntOp $0 $0 & ${SECTION_OFF}
1466    SectionSetFlags ${secServer} $0
1467    ;# !insertmacro UnselectSection ${secServer}
1468    goto skipServer
1469    
1470 skipServer:
1471    ; Check control center
1472    Call IsControlInstalled
1473    Pop $R2
1474    StrCmp $R2 "0" NoControl
1475
1476    SectionGetFlags ${secControl} $0
1477    IntOp $0 $0 | ${SF_SELECTED}
1478    SectionSetFlags ${secControl} $0
1479    goto CheckDocs
1480    
1481 NoControl:   
1482    SectionGetFlags ${secControl} $0
1483    IntOp $0 $0 & ${SECTION_OFF}
1484    SectionSetFlags ${secControl} $0
1485    ;# !insertmacro UnselectSection ${secControl}
1486
1487 CheckDocs:
1488    ; Check Documentation
1489    Call IsDocumentationInstalled
1490    Pop $R2
1491    StrCmp $R2 "0" NoDocs
1492    SectionGetFlags ${secDocs} $0
1493    IntOp $0 $0 | ${SF_SELECTED}
1494    SectionSetFlags ${secDocs} $0
1495    goto CheckSDK
1496    
1497 NoDocs:
1498    SectionGetFlags ${secDocs} $0
1499    IntOp $0 $0 & ${SECTION_OFF}
1500    SectionSetFlags ${secDocs} $0
1501    goto CheckSDK
1502    
1503 ; To check the SDK, we simply look to see if the files exist.  If they do,
1504 ; the SDK is installed.  If not, we don't need to push it on the user.
1505 ; If they are there, we want to make sure they match the installed version.
1506 CheckSDK:
1507    IfFileExists "$INSTDIR\SDK\Include\main.h" +1 NoSDK
1508    SectionGetFlags ${secSDK} $0
1509    IntOp $0 $0 | ${SF_SELECTED}
1510    SectionSetFlags ${secSDK} $0
1511    goto end
1512    
1513 NoSDK:
1514    SectionGetFlags ${secSDK} $0
1515    IntOp $0 $0 & ${SECTION_OFF}
1516    SectionSetFlags ${secSDK} $0
1517    goto end
1518    
1519 DefaultOptions:
1520    ; Client Selected
1521    SectionGetFlags ${secClient} $0
1522    IntOp $0 $0 | ${SF_SELECTED}
1523    SectionSetFlags ${secClient} $0
1524
1525    ; Server NOT selected
1526    SectionGetFlags ${secServer} $0
1527    IntOp $0 $0 & ${SECTION_OFF}
1528    SectionSetFlags ${secServer} $0
1529    
1530    ; Control Center NOT selected
1531    SectionGetFlags ${secControl} $0
1532    IntOp $0 $0 & ${SECTION_OFF}
1533    SectionSetFlags ${secControl} $0
1534    ;# !insertmacro UnselectSection ${secControl}
1535
1536    ; Documentation NOT selected
1537    SectionGetFlags ${secDocs} $0
1538    IntOp $0 $0 & ${SECTION_OFF}
1539    SectionSetFlags ${secDocs} $0
1540    ;# !insertmacro UnselectSection ${secDocs}
1541    
1542    ; SDK not selected
1543    SectionGetFlags ${secSDK} $0
1544    IntOp $0 $0 & ${SECTION_OFF}
1545    SectionSetFlags ${secSDK} $0
1546    ;# !insertmacro UnselectSection ${secSDK}
1547    
1548    goto end
1549
1550 end:
1551    Pop $0
1552   
1553    Push $R0
1554   
1555   ; See if we can set a default installation path...
1556   ReadRegStr $R0 HKLM "${AFS_REGKEY_ROOT}\AFS Client\CurrentVersion" "PathName"
1557   StrCmp $R0 "" TryServer
1558   Push $R0
1559   Call GetParent
1560   
1561   ; Work around bug in 1.3.5000, 1.3.5100, 1.3.5200, 1.3.5201, 1.3.5299 installers...
1562   ReadRegStr $R0 HKLM "${AFS_REGKEY_ROOT}\AFS Client\CurrentVersion" "MajorVersion"
1563   StrCmp $R0 "1" +1 SkipParent
1564   ReadRegStr $R0 HKLM "${AFS_REGKEY_ROOT}\AFS Client\CurrentVersion" "MinorVersion"
1565   StrCmp $R0 "3" +1 SkipParent
1566   ReadRegStr $R0 HKLM "${AFS_REGKEY_ROOT}\AFS Client\CurrentVersion" "PatchLevel"
1567   StrCmp $R0 "5000" UpParent
1568   StrCmp $R0 "5100" UpParent
1569   StrCmp $R0 "5200" UpParent
1570   StrCmp $R0 "5201" UpParent
1571   StrCmp $R0 "5299" UpParent
1572   goto SkipParent
1573   
1574 UpParent:
1575    Call GetParent
1576   
1577 SkipParent:
1578   Pop $R0
1579   StrCpy $INSTDIR $R0
1580   goto Nope
1581   
1582 TryServer:
1583   ReadRegStr $R0 HKLM "${AFS_REGKEY_ROOT}\AFS Server\CurrentVersion" "PathName"
1584   StrCmp $R0 "" TryControl
1585   Push $R0
1586   Call GetParent
1587   Pop $R0
1588   StrCpy $INSTDIR $R0
1589   goto Nope
1590    
1591 TryControl:
1592   ReadRegStr $R0 HKLM "${AFS_REGKEY_ROOT}\AFS Control Center\CurrentVersion" "PathName"
1593   StrCmp $R0 "" Nope
1594   StrCpy $INSTDIR $R0
1595   
1596 Nope:
1597   Pop $R0
1598   
1599   GetTempFilename $0
1600   File /oname=$0 CellServPage.ini
1601   GetTempFilename $1
1602   File /oname=$1 AFSCell.ini
1603   GetTempFilename $2
1604   File /oname=$2 AFSCreds.ini
1605   ;File /oname=$1 ConfigURL.ini
1606   
1607 FunctionEnd
1608
1609
1610 ;--------------------------------
1611 ; These are our cleanup functions
1612 Function .onInstFailed
1613 Delete $0
1614 Delete $1
1615 FunctionEnd
1616
1617 Function .onInstSuccess
1618 Delete $0
1619 Delete $1
1620 FunctionEnd
1621
1622
1623 ;--------------------------------
1624 ;Descriptions
1625
1626   !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
1627   !insertmacro MUI_DESCRIPTION_TEXT ${secServer} $(DESC_secServer)
1628   !insertmacro MUI_DESCRIPTION_TEXT ${secClient} $(DESC_secClient)
1629   !insertmacro MUI_DESCRIPTION_TEXT ${secControl} $(DESC_secControl)
1630   !insertmacro MUI_DESCRIPTION_TEXT ${secDocs} $(DESC_secDocs)
1631   !insertmacro MUI_DESCRIPTION_TEXT ${secSDK} $(DESC_secSDK)
1632   !insertmacro MUI_DESCRIPTION_TEXT ${secLoopback} $(DESC_secLoopback)
1633   !insertmacro MUI_DESCRIPTION_TEXT ${secDebug} $(DESC_secDebug)
1634   !insertmacro MUI_FUNCTION_DESCRIPTION_END
1635  
1636 ;--------------------------------
1637 ;Uninstaller Section
1638
1639 Section "Uninstall"
1640   ; Make sure the user REALLY wants to do this, unless they did a silent uninstall, in which case...let them!
1641   IfSilent StartRemove     ; New in v2.0b4
1642   MessageBox MB_YESNO "Are you sure you want to remove OpenAFS from this machine?" IDYES StartRemove
1643   abort
1644   
1645 StartRemove:
1646   
1647   SetShellVarContext all
1648   ; Stop the running processes
1649   GetTempFileName $R0
1650   File /oname=$R0 "${AFS_WININSTALL_DIR}\Killer.exe"
1651   nsExec::Exec '$R0 afscreds.exe'
1652   Exec "afscreds.exe -z"
1653   ; in case we are upgrading an old version that does not support -z
1654   Sleep 2000
1655   nsExec::Exec '$R0 afscreds.exe'
1656 !IFDEF INSTALL_KFW
1657   nsExec::Exec '$R0 krbcc32s.exe'
1658 !ENDIF
1659
1660   ; Delete the AFS service
1661   GetTempFileName $R0
1662   File /oname=$R0 "${AFS_WININSTALL_DIR}\Service.exe"
1663   nsExec::Exec "net stop TransarcAFSDaemon"
1664   nsExec::Exec "net stop TransarcAFSServer"
1665   nsExec::Exec '$R0 u TransarcAFSDaemon'
1666   ; After we stop the service, but before we delete it, we have to remove the volume data
1667   ; This is because the storage locations are in the registry under the service key.
1668   ; Call un.RemoveAFSVolumes
1669   nsExec::Exec '$R0 u TransarcAFSServer'
1670   Delete $R0
1671   
1672   Call un.RemoveProvider
1673
1674   Push "$INSTDIR\Client\Program"
1675   Call un.RemoveFromPath
1676   Push "$INSTDIR\Common"
1677   Call un.RemoveFromPath
1678 !ifdef INSTALL_KFW
1679   Push "$INSTDIR\kfw\bin"
1680   Call un.RemoveFromPath
1681 !endif
1682   
1683   ; Delete documentation
1684   Delete "$INSTDIR\Documentation\README.TXT"
1685   Delete "$INSTDIR\Documentation\html\*"
1686   Delete "$INSTDIR\Documentation\html\index_files\*"
1687   Delete "$INSTDIR\Documentation\html\CmdRef\1\*"
1688   Delete "$INSTDIR\Documentation\html\CmdRef\5\*"
1689   Delete "$INSTDIR\Documentation\html\CmdRef\8\*"
1690   Delete "$INSTDIR\Documentation\html\CmdRef\*"
1691   Delete "$INSTDIR\Documentation\html\ReleaseNotes\logo_files\*"
1692   Delete "$INSTDIR\Documentation\html\ReleaseNotes\relnotes_files\*"
1693   Delete "$INSTDIR\Documentation\html\ReleaseNotes\*"
1694   Delete "$INSTDIR\Documentation\html\SysAdminGd\*"
1695
1696    Delete /REBOOTOK "$INSTDIR\Common\afs_config.exe"
1697    Delete /REBOOTOK "$INSTDIR\Common\afs_shl_ext.dll"
1698    Delete /REBOOTOK "$INSTDIR\Common\afsadminutil.dll"
1699    Delete /REBOOTOK "$INSTDIR\Common\lib\afsauthent.dll"
1700    Delete /REBOOTOK "$INSTDIR\Common\lib\afspthread.dll"
1701    Delete /REBOOTOK "$INSTDIR\Common\lib\afsrpc.dll"
1702    Delete /REBOOTOK "$INSTDIR\Common\afsclientadmin.dll"
1703    Delete /REBOOTOK "$INSTDIR\Common\afsprocmgmt.dll"
1704    Delete /REBOOTOK "$INSTDIR\Common\afsvosadmin.dll"
1705    Delete /REBOOTOK "$INSTDIR\Common\TaAfsAppLib.dll"
1706    Delete /REBOOTOK "$INSTDIR\Common\afsvosadmin.dll"
1707    Delete /REBOOTOK "$INSTDIR\Common\afsbosadmin.dll"
1708    Delete /REBOOTOK "$INSTDIR\Common\afscfgadmin.dll"
1709    Delete /REBOOTOK "$INSTDIR\Common\afskasadmin.dll"
1710    Delete /REBOOTOK "$INSTDIR\Common\afsptsadmin.dll"
1711
1712    Delete /REBOOTOK "$INSTDIR\Common\afs_config.pdb"
1713    Delete /REBOOTOK "$INSTDIR\Common\afs_shl_ext.pdb"
1714    Delete /REBOOTOK "$INSTDIR\Common\afsadminutil.pdb"
1715    Delete /REBOOTOK "$INSTDIR\Common\lib\afsauthent.pdb"
1716    Delete /REBOOTOK "$INSTDIR\Common\lib\afspthread.pdb"
1717    Delete /REBOOTOK "$INSTDIR\Common\lib\afsrpc.pdb"
1718    Delete /REBOOTOK "$INSTDIR\Common\afsclientadmin.pdb"
1719    Delete /REBOOTOK "$INSTDIR\Common\afsprocmgmt.pdb"
1720    Delete /REBOOTOK "$INSTDIR\Common\afsvosadmin.pdb"
1721    Delete /REBOOTOK "$INSTDIR\Common\TaAfsAppLib.pdb"
1722    Delete /REBOOTOK "$INSTDIR\Common\afsvosadmin.pdb"
1723    Delete /REBOOTOK "$INSTDIR\Common\afsbosadmin.pdb"
1724    Delete /REBOOTOK "$INSTDIR\Common\afscfgadmin.pdb"
1725    Delete /REBOOTOK "$INSTDIR\Common\afskasadmin.pdb"
1726    Delete /REBOOTOK "$INSTDIR\Common\afsptsadmin.pdb"
1727 !IFDEF DEBUG
1728 !IFDEF CL_1500
1729    SetOutPath "$INSTDIR\Common"
1730    File /oname=vcruntime.msi "${MSVCMSI}"
1731    nsExec::Exec 'msiexec /x "$INSTDIR\Common\vcruntime.msi" /passive /norestart'
1732    Delete "$INSTDIR\Common\vcruntime.msi"
1733 !ELSE
1734 !IFDEF CL_1400
1735    SetOutPath "$INSTDIR\Common"
1736    File /oname=vcruntime.msi "${MSVCMSI}"
1737    nsExec::Exec 'msiexec /x "$INSTDIR\Common\vcruntime.msi" /passive /norestart'
1738    Delete "$INSTDIR\Common\vcruntime.msi"
1739 !ELSE
1740 !IFDEF CL_1310
1741    Delete /REBOOTOK "$INSTDIR\Common\msvcr71d.dll"
1742    Delete /REBOOTOK "$INSTDIR\Common\msvcr71d.pdb"
1743    Delete /REBOOTOK "$INSTDIR\Common\msvcp71d.dll"
1744    Delete /REBOOTOK "$INSTDIR\Common\msvcp71d.pdb"
1745    Delete /REBOOTOK "$INSTDIR\Common\mfc71d.dll"
1746    Delete /REBOOTOK "$INSTDIR\Common\mfc71d.pdb"
1747 !ELSE
1748 !IFDEF CL_1300
1749    Delete /REBOOTOK "$INSTDIR\Common\msvcr70d.dll"
1750    Delete /REBOOTOK "$INSTDIR\Common\msvcr70d.pdb"
1751    Delete /REBOOTOK "$INSTDIR\Common\msvcp70d.dll"
1752    Delete /REBOOTOK "$INSTDIR\Common\msvcp70d.pdb"
1753    Delete /REBOOTOK "$INSTDIR\Common\mfc70d.dll"
1754    Delete /REBOOTOK "$INSTDIR\Common\mfc70d.pdb"
1755 !ELSE
1756    Delete /REBOOTOK "$INSTDIR\Common\mfc42d.dll"
1757    Delete /REBOOTOK "$INSTDIR\Common\mfc42d.pdb"
1758    Delete /REBOOTOK "$INSTDIR\Common\msvcp60d.dll"
1759    Delete /REBOOTOK "$INSTDIR\Common\msvcp60d.pdb"
1760    Delete /REBOOTOK "$INSTDIR\Common\msvcrtd.dll"
1761    Delete /REBOOTOK "$INSTDIR\Common\msvcrtd.pdb"
1762 !ENDIF
1763 !ENDIF
1764 !ENDIF
1765 !ENDIF
1766 !ELSE
1767 !IFDEF CL_1500
1768    SetOutPath "$INSTDIR\Common"
1769    File /oname=vcruntime.msi "${MSVCMSI}"
1770    nsExec::Exec 'msiexec /x "$INSTDIR\Common\vcruntime.msi" /passive /norestart'
1771    Delete "$INSTDIR\Common\vcruntime.msi"
1772 !ELSE
1773 !IFDEF CL_1400
1774    SetOutPath "$INSTDIR\Common"
1775    File /oname=vcruntime.msi "${MSVCMSI}"
1776    nsExec::Exec 'msiexec /x "$INSTDIR\Common\vcruntime.msi" /passive /norestart'
1777    Delete "$INSTDIR\Common\vcruntime.msi"
1778 !ELSE
1779 !IFDEF CL_1310
1780    Delete /REBOOTOK "$INSTDIR\Common\mfc71.dll"
1781    Delete /REBOOTOK "$INSTDIR\Common\msvcr71.dll"
1782    Delete /REBOOTOK "$INSTDIR\Common\msvcp71.dll"
1783    Delete /REBOOTOK "$INSTDIR\Common\MFC71CHS.DLL"
1784    Delete /REBOOTOK "$INSTDIR\Common\MFC71CHT.DLL"
1785    Delete /REBOOTOK "$INSTDIR\Common\MFC71DEU.DLL"
1786    Delete /REBOOTOK "$INSTDIR\Common\MFC71ENU.DLL"
1787    Delete /REBOOTOK "$INSTDIR\Common\MFC71ESP.DLL"
1788    Delete /REBOOTOK "$INSTDIR\Common\MFC71FRA.DLL"
1789    Delete /REBOOTOK "$INSTDIR\Common\MFC71ITA.DLL"
1790    Delete /REBOOTOK "$INSTDIR\Common\MFC71JPN.DLL"
1791    Delete /REBOOTOK "$INSTDIR\Common\MFC71KOR.DLL"
1792 !ELSE
1793 !IFDEF CL_1300
1794    Delete /REBOOTOK "$INSTDIR\Common\mfc70.dll"
1795    Delete /REBOOTOK "$INSTDIR\Common\msvcr70.dll"
1796    Delete /REBOOTOK "$INSTDIR\Common\msvcp70.dll"
1797    Delete /REBOOTOK "$INSTDIR\Common\MFC70CHS.DLL"
1798    Delete /REBOOTOK "$INSTDIR\Common\MFC70CHT.DLL"
1799    Delete /REBOOTOK "$INSTDIR\Common\MFC70DEU.DLL"
1800    Delete /REBOOTOK "$INSTDIR\Common\MFC70ENU.DLL"
1801    Delete /REBOOTOK "$INSTDIR\Common\MFC70ESP.DLL"
1802    Delete /REBOOTOK "$INSTDIR\Common\MFC70FRA.DLL"
1803    Delete /REBOOTOK "$INSTDIR\Common\MFC70ITA.DLL"
1804    Delete /REBOOTOK "$INSTDIR\Common\MFC70JPN.DLL"
1805    Delete /REBOOTOK "$INSTDIR\Common\MFC70KOR.DLL"
1806 !ELSE
1807    Delete /REBOOTOK "$INSTDIR\Common\mfc42.dll"
1808    Delete /REBOOTOK "$INSTDIR\Common\msvcp60.dll"
1809    Delete /REBOOTOK "$INSTDIR\Common\msvcrt.dll"
1810 !ENDIF
1811 !ENDIF
1812 !ENDIF
1813 !ENDIF
1814 !ENDIF
1815   
1816    IfSilent SkipDel
1817 ;  IfFileExists "$INSTDIR\Client\CellServDB" CellExists SkipDelAsk
1818 ;  CellExists:
1819   MessageBox MB_YESNO "Would you like to keep your configuration information?" IDYES SkipDel
1820   Delete "$INSTDIR\Client\CellServDB"
1821
1822 ; Only remove krb5.ini if KfW was installed
1823 !IFDEF INSTALL_KFW
1824   Delete "$WINDIR\krb5.ini"
1825 !ENDIF
1826   Delete "$INSTDIR\Client\afsdns.ini"
1827   
1828   GetTempFileName $R0
1829   File /oname=$R0 "${AFS_WININSTALL_DIR}\AdminGroup.exe"
1830   nsExec::Exec '$R0 -remove'
1831
1832   SkipDel:
1833   Delete "$WINDIR\afsd_init.log"
1834   Delete "$INSTDIR\Uninstall.exe"
1835
1836   ; Remove server
1837   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\afskill.exe"
1838   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\afssvrcfg.exe"
1839   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\bosctlsvc.exe"
1840   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\bosserver.exe"
1841   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\buserver.exe"
1842   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\butc.exe"
1843   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\fileserver.exe"
1844   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\fms.exe"
1845   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\kaserver.exe"
1846   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\ptserver.exe"
1847   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\salvager.exe"
1848   Delete "$INSTDIR\Server\usr\afs\bin\ServerUninst.dll"
1849   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\upclient.exe"
1850   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\upserver.exe"
1851   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\vlserver.exe"
1852   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\volinfo.exe"
1853   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\volserver.exe"
1854
1855   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\afskill.pdb"
1856   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\afssvrcfg.pdb"
1857   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\bosctlsvc.pdb"
1858   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\bosserver.pdb"
1859   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\buserver.pdb"
1860   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\butc.pdb"
1861   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\fileserver.pdb"
1862   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\fms.pdb"
1863   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\kaserver.pdb"
1864   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\ptserver.pdb"
1865   Delete "$INSTDIR\Server\usr\afs\bin\salvager.pdb"
1866   Delete "$INSTDIR\Server\usr\afs\bin\ServerUninst.pdb"
1867   Delete "$INSTDIR\Server\usr\afs\bin\upclient.pdb"
1868   Delete "$INSTDIR\Server\usr\afs\bin\upserver.pdb"
1869   Delete "$INSTDIR\Server\usr\afs\bin\vlserver.pdb"
1870   Delete "$INSTDIR\Server\usr\afs\bin\volinfo.pdb"
1871   Delete "$INSTDIR\Server\usr\afs\bin\volserver.pdb"
1872
1873   RMDir /r "$INSTDIR\Server\usr\afs\bin"
1874   ; do not delete the server configuration files
1875   ; or we will lose the volumes and authentication
1876   ; databases
1877   ;RmDir /r "$INSTDIR\Server\usr\afs\etc\logs"
1878   ;RmDir /r "$INSTDIR\Server\usr\afs\etc"
1879   ;RmDir /r "$INSTDIR\Server\usr\afs\local"
1880   ;RMDIR /r "$INSTDIR\Server\usr\afs\logs"
1881   
1882   Delete /REBOOTOK "$SYSDIR\afsserver.cpl"
1883   Delete /REBOOTOK "$INSTDIR\Client\Program\afs_cpa.cpl"
1884   Delete /REBOOTOK "$INSTDIR\Client\Program\afslogon.dll"
1885   Delete /REBOOTOK "$INSTDIR\Client\Program\afscpcc.exe"
1886
1887   Delete /REBOOTOK "$SYSDIR\afsserver.pdb"
1888   Delete /REBOOTOK "$INSTDIR\Client\Program\afs_cpa.pdb"
1889   Delete /REBOOTOK "$INSTDIR\Client\Program\afslogon.pdb"
1890   Delete /REBOOTOK "$INSTDIR\Client\Program\afscpcc.pdb"
1891
1892   RMDir /r "$INSTDIR\Documentation\html\CmdRef"
1893   RMDir /r "$INSTDIR\Documentation\html\ReleaseNotes"
1894   RMDir /r "$INSTDIR\Documentation\html\SysAdminGd"
1895   RMDIr /r "$INSTDIR\Documentation\html"
1896   
1897   RMDir "$INSTDIR\Documentation"
1898   ; Delete DOC short cut
1899   Delete /REBOOTOK "$INSTDIR\Client\Program\afscreds.exe"
1900   Delete /REBOOTOK "$INSTDIR\Client\Program\afscreds.pdb"
1901
1902   Delete /REBOOTOK "$INSTDIR\SDK\Include\*"
1903   Delete /REBOOTOK "$INSTDIR\SDK\Include\afs\*"
1904   Delete /REBOOTOK "$INSTDIR\SDK\Include\rx\*"
1905   Delete /REBOOTOK "$INSTDIR\SDK\Sample\*"
1906   Delete /REBOOTOK "$INSTDIR\SDK\*"
1907
1908   RMDir  "$INSTDIR\SDK\Sample"
1909   RMDir  "$INSTDIR\SDK\Include\afs"
1910   RMDir  "$INSTDIR\SDK\Include\rx"
1911   RMDir  "$INSTDIR\SDK\Include"
1912   RMDir  "$INSTDIR\SDK"
1913
1914   Delete /REBOOTOK "$INSTDIR\Client\Program\*"
1915   Delete /REBOOTOK "$INSTDIR\Client\*"
1916
1917   RMDir  "$INSTDIR\Client\Program"
1918   RMDir  "$INSTDIR\Client"
1919
1920 !IFDEF DEBUG  
1921 !IFDEF CL_1500
1922    SetOutPath "$INSTDIR\Common"
1923    File /oname=vcruntime.msi "${MSVCMSI}"
1924    nsExec::Exec 'msiexec /x "$INSTDIR\Common\vcruntime.msi" /passive /norestart'
1925    Delete "$INSTDIR\Common\vcruntime.msi"
1926 !ELSE
1927 !IFDEF CL_1400
1928    SetOutPath "$INSTDIR\Common"
1929    File /oname=vcruntime.msi "${MSVCMSI}"
1930    nsExec::Exec 'msiexec /x "$INSTDIR\Common\vcruntime.msi" /passive /norestart'
1931    Delete "$INSTDIR\Common\vcruntime.msi"
1932 !ELSE
1933 !IFDEF CL_1310
1934    Delete /REBOOTOK "$INSTDIR\Common\msvcr71d.dll"
1935    Delete /REBOOTOK "$INSTDIR\Common\msvcr71d.pdb"
1936    Delete /REBOOTOK "$INSTDIR\Common\msvcp71d.dll"
1937    Delete /REBOOTOK "$INSTDIR\Common\msvcp71d.pdb"
1938    Delete /REBOOTOK "$INSTDIR\Common\mfc71d.dll"
1939    Delete /REBOOTOK "$INSTDIR\Common\mfc71d.pdb"
1940 !ELSE
1941 !IFDEF CL_1300
1942    Delete /REBOOTOK "$INSTDIR\Common\msvcr70d.dll"
1943    Delete /REBOOTOK "$INSTDIR\Common\msvcr70d.pdb"
1944    Delete /REBOOTOK "$INSTDIR\Common\msvcp70d.dll"
1945    Delete /REBOOTOK "$INSTDIR\Common\msvcp70d.pdb"
1946    Delete /REBOOTOK "$INSTDIR\Common\mfc70d.dll"
1947    Delete /REBOOTOK "$INSTDIR\Common\mfc70d.pdb"
1948 !ELSE
1949    Delete /REBOOTOK "$INSTDIR\Common\mfc42d.dll"
1950    Delete /REBOOTOK "$INSTDIR\Common\mfc42d.pdb"
1951    Delete /REBOOTOK "$INSTDIR\Common\msvcp60d.dll"
1952    Delete /REBOOTOK "$INSTDIR\Common\msvcp60d.pdb"
1953    Delete /REBOOTOK "$INSTDIR\Common\msvcrtd.dll"
1954    Delete /REBOOTOK "$INSTDIR\Common\msvcrtd.pdb"
1955 !ENDIF
1956 !ENDIF
1957 !ENDIF
1958 !ENDIF
1959 !ELSE
1960 !IFDEF CL_1500
1961    SetOutPath "$INSTDIR\Common"
1962    File /oname=vcruntime.msi "${MSVCMSI}"
1963    nsExec::Exec 'msiexec /x "$INSTDIR\Common\vcruntime.msi" /passive /norestart'
1964    Delete "$INSTDIR\Common\vcruntime.msi"
1965 !ELSE
1966 !IFDEF CL_1400
1967    SetOutPath "$INSTDIR\Common"
1968    File /oname=vcruntime.msi "${MSVCMSI}"
1969    nsExec::Exec 'msiexec /x "$INSTDIR\Common\vcruntime.msi" /passive /norestart'
1970    Delete "$INSTDIR\Common\vcruntime.msi"
1971 !ELSE
1972 !IFDEF CL_1310
1973    Delete /REBOOTOK "$INSTDIR\Common\mfc71.dll"
1974    Delete /REBOOTOK "$INSTDIR\Common\msvcr71.dll"
1975    Delete /REBOOTOK "$INSTDIR\Common\msvcp71.dll"
1976    Delete /REBOOTOK "$INSTDIR\Common\MFC71CHS.DLL"
1977    Delete /REBOOTOK "$INSTDIR\Common\MFC71CHT.DLL"
1978    Delete /REBOOTOK "$INSTDIR\Common\MFC71DEU.DLL"
1979    Delete /REBOOTOK "$INSTDIR\Common\MFC71ENU.DLL"
1980    Delete /REBOOTOK "$INSTDIR\Common\MFC71ESP.DLL"
1981    Delete /REBOOTOK "$INSTDIR\Common\MFC71FRA.DLL"
1982    Delete /REBOOTOK "$INSTDIR\Common\MFC71ITA.DLL"
1983    Delete /REBOOTOK "$INSTDIR\Common\MFC71JPN.DLL"
1984    Delete /REBOOTOK "$INSTDIR\Common\MFC71KOR.DLL"
1985 !ELSE
1986 !IFDEF CL_1300
1987    Delete /REBOOTOK "$INSTDIR\Common\mfc70.dll"
1988    Delete /REBOOTOK "$INSTDIR\Common\msvcr70.dll"
1989    Delete /REBOOTOK "$INSTDIR\Common\msvcp70.dll"
1990    Delete /REBOOTOK "$INSTDIR\Common\MFC70CHS.DLL"
1991    Delete /REBOOTOK "$INSTDIR\Common\MFC70CHT.DLL"
1992    Delete /REBOOTOK "$INSTDIR\Common\MFC70DEU.DLL"
1993    Delete /REBOOTOK "$INSTDIR\Common\MFC70ENU.DLL"
1994    Delete /REBOOTOK "$INSTDIR\Common\MFC70ESP.DLL"
1995    Delete /REBOOTOK "$INSTDIR\Common\MFC70FRA.DLL"
1996    Delete /REBOOTOK "$INSTDIR\Common\MFC70ITA.DLL"
1997    Delete /REBOOTOK "$INSTDIR\Common\MFC70JPN.DLL"
1998    Delete /REBOOTOK "$INSTDIR\Common\MFC70KOR.DLL"
1999 !ELSE
2000    Delete /REBOOTOK "$INSTDIR\Common\mfc42.dll"
2001    Delete /REBOOTOK "$INSTDIR\Common\msvcp60.dll"
2002    Delete /REBOOTOK "$INSTDIR\Common\msvcrt.dll"
2003 !ENDIF
2004 !ENDIF
2005 !ENDIF
2006 !ENDIF
2007 !ENDIF
2008
2009   Delete /REBOOTOK "$INSTDIR\Common\*"
2010   RMDir "$INSTDIR\Common"
2011
2012 !ifdef INSTALL_KFW
2013   ;Remove KfW files
2014   Delete /REBOOTOK "$INSTDIR\kfw\bin\*"
2015   RMDIR  /r "$INSTDIR\kfw\bin"
2016   Delete /REBOOTOK "$INSTDIR\kfw\doc\*"
2017   RMDIR  /r "$INSTDIR\kfw\doc"
2018   RMDIR  /r "$INSTDIR\kfw"
2019 !endif
2020
2021   Delete "$SMPROGRAMS\OpenAFS\Documentation.lnk"
2022
2023   ; Remove control center
2024   Delete /REBOOTOK "$INSTDIR\Control Center\TaAfsAccountManager.exe"
2025   Delete /REBOOTOK "$INSTDIR\Control Center\TaAfsAdmSvr.exe"
2026   Delete /REBOOTOK "$INSTDIR\Control Center\TaAfsServerManager.exe"
2027   Delete /REBOOTOK "$INSTDIR\Control Center\CCUninst.dll"
2028   Delete /REBOOTOK "$INSTDIR\Control Center\TaAfsAccountManager.pdb"
2029   Delete /REBOOTOK "$INSTDIR\Control Center\TaAfsAdmSvr.pdb"
2030   Delete /REBOOTOK "$INSTDIR\Control Center\TaAfsServerManager.pdb"
2031   RMDir  "$INSTDIR\Control Center"
2032   
2033   Delete "$SMPROGRAMS\OpenAFS\Uninstall OpenAFS.lnk"
2034   Delete "$SMPROGRAMS\OpenAFS\Client\Authentication.lnk"
2035   Delete "$SMPROGRAMS\OpenAFS\Control Center\Account Manager.lnk"
2036   Delete "$SMPROGRAMS\OpenAFS\Control Center\Server Manager.lnk"
2037   RMDIR "$SMPROGRAMS\OpenAFS\Control Center"
2038   RMDir /r "$SMPROGRAMS\OpenAFS\Client"
2039   RMDir /r "$SMPROGRAMS\OpenAFS"
2040   Delete "$SMSTARTUP\AFS Credentials.lnk"
2041   
2042   ReadRegStr $R0 HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon" "CachePath"
2043   IfErrors +2
2044   Delete "$R0\AFSCache"
2045   Delete "C:\AFSCache"
2046
2047   DeleteRegKey HKCR "*\shellex\ContextMenuHandlers\AFS Client Shell Extension"
2048   DeleteRegKey HKCR "CLSID\{DC515C27-6CAC-11D1-BAE7-00C04FD140D2}\InprocServer32"
2049   DeleteRegKey HKCR "CLSID\{DC515C27-6CAC-11D1-BAE7-00C04FD140D2}"
2050   DeleteRegKey HKCR "FOLDER\shellex\ContextMenuHandlers\AFS Client Shell Extension"
2051   DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved" "{DC515C27-6CAC-11D1-BAE7-00C04FD140D2}"
2052   DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Control Panel\Cpls" "afs_cpa"
2053
2054   ; WinLogon Event Notification
2055   DeleteRegKey HKLM "Software\Microsoft\Windows NT\CurrentVersion\Winlogon\Notify\AfsLogon"
2056
2057   DeleteRegKey HKLM "${AFS_REGKEY_ROOT}\AFS Client\CurrentVersion"
2058   DeleteRegKey HKLM "${AFS_REGKEY_ROOT}\AFS Client"
2059   DeleteRegKey HKLM "${AFS_REGKEY_ROOT}\AFS Supplemental Documentation\CurrentVersion"
2060   DeleteRegKey HKLM "${AFS_REGKEY_ROOT}\AFS Supplemental Documentation"
2061   DeleteRegKey HKLM "${AFS_REGKEY_ROOT}\AFS Control Center\CurrentVersion"
2062   DeleteRegKey HKLM "${AFS_REGKEY_ROOT}\AFS Control Center"
2063   DeleteRegKey HKLM "${AFS_REGKEY_ROOT}\AFS Server\CurrentVersion"
2064   DeleteRegKey HKLM "${AFS_REGKEY_ROOT}\AFS Server"
2065   DeleteRegKey /ifempty HKLM "${AFS_REGKEY_ROOT}"
2066   DeleteRegKey HKLM "${NID_PLUGIN_MGR}\Modules\OpenAFS"
2067   DeleteRegKey HKLM "${NID_PLUGIN_MGR}\Plugins\AfsCred"
2068   DeleteRegKey /ifempty HKLM "Software\MIT\NetIDMgr"
2069   DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenAFS"
2070   DeleteRegValue HKLM "SYSTEM\CurrentControlSet\Services\NetBT\Parameters" "SmbDeviceEnabled"
2071
2072   ; Support for apps that wrote submount data directly to afsdsbmt.ini
2073   DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\IniFileMapping\afsdsbmt.ini"
2074
2075   RMDir  "$INSTDIR"
2076
2077 SectionEnd
2078
2079 ;--------------------------------
2080 ;Uninstaller Functions
2081
2082 Function un.onInit
2083
2084   ;Get language from registry
2085   ReadRegStr $LANGUAGE HKCU "Software\OpenAFS\AFS" "Installer Language"
2086
2087 FunctionEnd
2088
2089 Function un.onUninstSuccess
2090
2091   IfSilent SkipAsk
2092   MessageBox MB_OK "Please reboot your machine to complete uninstallation of the software"
2093   SkipAsk:
2094
2095 FunctionEnd
2096
2097 ;------------------------------
2098 ; Get the CellServDB file from the Internet
2099
2100 Function afs.GetCellServDB
2101
2102 ;Check if we should download CellServDB
2103 ReadINIStr $R0 $0 "Field 4" "State"
2104 StrCmp $R0 "1" DoDownload
2105
2106 ;Do nothing if we're keeping the existing file
2107 ReadINIStr $R0 $0 "Field 2" "State"
2108 StrCmp $R0 "1" done
2109
2110 ReadINIStr $R0 $0 "Field 6" "State"
2111 StrCmp $R0 "1" CheckOther
2112
2113 ReadINIStr $R0 $0 "Field 3" "State"
2114 StrCmp $R0 "1" UsePackaged
2115
2116 ; If none of these, grab file from other location
2117 goto UsePackaged
2118
2119 DoDownload:
2120    ReadINIStr $R0 $0 "Field 5" "State"
2121    NSISdl::download $R0 "$INSTDIR\Client\CellServDB"
2122    Pop $R0 ;Get the return value
2123    StrCmp $R0 "success" +2
2124       MessageBox MB_OK|MB_ICONSTOP "Download failed: $R0"
2125    goto done
2126
2127 UsePackaged:
2128    SetOutPath "$INSTDIR\Client"
2129    File "CellServDB"
2130    goto done
2131    
2132 CheckOther:
2133    ReadINIStr $R0 $0 "Field 7" "State"
2134    StrCmp $R0 "" done
2135    CopyFiles $R0 "$INSTDIR\Client\CellServDB"
2136    
2137 done:
2138
2139 FunctionEnd
2140
2141 Function AddProvider
2142    Push $R0
2143    Push $R1
2144    ReadRegStr $R0 HKLM "SYSTEM\CurrentControlSet\Control\NetworkProvider\HWOrder" "ProviderOrder"
2145    Push $R0
2146    StrCpy $R0 "TransarcAFSDaemon"
2147    Push $R0
2148    Call StrStr
2149    Pop $R0
2150    StrCmp $R0 "" +1 DoOther
2151    ReadRegStr $R1 HKLM "SYSTEM\CurrentControlSet\Control\NetworkProvider\HWOrder" "ProviderOrder"   
2152    StrCpy $R0 "$R1,TransarcAFSDaemon"
2153    WriteRegStr HKLM "SYSTEM\CurrentControlSet\Control\NetworkProvider\HWOrder" "ProviderOrder" $R0
2154 DoOther:
2155    ReadRegStr $R0 HKLM "SYSTEM\CurrentControlSet\Control\NetworkProvider\Order" "ProviderOrder"
2156    Push $R0
2157    StrCpy $R0 "TransarcAFSDaemon"
2158    Push $R0
2159    Call StrStr
2160    Pop $R0
2161    StrCmp $R0 "" +1 End
2162    ReadRegStr $R1 HKLM "SYSTEM\CurrentControlSet\Control\NetworkProvider\Order" "ProviderOrder"   
2163    StrCpy $R0 "$R1,TransarcAFSDaemon"
2164    WriteRegStr HKLM "SYSTEM\CurrentControlSet\Control\NetworkProvider\Order" "ProviderOrder" $R0   
2165 End:
2166    Pop $R1
2167    Pop $R0
2168 FunctionEnd
2169
2170 Function un.RemoveProvider
2171    Push $R0
2172    StrCpy $R0 "TransarcAFSDaemon"
2173    Push $R0
2174    StrCpy $R0 "SYSTEM\CurrentControlSet\Control\NetworkProvider\HWOrder"
2175    Call un.RemoveFromProvider
2176    StrCpy $R0 "TransarcAFSDaemon"
2177    Push $R0
2178    StrCpy $R0 "SYSTEM\CurrentControlSet\Control\NetworkProvider\Order"
2179    Call un.RemoveFromProvider
2180    Pop $R0
2181 FunctionEnd
2182
2183 Function un.RemoveFromProvider
2184   Exch $0
2185   Push $1
2186   Push $2
2187   Push $3
2188   Push $4
2189   Push $5
2190   Push $6
2191
2192   ReadRegStr $1 HKLM "$R0" "ProviderOrder"
2193     StrCpy $5 $1 1 -1 # copy last char
2194     StrCmp $5 "," +2 # if last char != ,
2195       StrCpy $1 "$1," # append ,
2196     Push $1
2197     Push "$0,"
2198     Call un.StrStr ; Find `$0,` in $1
2199     Pop $2 ; pos of our dir
2200     StrCmp $2 "" unRemoveFromPath_done
2201       ; else, it is in path
2202       # $0 - path to add
2203       # $1 - path var
2204       StrLen $3 "$0,"
2205       StrLen $4 $2
2206       StrCpy $5 $1 -$4 # $5 is now the part before the path to remove
2207       StrCpy $6 $2 "" $3 # $6 is now the part after the path to remove
2208       StrCpy $3 $5$6
2209
2210       StrCpy $5 $3 1 -1 # copy last char
2211       StrCmp $5 "," 0 +2 # if last char == ,
2212         StrCpy $3 $3 -1 # remove last char
2213
2214       WriteRegStr HKLM "$R0" "ProviderOrder" $3
2215       
2216   unRemoveFromPath_done:
2217     Pop $6
2218     Pop $5
2219     Pop $4
2220     Pop $3
2221     Pop $2
2222     Pop $1
2223     Pop $0
2224 FunctionEnd
2225
2226 Function CheckPathForAFS
2227    Push $0
2228    Push $1
2229    Push $2
2230    Push $3
2231    ReadRegStr $1 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH"
2232    StrCpy $1 "$1;"
2233 loop:
2234    Push $1
2235    Push ";"
2236    Call StrStr
2237    Pop $0
2238    StrLen $2 $0
2239    StrCpy $3 $1 -$2
2240    IfFileExists "$3\afsd_service.exe" Error
2241    StrCpy $1 $0 32768 1
2242    StrLen $2 $1
2243    IntCmp $2 0 Done Done loop
2244    goto Done
2245 Error:
2246    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."
2247    Abort "Unable to install OpenAFS"
2248 Done:
2249    Pop $3
2250    Pop $2
2251    Pop $1
2252    Pop $0
2253 FunctionEnd
2254
2255 Function AddToUniquePath
2256    Pop $R0
2257    Push $R0
2258    Push "$R0;"
2259    ReadRegStr $R0 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH"
2260    Push "$R0;"
2261    Call StrStr
2262    Pop $R0
2263    StrCmp $R0 "" +1 Done
2264    Call AddToPath
2265 Done:
2266 FunctionEnd
2267
2268
2269 ;-------------------------------
2270 ;Do the page to get the CellServDB
2271
2272 Function AFSPageGetCellServDB
2273   ; Skip this page if we are not installing the client
2274   SectionGetFlags ${secClient} $R0
2275   IntOp $R0 $R0 & ${SF_SELECTED}
2276   StrCmp $R0 "0" Skip
2277   
2278   ; Set the install options here
2279   
2280 startOver:
2281   WriteINIStr $0 "Field 2" "Flags" "DISABLED"
2282   WriteINIStr $0 "Field 3" "State" "1"
2283   WriteINISTR $0 "Field 4" "State" "0"
2284   WriteINIStr $0 "Field 6" "State" "0"
2285   
2286   ; If there is an existing afsdcell.ini file, migrate it to CellServDB
2287   IfFileExists "$WINDIR\afsdcell.ini" +1 +3
2288   CopyFiles /SILENT "$WINDIR\afsdcell.ini" "$INSTDIR\Client\CellServDB"
2289   Delete "$WINDIR\afsdcell.ini"
2290   ; If there is an existing CellServDB file, allow the user to choose it and make it default
2291   IfFileExists "$INSTDIR\Client\CellServDB" +1 notpresent
2292   WriteINIStr $0 "Field 2" "Flags" "ENABLED"
2293   WriteINIStr $0 "Field 2" "State" "1"
2294   WriteINIStr $0 "Field 3" "State" "0"
2295   
2296   notpresent:
2297   
2298   !insertmacro MUI_HEADER_TEXT "CellServDB Configuration" "Please choose a method for installing the CellServDB file:" 
2299   InstallOptions::dialog $0
2300   Pop $R1
2301   StrCmp $R1 "cancel" exit
2302   StrCmp $R1 "back" done
2303   StrCmp $R1 "success" done
2304 exit: Quit
2305 done:
2306
2307    ; Check that if a file is set, a valid filename is entered...
2308    ReadINIStr $R0 $0 "Field 6" "State"
2309    StrCmp $R0 "1" CheckFileName
2310    
2311    ;Check if a URL is specified, one *IS* specified
2312    ReadINIStr $R0 $0 "Field 4" "State"
2313    StrCmp $R0 "1" CheckURL Skip
2314    
2315    CheckURL:
2316    ReadINIStr $R0 $0 "Field 5" "State"
2317    StrCmp $R0 "" +1 Skip
2318    MessageBox MB_OK|MB_ICONSTOP $(URLError)
2319    WriteINIStr $0 "Field 4" "State" "0"
2320    goto startOver
2321    
2322    CheckFileName:
2323    ReadINIStr $R0 $0 "Field 7" "State"
2324    IfFileExists $R0 Skip
2325
2326    MessageBox MB_OK|MB_ICONSTOP $(CellError)
2327    WriteINIStr $0 "Field 6" "State" "0"
2328    goto startOver
2329    
2330    Skip:
2331    
2332 FunctionEnd
2333
2334
2335 Function AFSPageGetCellName
2336    IfSilent good
2337   ; Skip this page if we are not installing the client
2338   SectionGetFlags ${secClient} $R0
2339   IntOp $R0 $R0 & ${SF_SELECTED}
2340   StrCmp $R0 "0" good
2341   
2342 startOver:
2343    ; We want to read in the existing parameters and make them the defaults
2344    
2345    ;AFS Crypt security
2346    ReadRegDWORD $R1 HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" "SecurityLevel"
2347    StrCmp $R1 "" +3
2348    WriteINIStr $1 "Field 3" "State" $R1
2349    goto +2
2350    WriteINIStr $1 "Field 3" "State" "1"
2351    
2352    ;Use DNS
2353    ReadRegDWORD $R1 HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" "UseDNS"
2354    StrCmp $R1 "" +3
2355    WriteINIStr $1 "Field 9" "State" $R1
2356    goto +2
2357    WriteINIStr $1 "Field 9" "State" "1"
2358    
2359    ; Use integrated logon
2360    ReadRegDWORD $R1 HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" "LogonOptions"
2361    StrCmp $R1 "" +3
2362    WriteINIStr $1 "Field 7" "State" $R1
2363    goto +2
2364    WriteINIStr $1 "Field 7" "State" "0"
2365    
2366    ; If this is a server install, we do NOT want to recommend the Freelance client
2367    ; And we do not need to ask for the cell name.
2368    SectionGetFlags ${secServer} $R1
2369    IntOp $R1 $R1 & ${SF_SELECTED}
2370    StrCmp $R1 "1" +1 NotServer
2371    WriteINIStr $1 "Field 6" "Text" "Enable AFS Freelance client (Not Recommended for servers)"
2372    ReadRegDWORD $R1 HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" "FreelanceClient"
2373    StrCmp $R1 "" +3
2374    WriteINIStr $1 "Field 5" "State" $R1
2375    goto +2
2376    WriteINIStr $1 "Field 5" "State" "0"
2377    WriteINIStr $1 "Field 1" "Flags" "DISABLED"
2378    WriteINIStr $1 "Field 2" "Flags" "DISABLED"
2379    goto SkipServerTest
2380 NotServer:
2381    WriteINIStr $1 "Field 6" "Text" "Enable AFS Freelance client (Recommended)"
2382    ReadRegDWORD $R1 HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" "FreelanceClient"
2383    StrCmp $R1 "" +3
2384    WriteINIStr $1 "Field 5" "State" $R1
2385    goto +2
2386    WriteINIStr $1 "Field 5" "State" "1"
2387    WriteINIStr $1 "Field 1" "Flags" ""
2388    WriteINIStr $1 "Field 2" "Flags" ""
2389 SkipServerTest:
2390    ; Get the current cell name, if any
2391    ReadRegStr $R1 HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" "Cell"
2392    StrCmp $R1 "" +2
2393    WriteINIStr $1 "Field 2" "State" $R1
2394   !insertmacro MUI_HEADER_TEXT "Client Cell Name Configuration" "Please enter the name for your default cell:" 
2395   InstallOptions::dialog $1
2396   Pop $R1
2397   StrCmp $R1 "cancel" exit
2398   StrCmp $R1 "back" done
2399   StrCmp $R1 "success" done
2400 exit: Quit
2401 done:
2402    ReadINIStr $R0 $1 "Field 2" "State"
2403    StrCmp $R0 "" +1 good
2404    
2405    MessageBox MB_OK|MB_ICONSTOP $(CellNameError)
2406    goto startOver
2407 good:
2408 FunctionEnd
2409
2410
2411 ;---------------------------------------------------------
2412 ;Do the page to get the afscreds.exe startup configuration
2413
2414 Function AFSPageConfigAFSCreds
2415   ; Skip this page if we are not installing the client
2416   SectionGetFlags ${secClient} $R0
2417   IntOp $R0 $R0 & ${SF_SELECTED}
2418   StrCmp $R0 "0" done
2419   
2420   ; Set the install options here
2421   
2422   !insertmacro MUI_HEADER_TEXT "AFS Credentials Configuration" "Please choose default options for configuring the AFS Credentials program:" 
2423   InstallOptions::dialog $2
2424   Pop $R1
2425   StrCmp $R1 "cancel" exit
2426   StrCmp $R1 "back" done
2427   StrCmp $R1 "success" done
2428 exit: Quit
2429 done:
2430    
2431 FunctionEnd
2432
2433
2434 ;-------------
2435 ; Common install routines for each module
2436 Function AFSCommon.Install
2437
2438 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenAFS" "DisplayName" "OpenAFS for Windows"
2439 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenAFS" "UninstallString" "$INSTDIR\uninstall.exe"
2440 !ifndef DEBUG
2441 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenAFS" "DisplayVersion" "${AFS_VERSION}"
2442 !else
2443 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenAFS" "DisplayVersion" "${AFS_VERSION} Checked/Debug"
2444 !endif
2445 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenAFS" "URLInfoAbout" "http://www.openafs.org/"
2446
2447 FunctionEnd
2448
2449
2450 ;-------------------
2451 ; Get the currently installed version and place it on the stack
2452 ; Modifies: Nothing
2453 Function GetInstalledVersion
2454    Push $R0
2455    Push $R1
2456    Push $R4
2457    
2458    ReadRegStr $R0 HKLM "Software\TransarcCorporation\$R2\CurrentVersion" "VersionString"
2459    StrCmp $R0 "" NotTransarc done
2460    
2461    
2462 NotTransarc:
2463    ReadRegStr $R0 HKLM "${AFS_REGKEY_ROOT}\$R2\CurrentVersion" "VersionString"
2464    StrCmp $R0 "" done
2465    
2466 done:
2467    Pop $R4
2468    Pop $R1
2469    Exch $R0
2470 FunctionEnd
2471
2472 ; Functions to get each component of the version number
2473 Function GetInstalledVersionMajor
2474    Push $R0
2475    Push $R1
2476    Push $R4
2477    
2478    ReadRegDWORD $R0 HKLM "Software\TransarcCorporation\$R2\CurrentVersion" "MajorVersion"
2479    StrCmp $R0 "" NotTransarc done
2480    
2481    
2482 NotTransarc:
2483    ReadRegDWORD $R0 HKLM "${AFS_REGKEY_ROOT}\$R2\CurrentVersion" "MajorVersion"
2484    StrCmp $R0 "" done
2485    
2486 done:
2487    Pop $R4
2488    Pop $R1
2489    Exch $R0
2490 FunctionEnd
2491
2492 Function GetInstalledVersionMinor
2493    Push $R0
2494    Push $R1
2495    Push $R4
2496    
2497    ReadRegDWORD $R0 HKLM "Software\TransarcCorporation\$R2\CurrentVersion" "MinorVersion"
2498    StrCmp $R0 "" NotTransarc done
2499    
2500    
2501 NotTransarc:
2502    ReadRegDWORD $R0 HKLM "${AFS_REGKEY_ROOT}\$R2\CurrentVersion" "MinorVersion"
2503    StrCmp $R0 "" done
2504    
2505 done:
2506    Pop $R4
2507    Pop $R1
2508    Exch $R0
2509 FunctionEnd
2510
2511 Function GetInstalledVersionPatch
2512    Push $R0
2513    Push $R1
2514    Push $R4
2515    
2516    ReadRegDWORD $R0 HKLM "Software\TransarcCorporation\$R2\CurrentVersion" "PatchLevel"
2517    StrCmp $R0 "" NotTransarc done
2518    
2519    
2520 NotTransarc:
2521    ReadRegDWORD $R0 HKLM "${AFS_REGKEY_ROOT}\$R2\CurrentVersion" "PatchLevel"
2522    StrCmp $R0 "" done
2523    
2524 done:
2525    Pop $R4
2526    Pop $R1
2527    Exch $R0
2528 FunctionEnd
2529
2530
2531
2532 ;-------------------------------
2533 ; Check if the client should be checked for default install
2534 Function ShouldClientInstall
2535    Push $R0
2536    StrCpy $R2 "AFS Client"
2537    Call GetInstalledVersion
2538    Pop $R0
2539    
2540    StrCmp $R0 "" NotInstalled
2541    ; Now we see if it's an older or newer version
2542    
2543    Call GetInstalledVersionMajor
2544    Pop $R0
2545    IntCmpU $R0 ${AFS_MAJORVERSION} +1 Upgrade Downgrade
2546
2547    Call GetInstalledVersionMinor
2548    Pop $R0
2549    IntCmpU $R0 ${AFS_MINORVERSION} +1 Upgrade Downgrade
2550    
2551    Call GetInstalledVersionPatch
2552    Pop $R0
2553    IntCmpU $R0 ${AFS_PATCHLEVEL} Reinstall Upgrade Downgrade
2554    
2555 Reinstall:
2556    StrCpy $R0 "1"
2557    Exch $R0
2558    goto end
2559    
2560 Upgrade:
2561    StrCpy $R0 "2"
2562    Exch $R0
2563    goto end
2564    
2565 Downgrade:
2566    StrCpy $R0 "3"
2567    Exch $R0
2568    goto end
2569    
2570 NotInstalled:
2571    StrCpy $R0 "0"
2572    Exch $R0
2573 end:   
2574 FunctionEnd
2575
2576 ;-------------------------------
2577 ; Check how the server options should be set
2578 Function ShouldServerInstall
2579    Push $R0
2580    StrCpy $R2 "AFS Server"
2581    Call GetInstalledVersion
2582    Pop $R0
2583    
2584    StrCmp $R0 "" NotInstalled
2585    ; Now we see if it's an older or newer version
2586
2587    Call GetInstalledVersionMajor
2588    Pop $R0
2589    IntCmpU $R0 ${AFS_MAJORVERSION} +1 Upgrade Downgrade
2590
2591    Call GetInstalledVersionMinor
2592    Pop $R0
2593    IntCmpU $R0 ${AFS_MINORVERSION} +1 Upgrade Downgrade
2594    
2595    Call GetInstalledVersionPatch
2596    Pop $R0
2597    IntCmpU $R0 ${AFS_PATCHLEVEL} Reinstall Upgrade Downgrade
2598    
2599 Reinstall:
2600    StrCpy $R0 "1"
2601    Exch $R0
2602    goto end
2603    
2604 Upgrade:
2605    StrCpy $R0 "2"
2606    Exch $R0
2607    goto end
2608    
2609 Downgrade:
2610    StrCpy $R0 "3"
2611    Exch $R0
2612    goto end
2613    
2614    
2615 NotInstalled:
2616    StrCpy $R0 "0"
2617    Exch $R0
2618 end:   
2619 FunctionEnd
2620
2621
2622 ; See if AFS Server is installed
2623 ; Returns: "1" if it is, 0 if it is not (on the stack)
2624 Function IsServerInstalled
2625    Push $R0
2626    StrCpy $R2 "AFS Server"
2627    Call GetInstalledVersion
2628    Pop $R0
2629    
2630    StrCmp $R0 "" NotInstalled
2631    
2632    StrCpy $R0 "1"
2633    Exch $R0
2634    goto end
2635    
2636 NotInstalled:
2637    StrCpy $R0 "0"
2638    Exch $R0
2639 end:   
2640 FunctionEnd
2641
2642
2643 ; See if AFS Client is installed
2644 ; Returns: "1" if it is, 0 if it is not (on the stack)
2645 Function IsClientInstalled
2646    Push $R0
2647    StrCpy $R2 "AFS Client"
2648    Call GetInstalledVersion
2649    Pop $R0
2650    
2651    StrCmp $R0 "" NotInstalled
2652    
2653    StrCpy $R0 "1"
2654    Exch $R0
2655    goto end
2656    
2657 NotInstalled:
2658    StrCpy $R0 "0"
2659    Exch $R0
2660 end:   
2661 FunctionEnd
2662
2663
2664
2665 ; See if AFS Documentation is installed
2666 ; Returns: "1" if it is, 0 if it is not (on the stack)
2667 Function IsDocumentationInstalled
2668    Push $R0
2669    StrCpy $R2 "AFS Supplemental Documentation"
2670    Call GetInstalledVersion
2671    Pop $R0
2672    
2673    StrCmp $R0 "" NotInstalled
2674    
2675    StrCpy $R0 "1"
2676    Exch $R0
2677    goto end
2678    
2679 NotInstalled:
2680    StrCpy $R0 "0"
2681    Exch $R0
2682 end:   
2683 FunctionEnd
2684
2685
2686 ; See if Control Center is installed
2687 ; Returns: "1" if it is, 0 if it is not (on the stack)
2688 Function IsControlInstalled
2689    Push $R0
2690    StrCpy $R2 "AFS Control Center"
2691    Call GetInstalledVersion
2692    Pop $R0
2693    
2694    StrCmp $R0 "" NotInstalled
2695    
2696    StrCpy $R0 "1"
2697    Exch $R0
2698    goto end
2699    
2700 NotInstalled:
2701    StrCpy $R0 "0"
2702    Exch $R0
2703 end:   
2704 FunctionEnd
2705
2706
2707 !ifdef USE_GETPARAMETERS
2708 ; GetParameters
2709 ; input, none
2710 ; output, top of stack (replaces, with e.g. whatever)
2711 ; modifies no other variables.
2712
2713 Function GetParameters
2714   Push $R0
2715   Push $R1
2716   Push $R2
2717   StrCpy $R0 $CMDLINE 1
2718   StrCpy $R1 '"'
2719   StrCpy $R2 1
2720   StrCmp $R0 '"' loop
2721     StrCpy $R1 ' ' ; we're scanning for a space instead of a quote
2722   loop:
2723     StrCpy $R0 $CMDLINE 1 $R2
2724     StrCmp $R0 $R1 loop2
2725     StrCmp $R0 "" loop2
2726     IntOp $R2 $R2 + 1
2727     Goto loop
2728   loop2:
2729     IntOp $R2 $R2 + 1
2730     StrCpy $R0 $CMDLINE 1 $R2
2731     StrCmp $R0 " " loop2
2732   StrCpy $R0 $CMDLINE "" $R2
2733   Pop $R2
2734   Pop $R1
2735   Exch $R0
2736 FunctionEnd
2737 !endif
2738
2739
2740 ;Check to see if any AFS component is installed
2741 ;Returns: Value on stack: "1" if it is, "0" if it is not
2742 Function IsAnyAFSInstalled
2743    Push $R0
2744    Push $R1
2745    Push $R2
2746    Push $R3
2747    Call IsClientInstalled
2748    Pop $R0
2749    Call IsServerInstalled
2750    Pop $R1
2751    Call IsControlInstalled
2752    Pop $R2
2753    Call IsDocumentationInstalled
2754    Pop $R3
2755    ; Now we must see if ANY of the $Rn values are 1
2756    StrCmp $R0 "1" SomethingInstalled
2757    StrCmp $R1 "1" SomethingInstalled
2758    StrCmp $R2 "1" SomethingInstalled
2759    StrCmp $R3 "1" SomethingInstalled
2760    ;Nothing installed
2761    StrCpy $R0 "0"
2762    goto end
2763 SomethingInstalled:
2764    StrCpy $R0 "1"
2765 end:
2766    Pop $R3
2767    Pop $R2
2768    Pop $R1
2769    Exch $R0
2770 FunctionEnd
2771
2772
2773 ;Install English Language Files
2774 Function AFSLangFiles
2775    ; Common files
2776    SetOutPath "$INSTDIR\Common"
2777    File "${AFS_CLIENT_BUILDDIR}\afs_config.exe"
2778   !insertmacro ReplaceDLL "${AFS_DESTDIR}\lib\afsauthent.dll" "$INSTDIR\Common\afsauthent.dll" "$INSTDIR"
2779   !insertmacro ReplaceDLL "${AFS_DESTDIR}\lib\afspthread.dll" "$INSTDIR\Common\afspthread.dll" "$INSTDIR"
2780   !insertmacro ReplaceDLL "${AFS_DESTDIR}\lib\afsrpc.dll" "$INSTDIR\Common\afsrpc.dll" "$INSTDIR"
2781   !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afsadminutil.dll"    "$INSTDIR\Common\afsadminutil.dll"    "$INSTDIR"
2782   !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afsclientadmin.dll"  "$INSTDIR\Common\afsclientadmin.dll"  "$INSTDIR" 
2783   !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afsprocmgmt.dll"     "$INSTDIR\Common\afsprocmgmt.dll"     "$INSTDIR" 
2784   !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afsvosadmin.dll"     "$INSTDIR\Common\afsvosadmin.dll"     "$INSTDIR" 
2785   !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\TaAfsAppLib.dll"     "$INSTDIR\Common\TaAfsAppLib.dll"     "$INSTDIR" 
2786   !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afsvosadmin.dll"     "$INSTDIR\Common\afsvosadmin.dll"     "$INSTDIR" 
2787   !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afsbosadmin.dll"     "$INSTDIR\Common\afsbosadmin.dll"     "$INSTDIR" 
2788   !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afscfgadmin.dll"     "$INSTDIR\Common\afscfgadmin.dll"     "$INSTDIR" 
2789   !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afskasadmin.dll"     "$INSTDIR\Common\afskasadmin.dll"     "$INSTDIR" 
2790   !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afsptsadmin.dll"     "$INSTDIR\Common\afsptsadmin.dll"     "$INSTDIR" 
2791
2792  SetOutPath "$INSTDIR\Common"
2793
2794 !IFDEF DEBUG
2795 !IFDEF CL_1500
2796    File /oname=vcruntime.msi "${MSVCMSI}"
2797    nsExec::Exec 'msiexec /i "$INSTDIR\Common\vcruntime.msi" /passive /norestart'
2798    Delete "$INSTDIR\Common\vcruntime.msi"
2799 !ELSE
2800 !IFDEF CL_1400
2801    File /oname=vcruntime.msi "${MSVCMSI}"
2802    nsExec::Exec 'msiexec /i "$INSTDIR\Common\vcruntime.msi" /passive /norestart'
2803    Delete "$INSTDIR\Common\vcruntime.msi"
2804 !ELSE
2805 !IFDEF CL_1310
2806    !insertmacro ReplaceDLL "${SYSTEMDIR}\msvcr71d.dll" "$INSTDIR\Common\msvcr71d.dll" "$INSTDIR"
2807    !insertmacro ReplaceDLL "${SYSTEMDIR}\msvcp71d.dll" "$INSTDIR\Common\msvcp71d.dll" "$INSTDIR"
2808    !insertmacro ReplaceDLL "${SYSTEMDIR}\mfc71d.dll" "$INSTDIR\Common\mfc71d.dll" "$INSTDIR"
2809    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71CHS.DLL" "$INSTDIR\Common\MFC71CHS.DLL" "$INSTDIR"
2810    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71CHT.DLL" "$INSTDIR\Common\MFC71CHT.DLL" "$INSTDIR"
2811    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71DEU.DLL" "$INSTDIR\Common\MFC71DEU.DLL" "$INSTDIR"
2812    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71ENU.DLL" "$INSTDIR\Common\MFC71ENU.DLL" "$INSTDIR"
2813    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71ESP.DLL" "$INSTDIR\Common\MFC71ESP.DLL" "$INSTDIR"
2814    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71FRA.DLL" "$INSTDIR\Common\MFC71FRA.DLL" "$INSTDIR"
2815    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71ITA.DLL" "$INSTDIR\Common\MFC71ITA.DLL" "$INSTDIR"
2816    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71JPN.DLL" "$INSTDIR\Common\MFC71JPN.DLL" "$INSTDIR"
2817    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71KOR.DLL" "$INSTDIR\Common\MFC71KOR.DLL" "$INSTDIR"
2818 !ELSE
2819 !IFDEF CL_1300
2820    !insertmacro ReplaceDLL "${SYSTEMDIR}\msvcr70d.dll" "$INSTDIR\Common\msvcr70d.dll" "$INSTDIR"
2821    !insertmacro ReplaceDLL "${SYSTEMDIR}\msvcp70d.dll" "$INSTDIR\Common\msvcp70d.dll" "$INSTDIR"
2822    !insertmacro ReplaceDLL "${SYSTEMDIR}\mfc70d.dll" "$INSTDIR\Common\mfc70d.dll" "$INSTDIR"
2823    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70CHS.DLL" "$INSTDIR\Common\MFC70CHS.DLL" "$INSTDIR"
2824    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70CHT.DLL" "$INSTDIR\Common\MFC70CHT.DLL" "$INSTDIR"
2825    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70DEU.DLL" "$INSTDIR\Common\MFC70DEU.DLL" "$INSTDIR"
2826    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70ENU.DLL" "$INSTDIR\Common\MFC70ENU.DLL" "$INSTDIR"
2827    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70ESP.DLL" "$INSTDIR\Common\MFC70ESP.DLL" "$INSTDIR"
2828    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70FRA.DLL" "$INSTDIR\Common\MFC70FRA.DLL" "$INSTDIR"
2829    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70ITA.DLL" "$INSTDIR\Common\MFC70ITA.DLL" "$INSTDIR"
2830    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70JPN.DLL" "$INSTDIR\Common\MFC70JPN.DLL" "$INSTDIR"
2831    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70KOR.DLL" "$INSTDIR\Common\MFC70KOR.DLL" "$INSTDIR"
2832 !ELSE
2833    !insertmacro ReplaceDLL "${SYSTEMDIR}\mfc42d.dll" "$INSTDIR\Common\mfc42d.dll" "$INSTDIR"
2834    !insertmacro ReplaceDLL "${SYSTEMDIR}\msvcp60d.dll" "$INSTDIR\Common\msvcp60d.dll" "$INSTDIR"
2835    !insertmacro ReplaceDLL "${SYSTEMDIR}\msvcrtd.dll" "$INSTDIR\Common\msvcrtd.dll" "$INSTDIR"
2836 !ENDIF
2837 !ENDIF
2838 !ENDIF
2839 !ENDIF
2840 !ELSE
2841 !IFDEF CL_1500
2842    File /oname=vcruntime.msi "${MSVCMSI}"
2843    nsExec::Exec 'msiexec /i "$INSTDIR\Common\vcruntime.msi" /passive /norestart'
2844    Delete "$INSTDIR\Common\vcruntime.msi"
2845 !ELSE
2846 !IFDEF CL_1400
2847    File /oname=vcruntime.msi "${MSVCMSI}"
2848    nsExec::Exec 'msiexec /i "$INSTDIR\Common\vcruntime.msi" /passive /norestart'
2849    Delete "$INSTDIR\Common\vcruntime.msi"
2850 !ELSE
2851 !IFDEF CL_1310
2852    !insertmacro ReplaceDLL "${SYSTEMDIR}\mfc71.dll" "$INSTDIR\Common\mfc71.dll" "$INSTDIR"
2853    !insertmacro ReplaceDLL "${SYSTEMDIR}\msvcr71.dll" "$INSTDIR\Common\msvcr71.dll" "$INSTDIR"
2854    !insertmacro ReplaceDLL "${SYSTEMDIR}\msvcp71.dll" "$INSTDIR\Common\msvcp71.dll" "$INSTDIR"
2855    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71CHS.DLL" "$INSTDIR\Common\MFC71CHS.DLL" "$INSTDIR"
2856    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71CHT.DLL" "$INSTDIR\Common\MFC71CHT.DLL" "$INSTDIR"
2857    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71DEU.DLL" "$INSTDIR\Common\MFC71DEU.DLL" "$INSTDIR"
2858    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71ENU.DLL" "$INSTDIR\Common\MFC71ENU.DLL" "$INSTDIR"
2859    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71ESP.DLL" "$INSTDIR\Common\MFC71ESP.DLL" "$INSTDIR"
2860    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71FRA.DLL" "$INSTDIR\Common\MFC71FRA.DLL" "$INSTDIR"
2861    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71ITA.DLL" "$INSTDIR\Common\MFC71ITA.DLL" "$INSTDIR"
2862    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71JPN.DLL" "$INSTDIR\Common\MFC71JPN.DLL" "$INSTDIR"
2863    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71KOR.DLL" "$INSTDIR\Common\MFC71KOR.DLL" "$INSTDIR"
2864 !ELSE
2865 !IFDEF CL_1300
2866    !insertmacro ReplaceDLL "${SYSTEMDIR}\mfc70.dll" "$INSTDIR\Common\mfc70.dll" "$INSTDIR"
2867    !insertmacro ReplaceDLL "${SYSTEMDIR}\msvcr70.dll" "$INSTDIR\Common\msvcr70.dll" "$INSTDIR"
2868    !insertmacro ReplaceDLL "${SYSTEMDIR}\msvcp70.dll" "$INSTDIR\Common\msvcp70.dll" "$INSTDIR"
2869    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70CHS.DLL" "$INSTDIR\Common\MFC70CHS.DLL" "$INSTDIR"
2870    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70CHT.DLL" "$INSTDIR\Common\MFC70CHT.DLL" "$INSTDIR"
2871    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70DEU.DLL" "$INSTDIR\Common\MFC70DEU.DLL" "$INSTDIR"
2872    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70ENU.DLL" "$INSTDIR\Common\MFC70ENU.DLL" "$INSTDIR"
2873    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70ESP.DLL" "$INSTDIR\Common\MFC70ESP.DLL" "$INSTDIR"
2874    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70FRA.DLL" "$INSTDIR\Common\MFC70FRA.DLL" "$INSTDIR"
2875    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70ITA.DLL" "$INSTDIR\Common\MFC70ITA.DLL" "$INSTDIR"
2876    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70JPN.DLL" "$INSTDIR\Common\MFC70JPN.DLL" "$INSTDIR"
2877    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70KOR.DLL" "$INSTDIR\Common\MFC70KOR.DLL" "$INSTDIR"
2878 !ELSE
2879    !insertmacro ReplaceDLL "${SYSTEMDIR}\mfc42.dll" "$INSTDIR\Common\mfc42.dll" "$INSTDIR"
2880    !insertmacro ReplaceDLL "${SYSTEMDIR}\msvcp60.dll" "$INSTDIR\Common\msvcp60.dll" "$INSTDIR"
2881    !insertmacro ReplaceDLL "${SYSTEMDIR}\msvcrt.dll" "$INSTDIR\Common\msvcrt.dll" "$INSTDIR"
2882 !ENDIF
2883 !ENDIF
2884 !ENDIF   
2885 !ENDIF
2886 !ENDIF
2887
2888    StrCmp $LANGUAGE ${LANG_ENGLISH} DoEnglish
2889    StrCmp $LANGUAGE ${LANG_GERMAN} DoGerman
2890    StrCmp $LANGUAGE ${LANG_SPANISH} DoSpanish
2891    StrCmp $LANGUAGE ${LANG_JAPANESE} DoJapanese
2892    StrCmp $LANGUAGE ${LANG_KOREAN} DoKorean
2893    StrCmp $LANGUAGE ${LANG_PORTUGUESEBR} DoPortugueseBR
2894    StrCmp $LANGUAGE ${LANG_SIMPCHINESE} DoSimpChinese
2895    StrCmp $LANGUAGE ${LANG_TRADCHINESE} DoTradChinese
2896    
2897 DoEnglish:
2898
2899    SetOutPath "$INSTDIR\Documentation"
2900    File "..\..\doc\install\Documentation\en_US\README.TXT"
2901    SetOutPath "$INSTDIR\Documentation\html"
2902    File "..\..\doc\install\Documentation\en_US\html\*"
2903    SetOutPath "$INSTDIR\Documentation\html\index_files"
2904    File "..\..\doc\install\Documentation\en_US\html\index_files\*"
2905    SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes"
2906    File "..\..\doc\install\Documentation\en_US\html\ReleaseNotes\*"
2907    SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes\logo_files"
2908    File "..\..\doc\install\Documentation\en_US\html\ReleaseNotes\logo_files\*"
2909    SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes\relnotes_files"
2910    File "..\..\doc\install\Documentation\en_US\html\ReleaseNotes\relnotes_files\*"
2911
2912    SetOutPath "$INSTDIR\Client\Program"
2913    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afscreds_1033.dll"    "$INSTDIR\Client\Program\afscreds_1033.dll" "$INSTDIR"
2914    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afs_shl_ext_1033.dll" "$INSTDIR\Client\Program\afs_shl_ext_1033.dll" "$INSTDIR"
2915 !ifdef DEBUG
2916    ;File "${AFS_CLIENT_BUILDDIR}\afs_shl_ext_1033.pdb"
2917    ;File "${AFS_CLIENT_BUILDDIR}\afscreds_1033.pdb"
2918 !endif
2919
2920    File "..\..\doc\help\en_US\afs-light.CNT"
2921    File "..\..\doc\help\en_US\afs-light.hlp"
2922    File "..\..\doc\help\en_US\afs-nt.CNT"
2923    File "..\..\doc\help\en_US\afs-nt.HLP"
2924
2925    SetOutPath "$INSTDIR\Common"
2926    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afs_config_1033.dll"           "$INSTDIR\Common\afs_config_1033.dll" "$INSTDIR"
2927    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afs_cpa_1033.dll"              "$INSTDIR\Common\afs_cpa_1033.dll" "$INSTDIR"
2928    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afseventmsg_1033.dll"          "$INSTDIR\Common\afseventmsg_1033.dll" "$INSTDIR"
2929   ;!insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afs_setup_utils_1033.dll"      "$INSTDIR\Common\afs_setup_utils_1033.dll" "$INSTDIR"
2930    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afsserver_1033.dll"            "$INSTDIR\Common\afsserver_1033.dll" "$INSTDIR"
2931    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afssvrcfg_1033.dll"            "$INSTDIR\Common\afssvrcfg_1033.dll" "$INSTDIR"
2932    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\TaAfsAccountManager_1033.dll"  "$INSTDIR\Common\TaAfsAccountManager_1033.dll" "$INSTDIR"
2933    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\TaAfsAppLib_1033.dll"          "$INSTDIR\Common\TaAfsAppLib_1033.dll" "$INSTDIR"
2934    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\TaAfsServerManager_1033.dll"   "$INSTDIR\Common\TaAfsServerManager_1033.dll" "$INSTDIR"
2935    File "..\..\doc\help\en_US\afs-cc.CNT"
2936    File "..\..\doc\help\en_US\afs-cc.hlp"
2937    File "..\..\doc\help\en_US\taafscfg.CNT"
2938    File "..\..\doc\help\en_US\taafscfg.hlp"
2939    File "..\..\doc\help\en_US\taafssvrmgr.CNT"
2940    File "..\..\doc\help\en_US\taafssvrmgr.hlp"
2941    File "..\..\doc\help\en_US\taafsusrmgr.CNT"
2942    File "..\..\doc\help\en_US\taafsusrmgr.hlp"
2943
2944 !ifdef DEBUG
2945    ;File "${AFS_CLIENT_BUILDDIR}\afs_config_1033.pdb"
2946    ;File "${AFS_CLIENT_BUILDDIR}\afs_cpa_1033.pdb"
2947    ;File "${AFS_SERVER_BUILDDIR}\afseventmsg_1033.pdb"
2948    ;File "${AFS_SERVER_BUILDDIR}\afsserver_1033.pdb"
2949    ;File "${AFS_SERVER_BUILDDIR}\afssvrcfg_1033.pdb"
2950    ;File "${AFS_SERVER_BUILDDIR}\TaAfsAccountManager_1033.pdb"
2951    ;File "${AFS_SERVER_BUILDDIR}\TaAfsAppLib_1033.pdb"
2952    ;File "${AFS_SERVER_BUILDDIR}\TaAfsServerManager_1033.pdb"
2953 !ENDIF
2954    goto done
2955
2956 DoGerman:
2957
2958    SetOutPath "$INSTDIR\Documentation"
2959    File "..\..\doc\install\Documentation\de_DE\README.TXT"
2960    SetOutPath "$INSTDIR\Documentation\html"
2961    File "..\..\doc\install\Documentation\de_DE\html\*"
2962    SetOutPath "$INSTDIR\Documentation\html\index_files"
2963    ;File "..\..\doc\install\Documentation\de_DE\html\index_files\*"
2964    SetOutPath "$INSTDIR\Documentation\html\InstallGd"
2965    File "..\..\doc\install\Documentation\de_DE\html\InstallGd\*"
2966    ;SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes"
2967    ;File "..\..\doc\install\Documentation\de_DE\html\ReleaseNotes\*"
2968    ;SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes\logo_files"
2969    ;File "..\..\doc\install\Documentation\de_DE\html\ReleaseNotes\logo_files\*"
2970    ;SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes\relnotes_files"
2971    ;File "..\..\doc\install\Documentation\de_DE\html\ReleaseNotes\relnotes_files\*"
2972
2973    SetOutPath "$INSTDIR\Client\Program"
2974   !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afscreds_1032.dll"                      "$INSTDIR\Client\Program\afscreds_1032.dll" "$INSTDIR"
2975   !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afs_shl_ext_1032.dll" "$INSTDIR\Client\Program\afs_shl_ext_1032.dll" "$INSTDIR"
2976 !ifdef DEBUG
2977    ;File "${AFS_CLIENT_BUILDDIR}\afs_shl_ext_1032.pdb"
2978    ;File "${AFS_CLIENT_BUILDDIR}\afscreds_1032.pdb"
2979 !endif
2980
2981    File "..\..\doc\help\de_DE\afs-light.CNT"
2982    File "..\..\doc\help\de_DE\afs-light.hlp"
2983    File "..\..\doc\help\de_DE\afs-nt.CNT"
2984    File "..\..\doc\help\de_DE\afs-nt.HLP"
2985
2986    SetOutPath "$INSTDIR\Common"
2987    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afs_config_1032.dll"           "$INSTDIR\Common\afs_config_1032.dll" "$INSTDIR"
2988    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afs_cpa_1032.dll"              "$INSTDIR\Common\afs_cpa_1032.dll" "$INSTDIR" 
2989    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afseventmsg_1032.dll"          "$INSTDIR\Common\afseventmsg_1032.dll" "$INSTDIR" 
2990   ;!insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afs_setup_utils_1032.dll"      "$INSTDIR\Common\afs_setup_utils_1032.dll" "$INSTDIR" 
2991    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afsserver_1032.dll"            "$INSTDIR\Common\afsserver_1032.dll" "$INSTDIR" 
2992    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afssvrcfg_1032.dll"            "$INSTDIR\Common\afssvrcfg_1032.dll" "$INSTDIR" 
2993    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\TaAfsAccountManager_1032.dll"  "$INSTDIR\Common\TaAfsAccountManager_1032.dll" "$INSTDIR" 
2994    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\TaAfsAppLib_1032.dll"          "$INSTDIR\Common\TaAfsAppLib_1032.dll" "$INSTDIR" 
2995    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\TaAfsServerManager_1032.dll"   "$INSTDIR\Common\TaAfsServerManager_1032.dll" "$INSTDIR" 
2996    File "..\..\doc\help\de_DE\afs-cc.CNT"
2997    File "..\..\doc\help\de_DE\afs-cc.hlp"
2998    File "..\..\doc\help\de_DE\taafscfg.CNT"
2999    File "..\..\doc\help\de_DE\taafscfg.hlp"
3000    File "..\..\doc\help\de_DE\taafssvrmgr.CNT"
3001    File "..\..\doc\help\de_DE\taafssvrmgr.hlp"
3002    File "..\..\doc\help\de_DE\taafsusrmgr.CNT"
3003    File "..\..\doc\help\de_DE\taafsusrmgr.hlp"
3004
3005 !ifdef DEBUG
3006    ;File "${AFS_CLIENT_BUILDDIR}\afs_config_1032.pdb"
3007    ;File "${AFS_CLIENT_BUILDDIR}\afs_cpa_1032.pdb"
3008    ;File "${AFS_SERVER_BUILDDIR}\afseventmsg_1032.pdb"
3009    ;File "${AFS_SERVER_BUILDDIR}\afsserver_1032.pdb"
3010    ;File "${AFS_SERVER_BUILDDIR}\afssvrcfg_1032.pdb"
3011    ;File "${AFS_SERVER_BUILDDIR}\TaAfsAccountManager_1032.pdb"
3012    ;File "${AFS_SERVER_BUILDDIR}\TaAfsAppLib_1032.pdb"
3013    ;File "${AFS_SERVER_BUILDDIR}\TaAfsServerManager_1032.pdb"
3014 !ENDIF
3015    goto done   
3016
3017 DoSpanish:
3018
3019    SetOutPath "$INSTDIR\Documentation"
3020    File "..\..\doc\install\Documentation\es_ES\README.TXT"
3021    SetOutPath "$INSTDIR\Documentation\html"
3022    ;File "..\..\doc\install\Documentation\es_ES\html\*"
3023    SetOutPath "$INSTDIR\Documentation\html\index_html"
3024    ;File "..\..\doc\install\Documentation\es_ES\html\index_files\*"
3025    SetOutPath "$INSTDIR\Documentation\html\InstallGd"
3026    ;File "..\..\doc\install\Documentation\es_ES\html\InstallGd\*"
3027    SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes"
3028    ;File "..\..\doc\install\Documentation\es_ES\html\ReleaseNotes\*"
3029    SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes\logo_files"
3030    ;File "..\..\doc\install\Documentation\es_ES\html\ReleaseNotes\logo_files\*"
3031    SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes\relnotes_files"
3032    ;File "..\..\doc\install\Documentation\es_ES\html\ReleaseNotes\relnotes_files\*"
3033
3034    SetOutPath "$INSTDIR\Client\Program"
3035    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afscreds_1034.dll"     "$INSTDIR\Client\Program\afscreds_1034.dll" "$INSTDIR" 
3036    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afs_shl_ext_1034.dll" "$INSTDIR\Client\Program\afs_shl_ext_1034.dll" "$INSTDIR"
3037 !ifdef DEBUG
3038    ;File "${AFS_CLIENT_BUILDDIR}\afscreds_1034.pdb"
3039    ;File "${AFS_CLIENT_BUILDDIR}\afs_shl_ext_1034.pdb"
3040 !endif
3041
3042    File "..\..\doc\help\es_ES\afs-light.CNT"
3043    File "..\..\doc\help\es_ES\afs-light.hlp"
3044    File "..\..\doc\help\es_ES\afs-nt.CNT"
3045    File "..\..\doc\help\es_ES\afs-nt.HLP"
3046
3047    SetOutPath "$INSTDIR\Common"
3048    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afs_config_1034.dll"          "$INSTDIR\Common\afs_config_1034.dll" "$INSTDIR"  
3049    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afs_cpa_1034.dll"             "$INSTDIR\Common\afs_cpa_1034.dll" "$INSTDIR"  
3050    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afseventmsg_1034.dll"         "$INSTDIR\Common\afseventmsg_1034.dll" "$INSTDIR"  
3051   ;!insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afs_setup_utils_1034.dll"     "$INSTDIR\Common\afs_setup_utils_1034.dll" "$INSTDIR"  
3052    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afsserver_1034.dll"           "$INSTDIR\Common\afsserver_1034.dll" "$INSTDIR"  
3053    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afssvrcfg_1034.dll"           "$INSTDIR\Common\afssvrcfg_1034.dll" "$INSTDIR"  
3054    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\TaAfsAccountManager_1034.dll" "$INSTDIR\Common\TaAfsAccountManager_1034.dll" "$INSTDIR"  
3055    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\TaAfsAppLib_1034.dll"         "$INSTDIR\Common\TaAfsAppLib_1034.dll" "$INSTDIR"  
3056    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\TaAfsServerManager_1034.dll"  "$INSTDIR\Common\TaAfsServerManager_1034.dll" "$INSTDIR"  
3057    File "..\..\doc\help\es_ES\afs-cc.CNT"
3058    File "..\..\doc\help\es_ES\afs-cc.hlp"
3059    File "..\..\doc\help\es_ES\taafscfg.CNT"
3060    File "..\..\doc\help\es_ES\taafscfg.hlp"
3061    File "..\..\doc\help\es_ES\taafssvrmgr.CNT"
3062    File "..\..\doc\help\es_ES\taafssvrmgr.hlp"
3063    File "..\..\doc\help\es_ES\taafsusrmgr.CNT"
3064    File "..\..\doc\help\es_ES\taafsusrmgr.hlp"
3065
3066 !ifdef DEBUG
3067    ;File "${AFS_CLIENT_BUILDDIR}\afs_config_1034.pdb"
3068    ;File "${AFS_CLIENT_BUILDDIR}\afs_cpa_1034.pdb"
3069    ;File "${AFS_SERVER_BUILDDIR}\afseventmsg_1034.pdb"
3070    ;File "${AFS_SERVER_BUILDDIR}\afsserver_1034.pdb"
3071    ;File "${AFS_SERVER_BUILDDIR}\afssvrcfg_1034.pdb"
3072    ;File "${AFS_SERVER_BUILDDIR}\TaAfsAccountManager_1034.pdb"
3073    ;File "${AFS_SERVER_BUILDDIR}\TaAfsAppLib_1034.pdb"
3074    ;File "${AFS_SERVER_BUILDDIR}\TaAfsServerManager_1034.pdb"
3075 !ENDIF
3076    goto done
3077
3078 DoJapanese:
3079
3080    SetOutPath "$INSTDIR\Documentation"
3081    File "..\..\doc\install\Documentation\ja_JP\README.TXT"
3082    SetOutPath "$INSTDIR\Documentation\html"
3083    File "..\..\doc\install\Documentation\ja_JP\html\*"
3084    SetOutPath "$INSTDIR\Documentation\html\index_files"
3085    ;File "..\..\doc\install\Documentation\ja_JP\html\index_files\*"
3086    SetOutPath "$INSTDIR\Documentation\html\InstallGd"
3087    File "..\..\doc\install\Documentation\ja_JP\html\InstallGd\*"
3088    SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes"
3089    ;File "..\..\doc\install\Documentation\ja_JP\html\ReleaseNotes\*"
3090    SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes\logo_files"
3091    ;File "..\..\doc\install\Documentation\ja_JP\html\ReleaseNotes\logo_files\*"
3092    SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes\relnotes_files"
3093    ;File "..\..\doc\install\Documentation\ja_JP\html\ReleaseNotes\relnotes_files\*"
3094
3095    SetOutPath "$INSTDIR\Client\Program"
3096    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afscreds_1041.dll"  "$INSTDIR\Client\Program\afscreds_1041.dll" "$INSTDIR"  
3097    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afs_shl_ext_1041.dll" "$INSTDIR\Client\Program\afs_shl_ext_1041.dll" "$INSTDIR"
3098 !ifdef DEBUG
3099    ;File "${AFS_CLIENT_BUILDDIR}\afscreds_1041.pdb"
3100    ;File "${AFS_CLIENT_BUILDDIR}\afs_shl_ext_1041.pdb"
3101 !endif
3102
3103    File "..\..\doc\help\ja_JP\afs-light.CNT"
3104    File "..\..\doc\help\ja_JP\afs-light.hlp"
3105    File "..\..\doc\help\ja_JP\afs-nt.CNT"
3106    File "..\..\doc\help\ja_JP\afs-nt.HLP"
3107
3108    SetOutPath "$INSTDIR\Common"
3109    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afs_config_1041.dll"           "$INSTDIR\Common\afs_config_1041.dll" "$INSTDIR"   
3110    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afs_cpa_1041.dll"              "$INSTDIR\Common\afs_cpa_1041.dll" "$INSTDIR"   
3111    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afseventmsg_1041.dll"          "$INSTDIR\Common\afseventmsg_1041.dll" "$INSTDIR"   
3112   ;!insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afs_setup_utils_1041.dll"      "$INSTDIR\Common\afs_setup_utils_1041.dll" "$INSTDIR"   
3113    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afsserver_1041.dll"            "$INSTDIR\Common\afsserver_1041.dll" "$INSTDIR"   
3114    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afssvrcfg_1041.dll"            "$INSTDIR\Common\afssvrcfg_1041.dll" "$INSTDIR"   
3115    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\TaAfsAccountManager_1041.dll"  "$INSTDIR\Common\TaAfsAccountManager_1041.dll" "$INSTDIR"   
3116    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\TaAfsAppLib_1041.dll"          "$INSTDIR\Common\TaAfsAppLib_1041.dll" "$INSTDIR"   
3117    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\TaAfsServerManager_1041.dll"   "$INSTDIR\Common\TaAfsServerManager_1041.dll" "$INSTDIR"   
3118    File "..\..\doc\help\ja_JP\afs-cc.CNT"
3119    File "..\..\doc\help\ja_JP\afs-cc.hlp"
3120    File "..\..\doc\help\ja_JP\taafscfg.CNT"
3121    File "..\..\doc\help\ja_JP\taafscfg.hlp"
3122    File "..\..\doc\help\ja_JP\taafssvrmgr.CNT"
3123    File "..\..\doc\help\ja_JP\taafssvrmgr.hlp"
3124    File "..\..\doc\help\ja_JP\taafsusrmgr.CNT"
3125    File "..\..\doc\help\ja_JP\taafsusrmgr.hlp"
3126
3127 !ifdef DEBUG
3128    ;File "${AFS_CLIENT_BUILDDIR}\afs_config_1041.pdb"
3129    ;File "${AFS_CLIENT_BUILDDIR}\afs_cpa_1041.pdb"
3130    ;File "${AFS_SERVER_BUILDDIR}\afseventmsg_1041.pdb"
3131    ;File "${AFS_SERVER_BUILDDIR}\afsserver_1041.pdb"
3132    ;File "${AFS_SERVER_BUILDDIR}\afssvrcfg_1041.pdb"
3133    ;File "${AFS_SERVER_BUILDDIR}\TaAfsAccountManager_1041.pdb"
3134    ;File "${AFS_SERVER_BUILDDIR}\TaAfsAppLib_1041.pdb"
3135    ;File "${AFS_SERVER_BUILDDIR}\TaAfsServerManager_1041.pdb"
3136 !ENDIF
3137    goto done
3138    
3139 DoKorean:
3140
3141    SetOutPath "$INSTDIR\Documentation"
3142    File "..\..\doc\install\Documentation\ko_KR\README.TXT"
3143    SetOutPath "$INSTDIR\Documentation\html"
3144    File "..\..\doc\install\Documentation\ko_KR\html\*"
3145    SetOutPath "$INSTDIR\Documentation\html\index_files"
3146    ;File "..\..\doc\install\Documentation\ko_KR\html\index_files\*"
3147    SetOutPath "$INSTDIR\Documentation\html\InstallGd"
3148    File "..\..\doc\install\Documentation\ko_KR\html\InstallGd\*"
3149    SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes"
3150    File "..\..\doc\install\Documentation\ko_KR\html\ReleaseNotes\*"
3151    SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes\logo_files"
3152    ;File "..\..\doc\install\Documentation\ko_KR\html\ReleaseNotes\logo_files\*"
3153    SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes\relnotes_files"
3154    ;File "..\..\doc\install\Documentation\ko_KR\html\ReleaseNotes\relnotes_files\*"
3155
3156    SetOutPath "$INSTDIR\Client\Program"
3157    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afscreds_1042.dll"  "$INSTDIR\Client\Program\afscreds_1042.dll" "$INSTDIR"   
3158    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afs_shl_ext_1042.dll" "$INSTDIR\Client\Program\afs_shl_ext_1042.dll" "$INSTDIR"
3159 !ifdef DEBUG
3160    ;File "${AFS_CLIENT_BUILDDIR}\afscreds_1042.pdb"
3161    ;File "${AFS_CLIENT_BUILDDIR}\afs_shl_ext_1042.pdb"
3162 !endif
3163
3164    File "..\..\doc\help\ko_KR\afs-light.CNT"
3165    File "..\..\doc\help\ko_KR\afs-light.hlp"
3166    File "..\..\doc\help\ko_KR\afs-nt.CNT"
3167    File "..\..\doc\help\ko_KR\afs-nt.HLP"
3168
3169    SetOutPath "$INSTDIR\Common"
3170    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afs_config_1042.dll"           "$INSTDIR\Common\afs_config_1042.dll" "$INSTDIR"    
3171    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afs_cpa_1042.dll"              "$INSTDIR\Common\afs_cpa_1042.dll" "$INSTDIR"    
3172    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afseventmsg_1042.dll"          "$INSTDIR\Common\afseventmsg_1042.dll" "$INSTDIR"    
3173   ;!insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afs_setup_utils_1042.dll"      "$INSTDIR\Common\afs_setup_utils_1042.dll" "$INSTDIR"    
3174    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afsserver_1042.dll"            "$INSTDIR\Common\afsserver_1042.dll" "$INSTDIR"    
3175    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afssvrcfg_1042.dll"            "$INSTDIR\Common\afssvrcfg_1042.dll" "$INSTDIR"    
3176    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\TaAfsAccountManager_1042.dll"  "$INSTDIR\Common\TaAfsAccountManager_1042.dll" "$INSTDIR"    
3177    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\TaAfsAppLib_1042.dll"          "$INSTDIR\Common\TaAfsAppLib_1042.dll" "$INSTDIR"    
3178    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\TaAfsServerManager_1042.dll"   "$INSTDIR\Common\TaAfsServerManager_1042.dll" "$INSTDIR"    
3179    File "..\..\doc\help\ko_KR\afs-cc.CNT"
3180    File "..\..\doc\help\ko_KR\afs-cc.hlp"
3181    File "..\..\doc\help\ko_KR\taafscfg.CNT"
3182    File "..\..\doc\help\ko_KR\taafscfg.hlp"
3183    File "..\..\doc\help\ko_KR\taafssvrmgr.CNT"
3184    File "..\..\doc\help\ko_KR\taafssvrmgr.hlp"
3185    File "..\..\doc\help\ko_KR\taafsusrmgr.CNT"
3186    File "..\..\doc\help\ko_KR\taafsusrmgr.hlp"
3187
3188 !ifdef DEBUG
3189    ;File "${AFS_CLIENT_BUILDDIR}\afs_config_1042.pdb"
3190    ;File "${AFS_CLIENT_BUILDDIR}\afs_cpa_1042.pdb"
3191    ;File "${AFS_SERVER_BUILDDIR}\afseventmsg_1042.pdb"
3192    ;File "${AFS_SERVER_BUILDDIR}\afsserver_1042.pdb"
3193    ;File "${AFS_SERVER_BUILDDIR}\afssvrcfg_1042.pdb"
3194    ;File "${AFS_SERVER_BUILDDIR}\TaAfsAccountManager_1042.pdb"
3195    ;File "${AFS_SERVER_BUILDDIR}\TaAfsAppLib_1042.pdb"
3196    ;File "${AFS_SERVER_BUILDDIR}\TaAfsServerManager_1042.pdb"
3197 !ENDIF
3198    goto done
3199
3200
3201 DoPortugueseBR:
3202
3203    SetOutPath "$INSTDIR\Documentation"
3204    File "..\..\doc\install\Documentation\pt_BR\README.TXT"
3205    SetOutPath "$INSTDIR\Documentation\html"
3206    File "..\..\doc\install\Documentation\pt_BR\html\*"
3207    SetOutPath "$INSTDIR\Documentation\html\index_files"
3208    ;File "..\..\doc\install\Documentation\pt_BR\html\index_files\*"
3209    SetOutPath "$INSTDIR\Documentation\html\InstallGd"
3210    File "..\..\doc\install\Documentation\pt_BR\html\InstallGd\*"
3211    SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes"
3212    File "..\..\doc\install\Documentation\pt_BR\html\ReleaseNotes\*"
3213    SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes\logo_files"
3214    ;File "..\..\doc\install\Documentation\pt_BR\html\ReleaseNotes\logo_files\*"
3215    SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes\relnotes_files"
3216    ;File "..\..\doc\install\Documentation\pt_BR\html\ReleaseNotes\relnotes_files\*"
3217
3218    SetOutPath "$INSTDIR\Client\Program"
3219    !insertmacro ReplaceDLL  "${AFS_CLIENT_BUILDDIR}\afscreds_1046.dll"  "$INSTDIR\Client\Program\afscreds_1046.dll" "$INSTDIR"    
3220    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afs_shl_ext_1046.dll" "$INSTDIR\Client\Program\afs_shl_ext_1046.dll" "$INSTDIR"
3221 !ifdef DEBUG
3222    ;File "${AFS_CLIENT_BUILDDIR}\afscreds_1046.pdb"
3223    ;File "${AFS_CLIENT_BUILDDIR}\afs_shl_ext_1046.pdb"
3224 !endif
3225
3226    File "..\..\doc\help\pt_BR\afs-light.CNT"
3227    File "..\..\doc\help\pt_BR\afs-light.hlp"
3228    File "..\..\doc\help\pt_BR\afs-nt.CNT"
3229    File "..\..\doc\help\pt_BR\afs-nt.HLP"
3230
3231    SetOutPath "$INSTDIR\Common"
3232    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afs_config_1046.dll"           "$INSTDIR\Common\afs_config_1046.dll" "$INSTDIR"     
3233    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afs_cpa_1046.dll"              "$INSTDIR\Common\afs_cpa_1046.dll" "$INSTDIR"     
3234    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afseventmsg_1046.dll"          "$INSTDIR\Common\afseventmsg_1046.dll" "$INSTDIR"     
3235   ;!insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afs_setup_utils_1046.dll"      "$INSTDIR\Common\afs_setup_utils_1046.dll" "$INSTDIR"     
3236    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afsserver_1046.dll"            "$INSTDIR\Common\afsserver_1046.dll" "$INSTDIR"     
3237    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afssvrcfg_1046.dll"            "$INSTDIR\Common\afssvrcfg_1046.dll" "$INSTDIR"     
3238    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\TaAfsAccountManager_1046.dll"  "$INSTDIR\Common\TaAfsAccountManager_1046.dll" "$INSTDIR"     
3239    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\TaAfsAppLib_1046.dll"          "$INSTDIR\Common\TaAfsAppLib_1046.dll" "$INSTDIR"     
3240    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\TaAfsServerManager_1046.dll"   "$INSTDIR\Common\TaAfsServerManager_1046.dll" "$INSTDIR"     
3241    File "..\..\doc\help\pt_BR\afs-cc.CNT"
3242    File "..\..\doc\help\pt_BR\afs-cc.hlp"
3243    File "..\..\doc\help\pt_BR\taafscfg.CNT"
3244    File "..\..\doc\help\pt_BR\taafscfg.hlp"
3245    File "..\..\doc\help\pt_BR\taafssvrmgr.CNT"
3246    File "..\..\doc\help\pt_BR\taafssvrmgr.hlp"
3247    File "..\..\doc\help\pt_BR\taafsusrmgr.CNT"
3248    File "..\..\doc\help\pt_BR\taafsusrmgr.hlp"
3249
3250 !ifdef DEBUG
3251    ;File "${AFS_CLIENT_BUILDDIR}\afs_config_1046.pdb"
3252    ;File "${AFS_CLIENT_BUILDDIR}\afs_cpa_1046.pdb"
3253    ;File "${AFS_SERVER_BUILDDIR}\afseventmsg_1046.pdb"
3254    ;File "${AFS_SERVER_BUILDDIR}\afsserver_1046.pdb"
3255    ;File "${AFS_SERVER_BUILDDIR}\afssvrcfg_1046.pdb"
3256    ;File "${AFS_SERVER_BUILDDIR}\TaAfsAccountManager_1046.pdb"
3257    ;File "${AFS_SERVER_BUILDDIR}\TaAfsAppLib_1046.pdb"
3258    ;File "${AFS_SERVER_BUILDDIR}\TaAfsServerManager_1046.pdb"
3259 !ENDIF
3260    goto done
3261    
3262 DoSimpChinese:
3263
3264    SetOutPath "$INSTDIR\Documentation"
3265    File "..\..\doc\install\Documentation\zh_CN\README.TXT"
3266    SetOutPath "$INSTDIR\Documentation\html"
3267    File "..\..\doc\install\Documentation\zh_CN\html\*"
3268    SetOutPath "$INSTDIR\Documentation\html\index_files"
3269    ;File "..\..\doc\install\Documentation\zh_CN\html\index_files\*"
3270    SetOutPath "$INSTDIR\Documentation\html\InstallGd"
3271    File "..\..\doc\install\Documentation\zh_CN\html\InstallGd\*"
3272    SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes"
3273    File "..\..\doc\install\Documentation\zh_CN\html\ReleaseNotes\*"
3274    SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes\logo_files"
3275    ;File "..\..\doc\install\Documentation\zh_CN\html\ReleaseNotes\logo_files\*"
3276    SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes\relnotes_files"
3277    ;File "..\..\doc\install\Documentation\zh_CN\html\ReleaseNotes\relnotes_files\*"
3278
3279    SetOutPath "$INSTDIR\Client\Program"
3280    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afscreds_2052.dll"   "$INSTDIR\Client\Program\afscreds_2052.dll" "$INSTDIR"     
3281    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afs_shl_ext_2052.dll" "$INSTDIR\Client\Program\afs_shl_ext_2052.dll" "$INSTDIR"
3282 !ifdef DEBUG
3283    ;File "${AFS_CLIENT_BUILDDIR}\afscreds_2052.pdb"
3284    ;File "${AFS_CLIENT_BUILDDIR}\afs_shl_ext_2052.pdb"
3285 !endif
3286
3287    File "..\..\doc\help\zh_CN\afs-light.CNT"
3288    File "..\..\doc\help\zh_CN\afs-light.hlp"
3289    File "..\..\doc\help\zh_CN\afs-nt.CNT"
3290    File "..\..\doc\help\zh_CN\afs-nt.HLP"
3291
3292    SetOutPath "$INSTDIR\Common"
3293    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afs_config_2052.dll"           "$INSTDIR\Common\afs_config_2052.dll" "$INSTDIR"      
3294    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afs_cpa_2052.dll"              "$INSTDIR\Common\afs_cpa_2052.dll" "$INSTDIR"      
3295    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afseventmsg_2052.dll"          "$INSTDIR\Common\afseventmsg_2052.dll" "$INSTDIR"      
3296   ;!insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afs_setup_utils_2052.dll"      "$INSTDIR\Common\afs_setup_utils_2052.dll" "$INSTDIR"      
3297    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afsserver_2052.dll"            "$INSTDIR\Common\afsserver_2052.dll" "$INSTDIR"      
3298    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afssvrcfg_2052.dll"            "$INSTDIR\Common\afssvrcfg_2052.dll" "$INSTDIR"      
3299    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\TaAfsAccountManager_2052.dll"  "$INSTDIR\Common\TaAfsAccountManager_2052.dll" "$INSTDIR"      
3300    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\TaAfsAppLib_2052.dll"          "$INSTDIR\Common\TaAfsAppLib_2052.dll" "$INSTDIR"      
3301    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\TaAfsServerManager_2052.dll"   "$INSTDIR\Common\TaAfsServerManager_2052.dll" "$INSTDIR"      
3302    File "..\..\doc\help\zh_CN\afs-cc.CNT"
3303    File "..\..\doc\help\zh_CN\afs-cc.hlp"
3304    File "..\..\doc\help\zh_CN\taafscfg.CNT"
3305    File "..\..\doc\help\zh_CN\taafscfg.hlp"
3306    File "..\..\doc\help\zh_CN\taafssvrmgr.CNT"
3307    File "..\..\doc\help\zh_CN\taafssvrmgr.hlp"
3308    File "..\..\doc\help\zh_CN\taafsusrmgr.CNT"
3309    File "..\..\doc\help\zh_CN\taafsusrmgr.hlp"
3310
3311 !ifdef DEBUG
3312    ;File "${AFS_CLIENT_BUILDDIR}\afs_config_2052.pdb"
3313    ;File "${AFS_CLIENT_BUILDDIR}\afs_cpa_2052.pdb"
3314    ;File "${AFS_SERVER_BUILDDIR}\afseventmsg_2052.pdb"
3315    ;File "${AFS_SERVER_BUILDDIR}\afsserver_2052.pdb"
3316    ;File "${AFS_SERVER_BUILDDIR}\afssvrcfg_2052.pdb"
3317    ;File "${AFS_SERVER_BUILDDIR}\TaAfsAccountManager_2052.pdb"
3318    ;File "${AFS_SERVER_BUILDDIR}\TaAfsAppLib_2052.pdb"
3319    ;File "${AFS_SERVER_BUILDDIR}\TaAfsServerManager_2052.pdb"
3320 !ENDIF
3321    goto done
3322    
3323 DoTradChinese:
3324
3325    SetOutPath "$INSTDIR\Documentation"
3326    File "..\..\doc\install\Documentation\zh_TW\README.TXT"
3327    SetOutPath "$INSTDIR\Documentation\html"
3328    File "..\..\doc\install\Documentation\zh_TW\html\*"
3329    SetOutPath "$INSTDIR\Documentation\html\index_files"
3330    ;File "..\..\doc\install\Documentation\zh_TW\html\index_files\*"
3331    SetOutPath "$INSTDIR\Documentation\html\InstallGd"
3332    File "..\..\doc\install\Documentation\zh_TW\html\InstallGd\*"
3333    SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes"
3334    File "..\..\doc\install\Documentation\zh_TW\html\ReleaseNotes\*"
3335    SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes\logo_files"
3336    ;File "..\..\doc\install\Documentation\zh_TW\html\ReleaseNotes\logo_files\*"
3337    SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes\relnotes_files"
3338    ;File "..\..\doc\install\Documentation\zh_TW\html\ReleaseNotes\relnotes_files\*"
3339
3340    SetOutPath "$INSTDIR\Client\Program"
3341    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afscreds_1028.dll"  "$INSTDIR\Client\Program\_1028.dll" "$INSTDIR"      
3342    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afs_shl_ext_1028.dll" "$INSTDIR\Client\Program\afs_shl_ext_1028.dll" "$INSTDIR"
3343 !ifdef DEBUG
3344    ;File "${AFS_CLIENT_BUILDDIR}\afscreds_1028.pdb"
3345    ;File "${AFS_CLIENT_BUILDDIR}\afs_shl_ext_1028.pdb"
3346 !endif
3347
3348    File "..\..\doc\help\zh_TW\afs-light.CNT"
3349    File "..\..\doc\help\zh_TW\afs-light.hlp"
3350    File "..\..\doc\help\zh_TW\afs-nt.CNT"
3351    File "..\..\doc\help\zh_TW\afs-nt.HLP"
3352
3353    SetOutPath "$INSTDIR\Common"
3354    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afs_config_1028.dll"           "$INSTDIR\Common\afs_config_1028.dll" "$INSTDIR"       
3355    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afs_cpa_1028.dll"              "$INSTDIR\Common\afs_cpa_1028.dll" "$INSTDIR"       
3356    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afseventmsg_1028.dll"          "$INSTDIR\Common\afseventmsg_1028.dll" "$INSTDIR"       
3357   ;!insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afs_setup_utils_1028.dll"      "$INSTDIR\Common\afs_setup_utils_1028.dll" "$INSTDIR"       
3358    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afsserver_1028.dll"            "$INSTDIR\Common\afsserver_1028.dll" "$INSTDIR"       
3359    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afssvrcfg_1028.dll"            "$INSTDIR\Common\afssvrcfg_1028.dll" "$INSTDIR"       
3360    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\TaAfsAccountManager_1028.dll"  "$INSTDIR\Common\TaAfsAccountManager_1028.dll" "$INSTDIR"       
3361    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\TaAfsAppLib_1028.dll"          "$INSTDIR\Common\TaAfsAppLib_1028.dll" "$INSTDIR"       
3362    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\TaAfsServerManager_1028.dll"   "$INSTDIR\Common\TaAfsServerManager_1028.dll" "$INSTDIR"       
3363    File "..\..\doc\help\zh_TW\afs-cc.CNT"
3364    File "..\..\doc\help\zh_TW\afs-cc.hlp"
3365    File "..\..\doc\help\zh_TW\taafscfg.CNT"
3366    File "..\..\doc\help\zh_TW\taafscfg.hlp"
3367    File "..\..\doc\help\zh_TW\taafssvrmgr.CNT"
3368    File "..\..\doc\help\zh_TW\taafssvrmgr.hlp"
3369    File "..\..\doc\help\zh_TW\taafsusrmgr.CNT"
3370    File "..\..\doc\help\zh_TW\taafsusrmgr.hlp"
3371
3372 !ifdef DEBUG
3373    ;File "${AFS_CLIENT_BUILDDIR}\afs_config_1028.pdb"
3374    ;File "${AFS_CLIENT_BUILDDIR}\afs_cpa_1028.pdb"
3375    ;File "${AFS_SERVER_BUILDDIR}\afseventmsg_1028.pdb"
3376    ;File "${AFS_SERVER_BUILDDIR}\afsserver_1028.pdb"
3377    ;File "${AFS_SERVER_BUILDDIR}\afssvrcfg_1028.pdb"
3378    ;File "${AFS_SERVER_BUILDDIR}\TaAfsAccountManager_1028.pdb"
3379    ;File "${AFS_SERVER_BUILDDIR}\TaAfsAppLib_1028.pdb"
3380    ;File "${AFS_SERVER_BUILDDIR}\TaAfsServerManager_1028.pdb"
3381 !ENDIF
3382    goto done
3383    
3384 done:
3385
3386   ; Write start menu shortcut
3387   SetOutPath "$SMPROGRAMS\OpenAFS"
3388   CreateShortCut "$SMPROGRAMS\OpenAFS\Documentation.lnk" "$INSTDIR\Documentation\html\index.htm"
3389   
3390
3391 FunctionEnd
3392
3393
3394
3395 ;====================================================
3396 ; AddToPath - Adds the given dir to the search path.
3397 ;        Input - head of the stack
3398 ;        Note - Win9x systems requires reboot
3399 ;====================================================
3400 Function AddToPath
3401   Exch $0
3402   Push $1
3403   Push $2
3404   Push $3
3405
3406   # don't add if the path doesn't exist
3407   IfFileExists $0 "" AddToPath_done
3408
3409   ReadEnvStr $1 PATH
3410   Push "$1;"
3411   Push "$0;"
3412   Call StrStr
3413   Pop $2
3414   StrCmp $2 "" "" AddToPath_done
3415   Push "$1;"
3416   Push "$0\;"
3417   Call StrStr
3418   Pop $2
3419   StrCmp $2 "" "" AddToPath_done
3420   GetFullPathName /SHORT $3 $0
3421   Push "$1;"
3422   Push "$3;"
3423   Call StrStr
3424   Pop $2
3425   StrCmp $2 "" "" AddToPath_done
3426   Push "$1;"
3427   Push "$3\;"
3428   Call StrStr
3429   Pop $2
3430   StrCmp $2 "" "" AddToPath_done
3431
3432   Call IsNT
3433   Pop $1
3434   StrCmp $1 1 AddToPath_NT
3435     ; Not on NT
3436     StrCpy $1 $WINDIR 2
3437     FileOpen $1 "$1\autoexec.bat" a
3438     FileSeek $1 -1 END
3439     FileReadByte $1 $2
3440     IntCmp $2 26 0 +2 +2 # DOS EOF
3441       FileSeek $1 -1 END # write over EOF
3442     FileWrite $1 "$\r$\nSET PATH=%PATH%;$3$\r$\n"
3443     FileClose $1
3444     SetRebootFlag true
3445     Goto AddToPath_done
3446
3447   AddToPath_NT:
3448     ReadRegStr $1 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH"
3449     StrCpy $2 $1 1 -1 # copy last char
3450     StrCmp $2 ";" 0 +2 # if last char == ;
3451       StrCpy $1 $1 -1 # remove last char
3452     StrCmp $1 "" AddToPath_NTdoIt
3453       StrCpy $0 "$1;$0"
3454     AddToPath_NTdoIt:
3455       WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH" $0
3456       SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
3457
3458   AddToPath_done:
3459     Pop $3
3460     Pop $2
3461     Pop $1
3462     Pop $0
3463 FunctionEnd
3464
3465 ;====================================================
3466 ; RemoveFromPath - Remove a given dir from the path
3467 ;     Input: head of the stack
3468 ;====================================================
3469 Function un.RemoveFromPath
3470   Exch $0
3471   Push $1
3472   Push $2
3473   Push $3
3474   Push $4
3475   Push $5
3476   Push $6
3477
3478   IntFmt $6 "%c" 26 # DOS EOF
3479
3480   Call un.IsNT
3481   Pop $1
3482   StrCmp $1 1 unRemoveFromPath_NT
3483     ; Not on NT
3484     StrCpy $1 $WINDIR 2
3485     FileOpen $1 "$1\autoexec.bat" r
3486     GetTempFileName $4
3487     FileOpen $2 $4 w
3488     GetFullPathName /SHORT $0 $0
3489     StrCpy $0 "SET PATH=%PATH%;$0"
3490     Goto unRemoveFromPath_dosLoop
3491
3492     unRemoveFromPath_dosLoop:
3493       FileRead $1 $3
3494       StrCpy $5 $3 1 -1 # read last char
3495       StrCmp $5 $6 0 +2 # if DOS EOF
3496         StrCpy $3 $3 -1 # remove DOS EOF so we can compare
3497       StrCmp $3 "$0$\r$\n" unRemoveFromPath_dosLoopRemoveLine
3498       StrCmp $3 "$0$\n" unRemoveFromPath_dosLoopRemoveLine
3499       StrCmp $3 "$0" unRemoveFromPath_dosLoopRemoveLine
3500       StrCmp $3 "" unRemoveFromPath_dosLoopEnd
3501       FileWrite $2 $3
3502       Goto unRemoveFromPath_dosLoop
3503       unRemoveFromPath_dosLoopRemoveLine:
3504         SetRebootFlag true
3505         Goto unRemoveFromPath_dosLoop
3506
3507     unRemoveFromPath_dosLoopEnd:
3508       FileClose $2
3509       FileClose $1
3510       StrCpy $1 $WINDIR 2
3511       Delete "$1\autoexec.bat"
3512       CopyFiles /SILENT $4 "$1\autoexec.bat"
3513       Delete $4
3514       Goto unRemoveFromPath_done
3515
3516   unRemoveFromPath_NT:
3517     ReadRegStr $1 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH"
3518     StrCpy $5 $1 1 -1 # copy last char
3519     StrCmp $5 ";" +2 # if last char != ;
3520       StrCpy $1 "$1;" # append ;
3521     Push $1
3522     Push "$0;"
3523     Call un.StrStr ; Find `$0;` in $1
3524     Pop $2 ; pos of our dir
3525     StrCmp $2 "" unRemoveFromPath_done
3526       ; else, it is in path
3527       # $0 - path to add
3528       # $1 - path var
3529       StrLen $3 "$0;"
3530       StrLen $4 $2
3531       StrCpy $5 $1 -$4 # $5 is now the part before the path to remove
3532       StrCpy $6 $2 "" $3 # $6 is now the part after the path to remove
3533       StrCpy $3 $5$6
3534
3535       StrCpy $5 $3 1 -1 # copy last char
3536       StrCmp $5 ";" 0 +2 # if last char == ;
3537         StrCpy $3 $3 -1 # remove last char
3538
3539       WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH" $3
3540       SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
3541
3542   unRemoveFromPath_done:
3543     Pop $6
3544     Pop $5
3545     Pop $4
3546     Pop $3
3547     Pop $2
3548     Pop $1
3549     Pop $0
3550 FunctionEnd
3551
3552 ;====================================================
3553 ; IsNT - Returns 1 if the current system is NT, 0
3554 ;        otherwise.
3555 ;     Output: head of the stack
3556 ;====================================================
3557 !macro IsNT un
3558 Function ${un}IsNT
3559   Push $0
3560   ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
3561   StrCmp $0 "" 0 IsNT_yes
3562   ; we are not NT.
3563   Pop $0
3564   Push 0
3565   Return
3566
3567   IsNT_yes:
3568     ; NT!!!
3569     Pop $0
3570     Push 1
3571 FunctionEnd
3572 !macroend
3573 !insertmacro IsNT ""
3574 !insertmacro IsNT "un."
3575
3576 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3577 ; Uninstall stuff
3578 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3579 ;====================================================
3580 ; StrStr - Finds a given string in another given string.
3581 ;               Returns -1 if not found and the pos if found.
3582 ;          Input: head of the stack - string to find
3583 ;                      second in the stack - string to find in
3584 ;          Output: head of the stack
3585 ;====================================================
3586 !macro StrStr un
3587 Function ${un}StrStr
3588 Exch $R1 ; st=haystack,old$R1, $R1=needle
3589   Exch    ; st=old$R1,haystack
3590   Exch $R2 ; st=old$R1,old$R2, $R2=haystack
3591   Push $R3
3592   Push $R4
3593   Push $R5
3594   StrLen $R3 $R1
3595   StrCpy $R4 0
3596   ; $R1=needle
3597   ; $R2=haystack
3598   ; $R3=len(needle)
3599   ; $R4=cnt
3600   ; $R5=tmp
3601   loop:
3602     StrCpy $R5 $R2 $R3 $R4
3603     StrCmp $R5 $R1 done
3604     StrCmp $R5 "" done
3605     IntOp $R4 $R4 + 1
3606     Goto loop
3607 done:
3608   StrCpy $R1 $R2 "" $R4
3609   Pop $R5
3610   Pop $R4
3611   Pop $R3
3612   Pop $R2
3613   Exch $R1
3614 FunctionEnd
3615 !macroend
3616 !insertmacro StrStr ""
3617 !insertmacro StrStr "un."
3618
3619
3620 !ifdef ADDSHAREDDLLUSED
3621 ; AddSharedDLL
3622  ;
3623  ; Increments a shared DLLs reference count.
3624  ; Use by passing one item on the stack (the full path of the DLL).
3625  ;
3626  ; Usage:
3627  ;   Push $SYSDIR\myDll.dll
3628  ;   Call AddSharedDLL
3629  ;
3630
3631  Function AddSharedDLL
3632    Exch $R1
3633    Push $R0
3634    ReadRegDword $R0 HKLM Software\Microsoft\Windows\CurrentVersion\SharedDLLs $R1
3635    IntOp $R0 $R0 + 1
3636    WriteRegDWORD HKLM Software\Microsoft\Windows\CurrentVersion\SharedDLLs $R1 $R0
3637    Pop $R0
3638    Pop $R1
3639  FunctionEnd
3640
3641  
3642 ; un.RemoveSharedDLL
3643  ;
3644  ; Decrements a shared DLLs reference count, and removes if necessary.
3645  ; Use by passing one item on the stack (the full path of the DLL).
3646  ; Note: for use in the main installer (not the uninstaller), rename the
3647  ; function to RemoveSharedDLL.
3648  ;
3649  ; Usage:
3650  ;   Push $SYSDIR\myDll.dll
3651  ;   Call un.RemoveSharedDLL
3652  ;
3653
3654  Function un.RemoveSharedDLL
3655    Exch $R1
3656    Push $R0
3657    ReadRegDword $R0 HKLM Software\Microsoft\Windows\CurrentVersion\SharedDLLs $R1
3658    StrCmp $R0 "" remove
3659      IntOp $R0 $R0 - 1
3660      IntCmp $R0 0 rk rk uk
3661      rk:
3662        DeleteRegValue HKLM Software\Microsoft\Windows\CurrentVersion\SharedDLLs $R1
3663      goto Remove
3664      uk:
3665        WriteRegDWORD HKLM Software\Microsoft\Windows\CurrentVersion\SharedDLLs $R1 $R0
3666      Goto noremove
3667    remove:
3668      Delete /REBOOTOK $R1
3669    noremove:
3670    Pop $R0
3671    Pop $R1
3672  FunctionEnd
3673 !endif
3674
3675
3676 ; Installs the loopback adpater and disables it on Windows 2000
3677 Function afs.InstallMSLoopback
3678    GetTempFileName $R0
3679    File /oname=$R0 "${AFS_WININSTALL_DIR}\afsloopback.dll"
3680    nsExec::Exec "rundll32.exe $R0 doLoopBackEntry AFS 10.254.254.253 255.255.255.252"
3681    Delete $R0
3682 FunctionEnd
3683
3684 Function afs.isLoopbackInstalled
3685    SetOutPath $TEMP
3686    File "${AFS_WININSTALL_DIR}\afsloopback.dll"
3687    System::Call "$TEMP\afsloopback.dll::IsLoopbackInstalled() i().r11"
3688    Delete "$TEMP\afsloopback.dll"
3689 FunctionEnd
3690
3691
3692 ; GetWindowsVersion
3693 ;
3694 ; Based on Yazno's function, http://yazno.tripod.com/powerpimpit/
3695 ; Updated by Joost Verburg
3696 ;
3697 ; Returns on top of stack
3698 ;
3699 ; Windows Version (95, 98, ME, NT x.x, 2000, XP, 2003, Vista/2008)
3700 ; or
3701 ; '' (Unknown Windows Version)
3702 ;
3703 ; Usage:
3704 ;   Call GetWindowsVersion
3705 ;   Pop $R0
3706 ;   ; at this point $R0 is "NT 4.0" or whatnot
3707
3708 Function GetWindowsVersion
3709
3710   Push $R0
3711   Push $R1
3712
3713   ClearErrors
3714
3715   ReadRegStr $R0 HKLM \
3716   "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
3717
3718   IfErrors 0 lbl_winnt
3719   
3720   ; we are not NT
3721   ReadRegStr $R0 HKLM \
3722   "SOFTWARE\Microsoft\Windows\CurrentVersion" VersionNumber
3723
3724   StrCpy $R1 $R0 1
3725   StrCmp $R1 '4' 0 lbl_error
3726
3727   StrCpy $R1 $R0 3
3728
3729   StrCmp $R1 '4.0' lbl_win32_95
3730   StrCmp $R1 '4.9' lbl_win32_ME lbl_win32_98
3731
3732   lbl_win32_95:
3733     StrCpy $R0 '95'
3734   Goto lbl_done
3735
3736   lbl_win32_98:
3737     StrCpy $R0 '98'
3738   Goto lbl_done
3739
3740   lbl_win32_ME:
3741     StrCpy $R0 'ME'
3742   Goto lbl_done
3743
3744   lbl_winnt:
3745
3746   StrCpy $R1 $R0 1
3747
3748   StrCmp $R1 '3' lbl_winnt_x
3749   StrCmp $R1 '4' lbl_winnt_x
3750
3751   StrCpy $R1 $R0 3
3752
3753   StrCmp $R1 '5.0' lbl_winnt_2000
3754   StrCmp $R1 '5.1' lbl_winnt_XP
3755   StrCmp $R1 '5.2' lbl_winnt_2003
3756   StrCmp $R1 '6.0' lbl_winnt_vista lbl_error
3757
3758   lbl_winnt_x:
3759     StrCpy $R0 "NT $R0" 6
3760   Goto lbl_done
3761
3762   lbl_winnt_2000:
3763     Strcpy $R0 '2000'
3764   Goto lbl_done
3765
3766   lbl_winnt_XP:
3767     Strcpy $R0 'XP'
3768   Goto lbl_done
3769
3770   lbl_winnt_2003:
3771     Strcpy $R0 '2003'
3772   Goto lbl_done
3773
3774   lbl_winnt_vista:
3775     Strcpy $R0 'Vista'
3776   Goto lbl_done
3777
3778   lbl_error:
3779     Strcpy $R0 ''
3780   lbl_done:
3781
3782   Pop $R1
3783   Exch $R0
3784
3785 FunctionEnd
3786
3787
3788 ; Author: Lilla (lilla@earthlink.net) 2003-06-13
3789 ; function IsUserAdmin uses plugin \NSIS\PlusgIns\UserInfo.dll
3790 ; This function is based upon code in \NSIS\Contrib\UserInfo\UserInfo.nsi
3791 ; This function was tested under NSIS 2 beta 4 (latest CVS as of this writing).
3792 ;
3793 ; Usage:
3794 ;   Call IsUserAdmin
3795 ;   Pop $R0   ; at this point $R0 is "true" or "false"
3796 ;
3797 Function IsUserAdmin
3798 Push $R0
3799 Push $R1
3800 Push $R2
3801
3802 ClearErrors
3803 UserInfo::GetName
3804 IfErrors Win9x
3805 Pop $R1
3806 UserInfo::GetAccountType
3807 Pop $R2
3808
3809 StrCmp $R2 "Admin" 0 Continue
3810 ; Observation: I get here when running Win98SE. (Lilla)
3811 ; The functions UserInfo.dll looks for are there on Win98 too, 
3812 ; but just don't work. So UserInfo.dll, knowing that admin isn't required
3813 ; on Win98, returns admin anyway. (per kichik)
3814 ; MessageBox MB_OK 'User "$R1" is in the Administrators group'
3815 StrCpy $R0 "true"
3816 Goto Done
3817
3818 Continue:
3819 ; You should still check for an empty string because the functions
3820 ; UserInfo.dll looks for may not be present on Windows 95. (per kichik)
3821 StrCmp $R2 "" Win9x
3822 StrCpy $R0 "false"
3823 ;MessageBox MB_OK 'User "$R1" is in the "$R2" group'
3824 Goto Done
3825
3826 Win9x:
3827 ; comment/message below is by UserInfo.nsi author:
3828 ; This one means you don't need to care about admin or
3829 ; not admin because Windows 9x doesn't either
3830 ;MessageBox MB_OK "Error! This DLL can't run under Windows 9x!"
3831 StrCpy $R0 "false"
3832
3833 Done:
3834 ;MessageBox MB_OK 'User= "$R1"  AccountType= "$R2"  IsUserAdmin= "$R0"'
3835
3836 Pop $R2
3837 Pop $R1
3838 Exch $R0
3839 FunctionEnd
3840
3841 ; GetParent
3842  ; input, top of stack  (e.g. C:\Program Files\Poop)
3843  ; output, top of stack (replaces, with e.g. C:\Program Files)
3844  ; modifies no other variables.
3845  ;
3846  ; Usage:
3847  ;   Push "C:\Program Files\Directory\Whatever"
3848  ;   Call GetParent
3849  ;   Pop $R0
3850  ;   ; at this point $R0 will equal "C:\Program Files\Directory"
3851
3852 Function GetParent
3853
3854   Exch $R0
3855   Push $R1
3856   Push $R2
3857   Push $R3
3858   
3859   StrCpy $R1 0
3860   StrLen $R2 $R0
3861   
3862   loop:
3863     IntOp $R1 $R1 + 1
3864     IntCmp $R1 $R2 get 0 get
3865     StrCpy $R3 $R0 1 -$R1
3866     StrCmp $R3 "\" get
3867   Goto loop
3868   
3869   get:
3870     StrCpy $R0 $R0 -$R1
3871     
3872     Pop $R3
3873     Pop $R2
3874     Pop $R1
3875     Exch $R0
3876     
3877 FunctionEnd
3878
3879
3880 ;--------------------------------
3881 ;Handle what must and what must not be installed
3882 Function .onSelChange
3883    ; If they install the server, they MUST install the client
3884    SectionGetFlags ${secServer} $R0
3885    IntOp $R0 $R0 & ${SF_SELECTED}
3886    StrCmp $R0 "1" MakeClientSelected
3887    
3888    ; If they install the control center, we'll give them the client.
3889    ; It may not be required, but it's a bit more useful
3890    SectionGetFlags ${secControl} $R0
3891    IntOp $R0 $R0 & ${SF_SELECTED}
3892    StrCmp $R0 "1" MakeClientSelected
3893    goto end
3894    
3895 MakeClientSelected:
3896    SectionGetFlags ${secClient} $R0
3897    IntOp $R0 $R0 | ${SF_SELECTED}
3898    SectionSetFlags ${secClient} $R0
3899    
3900 end:
3901 FunctionEnd
3902
3903 Function RegWriteMultiStr
3904 !define HKEY_CLASSES_ROOT        0x80000000
3905 !define HKEY_CURRENT_USER        0x80000001
3906 !define HKEY_LOCAL_MACHINE       0x80000002
3907 !define HKEY_USERS               0x80000003
3908 !define HKEY_PERFORMANCE_DATA    0x80000004
3909 !define HKEY_PERFORMANCE_TEXT    0x80000050
3910 !define HKEY_PERFORMANCE_NLSTEXT 0x80000060
3911 !define HKEY_CURRENT_CONFIG      0x80000005
3912 !define HKEY_DYN_DATA            0x80000006
3913
3914 !define KEY_QUERY_VALUE          0x0001
3915 !define KEY_SET_VALUE            0x0002
3916 !define KEY_CREATE_SUB_KEY       0x0004
3917 !define KEY_ENUMERATE_SUB_KEYS   0x0008
3918 !define KEY_NOTIFY               0x0010
3919 !define KEY_CREATE_LINK          0x0020
3920
3921 !define REG_NONE                 0
3922 !define REG_SZ                   1
3923 !define REG_EXPAND_SZ            2
3924 !define REG_BINARY               3
3925 !define REG_DWORD                4
3926 !define REG_DWORD_LITTLE_ENDIAN  4
3927 !define REG_DWORD_BIG_ENDIAN     5
3928 !define REG_LINK                 6
3929 !define REG_MULTI_SZ             7
3930
3931 !define RegCreateKey             "Advapi32::RegCreateKeyA(i, t, *i) i"
3932 !define RegSetValueEx            "Advapi32::RegSetValueExA(i, t, i, i, i, i) i"
3933 !define RegCloseKey              "Advapi32::RegCloseKeyA(i) i"
3934
3935   Exch $R0
3936   Push $1
3937   Push $2
3938   Push $9
3939
3940   SetPluginUnload alwaysoff
3941   ; Create a buffer for the multi_sz value
3942   System::Call "*(&t${NSIS_MAX_STRLEN}) i.r1"
3943   ; Open/create the registry key
3944   System::Call "${RegCreateKey}(${HKEY_LOCAL_MACHINE}, '$REG_SUB_KEY', .r0) .r9"
3945   ; Failed?
3946   IntCmp $9 0 write
3947     MessageBox MB_OK|MB_ICONSTOP "Can't create registry key! ($9)"
3948     Goto noClose
3949
3950   write:
3951     ; Fill in the buffer with our strings
3952     StrCpy $2 $1                            ; Initial position
3953
3954     StrLen $9 '$REG_DATA_1'                 ; Length of first string
3955     IntOp $9 $9 + 1                         ; Plus null
3956     System::Call "*$2(&t$9 '$REG_DATA_1')"  ; Place the string
3957     IntOp $2 $2 + $9                        ; Advance to the next position
3958
3959     StrCmp '$REG_DATA_2' "" terminate
3960     StrLen $9 '$REG_DATA_2'                 ; Length of second string
3961     IntOp $9 $9 + 1                         ; Plus null
3962     System::Call "*$2(&t$9 '$REG_DATA_2')"  ; Place the string
3963     IntOp $2 $2 + $9                        ; Advance to the next position
3964
3965     StrCmp '$REG_DATA_3' "" terminate
3966     StrLen $9 '$REG_DATA_3'                 ; Length of third string
3967     IntOp $9 $9 + 1                         ; Plus null
3968     System::Call "*$2(&t$9 '$REG_DATA_3')"  ; Place the string
3969     IntOp $2 $2 + $9                        ; Advance to the next position
3970
3971     StrCmp '$REG_DATA_4' "" terminate
3972     StrLen $9 '$REG_DATA_4'                 ; Length of third string
3973     IntOp $9 $9 + 1                         ; Plus null
3974     System::Call "*$2(&t$9 '$REG_DATA_4')"  ; Place the string
3975     IntOp $2 $2 + $9                        ; Advance to the next position
3976
3977   terminate:
3978     System::Call "*$2(&t1 '')"              ; Place the terminating null
3979     IntOp $2 $2 + 1                         ; Advance to the next position
3980
3981     ; Create/write the value
3982     IntOp $2 $2 - $1                        ; Total length
3983     System::Call "${RegSetValueEx}(r0, '$REG_VALUE', 0, ${REG_MULTI_SZ}, r1, r2) .r9"
3984     ; Failed?
3985     IntCmp $9 0 done
3986       MessageBox MB_OK|MB_ICONSTOP "Can't set key value! ($9)"
3987       Goto done
3988
3989   done:
3990     ; Close the registry key
3991     System::Call "${RegCloseKey}(r0)"
3992
3993 noClose:
3994   ; Clear the buffer
3995   SetPluginUnload manual
3996   System::Free $1
3997
3998   Pop $9
3999   Pop $2
4000   Pop $1
4001   Exch $R0
4002 FunctionEnd
4003
4004 Function CreateDesktopIni
4005    WriteIniStr "$INSTDIR\Desktop.ini" ".ShellClassInfo" "IconFile" "client\program\afsd_service.exe"
4006    WriteIniStr "$INSTDIR\Desktop.ini" ".ShellClassInfo" "IconIndex" "0"
4007    SetFileAttributes "$INSTDIR\Desktop.ini" HIDDEN|SYSTEM
4008    SetFileAttributes "$INSTDIR\" READONLY
4009 FunctionEnd