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