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