62ac3b8fe00aba63bd2d5663922fd9418cadf142
[openafs.git] / src / WINNT / install / NSIS / OpenAFS.nsi
1 ;OpenAFS Install Script for NSIS
2 ;
3 ; Written by Rob Murawski <rsm4@ieee.org>
4 ;
5 ;Based on:
6 ;NSIS Modern User Interface version 1.63
7 ;MultiLanguage Example Script
8 ;Written by Joost Verburg
9
10 ; Read in the environment information
11 !include ${INCLUDEDIR}\nsi-includes.nsi
12 ; Define DEBUG if building a DEBUG installer
13
14 ; This version compiles with NSIS v2.0b3 or NSIS v2.0b4
15
16 !ifdef v2.0b3       ; v2.0b3
17 !ifndef DEBUG        ; !DEBUG
18 !define MUI_PRODUCT "OpenAFS" ;Define your own software name here
19 !else                ; DEBUG on v2.0b3
20 !define MUI_PRODUCT "OpenAFS Checked/Debug"
21 !endif               ; End DEBUG
22 !define MUI_VERSION ${AFS_VERSION}
23 !else                ; v2.0b4
24 !ifndef DEBUG        ; !DEBUG on v2.0b4
25 Name "OpenAFS ${AFS_VERSION} ${__DATE__} ${__TIME__}"
26 !else                ; DEBUG on v2.0b4
27 Name "OpenAFS ${AFS_VERSION} ${__DATE__} ${__TIME__} Checked/Debug"
28 !endif               ; End DEBUG/!DEBUG
29 VIProductVersion "${AFS_VERSION}.00"
30 VIAddVersionKey "ProductName" "OpenAFS"
31 VIAddVersionKey "CompanyName" "OpenAFS.org"
32 VIAddVersionKey "ProductVersion" ${AFS_VERSION}
33 VIAddVersionKey "FileVersion" ${AFS_VERSION}
34 VIAddVersionKey "FileDescription" "OpenAFS for Windows Installer"
35 VIAddVersionKey "LegalCopyright" "(C)2003"
36 !ifdef DEBUG
37 VIAddVersionKey "PrivateBuild" "Checked/Debug"
38 !endif               ; End DEBUG
39 !endif               ; End v2.0b4
40
41
42 !include "MUI.nsh"
43 !include Sections.nsh
44
45 ;--------------------------------
46 ;Configuration
47
48   ;General
49 !ifndef DEBUG
50   OutFile "${AFS_DESTDIR}\WinInstall\OpenAFSforWindows.exe"
51 !else
52   OutFile "${AFS_DESTDIR}\WinInstall\OpenAFSforWindows-DEBUG.exe"
53 !endif
54   SilentInstall normal
55   SetCompressor bzip2
56   !define MUI_ICON "..\..\client_config\afs_config.ico"
57   !ifdef v2.0b3
58   !define MUI_UNICON "${NSISDIR}\Contrib\Icons\normal-uninstall.ico"
59   !else
60   !define MUI_UNICON "..\..\client_config\afs_config.ico"
61   !endif
62   !define AFS_COMPANY_NAME "OpenAFS"
63   !define AFS_PRODUCT_NAME "OpenAFS"
64   !define AFS_REGKEY_ROOT "Software\TransarcCorporation"
65   CRCCheck force
66
67   ;Folder selection page
68   InstallDir "$PROGRAMFILES\OpenAFS"      ; Install to shorter path
69   
70   ;Remember install folder
71   InstallDirRegKey HKCU ${AFS_REGKEY_ROOT} ""
72   
73   ;Remember the installer language
74   !define MUI_LANGDLL_REGISTRY_ROOT "HKCU" 
75   !define MUI_LANGDLL_REGISTRY_KEY $(AFS_REGKEY_ROOT}
76   !define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"
77   
78   ;Where are the files?
79   !define AFS_CLIENT_BUILDDIR "${AFS_DESTDIR}\root.client\usr\vice\etc"
80   !define AFS_WININSTALL_DIR "${AFS_DESTDIR}\WinInstall\Config"
81   !define AFS_BUILD_INCDIR "${AFS_DESTDIR}\include"
82   !define AFS_CLIENT_LIBDIR "${AFS_DESTDIR}\lib"
83   !define AFS_SERVER_BUILDDIR "${AFS_DESTDIR}\root.server\usr\afs\bin"
84   !define AFS_ETC_BUILDDIR "${AFS_DESTDIR}\etc"
85   
86 ;--------------------------------
87 ;Modern UI Configuration
88
89   ;!define MUI_LICENSEPAGE
90   !define MUI_CUSTOMPAGECOMMANDS
91   !define MUI_WELCOMEPAGE
92   !define MUI_COMPONENTSPAGE
93   !define MUI_COMPONENTSPAGE_SMALLDESC
94   !define MUI_DIRECTORYPAGE
95
96   !define MUI_ABORTWARNING
97   !define MUI_FINISHPAGE
98   
99   !define MUI_UNINSTALLER
100   !define MUI_UNCONFIRMPAGE
101   
102   
103 !IFDEF v2.0b3       ; v2.0b3
104   !insertmacro MUI_PAGECOMMAND_WELCOME
105  ;!insertmacro MUI_PAGECOMMAND_LICENSE
106   !insertmacro MUI_PAGECOMMAND_COMPONENTS
107   !insertmacro MUI_PAGECOMMAND_DIRECTORY
108   Page custom AFSPageGetCellServDB
109   Page custom AFSPageGetCellName
110   !insertmacro MUI_PAGECOMMAND_INSTFILES
111   !insertmacro MUI_PAGECOMMAND_FINISH
112 !ELSE                ; v2.0b4
113   !insertmacro MUI_PAGE_WELCOME
114   !insertmacro MUI_PAGE_COMPONENTS
115   !insertmacro MUI_PAGE_DIRECTORY
116   Page custom AFSPageGetCellServDB
117   Page custom AFSPageGetCellName
118   !insertmacro MUI_PAGE_INSTFILES
119   !insertmacro MUI_PAGE_FINISH
120 !ENDIF
121   
122   ;LicenseData "Licenses.rtf"
123 ;--------------------------------
124 ;Languages
125
126   !insertmacro MUI_LANGUAGE "English"
127   ;!insertmacro MUI_LANGUAGE "French"
128   !insertmacro MUI_LANGUAGE "German"
129   !insertmacro MUI_LANGUAGE "Spanish"
130   !insertmacro MUI_LANGUAGE "SimpChinese"
131   !insertmacro MUI_LANGUAGE "TradChinese"    
132   !insertmacro MUI_LANGUAGE "Japanese"
133   !ifndef v2.0b3
134   !insertmacro MUI_LANGUAGE "Korean"
135   !endif
136   ;!insertmacro MUI_LANGUAGE "Italian"
137   ;!insertmacro MUI_LANGUAGE "Dutch"
138   ;!insertmacro MUI_LANGUAGE "Danish"
139   ;!insertmacro MUI_LANGUAGE "Greek"
140   ;!insertmacro MUI_LANGUAGE "Russian"
141   !insertmacro MUI_LANGUAGE "PortugueseBR"
142   ;!insertmacro MUI_LANGUAGE "Polish"
143   ;!insertmacro MUI_LANGUAGE "Ukrainian"
144   ;!insertmacro MUI_LANGUAGE "Czech"
145   ;!insertmacro MUI_LANGUAGE "Slovak"
146   ;!insertmacro MUI_LANGUAGE "Croatian"
147   ;!insertmacro MUI_LANGUAGE "Bulgarian"
148   ;!insertmacro MUI_LANGUAGE "Hungarian"
149   ;!insertmacro MUI_LANGUAGE "Thai"
150   ;!insertmacro MUI_LANGUAGE "Romanian"
151   ;!insertmacro MUI_LANGUAGE "Macedonian"
152   ;!insertmacro MUI_LANGUAGE "Turkish"
153   
154 ;--------------------------------
155 ;Language Strings
156     
157   ;Descriptions
158   LangString DESC_SecCopyUI ${LANG_ENGLISH} "OpenAFS for Windows: English"
159   ;LangString DESC_SecCopyUI ${LANG_FRENCH} "OpenAFS for Windows: French"
160   LangString DESC_SecCopyUI ${LANG_GERMAN} "OpenAFS for Windows: German"
161   LangString DESC_SecCopyUI ${LANG_SPANISH} "OpenAFS for Windows: Spanish"
162   LangString DESC_SecCopyUI ${LANG_SIMPCHINESE} "OpenAFS for Windows: Simplified Chinese"
163   LangString DESC_SecCopyUI ${LANG_TRADCHINESE} "OpenAFS for Windows: Traditional Chinese description"
164   LangString DESC_SecCopyUI ${LANG_JAPANESE} "OpenAFS for Windows: Japanese description"
165 !ifndef v2.0b3
166   LangString DESC_SecCopyUI ${LANG_KOREAN} "OpenAFS for Windows: Korean description"
167 !endif
168   ;LangString DESC_SecCopyUI ${LANG_ITALIAN} "OpenAFS for Windows: Italian description"
169   ;LangString DESC_SecCopyUI ${LANG_DUTCH} "OpenAFS for Windows: Dutch description"
170   ;LangString DESC_SecCopyUI ${LANG_DANISH} "OpenAFS for Windows: Danish description"
171   ;LangString DESC_SecCopyUI ${LANG_GREEK} "OpenAFS for Windows: Greek description"
172   ;LangString DESC_SecCopyUI ${LANG_RUSSIAN} "OpenAFS for Windows: Russian description"
173   LangString DESC_SecCopyUI ${LANG_PORTUGUESEBR} "OpenAFS for Windows: Portuguese (Brasil) description"
174   ;LangString DESC_SecCopyUI ${LANG_POLISH} "OpenAFS for Windows: Polish description"
175   ;LangString DESC_SecCopyUI ${LANG_UKRAINIAN} "OpenAFS for Windows: Ukrainian description"
176   ;LangString DESC_SecCopyUI ${LANG_CZECH} "OpenAFS for Windows: Czechian description"
177   ;LangString DESC_SecCopyUI ${LANG_SLOVAK} "OpenAFS for Windows: Slovakian description"
178   ;LangString DESC_SecCopyUI ${LANG_CROATIAN} "OpenAFS for Windows: Slovakian description"
179   ;LangString DESC_SecCopyUI ${LANG_BULGARIAN} "OpenAFS for Windows: Bulgarian description"
180   ;LangString DESC_SecCopyUI ${LANG_HUNGARIAN} "OpenAFS for Windows: Hungarian description"
181   ;LangString DESC_SecCopyUI ${LANG_THAI} "OpenAFS for Windows: Thai description"
182   ;LangString DESC_SecCopyUI ${LANG_ROMANIAN} "OpenAFS for Windows: Romanian description"
183   ;LangString DESC_SecCopyUI ${LANG_MACEDONIAN} "OpenAFS for Windows: Macedonian description"
184   ;LangString DESC_SecCopyUI ${LANG_TURKISH} "OpenAFS for Windows: Turkish description"
185
186   LangString DESC_secClient ${LANG_ENGLISH} "OpenAFS Client: Allows you to access AFS from your Windows PC."
187   LangString DESC_secClient ${LANG_GERMAN} "OpenAFS Client: Allows you to access AFS from your Windows PC."
188   LangString DESC_secClient ${LANG_SPANISH} "OpenAFS Client: Allows you to access AFS from your Windows PC."
189   LangString DESC_secClient ${LANG_SIMPCHINESE} "OpenAFS Client: Allows you to access AFS from your Windows PC."
190   LangString DESC_secClient ${LANG_TRADCHINESE} "OpenAFS Client: Allows you to access AFS from your Windows PC."
191   LangString DESC_secClient ${LANG_JAPANESE} "OpenAFS Client: Allows you to access AFS from your Windows PC."
192 !ifndef v2.0b3  
193   LangString DESC_secClient ${LANG_KOREAN} "OpenAFS Client: Allows you to access AFS from your Windows PC."
194 !endif
195   LangString DESC_secClient ${LANG_PORTUGUESEBR} "OpenAFS Client: Allows you to access AFS from your Windows PC."
196   
197   LangString DESC_secServer ${LANG_ENGLISH} "OpenAFS Server: Allows you to run an AFS file server. This option requires the AFS Client."
198   LangString DESC_secServer ${LANG_GERMAN} "OpenAFS Server: Allows you to run an AFS file server. This option requires the AFS Client."
199   LangString DESC_secServer ${LANG_SPANISH} "OpenAFS Server: Allows you to run an AFS file server. This option requires the AFS Client."
200   LangString DESC_secServer ${LANG_SIMPCHINESE} "OpenAFS Server: Allows you to run an AFS file server. This option requires the AFS Client."
201   LangString DESC_secServer ${LANG_TRADCHINESE} "OpenAFS Server: Allows you to run an AFS file server. This option requires the AFS Client."
202   LangString DESC_secServer ${LANG_JAPANESE} "OpenAFS Server: Allows you to run an AFS file server. This option requires the AFS Client."
203 !ifndef v2.0b3 
204   LangString DESC_secServer ${LANG_KOREAN} "OpenAFS Server: Allows you to run an AFS file server. This option requires the AFS Client."
205 !endif
206   LangString DESC_secServer ${LANG_PORTUGUESEBR} "OpenAFS Server: Allows you to run an AFS file server. This option requires the AFS Client."
207   
208   LangString DESC_secControl ${LANG_ENGLISH} "Control Center: GUI utilities for managing and configuring AFS servers.  This option requires the AFS Client."
209   LangString DESC_secControl ${LANG_GERMAN} "Control Center: GUI utilities for managing and configuring AFS servers.  This option requires the AFS Client."
210   LangString DESC_secControl ${LANG_SPANISH} "Control Center: GUI utilities for managing and configuring AFS servers.  This option requires the AFS Client."
211   LangString DESC_secControl ${LANG_SIMPCHINESE} "Control Center: GUI utilities for managing and configuring AFS servers.  This option requires the AFS Client."
212   LangString DESC_secControl ${LANG_TRADCHINESE} "Control Center: GUI utilities for managing and configuring AFS servers.  This option requires the AFS Client."
213   LangString DESC_secControl ${LANG_JAPANESE} "Control Center: GUI utilities for managing and configuring AFS servers.  This option requires the AFS Client."
214 !ifndef v2.0b3  
215   LangString DESC_secControl ${LANG_KOREAN} "Control Center: GUI utilities for managing and configuring AFS servers.  This option requires the AFS Client."
216 !endif
217   LangString DESC_secControl ${LANG_PORTUGUESEBR} "Control Center: GUI utilities for managing and configuring AFS servers.  This option requires the AFS Client."
218   
219   LangString DESC_secDocs ${LANG_ENGLISH} "Supplemental Documentation: Additional documentation for using OpenAFS."
220   LangString DESC_secDocs ${LANG_GERMAN} "Supplemental Documentation: Additional documentation for using OpenAFS."
221   LangString DESC_secDocs ${LANG_SPANISH} "Supplemental Documentation: Additional documentation for using OpenAFS."
222   LangString DESC_secDocs ${LANG_SIMPCHINESE} "Supplemental Documentation: Additional documentation for using OpenAFS."
223   LangString DESC_secDocs ${LANG_TRADCHINESE} "Supplemental Documentation: Additional documentation for using OpenAFS."
224   LangString DESC_secDocs ${LANG_JAPANESE} "Supplemental Documentation: Additional documentation for using OpenAFS."
225 !ifndef v2.0b3  
226   LangString DESC_secDocs ${LANG_KOREAN} "Supplemental Documentation: Additional documentation for using OpenAFS."
227 !endif
228   LangString DESC_secDocs ${LANG_PORTUGUESEBR} "Supplemental Documentation: Additional documentation for using OpenAFS."
229   
230 ; Popup error messages
231   LangString CellError ${LANG_ENGLISH} "You must specify a valid CellServDB file to copy during install"
232   LangString CellError ${LANG_GERMAN} "You must specify a valid CellServDB file to copy during the install"
233   LangString CellError ${LANG_SPANISH} "You must specify a valid CellServDB file to copy during the install"
234   LangString CellError ${LANG_SIMPCHINESE} "You must specify a valid CellServDB file to copy during the install"
235   LangString CellError ${LANG_TRADCHINESE} "You must specify a valid CellServDB file to copy during the install"
236   LangString CellError ${LANG_JAPANESE} "You must specify a valid CellServDB file to copy during the install"
237 !ifndef v2.0b3  
238   LangString CellError ${LANG_KOREAN} "You must specify a valid CellServDB file to copy during the install"
239 !endif
240   LangString CellError ${LANG_PORTUGUESEBR} "You must specify a valid CellServDB file to copy during the install"
241   
242   LangString CellNameError ${LANG_ENGLISH} "You must specify a cell name for your client to use."
243   LangString CellNameError ${LANG_GERMAN} "You must specify a cell name for your client to use."
244   LangString CellNameError ${LANG_SPANISH} "You must specify a cell name for your client to use."
245   LangString CellNameError ${LANG_SIMPCHINESE} "You must specify a cell name for your client to use."
246   LangString CellNameError ${LANG_TRADCHINESE} "You must specify a cell name for your client to use."
247   LangString CellNameError ${LANG_JAPANESE} "You must specify a cell name for your client to use."
248 !ifndef v2.0b3
249   LangString CellNameError ${LANG_KOREAN} "You must specify a cell name for your client to use."
250 !endif
251   LangString CellNameError ${LANG_PORTUGUESEBR} "You must specify a cell name for your client to use."
252   
253   LangString URLError ${LANG_ENGLISH} "You must specify a URL if you choose the option to download the CellServDB."
254   LangString URLError ${LANG_GERMAN} "You must specify a URL if you choose the option to download the CellServDB."
255   LangString URLError ${LANG_SPANISH} "You must specify a URL if you choose the option to download the CellServDB."
256   LangString URLError ${LANG_SIMPCHINESE} "You must specify a URL if you choose the option to download the CellServDB."
257   LangString URLError ${LANG_TRADCHINESE} "You must specify a URL if you choose the option to download the CellServDB."
258   LangString URLError ${LANG_JAPANESE} "You must specify a URL if you choose the option to download the CellServDB."
259 !ifndef v2.0b3
260   LangString URLError ${LANG_KOREAN} "You must specify a URL if you choose the option to download the CellServDB."
261 !endif
262   LangString URLError ${LANG_PORTUGUESEBR} "You must specify a URL if you choose the option to download the CellServDB."
263
264   
265 ; Upgrade/re-install strings
266    LangString UPGRADE_CLIENT ${LANG_ENGLISH} "Upgrade AFS Client"
267    LangString UPGRADE_CLIENT ${LANG_GERMAN} "Upgrade AFS Client"
268    LangString UPGRADE_CLIENT ${LANG_SPANISH} "Upgrade AFS Client"
269    LangString UPGRADE_CLIENT ${LANG_SIMPCHINESE} "Upgrade AFS Client"
270    LangString UPGRADE_CLIENT ${LANG_TRADCHINESE} "Upgrade AFS Client"
271    LangString UPGRADE_CLIENT ${LANG_JAPANESE} "Upgrade AFS Client"
272 !ifndef v2.0b3
273    LangString UPGRADE_CLIENT ${LANG_KOREAN} "Upgrade AFS Client"
274 !endif
275    LangString UPGRADE_CLIENT ${LANG_PORTUGUESEBR} "Upgrade AFS Client"
276  
277    LangString REINSTALL_CLIENT ${LANG_ENGLISH} "Re-install AFS Client"
278    LangString REINSTALL_CLIENT ${LANG_GERMAN} "Re-install AFS Client"
279    LangString REINSTALL_CLIENT ${LANG_SPANISH} "Re-install AFS Client"
280    LangString REINSTALL_CLIENT ${LANG_SIMPCHINESE} "Re-install AFS Client"
281    LangString REINSTALL_CLIENT ${LANG_TRADCHINESE} "Re-install AFS Client"
282    LangString REINSTALL_CLIENT ${LANG_JAPANESE} "Re-install AFS Client"
283 !ifndef v2.0b3
284    LangString REINSTALL_CLIENT ${LANG_KOREAN} "Re-install AFS Client"
285 !endif
286    LangString REINSTALL_CLIENT ${LANG_PORTUGUESEBR} "Re-install AFS Client"
287   
288    LangString UPGRADE_SERVER ${LANG_ENGLISH} "Upgrade AFS Server"
289    LangString UPGRADE_SERVER ${LANG_GERMAN} "Upgrade AFS Server"
290    LangString UPGRADE_SERVER ${LANG_SPANISH} "Upgrade AFS Server"
291    LangString UPGRADE_SERVER ${LANG_SIMPCHINESE} "Upgrade AFS Server"
292    LangString UPGRADE_SERVER ${LANG_TRADCHINESE} "Upgrade AFS Server"
293    LangString UPGRADE_SERVER ${LANG_JAPANESE} "Upgrade AFS Server"
294 !ifndef v2.0b3
295    LangString UPGRADE_SERVER ${LANG_KOREAN} "Upgrade AFS Server"
296 !endif
297    LangString UPGRADE_SERVER ${LANG_PORTUGUESEBR} "Upgrade AFS Server"
298     
299    LangString REINSTALL_SERVER ${LANG_ENGLISH} "Re-install AFS Server"
300    LangString REINSTALL_SERVER ${LANG_GERMAN} "Re-install AFS Server"
301    LangString REINSTALL_SERVER ${LANG_SPANISH} "Re-install AFS Server"
302    LangString REINSTALL_SERVER ${LANG_SIMPCHINESE} "Re-install AFS Server"
303    LangString REINSTALL_SERVER ${LANG_TRADCHINESE} "Re-install AFS Server"
304    LangString REINSTALL_SERVER ${LANG_JAPANESE} "Re-install AFS Server"
305 !ifndef v2.0b3   
306    LangString REINSTALL_SERVER ${LANG_KOREAN} "Re-install AFS Server"
307 !endif
308    LangString REINSTALL_SERVER ${LANG_PORTUGUESEBR} "Re-install AFS Server"
309   
310   ReserveFile "CellServPage.ini"
311   ReserveFile "AFSCell.ini"
312   !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS ;InstallOptions plug-in
313   !insertmacro MUI_RESERVEFILE_LANGDLL ;Language selection dialog
314 ;--------------------------------
315 ; Macros
316 ; Macro - Upgrade DLL File
317  ; Written by Joost Verburg
318  ; ------------------------
319  ;
320  ; Example of usage:
321  ; !insertmacro UpgradeDLL "dllname.dll" "$SYSDIR\dllname.dll"
322  ;
323  ; !define UPGRADEDLL_NOREGISTER if you want to upgrade a DLL which cannot be registered
324  ;
325  ; Note that this macro sets overwrite to ON (the default) when it has been inserted.
326  ; If you are using another setting, set it again after inserting the macro.
327
328
329  !macro UpgradeDLL LOCALFILE DESTFILE
330
331    Push $R0
332    Push $R1
333    Push $R2
334    Push $R3
335
336    ;------------------------
337    ;Check file and version
338
339    IfFileExists "${DESTFILE}" "" "copy_${LOCALFILE}"
340
341    ClearErrors
342      GetDLLVersionLocal "${LOCALFILE}" $R0 $R1
343      GetDLLVersion "${DESTFILE}" $R2 $R3
344    IfErrors "upgrade_${LOCALFILE}"
345
346    IntCmpU $R0 $R2 "" "done_${LOCALFILE}" "upgrade_${LOCALFILE}"
347    IntCmpU $R1 $R3 "done_${LOCALFILE}" "done_${LOCALFILE}" "upgrade_${LOCALFILE}"
348
349    ;------------------------
350    ;Let's upgrade the DLL!
351
352    SetOverwrite try
353
354    "upgrade_${LOCALFILE}:"
355      !ifndef UPGRADEDLL_NOREGISTER
356        ;Unregister the DLL
357        UnRegDLL "${DESTFILE}"
358      !endif
359
360    ;------------------------
361    ;Try to copy the DLL directly
362
363    ClearErrors
364      StrCpy $R0 "${DESTFILE}"
365      Call ":file_${LOCALFILE}"
366    IfErrors "" "noreboot_${LOCALFILE}"
367
368    ;------------------------
369    ;DLL is in use. Copy it to a temp file and Rename it on reboot.
370
371    GetTempFileName $R0
372      Call ":file_${LOCALFILE}"
373    Rename /REBOOTOK $R0 "${DESTFILE}"
374
375    ;------------------------
376    ;Register the DLL on reboot
377
378    !ifndef UPGRADEDLL_NOREGISTER
379      WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\RunOnce" \
380      "Register ${DESTFILE}" '"$SYSDIR\rundll32.exe" "${DESTFILE},DllRegisterServer"'
381    !endif
382
383    Goto "done_${LOCALFILE}"
384
385    ;------------------------
386    ;DLL does not exist - just extract
387
388    "copy_${LOCALFILE}:"
389      StrCpy $R0 "${DESTFILE}"
390      Call ":file_${LOCALFILE}"
391
392    ;------------------------
393    ;Register the DLL
394
395    "noreboot_${LOCALFILE}:"
396      !ifndef UPGRADEDLL_NOREGISTER
397        RegDLL "${DESTFILE}"
398      !endif
399
400    ;------------------------
401    ;Done
402
403    "done_${LOCALFILE}:"
404
405    Pop $R3
406    Pop $R2
407    Pop $R1
408    Pop $R0
409
410    ;------------------------
411    ;End
412
413    Goto "end_${LOCALFILE}"
414
415    ;------------------------
416    ;Called to extract the DLL
417
418    "file_${LOCALFILE}:"
419      File /oname=$R0 "${LOCALFILE}"
420      Return
421
422    "end_${LOCALFILE}:"
423
424   ;------------------------
425   ;Set overwrite to default
426   ;(was set to TRY above)
427
428   SetOverwrite on
429
430  !macroend
431
432
433 ;--------------------------------
434 ;Reserve Files
435   
436   ;Things that need to be extracted on first (keep these lines before any File command!)
437   ;Only useful for BZIP2 compression
438   !insertmacro MUI_RESERVEFILE_LANGDLL
439   
440
441 ;--------------------------------
442 ;Installer Sections
443
444 ;----------------------
445 ; OpenAFS CLIENT
446 Section "AFS Client" secClient
447
448   SetShellVarContext all
449   ; Stop any running services or we can't replace the files
450   ; Stop the running processes
451   ;GetTempFileName $R0
452   ;File /oname=$R0 "${AFS_WININSTALL_DIR}\Killer.exe"   ; Might not have the MSVCR71.DLL file to run
453   ;nsExec::Exec '$R0 afscreds.exe'
454 !IFDEF INSTALL_KFW
455   ;nsExec::Exec '$R0 krbcc32s.exe'
456 !ENDIF
457
458   nsExec::Exec "net stop TransarcAFSDaemon"
459   nsExec::Exec "net stop TransarcAFSServer"
460   
461    ; Do client components
462   SetOutPath "$INSTDIR\Client\Program"
463   File "${AFS_CLIENT_BUILDDIR}\afsshare.exe"
464   File "${AFS_BUILD_INCDIR}\afs\cm_config.h"
465   File "${AFS_CLIENT_BUILDDIR}\libosi.dll"
466   File "${AFS_BUILD_INCDIR}\afs\kautils.h"
467   File "${AFS_CLIENT_BUILDDIR}\libafsconf.dll"
468   File "${AFS_CLIENT_BUILDDIR}\klog.exe"
469   File "${AFS_CLIENT_BUILDDIR}\tokens.exe"
470   File "${AFS_CLIENT_BUILDDIR}\unlog.exe"
471   File "${AFS_CLIENT_BUILDDIR}\fs.exe"
472   File "${AFS_CLIENT_LIBDIR}\libafsconf.lib"
473   File "${AFS_CLIENT_LIBDIR}\afsauthent.lib"
474   File "${AFS_CLIENT_BUILDDIR}\afscreds.exe"
475   File "${AFS_CLIENT_BUILDDIR}\afs_shl_ext.dll"
476   File "${AFS_BUILD_INCDIR}\afs\auth.h"
477   File "${AFS_CLIENT_BUILDDIR}\afsd_service.exe"
478   File "${AFS_CLIENT_BUILDDIR}\afslogon.dll"
479   File "${AFS_CLIENT_BUILDDIR}\symlink.exe"
480   File "${AFS_DESTDIR}\bin\kpasswd.exe"
481   File "${AFS_SERVER_BUILDDIR}\pts.exe"
482   File "${AFS_SERVER_BUILDDIR}\bos.exe"
483   File "${AFS_SERVER_BUILDDIR}\kas.exe"
484   File "${AFS_SERVER_BUILDDIR}\vos.exe"
485   File "${AFS_SERVER_BUILDDIR}\udebug.exe"
486   File "${AFS_DESTDIR}\bin\translate_et.exe"
487   File "${AFS_DESTDIR}\etc\rxdebug.exe"
488   File "${AFS_DESTDIR}\etc\backup.exe"
489   
490 !ifdef DEBUG
491   File "${AFS_CLIENT_BUILDDIR}\afsshare.pdb"
492   File "${AFS_CLIENT_BUILDDIR}\libosi.pdb"
493   File "${AFS_CLIENT_BUILDDIR}\libafsconf.pdb"
494   File "${AFS_CLIENT_BUILDDIR}\klog.pdb"
495   File "${AFS_CLIENT_BUILDDIR}\tokens.pdb"
496   File "${AFS_CLIENT_BUILDDIR}\unlog.pdb"
497   File "${AFS_CLIENT_BUILDDIR}\fs.pdb"
498   File "${AFS_CLIENT_BUILDDIR}\afscreds.pdb"
499   File "${AFS_CLIENT_BUILDDIR}\afs_shl_ext.pdb"
500   File "${AFS_CLIENT_BUILDDIR}\afsd_service.pdb"
501   File "${AFS_CLIENT_BUILDDIR}\afslogon.pdb"
502   File "${AFS_CLIENT_BUILDDIR}\symlink.pdb"
503   File "${AFS_DESTDIR}\bin\kpasswd.pdb"
504   ;File "${AFS_SERVER_BUILDDIR}\pts.pdb"
505   File "${AFS_SERVER_BUILDDIR}\bos.pdb"
506   File "${AFS_SERVER_BUILDDIR}\kas.pdb"
507   File "${AFS_SERVER_BUILDDIR}\vos.pdb"
508   File "${AFS_SERVER_BUILDDIR}\udebug.pdb"
509   File "${AFS_DESTDIR}\bin\translate_et.pdb"
510   File "${AFS_DESTDIR}\etc\rxdebug.pdb"
511   File "${AFS_DESTDIR}\etc\backup.pdb"
512 !endif
513
514   ; Client_headers
515    SetOutPath "$INSTDIR\Client\Program\Include"
516    File "${AFS_BUILD_INCDIR}\lock.h"
517    File "${AFS_BUILD_INCDIR}\lwp.h"
518    File "${AFS_BUILD_INCDIR}\preempt.h"
519    File "${AFS_BUILD_INCDIR}\timer.h"
520    File "${AFS_BUILD_INCDIR}\des.h"
521    File "${AFS_BUILD_INCDIR}\des_conf.h"
522    File "${AFS_BUILD_INCDIR}\mit-cpyright.h"
523    ;File "${AFS_BUILD_INCDIR}\des-odd.h"
524    File "${AFS_BUILD_INCDIR}\crypt.h"
525    File "${AFS_BUILD_INCDIR}\pthread.h"
526    File "${AFS_BUILD_INCDIR}\dbrpc.h"
527    File "${AFS_BUILD_INCDIR}\basic.h"
528    File "${AFS_BUILD_INCDIR}\osidebug.h"
529    File "${AFS_BUILD_INCDIR}\osiltype.h"
530    File "${AFS_BUILD_INCDIR}\osistatl.h"
531    File "${AFS_BUILD_INCDIR}\trylock.h"
532    File "${AFS_BUILD_INCDIR}\main.h"
533    File "${AFS_BUILD_INCDIR}\osibasel.h"
534    File "${AFS_BUILD_INCDIR}\osifd.h"
535    File "${AFS_BUILD_INCDIR}\osiqueue.h"
536    File "${AFS_BUILD_INCDIR}\osiutils.h"
537    File "${AFS_BUILD_INCDIR}\osi.h"
538    File "${AFS_BUILD_INCDIR}\osidb.h"
539    File "${AFS_BUILD_INCDIR}\osilog.h"
540    File "${AFS_BUILD_INCDIR}\osisleep.h"
541    File "${AFS_BUILD_INCDIR}\perf.h"
542    File "${AFS_BUILD_INCDIR}\ubik.h"
543    File "${AFS_BUILD_INCDIR}\ubik_int.h"
544    
545    
546    
547    SetOutPath "$INSTDIR\Client\Program\Include\afs"
548    File "${AFS_BUILD_INCDIR}\afs\afs_args.h"
549    File "${AFS_BUILD_INCDIR}\afs\debug.h"
550    File "${AFS_BUILD_INCDIR}\afs\param.h"
551    File "${AFS_BUILD_INCDIR}\afs\afs_sysnames.h"
552    ;File "${AFS_BUILD_INCDIR}\afs\permit_xprt.h"
553    File "${AFS_BUILD_INCDIR}\afs\stds.h"
554    File "${AFS_BUILD_INCDIR}\afs\icl.h"
555    File "${AFS_BUILD_INCDIR}\afs\procmgmt.h"
556    File "${AFS_BUILD_INCDIR}\afs\afsutil.h"
557    File "${AFS_BUILD_INCDIR}\afs\assert.h"
558    File "${AFS_BUILD_INCDIR}\afs\dirent.h"
559    File "${AFS_BUILD_INCDIR}\afs\errors.h"
560    File "${AFS_BUILD_INCDIR}\afs\itc.h"
561    File "${AFS_BUILD_INCDIR}\afs\vice.h"
562    File "${AFS_BUILD_INCDIR}\afs\pthread_glock.h"
563    File "${AFS_BUILD_INCDIR}\afs\errmap_nt.h"
564    File "${AFS_BUILD_INCDIR}\afs\dirpath.h"
565    File "${AFS_BUILD_INCDIR}\afs\ktime.h"
566    File "${AFS_BUILD_INCDIR}\afs\fileutil.h"
567    File "${AFS_BUILD_INCDIR}\afs\secutil_nt.h"
568    File "${AFS_BUILD_INCDIR}\afs\com_err.h"
569    File "${AFS_BUILD_INCDIR}\afs\error_table.h"
570    ;File "${AFS_BUILD_INCDIR}\afs\mit_sipb-cr.h"
571    File "${AFS_BUILD_INCDIR}\afs\cmd.h"
572    File "${AFS_BUILD_INCDIR}\afs\rxgen_consts.h"
573    File "${AFS_BUILD_INCDIR}\afs\afsint.h"
574    File "${AFS_BUILD_INCDIR}\afs\afscbint.h"
575    File "${AFS_BUILD_INCDIR}\afs\audit.h"
576    File "${AFS_BUILD_INCDIR}\afs\acl.h"
577    File "${AFS_BUILD_INCDIR}\afs\prs_fs.h"
578    File "${AFS_BUILD_INCDIR}\afs\afsd.h"
579    File "${AFS_BUILD_INCDIR}\afs\cm.h"
580    File "${AFS_BUILD_INCDIR}\afs\cm_buf.h"
581    File "${AFS_BUILD_INCDIR}\afs\cm_cell.h"
582    File "${AFS_BUILD_INCDIR}\afs\cm_config.h"
583    File "${AFS_BUILD_INCDIR}\afs\cm_conn.h"
584    File "${AFS_BUILD_INCDIR}\afs\cm_ioctl.h"
585    File "${AFS_BUILD_INCDIR}\afs\cm_scache.h"
586    File "${AFS_BUILD_INCDIR}\afs\cm_server.h"
587    File "${AFS_BUILD_INCDIR}\afs\cm_user.h"
588    File "${AFS_BUILD_INCDIR}\afs\cm_utils.h"
589    File "${AFS_BUILD_INCDIR}\afs\fs_utils.h"
590    File "${AFS_BUILD_INCDIR}\afs\krb.h"
591    File "${AFS_BUILD_INCDIR}\afs\krb_prot.h"
592    File "${AFS_BUILD_INCDIR}\afs\smb.h"
593    File "${AFS_BUILD_INCDIR}\afs\smb3.h"
594    File "${AFS_BUILD_INCDIR}\afs\smb_iocons.h"
595    File "${AFS_BUILD_INCDIR}\afs\smb_ioctl.h"
596    File "${AFS_BUILD_INCDIR}\afs\afsrpc.h"
597    File "${AFS_BUILD_INCDIR}\afs\afssyscalls.h"
598    File "${AFS_BUILD_INCDIR}\afs\pioctl_nt.h"
599    File "${AFS_BUILD_INCDIR}\afs\auth.h"
600    File "${AFS_BUILD_INCDIR}\afs\cellconfig.h"
601    File "${AFS_BUILD_INCDIR}\afs\keys.h"
602    File "${AFS_BUILD_INCDIR}\afs\ptserver.h"
603    File "${AFS_BUILD_INCDIR}\afs\ptint.h"
604    File "${AFS_BUILD_INCDIR}\afs\pterror.h"
605    File "${AFS_BUILD_INCDIR}\afs\ptint.h"
606    File "${AFS_BUILD_INCDIR}\afs\pterror.h"
607    File "${AFS_BUILD_INCDIR}\afs\ptclient.h"
608    File "${AFS_BUILD_INCDIR}\afs\prserver.h"
609    File "${AFS_BUILD_INCDIR}\afs\print.h"
610    File "${AFS_BUILD_INCDIR}\afs\prerror.h"
611    File "${AFS_BUILD_INCDIR}\afs\prclient.h"
612    File "${AFS_BUILD_INCDIR}\afs\kautils.h"
613    File "${AFS_BUILD_INCDIR}\afs\kauth.h"
614    File "${AFS_BUILD_INCDIR}\afs\kaport.h"
615    File "${AFS_BUILD_INCDIR}\afs\vl_opcodes.h"
616    File "${AFS_BUILD_INCDIR}\afs\vlserver.h"
617    File "${AFS_BUILD_INCDIR}\afs\vldbint.h"
618    File "${AFS_BUILD_INCDIR}\afs\usd.h"
619    File "${AFS_BUILD_INCDIR}\afs\bubasics.h"
620    File "${AFS_BUILD_INCDIR}\afs\butc.h"
621    File "${AFS_BUILD_INCDIR}\afs\bumon.h"
622    File "${AFS_BUILD_INCDIR}\afs\butm.h"
623    File "${AFS_BUILD_INCDIR}\afs\tcdata.h"
624    File "${AFS_BUILD_INCDIR}\afs\budb.h"
625    ;File "${AFS_BUILD_INCDIR}\afs\budb_errors.h"
626    File "${AFS_BUILD_INCDIR}\afs\budb_client.h"
627    File "${AFS_BUILD_INCDIR}\afs\dir.h"
628    File "${AFS_BUILD_INCDIR}\afs\fssync.h"
629    File "${AFS_BUILD_INCDIR}\afs\ihandle.h"
630    File "${AFS_BUILD_INCDIR}\afs\nfs.h"
631    File "${AFS_BUILD_INCDIR}\afs\ntops.h"
632    File "${AFS_BUILD_INCDIR}\afs\partition.h"
633    File "${AFS_BUILD_INCDIR}\afs\viceinode.h"
634    File "${AFS_BUILD_INCDIR}\afs\vnode.h"
635    File "${AFS_BUILD_INCDIR}\afs\volume.h"
636    File "${AFS_BUILD_INCDIR}\afs\voldefs.h"
637    File "${AFS_BUILD_INCDIR}\afs\volser.h"
638    File "${AFS_BUILD_INCDIR}\afs\volint.h"
639    File "${AFS_BUILD_INCDIR}\afs\fs_stats.h"
640    File "${AFS_BUILD_INCDIR}\afs\bosint.h"
641    File "${AFS_BUILD_INCDIR}\afs\bnode.h"
642    
643    
644    SetOutPath "$INSTDIR\Client\Program\Include\rx"
645    File "${AFS_BUILD_INCDIR}\rx\rx.h"
646    File "${AFS_BUILD_INCDIR}\rx\rx_packet.h"
647    File "${AFS_BUILD_INCDIR}\rx\rx_user.h"
648    File "${AFS_BUILD_INCDIR}\rx\rx_event.h"
649    File "${AFS_BUILD_INCDIR}\rx\rx_queue.h"
650    File "${AFS_BUILD_INCDIR}\rx\rx_globals.h"
651    File "${AFS_BUILD_INCDIR}\rx\rx_clock.h"
652    File "${AFS_BUILD_INCDIR}\rx\rx_misc.h"
653    File "${AFS_BUILD_INCDIR}\rx\rx_multi.h"
654    File "${AFS_BUILD_INCDIR}\rx\rx_null.h"
655    File "${AFS_BUILD_INCDIR}\rx\rx_lwp.h"
656    File "${AFS_BUILD_INCDIR}\rx\rx_pthread.h"
657    File "${AFS_BUILD_INCDIR}\rx\rx_xmit_nt.h"
658    File "${AFS_BUILD_INCDIR}\rx\xdr.h"
659    File "${AFS_BUILD_INCDIR}\rx\rxkad.h"
660    
661    
662
663    ; Client Sample
664    SetOutPath "$INSTDIR\Client\Program\Sample"
665    File "..\..\afsd\sample\token.c"
666    
667    Call AFSLangFiles
668    
669
670    
671   ; Do WINDOWSDIR components
672   
673   ; Do Windows SYSDIR (Control panel)
674   SetOutPath "$SYSDIR"
675   File "${AFS_CLIENT_BUILDDIR}\afs_cpa.cpl"
676 !ifdef DEBUG
677   File "${AFS_CLIENT_BUILDDIR}\afs_cpa.pdb"
678 !endif
679   
680   ; Get AFS CellServDB file
681   Call afs.GetCellServDB
682 !ifdef INSTALL_LOOPBACK
683   Call afs.InstallMSLoopback
684 !endif
685
686 !ifdef INSTALL_KFW
687   ; Include Kerberos for Windows files in the installer...
688   SetOutPath "$INSTDIR\kfw\bin\"
689   File "${KFW_SOURCE}\bin\*"
690   SetOutPath "$INSTDIR\kfw\doc"
691   File "${KFW_SOURCE}\doc\*"
692 !endif
693    
694   ;Store install folder
695   WriteRegStr HKCU "${AFS_REGKEY_ROOT}\Client" "" $INSTDIR
696   Call AFSCommon.Install
697   
698   ; Write registry entries
699   WriteRegStr HKCR "*\shellex\ContextMenuHandlers\AFS Client Shell Extension" "" "{DC515C27-6CAC-11D1-BAE7-00C04FD140D2}"
700   WriteRegStr HKCR "CLSID\{DC515C27-6CAC-11D1-BAE7-00C04FD140D2}" "" "AFS Client Shell Extension"
701   WriteRegStr HKCR "CLSID\{DC515C27-6CAC-11D1-BAE7-00C04FD140D2}\InprocServer32" "" "$INSTDIR\Client\Program\afs_shl_ext.dll"
702   WriteRegStr HKCR "CLSID\{DC515C27-6CAC-11D1-BAE7-00C04FD140D2}\InprocServer32" "ThreadingModel" "Apartment"
703   WriteRegStr HKCR "FOLDER\shellex\ContextMenuHandlers\AFS Client Shell Extension" "" "{DC515C27-6CAC-11D1-BAE7-00C04FD140D2}"
704   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved" "{DC515C27-6CAC-11D1-BAE7-00C04FD140D2}" "AFS Client Shell Extension"
705   
706   ; AFS Reg entries
707   DeleteRegKey HKLM "${AFS_REGKEY_ROOT}\AFS Client\CurrentVersion"
708   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Client\CurrentVersion" "VersionString" ${AFS_VERSION}
709   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Client\CurrentVersion" "Title" "AFS Client"
710   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Client\CurrentVersion" "Description" "AFS Client"
711   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Client\CurrentVersion" "PathName" "$INSTDIR\Client\Program"
712   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Client\CurrentVersion" "Software Type" "File System"
713   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Client\CurrentVersion" "MajorVersion" ${AFS_MAJORVERSION}
714   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Client\CurrentVersion" "MinorVersion" ${AFS_MINORVERSION}
715   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Client\CurrentVersion" "PatchLevel" ${AFS_PATCHLEVEL}
716   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Client\${AFS_VERSION}" "VersionString" ${AFS_VERSION}
717   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Client\${AFS_VERSION}" "Title" "AFS Client"
718   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Client\${AFS_VERSION}" "Description" "AFS Client"
719   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Client\${AFS_VERSION}" "Software Type" "File System"
720   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Client\${AFS_VERSION}" "PathName" "$INSTDIR\Client\Program"
721   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Client\${AFS_VERSION}" "MajorVersion" ${AFS_MAJORVERSION}
722   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Client\${AFS_VERSION}" "MinorVersion" ${AFS_MINORVERSION}
723   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Client\${AFS_VERSION}" "PatchLevel" ${AFS_PATCHLEVEL}
724 !ifdef DEBUG
725   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Client\CurrentVersion" "Debug" 1
726   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Client\${AFS_VERSION}" "Debug" 1
727 !else
728    ; Delete the DEBUG string
729    DeleteRegValue HKLM "${AFS_REGKEY_ROOT}\AFS Client\CurrentVersion" "Debug"
730    DeleteRegValue HKLM "${AFS_REGKEY_ROOT}\AFS Client\${AFS_VERSION}" "Debug"
731 !endif
732    ; Set network settings
733   WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Services\NetBT\Parameters" "SmbDeviceEnabled" 0
734   
735   ;Write start menu entries
736   CreateDirectory "$SMPROGRAMS\OpenAFS\Client"
737   CreateShortCut "$SMPROGRAMS\OpenAFS\Uninstall OpenAFS.lnk" "$INSTDIR\Uninstall.exe"
738   CreateShortCut "$SMPROGRAMS\OpenAFS\Client\Authentication.lnk" "$INSTDIR\Client\Program\afscreds.exe" 
739   CreateShortCut "$SMSTARTUP\AFS Credentials.lnk" "$INSTDIR\Client\Program\afscreds.exe" 
740
741   Push "$INSTDIR\Client\Program"
742   Call AddToPath
743   Push "$INSTDIR\Common"
744   Call AddToPath
745   
746 !ifdef INSTALL_KFW
747   ; Add kfw to path too
748   Push "$INSTDIR\kfw\bin"
749   Call AddToPath
750 !endif
751    
752   ; Create the AFS service
753   SetOutPath "$INSTDIR\Common"
754   File "${AFS_WININSTALL_DIR}\Service.exe"
755   nsExec::Exec "net stop TransarcAFSDaemon"
756   ;IMPORTANT!  If we are not refreshing the config files, do NOT remove the service
757   ;Don't re-install because it must be present or we wouldn't have passed the Reg check
758  
759   ReadRegStr $R2 HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon" "Cell"
760   StrCmp $R2 "" +1 skipremove
761   nsExec::Exec '$INSTDIR\Common\Service.exe u TransarcAFSDaemon'
762   nsExec::Exec '$INSTDIR\Common\Service.exe TransarcAFSDaemon "$INSTDIR\Client\Program\afsd_service.exe" "OpenAFS Client Service"'
763 skipremove:
764   Delete "$INSTDIR\Common\service.exe"
765
766   ; Daemon entries
767   WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon" "(Default)" ""
768   WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" "AuthentProviderPath" "$INSTDIR\Client\Program\afslogon.dll"
769   WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" "Class" 2
770   ReadINIStr $R0 $1 "Field 7" "State"
771   ReadINIStr $R1 $1 "Field 9" "State"
772   ; Complicated way to do $R1 = ($R1 *2) + $R0
773   IntOp $R2 $R1 * 2
774   IntOp $R1 $R2 + $R0
775   WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" "LogonOptions" $R1
776   WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" "LogonScript" "$INSTDIR\Client\Program\afscreds.exe -:%s -x"
777   WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" "Name" "OpenAFSDaemon"
778   WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" "ProviderPath" "$INSTDIR\Client\Program\afslogon.dll"
779
780   ;Write cell name
781   ReadINIStr $R0 $1 "Field 2" "State"
782   WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" "Cell" $R0
783   ReadINIStr $R0 $1 "Field 3" "State"
784   WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" "ShowTrayIcon" 1
785   WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" "SecurityLevel" $R0
786   ReadINIStr $R0 $1 "Field 5" "State"  
787   WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" "FreelanceClient" $R0
788   WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" "UseDNS" 0
789   SetRebootFlag true
790   
791   WriteUninstaller "$INSTDIR\Uninstall.exe"
792   
793 SectionEnd
794
795 ;------------------------
796 ; OpenAFS SERVER  
797 Section "AFS Server" secServer
798
799   SetShellVarContext all
800   ; Stop any running services or we can't replace the files
801   ; Stop the running processes
802   ;GetTempFileName $R0
803   ;File /oname=$R0 "${AFS_WININSTALL_DIR}\Killer.exe"   ; Might not have the MSVCR71.DLL file to run
804   ;nsExec::Exec '$R0 afscreds.exe'
805 !IFDEF INSTALL_KFW
806   ;nsExec::Exec '$R0 krbcc32s.exe'
807 !ENDIF
808
809   nsExec::Exec "net stop TransarcAFSDaemon"
810   nsExec::Exec "net stop TransarcAFSServer"
811
812   CreateDirectory "$INSTDIR\Server\usr\afs\etc"
813   CreateDirectory "$INSTDIR\Server\usr\afs\local"
814   CreateDirectory "$INSTDIR\Server\usr\afs\etc\logs"
815   
816   SetOutPath "$INSTDIR\Server\usr\afs\bin"  
817   File "${AFS_SERVER_BUILDDIR}\afskill.exe"
818   File "${AFS_SERVER_BUILDDIR}\afssvrcfg.exe"
819   File "${AFS_SERVER_BUILDDIR}\bosctlsvc.exe"
820   File "${AFS_SERVER_BUILDDIR}\bosserver.exe"
821   File "${AFS_SERVER_BUILDDIR}\buserver.exe"
822   File "${AFS_ETC_BUILDDIR}\butc.exe"
823   File "${AFS_SERVER_BUILDDIR}\fileserver.exe"
824   File "${AFS_ETC_BUILDDIR}\fms.exe"
825   File "${AFS_SERVER_BUILDDIR}\kaserver.exe"
826   File "${AFS_SERVER_BUILDDIR}\ptserver.exe"
827   File "${AFS_SERVER_BUILDDIR}\salvager.exe"
828   File "${AFS_SERVER_BUILDDIR}\upclient.exe"
829   File "${AFS_SERVER_BUILDDIR}\upserver.exe"
830   File "${AFS_SERVER_BUILDDIR}\vlserver.exe"
831   File "${AFS_SERVER_BUILDDIR}\volinfo.exe"
832   File "${AFS_SERVER_BUILDDIR}\volserver.exe"
833
834 !ifdef DEBUG
835   File "${AFS_SERVER_BUILDDIR}\afskill.pdb"
836   File "${AFS_SERVER_BUILDDIR}\afssvrcfg.pdb"
837   File "${AFS_SERVER_BUILDDIR}\bosctlsvc.pdb"
838   File "${AFS_SERVER_BUILDDIR}\bosserver.pdb"
839   File "${AFS_SERVER_BUILDDIR}\buserver.pdb"
840   File "${AFS_ETC_BUILDDIR}\butc.pdb"
841   File "${AFS_SERVER_BUILDDIR}\fileserver.pdb"
842   File "${AFS_ETC_BUILDDIR}\fms.pdb"
843   File "${AFS_SERVER_BUILDDIR}\kaserver.pdb"
844   File "${AFS_SERVER_BUILDDIR}\ptserver.pdb"
845   File "${AFS_SERVER_BUILDDIR}\salvager.pdb"
846   File "${AFS_SERVER_BUILDDIR}\upclient.pdb"
847   File "${AFS_SERVER_BUILDDIR}\upserver.pdb"
848   File "${AFS_SERVER_BUILDDIR}\vlserver.pdb"
849   File "${AFS_SERVER_BUILDDIR}\volinfo.pdb"
850   File "${AFS_SERVER_BUILDDIR}\volserver.pdb"
851 !endif
852  
853  ;AFS Server common files
854  SetOutPath "$INSTDIR\Common"
855  File "${AFS_SERVER_BUILDDIR}\afsvosadmin.dll"
856  File "${AFS_SERVER_BUILDDIR}\afsbosadmin.dll"
857  File "${AFS_SERVER_BUILDDIR}\afscfgadmin.dll"
858  File "${AFS_SERVER_BUILDDIR}\afskasadmin.dll"
859  File "${AFS_SERVER_BUILDDIR}\afsptsadmin.dll"
860
861 !ifdef DEBUG
862  File "${AFS_SERVER_BUILDDIR}\afsvosadmin.pdb"
863  File "${AFS_SERVER_BUILDDIR}\afsbosadmin.pdb"
864  File "${AFS_SERVER_BUILDDIR}\afscfgadmin.pdb"
865  File "${AFS_SERVER_BUILDDIR}\afskasadmin.pdb"
866  File "${AFS_SERVER_BUILDDIR}\afsptsadmin.pdb"
867 !endif
868  SetOutPath "$INSTDIR\Common"
869    Call AFSLangFiles
870    
871    SetOutPath "$SYSDIR"
872    File "${AFS_SERVER_BUILDDIR}\afsserver.cpl"
873
874 !ifdef DEBUG
875    File "${AFS_SERVER_BUILDDIR}\afsserver.pdb"
876 !endif
877    
878   ;Store install folder
879   WriteRegStr HKCU "${AFS_REGKEY_ROOT}\AFS Server" "" $INSTDIR
880   
881   DeleteRegKey HKLM "${AFS_REGKEY_ROOT}\AFS Server\CurrentVersion"
882   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Server\CurrentVersion" "VersionString" ${AFS_VERSION}
883   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Server\CurrentVersion" "Title" "AFS Server"
884   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Server\CurrentVersion" "Description" "AFS Server for Windows"
885   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Server\CurrentVersion" "PathName" "$INSTDIR\Server"
886   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Server\CurrentVersion" "Software Type" "File System"
887   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Server\CurrentVersion" "MajorVersion" ${AFS_MAJORVERSION}
888   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Server\CurrentVersion" "MinorVersion" ${AFS_MINORVERSION}
889   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Server\CurrentVersion" "PatchLevel" ${AFS_PATCHLEVEL}
890   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Server\${AFS_VERSION}" "VersionString" ${AFS_VERSION}
891   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Server\${AFS_VERSION}" "Title" "AFS Server"
892   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Server\${AFS_VERSION}" "Description" "AFS Server for Windows"
893   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Server\${AFS_VERSION}" "Software Type" "File System"
894   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Server\${AFS_VERSION}" "PathName" "$INSTDIR\Server"
895   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Server\${AFS_VERSION}" "MajorVersion" ${AFS_MAJORVERSION}
896   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Server\${AFS_VERSION}" "MinorVersion" ${AFS_MINORVERSION}
897   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Server\${AFS_VERSION}" "PatchLevel" ${AFS_PATCHLEVEL}
898 !ifdef DEBUG
899   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Server\CurrentVersion" "Debug" 1
900   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Server\${AFS_VERSION}" "Debug" 1
901 !else
902    ; Delete the DEBUG string
903    DeleteRegValue HKLM "${AFS_REGKEY_ROOT}\AFS Server\CurrentVersion" "Debug"
904    DeleteRegValue HKLM "${AFS_REGKEY_ROOT}\AFS Server\${AFS_VERSION}" "Debug"
905 !endif
906   ; Install the service
907   SetOutPath "$INSTDIR\Common"
908   File "${AFS_WININSTALL_DIR}\Service.exe"
909 !ifdef DEBUG
910   File "${AFS_WININSTALL_DIR}\Service.pdb"
911 !endif
912   ;Don't want to whack existing settings... Make users un-install and then re-install if they want that
913   ;nsExec::Exec '$INSTDIR\Common\service.exe u TransarcAFSServer'
914   nsExec::Exec '$INSTDIR\Common\service.exe TransarcAFSServer "$INSTDIR\Server\usr\afs\bin\bosctlsvc.exe" "OpenAFS AFS Server"'
915   Delete "$INSTDIR\Common\service.exe"
916   
917   CreateDirectory "$SMPROGRAMS\OpenAFS\Server"
918   CreateShortCut "$SMPROGRAMS\OpenAFS\Server\Server Configuration.lnk" "$INSTDIR\Server\usr\afs\bin\afssvrcfg.exe"
919   
920   ; Make the server config wizard auto-start on bootup
921   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce" "AFS Server Wizard" '"$INSTDIR\Server\usr\afs\bin\afssvrcfg.exe" /wizard"'
922   
923   WriteUninstaller "$INSTDIR\Uninstall.exe"
924
925 SectionEnd
926
927
928 ;----------------------------
929 ; OpenAFS Control Center
930 Section "AFS Control Center" secControl
931
932   SetShellVarContext all
933
934    SetOutPath "$INSTDIR\Control Center"
935   File "${AFS_SERVER_BUILDDIR}\TaAfsAccountManager.exe"
936   File "${AFS_SERVER_BUILDDIR}\TaAfsAdmSvr.exe"
937   File "${AFS_SERVER_BUILDDIR}\TaAfsServerManager.exe"
938    
939 !ifdef DEBUG
940   File "${AFS_SERVER_BUILDDIR}\TaAfsAccountManager.pdb"
941   File "${AFS_SERVER_BUILDDIR}\TaAfsAdmSvr.pdb"
942   File "${AFS_SERVER_BUILDDIR}\TaAfsServerManager.pdb"
943 !endif
944
945  ;AFS Server common files
946  Call AFSCommon.Install
947  Call AFSLangFiles
948  SetOutPath "$INSTDIR\Common"
949
950   SetOutPath "$INSTDIR\Common"
951 !IFDEF DEBUG
952 !IFDEF CL_1310
953   File "${AFS_WININSTALL_DIR}\msvcr71d.dll"
954   File "${AFS_WININSTALL_DIR}\msvcr71d.pdb"
955 !ELSE
956 !IFDEF CL_1300
957   File "${AFS_WININSTALL_DIR}\msvcrtd.dll"
958   File "${AFS_WININSTALL_DIR}\msvcrtd.pdb"
959 !ELSE
960   File "${AFS_WININSTALL_DIR}\msvcrtd.dll"
961   File "${AFS_WININSTALL_DIR}\msvcrtd.pdb"
962 !ENDIF
963 !ENDIF
964 !ELSE
965 !IFDEF CL_1310
966   File "${AFS_WININSTALL_DIR}\msvcr71.dll"
967 !ELSE
968 !IFDEF CL_1300
969   File "${AFS_WININSTALL_DIR}\msvcrt.dll"
970 !ELSE
971   File "${AFS_WININSTALL_DIR}\msvcrt.dll"
972 !ENDIF
973 !ENDIF
974 !ENDIF
975    
976    ;Store install folder
977   WriteRegStr HKCU "${AFS_REGKEY_ROOT}\AFS Control Center\CurrentVersion" "PathName" $INSTDIR
978   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Control Center\CurrentVersion" "VersionString" ${AFS_VERSION}
979   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Control Center\CurrentVersion" "MajorVersion" ${AFS_MAJORVERSION}
980   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Control Center\CurrentVersion" "MinorVersion" ${AFS_MINORVERSION}
981   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Control Center\CurrentVersion" "PatchLevel" ${AFS_PATCHLEVEL}
982   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Control Center\${AFS_VERSION}" "VersionString" ${AFS_VERSION}
983   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Control Center\${AFS_VERSION}" "MajorVersion" ${AFS_MAJORVERSION}
984   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Control Center\${AFS_VERSION}" "MinorVersion" ${AFS_MINORVERSION}
985   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Control Center\${AFS_VERSION}" "PatchLevel" ${AFS_PATCHLEVEL}
986 !ifdef DEBUG
987   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Control Center\CurrentVersion" "Debug" 1
988   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Control Center\${AFS_VERSION}" "Debug" 1
989 !else
990    ; Delete the DEBUG string
991    DeleteRegValue HKLM "${AFS_REGKEY_ROOT}\AFS Control Center\CurrentVersion" "Debug"
992    DeleteRegValue HKLM "${AFS_REGKEY_ROOT}\AFS Control Center\${AFS_VERSION}" "Debug"
993 !endif
994
995   ;Write start menu entries
996   CreateDirectory "$SMPROGRAMS\OpenAFS\Control Center"
997   CreateShortCut "$SMPROGRAMS\OpenAFS\Control Center\Account Manager.lnk" "$INSTDIR\Control Center\TaAfsAccountManager.exe"
998   CreateShortCut "$SMPROGRAMS\OpenAFS\Control Center\Server Manager.lnk" "$INSTDIR\Control Center\TaAfsServerManager.exe"
999   
1000   WriteUninstaller "$INSTDIR\Uninstall.exe"
1001
1002 SectionEnd   
1003
1004
1005 ;----------------------------
1006 ; OpenAFS Supplemental Documentation
1007 Section "Supplemental Documentation" secDocs
1008   SetShellVarContext all
1009
1010    StrCmp $LANGUAGE ${LANG_ENGLISH} DoEnglish
1011    StrCmp $LANGUAGE ${LANG_GERMAN} DoGerman
1012    StrCmp $LANGUAGE ${LANG_SPANISH} DoSpanish
1013    StrCmp $LANGUAGE ${LANG_JAPANESE} DoJapanese
1014 !ifndef v2.0b3
1015    StrCmp $LANGUAGE ${LANG_KOREAN} DoKorean
1016 !endif
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"
1024    File "..\..\doc\install\Documentation\en_US\html\*"
1025    SetOutPath "$INSTDIR\Documentation\html\CmdRef"
1026    File "..\..\doc\install\Documentation\en_US\html\CmdRef\*"
1027    SetOutPath "$INSTDIR\Documentation\html\InstallGd"
1028    File "..\..\doc\install\Documentation\en_US\html\InstallGd\*"
1029    SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes"
1030    File "..\..\doc\install\Documentation\en_US\html\ReleaseNotes\*"
1031    SetOutPath "$INSTDIR\Documentation\html\SysAdminGd"
1032    File "..\..\doc\install\Documentation\en_US\html\SysAdminGd\*"
1033    goto DoneLanguage
1034    
1035 DoGerman:
1036    SetOutPath "$INSTDIR\Documentation"
1037    File "..\..\doc\install\Documentation\de_DE\README.TXT"
1038    SetOutPath "$INSTDIR\Documentation\html"
1039    File "..\..\doc\install\Documentation\de_DE\html\*"
1040    SetOutPath "$INSTDIR\Documentation\html\CmdRef"
1041    ;File "..\..\doc\install\Documentation\de_DE\html\CmdRef\*"
1042    SetOutPath "$INSTDIR\Documentation\html\InstallGd"
1043    File "..\..\doc\install\Documentation\de_DE\html\InstallGd\*"
1044    ;SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes"
1045    ;File "..\..\doc\install\Documentation\de_DE\html\ReleaseNotes\*"
1046    ;SetOutPath "$INSTDIR\Documentation\html\SysAdminGd"
1047    ;File "..\..\doc\install\Documentation\de_DE\html\SysAdminGd\*"
1048    goto DoneLanguage
1049    
1050 DoSpanish:
1051    SetOutPath "$INSTDIR\Documentation"
1052    File "..\..\doc\install\Documentation\es_ES\README.TXT"
1053    SetOutPath "$INSTDIR\Documentation\html"
1054    File "..\..\doc\install\Documentation\es_ES\html\*"
1055    SetOutPath "$INSTDIR\Documentation\html\CmdRef"
1056    ;File "..\..\doc\install\Documentation\es_ES\html\CmdRef\*"
1057    SetOutPath "$INSTDIR\Documentation\html\InstallGd"
1058    ;File "..\..\doc\install\Documentation\es_ES\html\InstallGd\*"
1059    SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes"
1060    ;File "..\..\doc\install\Documentation\es_ES\html\ReleaseNotes\*"
1061    SetOutPath "$INSTDIR\Documentation\html\SysAdminGd"
1062    ;File "..\..\doc\install\Documentation\es_ES\html\SysAdminGd\*"
1063    goto DoneLanguage
1064
1065 DoJapanese:
1066    SetOutPath "$INSTDIR\Documentation"
1067    File "..\..\doc\install\Documentation\ja_JP\README.TXT"
1068    SetOutPath "$INSTDIR\Documentation\html"
1069    File "..\..\doc\install\Documentation\ja_JP\html\*"
1070    SetOutPath "$INSTDIR\Documentation\html\CmdRef"
1071    File "..\..\doc\install\Documentation\ja_JP\html\CmdRef\*"
1072    SetOutPath "$INSTDIR\Documentation\html\InstallGd"
1073    File "..\..\doc\install\Documentation\ja_JP\html\InstallGd\*"
1074    SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes"
1075    ;File "..\..\doc\install\Documentation\ja_JP\html\ReleaseNotes\*"
1076    SetOutPath "$INSTDIR\Documentation\html\SysAdminGd"
1077    ;File "..\..\doc\install\Documentation\ja_JP\html\SysAdminGd\*"
1078    goto DoneLanguage
1079    
1080 DoKorean:
1081    SetOutPath "$INSTDIR\Documentation"
1082    File "..\..\doc\install\Documentation\ko_KR\README.TXT"
1083    SetOutPath "$INSTDIR\Documentation\html"
1084    File "..\..\doc\install\Documentation\ko_KR\html\*"
1085    ;SetOutPath "$INSTDIR\Documentation\html\CmdRef"
1086    ;File "..\..\doc\install\Documentation\ko_KR\html\CmdRef\*"
1087    SetOutPath "$INSTDIR\Documentation\html\InstallGd"
1088    File "..\..\doc\install\Documentation\ko_KR\html\InstallGd\*"
1089    SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes"
1090    File "..\..\doc\install\Documentation\ko_KR\html\ReleaseNotes\*"
1091    SetOutPath "$INSTDIR\Documentation\html\SysAdminGd"
1092    File "..\..\doc\install\Documentation\ko_KR\html\SysAdminGd\*"
1093    goto DoneLanguage
1094    
1095 DoPortugueseBR:
1096    SetOutPath "$INSTDIR\Documentation"
1097    File "..\..\doc\install\Documentation\pt_BR\README.TXT"
1098    SetOutPath "$INSTDIR\Documentation\html"
1099    File "..\..\doc\install\Documentation\pt_BR\html\*"
1100    ;SetOutPath "$INSTDIR\Documentation\html\CmdRef"
1101    ;File "..\..\doc\install\Documentation\pt_BR\html\CmdRef\*"
1102    SetOutPath "$INSTDIR\Documentation\html\InstallGd"
1103    File "..\..\doc\install\Documentation\pt_BR\html\InstallGd\*"
1104    SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes"
1105    File "..\..\doc\install\Documentation\pt_BR\html\ReleaseNotes\*"
1106    ;SetOutPath "$INSTDIR\Documentation\html\SysAdminGd"
1107    ;File "..\..\doc\install\Documentation\pt_BR\html\SysAdminGd\*"
1108    goto DoneLanguage
1109
1110 DoSimpChinese:
1111    SetOutPath "$INSTDIR\Documentation"
1112    File "..\..\doc\install\Documentation\zh_CN\README.TXT"
1113    SetOutPath "$INSTDIR\Documentation\html"
1114    File "..\..\doc\install\Documentation\zh_CN\html\*"
1115    ;SetOutPath "$INSTDIR\Documentation\html\CmdRef"
1116    ;File "..\..\doc\install\Documentation\zh_CN\html\CmdRef\*"
1117    SetOutPath "$INSTDIR\Documentation\html\InstallGd"
1118    File "..\..\doc\install\Documentation\zh_CN\html\InstallGd\*"
1119    SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes"
1120    File "..\..\doc\install\Documentation\zh_CN\html\ReleaseNotes\*"
1121    ;SetOutPath "$INSTDIR\Documentation\html\SysAdminGd"
1122    ;File "..\..\doc\install\Documentation\zh_CN\html\SysAdminGd\*"
1123    goto DoneLanguage
1124    
1125 DoTradChinese:
1126    SetOutPath "$INSTDIR\Documentation"
1127    File "..\..\doc\install\Documentation\zh_TW\README.TXT"
1128    SetOutPath "$INSTDIR\Documentation\html"
1129    File "..\..\doc\install\Documentation\zh_TW\html\*"
1130    ;SetOutPath "$INSTDIR\Documentation\html\CmdRef"
1131    ;File "..\..\doc\install\Documentation\zh_TW\html\CmdRef\*"
1132    SetOutPath "$INSTDIR\Documentation\html\InstallGd"
1133    File "..\..\doc\install\Documentation\zh_TW\html\InstallGd\*"
1134    SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes"
1135    File "..\..\doc\install\Documentation\zh_TW\html\ReleaseNotes\*"
1136    ;SetOutPath "$INSTDIR\Documentation\html\SysAdminGd"
1137    ;File "..\..\doc\install\Documentation\zh_TW\html\SysAdminGd\*"
1138    goto DoneLanguage
1139    
1140    
1141 DoneLanguage:
1142    ;Store install folder
1143   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Supplemental Documentation" "" $INSTDIR
1144   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Supplemental Documentation\CurrentVersion" "VersionString" ${AFS_VERSION}
1145   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Supplemental Documentation\CurrentVersion" "MajorVersion" ${AFS_MAJORVERSION}
1146   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Supplemental Documentation\CurrentVersion" "MinorVersion" ${AFS_MINORVERSION}
1147   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Supplemental Documentation\CurrentVersion" "PatchLevel" ${AFS_PATCHLEVEL}
1148   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Supplemental Documentation\${AFS_VERSION}" "VersionString" ${AFS_VERSION}
1149   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Supplemental Documentation\${AFS_VERSION}" "MajorVersion" ${AFS_MAJORVERSION}
1150   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Supplemental Documentation\${AFS_VERSION}" "MinorVersion" ${AFS_MINORVERSION}
1151   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Supplemental Documentation\${AFS_VERSION}" "PatchLevel" ${AFS_PATCHLEVEL}
1152
1153   ; Write start menu shortcut
1154   SetOutPath "$SMPROGRAMS\OpenAFS"
1155   CreateShortCut "$SMPROGRAMS\OpenAFS\Documentation.lnk" "$INSTDIR\Documentation\html\index.htm"
1156   
1157   
1158   WriteUninstaller "$INSTDIR\Uninstall.exe"
1159   CreateShortCut "$SMPROGRAMS\OpenAFS\Uninstall OpenAFS.lnk" "$INSTDIR\Uninstall.exe"
1160 SectionEnd  
1161   
1162 ;Display the Finish header
1163 ;Insert this macro after the sections if you are not using a finish page
1164 ;!insertmacro MUI_SECTIONS_FINISHHEADER
1165
1166 ;--------------------------------
1167 ;Installer Functions
1168
1169 Function .onInit
1170
1171   !insertmacro MUI_LANGDLL_DISPLAY
1172   
1173   ; Set the default install options
1174         Push $0
1175
1176    Call IsUserAdmin
1177    Pop $R0
1178    StrCmp $R0 "true" contInstall
1179
1180    MessageBox MB_OK|MB_ICONSTOP|MB_TOPMOST "You must be an administrator of this machine to install this software."
1181    Abort
1182    
1183 contInstall:
1184    ; Our logic should be like this.
1185    ;     1) If no AFS components are installed, we do a clean install with default options. (Client/Docs)
1186    ;     2) If existing modules are installed, we keep them selected
1187    ;     3) If it is an upgrade, we set the text accordingly, else we mark it as a re-install
1188    ;  TODO: Downgrade?
1189    Call IsAnyAFSInstalled
1190    Pop $R0
1191    StrCmp $R0 "0" DefaultOptions
1192    
1193    Call ShouldClientInstall
1194    Pop $R2
1195    
1196    StrCmp $R2 "0" NoClient
1197    StrCmp $R2 "1" ReinstallClient
1198    StrCmp $R2 "2" UpgradeClient
1199    StrCmp $R3 "3" DowngradeClient
1200    
1201         SectionGetFlags ${secClient} $0
1202         IntOp $0 $0 | ${SF_SELECTED}
1203         SectionSetFlags ${secClient} $0
1204     ;# !insertmacro SelectSection ${secClient}
1205    goto skipClient
1206 NoClient:
1207         ;StrCpy $1 ${secClient} ; Gotta remember which section we are at now...
1208         SectionGetFlags ${secClient} $0
1209         IntOp $0 $0 & ${SECTION_OFF}
1210         SectionSetFlags ${secClient} $0
1211    goto skipClient
1212 UpgradeClient:
1213         SectionGetFlags ${secClient} $0
1214         IntOp $0 $0 | ${SF_SELECTED}
1215         SectionSetFlags ${secClient} $0
1216    SectionSetText ${secClient} $(UPGRADE_CLIENT)
1217    goto skipClient
1218 ReinstallClient:
1219         SectionGetFlags ${secClient} $0
1220         IntOp $0 $0 | ${SF_SELECTED}
1221         SectionSetFlags ${secClient} $0
1222    SectionSetText ${secClient} $(REINSTALL_CLIENT)
1223    goto skipClient
1224 DowngradeClient:
1225         SectionGetFlags ${secClient} $0
1226         IntOp $0 $0 | ${SF_SELECTED}
1227         SectionSetFlags ${secClient} $0
1228    SectionSetText ${secClient} $(REINSTALL_CLIENT)
1229    goto skipClient
1230
1231    
1232 skipClient:   
1233    
1234    Call ShouldServerInstall
1235    Pop $R2
1236    StrCmp $R2 "0" NoServer
1237    StrCmp $R2 "1" ReinstallServer
1238    StrCmp $R2 "2" UpgradeServer
1239    StrCmp $R2 "3" DowngradeServer
1240    
1241         SectionGetFlags ${secServer} $0
1242         IntOp $0 $0 | ${SF_SELECTED}
1243         SectionSetFlags ${secServer} $0
1244         ;# !insertmacro UnselectSection ${secServer}
1245    goto skipServer
1246
1247 UpgradeServer:
1248    SectionGetFlags ${secServer} $0
1249    IntOp $0 $0 | ${SF_SELECTED}
1250    SectionSetFlags ${secServer} $0
1251    SectionSetText ${secServer} $(UPGRADE_SERVER)
1252    goto skipServer
1253
1254 ReinstallServer:
1255    SectionGetFlags ${secServer} $0
1256    IntOp $0 $0 | ${SF_SELECTED}
1257    SectionSetFlags ${secServer} $0
1258    SectionSetText ${secServer} $(REINSTALL_SERVER)
1259    goto skipServer
1260
1261 DowngradeServer:
1262    SectionGetFlags ${secServer} $0
1263    IntOp $0 $0 | ${SF_SELECTED}
1264    SectionSetFlags ${secServer} $0
1265    SectionSetText ${secServer} $(REINSTALL_SERVER)
1266    goto skipServer
1267    
1268 NoServer:
1269         SectionGetFlags ${secServer} $0
1270         IntOp $0 $0 & ${SECTION_OFF}
1271         SectionSetFlags ${secServer} $0
1272         ;# !insertmacro UnselectSection ${secServer}
1273    goto skipServer
1274    
1275 skipServer:
1276    ; Check control center
1277    Call IsControlInstalled
1278    Pop $R2
1279    StrCmp $R2 "0" NoControl
1280
1281         SectionGetFlags ${secControl} $0
1282         IntOp $0 $0 | ${SF_SELECTED}
1283         SectionSetFlags ${secControl} $0
1284    goto CheckDocs
1285    
1286 NoControl:   
1287         SectionGetFlags ${secControl} $0
1288         IntOp $0 $0 & ${SECTION_OFF}
1289         SectionSetFlags ${secControl} $0
1290         ;# !insertmacro UnselectSection ${secControl}
1291
1292 CheckDocs:
1293    ; Check Documentation
1294    Call IsDocumentationInstalled
1295    Pop $R2
1296    StrCmp $R2 "0" NoDocs
1297         SectionGetFlags ${secDocs} $0
1298         IntOp $0 $0 | ${SF_SELECTED}
1299         SectionSetFlags ${secDocs} $0
1300    goto end
1301    
1302 NoDocs:
1303         SectionGetFlags ${secDocs} $0
1304         IntOp $0 $0 & ${SECTION_OFF}
1305         SectionSetFlags ${secDocs} $0
1306    goto end
1307    
1308 DefaultOptions:
1309    ; Client Selected
1310         SectionGetFlags ${secClient} $0
1311         IntOp $0 $0 | ${SF_SELECTED}
1312         SectionSetFlags ${secClient} $0
1313
1314    ; Server NOT selected
1315         SectionGetFlags ${secServer} $0
1316         IntOp $0 $0 & ${SECTION_OFF}
1317         SectionSetFlags ${secServer} $0
1318    
1319    ; Control Center NOT selected
1320         SectionGetFlags ${secControl} $0
1321         IntOp $0 $0 & ${SECTION_OFF}
1322         SectionSetFlags ${secControl} $0
1323         ;# !insertmacro UnselectSection ${secControl}
1324
1325    ; Documentation selected
1326         SectionGetFlags ${secDocs} $0
1327         IntOp $0 $0 | ${SF_SELECTED}
1328         SectionSetFlags ${secDocs} $0
1329         ;# !insertmacro UnselectSection ${secDocs}
1330    goto end
1331
1332 end:
1333         Pop $0
1334   
1335    Push $R0
1336   
1337   ; See if we can set a default installation path...
1338   ReadRegStr $R0 HKLM "${AFS_REGKEY_ROOT}\AFS Client\CurrentVersion" "PathName"
1339   StrCmp $R0 "" TryServer
1340   Push $R0
1341   Call GetParent
1342   Call GetParent
1343   Pop $R0
1344   StrCpy $INSTDIR $R0
1345   goto Nope
1346   
1347 TryServer:
1348   ReadRegStr $R0 HKLM "${AFS_REGKEY_ROOT}\AFS Server\CurrentVersion" "PathName"
1349   StrCmp $R0 "" TryControl
1350   Push $R0
1351   Call GetParent
1352   Pop $R0
1353   StrCpy $INSTDIR $R0
1354   goto Nope
1355    
1356 TryControl:
1357   ReadRegStr $R0 HKLM "${AFS_REGKEY_ROOT}\AFS Control Center\CurrentVersion" "PathName"
1358   StrCmp $R0 "" Nope
1359   StrCpy $INSTDIR $R0
1360   
1361 Nope:
1362   Pop $R0
1363   
1364   GetTempFilename $0
1365   File /oname=$0 CellServPage.ini
1366   GetTempFilename $1
1367   File /oname=$1 AFSCell.ini
1368   ;File /oname=$1 ConfigURL.ini
1369   
1370 FunctionEnd
1371
1372
1373
1374
1375
1376 ;--------------------------------
1377 ; These are our cleanup functions
1378 Function .onInstFailed
1379 Delete $0
1380 Delete $1
1381 FunctionEnd
1382
1383 Function .onInstSuccess
1384 Delete $0
1385 Delete $1
1386 FunctionEnd
1387
1388
1389 ;--------------------------------
1390 ;Descriptions
1391
1392 !ifdef v2.0b3
1393 !insertmacro MUI_FUNCTIONS_DESCRIPTION_BEGIN
1394 !else
1395 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
1396 !endif
1397   !insertmacro MUI_DESCRIPTION_TEXT ${secServer} $(DESC_secServer)
1398   !insertmacro MUI_DESCRIPTION_TEXT ${secClient} $(DESC_secClient)
1399   !insertmacro MUI_DESCRIPTION_TEXT ${secControl} $(DESC_secControl)
1400   !insertmacro MUI_DESCRIPTION_TEXT ${secDocs} $(DESC_secDocs)
1401 !ifndef v2.0b4
1402   !insertmacro MUI_FUNCTIONS_DESCRIPTION_END
1403 !else
1404   !insertmacro MUI_FUNCTION_DESCRIPTION_END
1405 !endif
1406  
1407 ;--------------------------------
1408 ;Uninstaller Section
1409
1410 Section "Uninstall"
1411   ; Make sure the user REALLY wants to do this, unless they did a silent uninstall, in which case...let them!
1412 #ifdef v2.0b4
1413   IfSilent StartRemove     ; New in v2.0b4
1414 #endif
1415   MessageBox MB_YESNO "Are you sure you want to remove OpenAFS from this machine?" IDYES StartRemove
1416   abort
1417   
1418 StartRemove:
1419   
1420   SetShellVarContext all
1421   ; Stop the running processes
1422   GetTempFileName $R0
1423   File /oname=$R0 "${AFS_WININSTALL_DIR}\Killer.exe"
1424   nsExec::Exec '$R0 afscreds.exe'
1425 !IFDEF INSTALL_KFW
1426   nsExec::Exec '$R0 krbcc32s.exe'
1427 !ENDIF
1428
1429   ; Delete the AFS service
1430   GetTempFileName $R0
1431   File /oname=$R0 "${AFS_WININSTALL_DIR}\Service.exe"
1432   nsExec::Exec "net stop TransarcAFSDaemon"
1433   nsExec::Exec "net stop TransarcAFSServer"
1434   nsExec::Exec '$R0 u TransarcAFSDaemon'
1435   ; After we stop the service, but before we delete it, we have to remove the volume data
1436   ; This is because the storage locations are in the registry under the service key.
1437   ; Call un.RemoveAFSVolumes
1438   nsExec::Exec '$R0 u TransarcAFSServer'
1439   Delete $R0
1440   
1441   Push "$INSTDIR\Client\Program"
1442   Call un.RemoveFromPath
1443   Push "$INSTDIR\Common"
1444   Call un.RemoveFromPath
1445 !ifdef INSTALL_KFW
1446   Push "$INSTDIR\kfw\bin"
1447   Call un.RemoveFromPath
1448 !endif
1449   
1450   ; Delete documentation
1451   Delete "$INSTDIR\Documentation\README.TXT"
1452   Delete "$INSTDIR\Documentation\html\*"
1453   Delete "$INSTDIR\Documentation\html\CmdRef\*"
1454   Delete "$INSTDIR\Documentation\html\InstallGd\*"
1455   Delete "$INSTDIR\Documentation\html\ReleaseNotes\*"
1456   Delete "$INSTDIR\Documentation\html\SysAdminGd\*"
1457
1458    Delete /REBOOTOK "$INSTDIR\Common\afs_config.exe"
1459    Delete /REBOOTOK "$INSTDIR\Common\afs_shl_ext.dll"
1460    Delete /REBOOTOK "$INSTDIR\Common\afsadminutil.dll"
1461    Delete /REBOOTOK "$INSTDIR\Common\lib\afsauthent.dll"
1462    Delete /REBOOTOK "$INSTDIR\Common\lib\afspthread.dll"
1463    Delete /REBOOTOK "$INSTDIR\Common\lib\afsrpc.dll"
1464    Delete /REBOOTOK "$INSTDIR\Common\afsclientadmin.dll"
1465    Delete /REBOOTOK "$INSTDIR\Common\afsprocmgmt.dll"
1466    Delete /REBOOTOK "$INSTDIR\Common\afsvosadmin.dll"
1467    Delete /REBOOTOK "$INSTDIR\Common\TaAfsAppLib.dll"
1468    Delete /REBOOTOK "$INSTDIR\Common\afsvosadmin.dll"
1469    Delete /REBOOTOK "$INSTDIR\Common\afsbosadmin.dll"
1470    Delete /REBOOTOK "$INSTDIR\Common\afscfgadmin.dll"
1471    Delete /REBOOTOK "$INSTDIR\Common\afskasadmin.dll"
1472    Delete /REBOOTOK "$INSTDIR\Common\afsptsadmin.dll"
1473
1474 !IFDEF DEBUG
1475    Delete /REBOOTOK "$INSTDIR\Common\afs_config.pdb"
1476    Delete /REBOOTOK "$INSTDIR\Common\afs_shl_ext.pdb"
1477    Delete /REBOOTOK "$INSTDIR\Common\afsadminutil.pdb"
1478    Delete /REBOOTOK "$INSTDIR\Common\lib\afsauthent.pdb"
1479    Delete /REBOOTOK "$INSTDIR\Common\lib\afspthread.pdb"
1480    Delete /REBOOTOK "$INSTDIR\Common\lib\afsrpc.pdb"
1481    Delete /REBOOTOK "$INSTDIR\Common\afsclientadmin.pdb"
1482    Delete /REBOOTOK "$INSTDIR\Common\afsprocmgmt.pdb"
1483    Delete /REBOOTOK "$INSTDIR\Common\afsvosadmin.pdb"
1484    Delete /REBOOTOK "$INSTDIR\Common\TaAfsAppLib.pdb"
1485    Delete /REBOOTOK "$INSTDIR\Common\afsvosadmin.pdb"
1486    Delete /REBOOTOK "$INSTDIR\Common\afsbosadmin.pdb"
1487    Delete /REBOOTOK "$INSTDIR\Common\afscfgadmin.pdb"
1488    Delete /REBOOTOK "$INSTDIR\Common\afskasadmin.pdb"
1489    Delete /REBOOTOK "$INSTDIR\Common\afsptsadmin.pdb"
1490
1491 !IFDEF CL_1310
1492    Delete /REBOOTOK "$INSTDIR\Common\msvcr71d.dll"
1493    Delete /REBOOTOK "$INSTDIR\Common\msvcr71d.pdb"
1494 !ELSE
1495    Delete /REBOOTOK "$INSTDIR\Common\msvcrtd.dll"
1496    Delete /REBOOTOK "$INSTDIR\Common\msvcrtd.pdb"
1497 !ENDIF
1498 !ELSE
1499 !IFDEF CL_1310
1500    Delete /REBOOTOK "$INSTDIR\Common\msvcr71.dll"
1501 !ELSE
1502    Delete /REBOOTOK "$INSTDIR\Common\msvcrt.dll"
1503 !ENDIF
1504 !ENDIF
1505   
1506 !ifdef v2.0b3
1507    Call un.IsSilent
1508    Pop $R1
1509    StrCmp $R1 "/S" SkipAsk
1510 !else
1511    IfSilent SkipAsk
1512 !endif
1513 ;  IfFileExists "$WINDIR\afsdcell.ini" CellExists SkipDelAsk
1514 ;  CellExists:
1515   MessageBox MB_YESNO "Would you like to keep your configuration files?" IDYES SkipDel
1516   SkipAsk:
1517   Delete "$WINDIR\afsdcell.ini"
1518
1519   Delete "$WINDIR\afsdsbmt.ini"
1520 ; Only remove krb5.ini if KfW was installed
1521 !IFDEF INSTALL_KFW
1522   Delete "$WINDIR\krb5.ini"
1523 !ENDIF
1524   Delete "$WINDIR\afsdns.ini"
1525   Delete "$WINDIR\afs_freelance.ini"
1526   
1527   SkipDel:
1528   Delete "$WINDIR\afsd_init.log"
1529   Delete "$INSTDIR\Uninstall.exe"
1530
1531   ; Remove server
1532   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\afskill.exe"
1533   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\afssvrcfg.exe"
1534   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\bosctlsvc.exe"
1535   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\bosserver.exe"
1536   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\buserver.exe"
1537   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\butc.exe"
1538   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\fileserver.exe"
1539   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\fms.exe"
1540   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\kaserver.exe"
1541   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\ptserver.exe"
1542   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\salvager.exe"
1543   Delete "$INSTDIR\Server\usr\afs\bin\ServerUninst.dll"
1544   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\upclient.exe"
1545   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\upserver.exe"
1546   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\vlserver.exe"
1547   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\volinfo.exe"
1548   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\volserver.exe"
1549
1550 !ifdef DEBUG
1551   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\afskill.pdb"
1552   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\afssvrcfg.pdb"
1553   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\bosctlsvc.pdb"
1554   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\bosserver.pdb"
1555   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\buserver.pdb"
1556   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\butc.pdb"
1557   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\fileserver.pdb"
1558   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\fms.pdb"
1559   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\kaserver.pdb"
1560   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\ptserver.pdb"
1561   Delete "$INSTDIR\Server\usr\afs\bin\salvager.pdb"
1562   Delete "$INSTDIR\Server\usr\afs\bin\ServerUninst.pdb"
1563   Delete "$INSTDIR\Server\usr\afs\bin\upclient.pdb"
1564   Delete "$INSTDIR\Server\usr\afs\bin\upserver.pdb"
1565   Delete "$INSTDIR\Server\usr\afs\bin\vlserver.pdb"
1566   Delete "$INSTDIR\Server\usr\afs\bin\volinfo.pdb"
1567   Delete "$INSTDIR\Server\usr\afs\bin\volserver.pdb"
1568 !endif
1569
1570   RMDir /r "$INSTDIR\Server\usr\afs\bin"
1571   RmDir /r "$INSTDIR\Server\usr\afs\etc\logs"
1572   RmDir /r "$INSTDIR\Server\usr\afs\etc"
1573   RmDir /r "$INSTDIR\Server\usr\afs\local"
1574   RMDIR /r "$INSTDIR\Server\usr\afs\logs"
1575   
1576   Delete /REBOOTOK "$SYSDIR\afsserver.cpl"
1577   Delete /REBOOTOK "$SYSDIR\afs_cpa.cpl"
1578
1579 !ifdef DEBUG
1580   Delete /REBOOTOK "$SYSDIR\afsserver.pdb"
1581   Delete /REBOOTOK "$SYSDIR\afs_cpa.pdb"
1582 !endif
1583   
1584   RMDir /r "$INSTDIR\Documentation\html\CmdRef"
1585   RMDir /r "$INSTDIR\Documentation\html\InstallGd"
1586   RMDir /r "$INSTDIR\Documentation\html\ReleaseNotes"
1587   RMDir /r "$INSTDIR\Documentation\html\SysAdminGd"
1588   RMDIr /r "$INSTDIR\Documentation\html"
1589   
1590   RMDir "$INSTDIR\Documentation"
1591   ; Delete DOC short cut
1592   Delete /REBOOTOK "$INSTDIR\Client\Program\afscreds.exe"
1593
1594 !ifdef DEBUG
1595   Delete /REBOOTOK "$INSTDIR\Client\Program\afscreds.pdb"
1596 !endif
1597
1598   Delete /REBOOTOK "$INSTDIR\Client\Program\*"
1599   Delete /REBOOTOK "$INSTDIR\Client\Program\Include\*"
1600   Delete /REBOOTOK "$INSTDIR\Client\Program\Include\afs\*"
1601   Delete /REBOOTOK "$INSTDIR\Client\Program\Include\rx\*"
1602   Delete /REBOOTOK "$INSTDIR\Client\Program\Sample\*"
1603   RMDir  "$INSTDIR\Client\Program\Sample"
1604   RMDir  "$INSTDIR\Client\Program\Include\afs"
1605   RMDir  "$INSTDIR\Client\Program\Include\rx"
1606   RMDir  "$INSTDIR\Client\Program\Include"
1607   RMDir  "$INSTDIR\Client\Program"
1608   RMDir  "$INSTDIR\Client"
1609   
1610 !IFDEF DEBUG
1611 !IFDEF CL_1310
1612   Delete /REBOOTOK "$INSTDIR\Common\msvcr71d.dll"
1613   Delete /REBOOTOK "$INSTDIR\Common\msvcr71d.pdb"
1614 !ELSE
1615   Delete /REBOOTOK "$INSTDIR\Common\msvcrtd.dll"
1616   Delete /REBOOTOK "$INSTDIR\Common\msvcrtd.pdb"
1617 !ENDIF
1618 !ELSE
1619 !IFDEF CL_1310
1620   Delete /REBOOTOK "$INSTDIR\Common\msvcr71.dll"
1621 !ELSE
1622   Delete /REBOOTOK "$INSTDIR\Common\msvcrt.dll"
1623 !ENDIF
1624 !ENDIF
1625   Delete /REBOOTOK "$INSTDIR\Common\*"
1626   RMDir "$INSTDIR\Common"
1627
1628 !ifdef INSTALL_KFW
1629   ;Remove KfW files
1630   Delete /REBOOTOK "$INSTDIR\kfw\bin\*"
1631   RMDIR  /r "$INSTDIR\kfw\bin"
1632   Delete /REBOOTOK "$INSTDIR\kfw\doc\*"
1633   RMDIR  /r "$INSTDIR\kfw\doc"
1634   RMDIR  /r "$INSTDIR\kfw"
1635 !endif
1636
1637   Delete "$SMPROGRAMS\OpenAFS\Documentation.lnk"
1638
1639   ; Remove control center
1640   Delete /REBOOTOK "$INSTDIR\Control Center\TaAfsAccountManager.exe"
1641   Delete /REBOOTOK "$INSTDIR\Control Center\TaAfsAdmSvr.exe"
1642   Delete /REBOOTOK "$INSTDIR\Control Center\TaAfsServerManager.exe"
1643   Delete /REBOOTOK "$INSTDIR\Control Center\CCUninst.dll"
1644 !ifdef DEBUG
1645   Delete /REBOOTOK "$INSTDIR\Control Center\TaAfsAccountManager.pdb"
1646   Delete /REBOOTOK "$INSTDIR\Control Center\TaAfsAdmSvr.pdb"
1647   Delete /REBOOTOK "$INSTDIR\Control Center\TaAfsServerManager.pdb"
1648 !endif
1649   RMDir  "$INSTDIR\Control Center"
1650   
1651   Delete "$SMPROGRAMS\OpenAFS\Uninstall OpenAFS.lnk"
1652   Delete "$SMPROGRAMS\OpenAFS\Client\Authentication.lnk"
1653   Delete "$SMPROGRAMS\OpenAFS\Control Center\Account Manager.lnk"
1654   Delete "$SMPROGRAMS\OpenAFS\Control Center\Server Manager.lnk"
1655   RMDIR "$SMPROGRAMS\OpenAFS\Control Center"
1656   RMDir /r "$SMPROGRAMS\OpenAFS\Client"
1657   RMDir /r "$SMPROGRAMS\OpenAFS"
1658   Delete "$SMSTARTUP\AFS Credentials.lnk"
1659   
1660   ReadRegStr $R0 HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon" "CachePath"
1661   IfErrors +2
1662   Delete "$R0\AFSCache"
1663   Delete "C:\AFSCache"
1664
1665   DeleteRegKey HKCR "*\shellex\ContextMenuHandlers\AFS Client Shell Extension"
1666   DeleteRegKey HKCR "CLSID\{DC515C27-6CAC-11D1-BAE7-00C04FD140D2}\InprocServer32"
1667   DeleteRegKey HKCR "CLSID\{DC515C27-6CAC-11D1-BAE7-00C04FD140D2}"
1668   DeleteRegKey HKCR "FOLDER\shellex\ContextMenuHandlers\AFS Client Shell Extension"
1669   DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved" "{DC515C27-6CAC-11D1-BAE7-00C04FD140D2}"
1670
1671   DeleteRegKey HKLM "${AFS_REGKEY_ROOT}\AFS Client\CurrentVersion"
1672   DeleteRegKey HKLM "${AFS_REGKEY_ROOT}\AFS Client"
1673   DeleteRegKey HKLM "${AFS_REGKEY_ROOT}\AFS Supplemental Documentation\CurrentVersion"
1674   DeleteRegKey HKLM "${AFS_REGKEY_ROOT}\AFS Supplemental Documentation"
1675   DeleteRegKey HKLM "${AFS_REGKEY_ROOT}\AFS Control Center\CurrentVersion"
1676   DeleteRegKey HKLM "${AFS_REGKEY_ROOT}\AFS Control Center"
1677   DeleteRegKey HKLM "${AFS_REGKEY_ROOT}\AFS Server\CurrentVersion"
1678   DeleteRegKey HKLM "${AFS_REGKEY_ROOT}\AFS Server"
1679   DeleteRegKey /ifempty HKLM "${AFS_REGKEY_ROOT}"
1680   DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenAFS"
1681   DeleteRegValue HKLM "SYSTEM\CurrentControlSet\Services\NetBT\Parameters" "SmbDeviceEnabled"
1682  
1683   RMDir  "$INSTDIR"
1684
1685 !ifdef v2.0b3
1686   ;Display the Finish header
1687   !insertmacro MUI_UNFINISHHEADER
1688 !endif
1689
1690 SectionEnd
1691
1692 ;--------------------------------
1693 ;Uninstaller Functions
1694
1695 Function un.onInit
1696
1697   ;Get language from registry
1698   ReadRegStr $LANGUAGE HKCU "Software\OpenAFS\AFS" "Installer Language"
1699
1700 FunctionEnd
1701
1702 Function un.onUninstSuccess
1703
1704    MessageBox MB_OK "Please reboot your machine to complete uninstallation of the software"
1705
1706 FunctionEnd
1707
1708 ;------------------------------
1709 ; Get the CellServDB file from the Internet
1710
1711 Function afs.GetCellServDB
1712
1713 ;Check if we should download CellServDB
1714 ReadINIStr $R0 $0 "Field 4" "State"
1715 StrCmp $R0 "1" DoDownload
1716
1717 ;Do nothing if we're keeping the existing file
1718 ReadINIStr $R0 $0 "Field 2" "State"
1719 StrCmp $R0 "1" done
1720
1721 ReadINIStr $R0 $0 "Field 3" "State"
1722 StrCmp $R0 "1" UsePackaged
1723
1724 ; If none of these, grab file from other location
1725 goto CheckOther
1726
1727 DoDownload:
1728    ReadINIStr $R0 $0 "Field 5" "State"
1729    NSISdl::download $R0 "$WINDIR\afsdcell.ini"
1730    Pop $R0 ;Get the return value
1731    StrCmp $R0 "success" +2
1732       MessageBox MB_OK|MB_ICONSTOP "Download failed: $R0"
1733    goto done
1734
1735 UsePackaged:
1736    SetOutPath "$WINDIR"
1737    File "afsdcell.ini"
1738    goto done
1739    
1740 CheckOther:
1741    ReadINIStr $R0 $0 "Field 7" "State"
1742    StrCmp $R0 "1" +1 done
1743    CopyFiles $R0 "$WINDIR\afsdcell.ini"
1744    
1745 done:
1746
1747 FunctionEnd
1748
1749
1750
1751 ;-------------------------------
1752 ;Do the page to get the CellServDB
1753
1754 Function AFSPageGetCellServDB
1755   ; Skip this page if we are not installing the client
1756   SectionGetFlags ${secClient} $R0
1757   IntOp $R0 $R0 & ${SF_SELECTED}
1758   StrCmp $R0 "0" Skip
1759   
1760   ; Set the install options here
1761   
1762 startOver:
1763   WriteINIStr $0 "Field 2" "Flags" "DISABLED"
1764   WriteINIStr $0 "Field 3" "State" "1"
1765   WriteINISTR $0 "Field 4" "State" "0"
1766   WriteINIStr $0 "Field 6" "State" "0"
1767   
1768   ; If there is an existing afsdcell.ini file, allow the user to choose it and make it default
1769   IfFileExists "$WINDIR\afsdcell.ini" +1 notpresent
1770   WriteINIStr $0 "Field 2" "Flags" "ENABLED"
1771   WriteINIStr $0 "Field 2" "State" "1"
1772   WriteINIStr $0 "Field 3" "State" "0"
1773   
1774   notpresent:
1775   
1776   !insertmacro MUI_HEADER_TEXT "CellServDB Configuration" "Please choose a method for installing the CellServDB file:" 
1777   InstallOptions::dialog $0
1778   Pop $R1
1779   StrCmp $R1 "cancel" exit
1780   StrCmp $R1 "back" done
1781   StrCmp $R1 "success" done
1782 exit: Quit
1783 done:
1784
1785    ; Check that if a file is set, a valid filename is entered...
1786    ReadINIStr $R0 $0 "Field 6" "State"
1787    StrCmp $R0 "1" CheckFileName
1788    
1789    ;Check if a URL is specified, one *IS* specified
1790    ReadINIStr $R0 $0 "Field 4" "State"
1791    StrCmp $R0 "1" CheckURL Skip
1792    
1793    CheckURL:
1794    ReadINIStr $R0 $0 "Field 5" "State"
1795    StrCmp $R0 "" +1 Skip
1796    MessageBox MB_OK|MB_ICONSTOP $(URLError)
1797    WriteINIStr $0 "Field 4" "State" "0"
1798    goto startOver
1799    
1800    CheckFileName:
1801    ReadINIStr $R0 $0 "Field 7" "State"
1802    IfFileExists $R0 Skip
1803
1804    MessageBox MB_OK|MB_ICONSTOP $(CellError)
1805    WriteINIStr $0 "Field 6" "State" "0"
1806    goto startOver
1807    
1808    Skip:
1809    
1810 FunctionEnd
1811
1812
1813 Function AFSPageGetCellName
1814 !ifndef v2.0b4
1815    Call IsSilent
1816    Pop $R1
1817    StrCmp $R1 "/S" exit
1818 !else
1819    IfSilent good
1820 !endif
1821   ; Skip this page if we are not installing the client
1822   SectionGetFlags ${secClient} $R0
1823   IntOp $R0 $R0 & ${SF_SELECTED}
1824   StrCmp $R0 "0" good
1825   
1826 startOver:
1827    ; If this is a server install, we do NOT want to recommend the Freelance client
1828    ; And we do not need to ask for the cell name.
1829    SectionGetFlags ${secServer} $R1
1830    IntOp $R1 $R1 & ${SF_SELECTED}
1831    StrCmp $R1 "1" +1 NotServer
1832    WriteINIStr $1 "Field 6" "Text" "Enable AFS Freelance client (Not Recommended for servers)"
1833    WriteINIStr $1 "Field 5" "State" "0"
1834    WriteINIStr $1 "Field 1" "Flags" "DISABLED"
1835    WriteINIStr $1 "Field 2" "Flags" "DISABLED"
1836    goto SkipServerTest
1837 NotServer:
1838    WriteINIStr $1 "Field 6" "Text" "Enable AFS Freelance client (Recommended)"
1839    WriteINIStr $1 "Field 5" "State" "1"
1840    WriteINIStr $1 "Field 1" "Flags" ""
1841    WriteINIStr $1 "Field 2" "Flags" ""
1842 SkipServerTest:
1843    ; Get the current cell name, if any
1844    ReadRegStr $R1 HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" "Cell"
1845    StrCmp $R1 "" +2
1846    WriteINIStr $1 "Field 2" "State" $R1
1847   !insertmacro MUI_HEADER_TEXT "Client Cell Name Configuration" "Please enter the name for your default cell:" 
1848   InstallOptions::dialog $1
1849   Pop $R1
1850   StrCmp $R1 "cancel" exit
1851   StrCmp $R1 "back" done
1852   StrCmp $R1 "success" done
1853 exit: Quit
1854 done:
1855    ReadINIStr $R0 $1 "Field 2" "State"
1856    StrCmp $R0 "" +1 good
1857    
1858    MessageBox MB_OK|MB_ICONSTOP $(CellNameError)
1859    goto startOver
1860 good:
1861 FunctionEnd
1862
1863 ;-------------
1864 ; Common install routines for each module
1865 Function AFSCommon.Install
1866
1867 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenAFS" "DisplayName" "OpenAFS for Windows"
1868 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenAFS" "UninstallString" "$INSTDIR\uninstall.exe"
1869 !ifndef DEBUG
1870 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenAFS" "DisplayVersion" "${AFS_VERSION}"
1871 !else
1872 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenAFS" "DisplayVersion" "${AFS_VERSION} Checked/Debug"
1873 !endif
1874 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenAFS" "URLInfoAbout" "http://www.openafs.org/"
1875
1876 FunctionEnd
1877
1878 ; This code is all needed in v2.0b3 to handle the /S switch...
1879 !ifdef v2.0b3
1880 ; Check if install should be silent
1881 Function IsSilent
1882   Push $0
1883   Push $CMDLINE
1884   Push "/S"
1885   Call StrStr
1886   Pop $0
1887   StrCpy $0 $0 3
1888   StrCmp $0 "/S" silent
1889   StrCmp $0 "/S " silent
1890     StrCpy $0 0
1891     Goto notsilent
1892   silent: StrCpy $0 1
1893   notsilent: Exch $0
1894 FunctionEnd
1895
1896
1897 ; Check if uninstall should be silent
1898 Function un.IsSilent
1899   Push $0
1900   Push $CMDLINE
1901   Push "/S"
1902   Call un.StrStr
1903   Pop $0
1904   StrCpy $0 $0 3
1905   StrCmp $0 "/S" silent
1906   StrCmp $0 "/S " silent
1907     StrCpy $0 0
1908     Goto notsilent
1909   silent: StrCpy $0 1
1910   notsilent: Exch $0
1911 FunctionEnd
1912
1913
1914
1915 ; StrStr function
1916 Function StrStr
1917   Exch $R1 ; st=haystack,old$R1, $R1=needle
1918   Exch    ; st=old$R1,haystack
1919   Exch $R2 ; st=old$R1,old$R2, $R2=haystack
1920   Push $R3
1921   Push $R4
1922   Push $R5
1923   StrLen $R3 $R1
1924   StrCpy $R4 0
1925   ; $R1=needle
1926   ; $R2=haystack
1927   ; $R3=len(needle)
1928   ; $R4=cnt
1929   ; $R5=tmp
1930   loop:
1931     StrCpy $R5 $R2 $R3 $R4
1932     StrCmp $R5 $R1 done
1933     StrCmp $R5 "" done
1934     IntOp $R4 $R4 + 1
1935     Goto loop
1936   done:
1937   StrCpy $R1 $R2 "" $R4
1938   Pop $R5
1939   Pop $R4
1940   Pop $R3
1941   Pop $R2
1942   Exch $R1
1943 FunctionEnd
1944 !endif
1945 ; End of specific v2.0b3 code...
1946
1947
1948 ;-------------------
1949 ; Get the currently installed version and place it on the stack
1950 ; Modifies: Nothing
1951 Function GetInstalledVersion
1952    Push $R0
1953    Push $R1
1954    Push $R4
1955    
1956    ReadRegStr $R0 HKLM "Software\TransarcCorporation\$R2\CurrentVersion" "VersionString"
1957    StrCmp $R0 "" NotTransarc done
1958    
1959    
1960 NotTransarc:
1961    ReadRegStr $R0 HKLM "${AFS_REGKEY_ROOT}\$R2\CurrentVersion" "VersionString"
1962    StrCmp $R0 "" done
1963    
1964 done:
1965    Pop $R4
1966    Pop $R1
1967    Exch $R0
1968 FunctionEnd
1969
1970 ; Functions to get each component of the version number
1971 Function GetInstalledVersionMajor
1972    Push $R0
1973    Push $R1
1974    Push $R4
1975    
1976    ReadRegDWORD $R0 HKLM "Software\TransarcCorporation\$R2\CurrentVersion" "MajorVersion"
1977    StrCmp $R0 "" NotTransarc done
1978    
1979    
1980 NotTransarc:
1981    ReadRegDWORD $R0 HKLM "${AFS_REGKEY_ROOT}\$R2\CurrentVersion" "MajorVersion"
1982    StrCmp $R0 "" done
1983    
1984 done:
1985    Pop $R4
1986    Pop $R1
1987    Exch $R0
1988 FunctionEnd
1989
1990 Function GetInstalledVersionMinor
1991    Push $R0
1992    Push $R1
1993    Push $R4
1994    
1995    ReadRegDWORD $R0 HKLM "Software\TransarcCorporation\$R2\CurrentVersion" "MinorVersion"
1996    StrCmp $R0 "" NotTransarc done
1997    
1998    
1999 NotTransarc:
2000    ReadRegDWORD $R0 HKLM "${AFS_REGKEY_ROOT}\$R2\CurrentVersion" "MinorVersion"
2001    StrCmp $R0 "" done
2002    
2003 done:
2004    Pop $R4
2005    Pop $R1
2006    Exch $R0
2007 FunctionEnd
2008
2009 Function GetInstalledVersionPatch
2010    Push $R0
2011    Push $R1
2012    Push $R4
2013    
2014    ReadRegDWORD $R0 HKLM "Software\TransarcCorporation\$R2\CurrentVersion" "PatchLevel"
2015    StrCmp $R0 "" NotTransarc done
2016    
2017    
2018 NotTransarc:
2019    ReadRegDWORD $R0 HKLM "${AFS_REGKEY_ROOT}\$R2\CurrentVersion" "PatchLevel"
2020    StrCmp $R0 "" done
2021    
2022 done:
2023    Pop $R4
2024    Pop $R1
2025    Exch $R0
2026 FunctionEnd
2027
2028
2029
2030 ;-------------------------------
2031 ; Check if the client should be checked for default install
2032 Function ShouldClientInstall
2033    Push $R0
2034    StrCpy $R2 "AFS Client"
2035    Call GetInstalledVersion
2036    Pop $R0
2037    
2038    StrCmp $R0 "" NotInstalled
2039    ; Now we see if it's an older or newer version
2040
2041    Call GetInstalledVersionMajor
2042    Pop $R0
2043    IntCmpU $R0 ${AFS_MAJORVERSION} +1 Upgrade Downgrade
2044
2045    Call GetInstalledVersionMinor
2046    Pop $R0
2047    IntCmpU $R0 ${AFS_MINORVERSION} +1 Upgrade Downgrade
2048    
2049    Call GetInstalledVersionPatch
2050    Pop $R0
2051    IntCmpU $R0 ${AFS_PATCHLEVEL} Reinstall Upgrade Downgrade
2052    
2053 Reinstall:
2054    StrCpy $R0 "1"
2055    Exch $R0
2056    goto end
2057    
2058 Upgrade:
2059    StrCpy $R0 "2"
2060    Exch $R0
2061    goto end
2062    
2063 Downgrade:
2064    StrCpy $R0 "3"
2065    Exch $R0
2066    goto end
2067    
2068    
2069 NotInstalled:
2070    StrCpy $R0 "0"
2071    Exch $R0
2072 end:   
2073 FunctionEnd
2074
2075 ;-------------------------------
2076 ; Check how the server options should be set
2077 Function ShouldServerInstall
2078    Push $R0
2079    StrCpy $R2 "AFS Server"
2080    Call GetInstalledVersion
2081    Pop $R0
2082    
2083    StrCmp $R0 "" NotInstalled
2084    ; Now we see if it's an older or newer version
2085
2086    Call GetInstalledVersionMajor
2087    Pop $R0
2088    IntCmpU $R0 ${AFS_MAJORVERSION} +1 Upgrade Downgrade
2089
2090    Call GetInstalledVersionMinor
2091    Pop $R0
2092    IntCmpU $R0 ${AFS_MINORVERSION} +1 Upgrade Downgrade
2093    
2094    Call GetInstalledVersionPatch
2095    Pop $R0
2096    IntCmpU $R0 ${AFS_PATCHLEVEL} Reinstall Upgrade Downgrade
2097    
2098 Reinstall:
2099    StrCpy $R0 "1"
2100    Exch $R0
2101    goto end
2102    
2103 Upgrade:
2104    StrCpy $R0 "2"
2105    Exch $R0
2106    goto end
2107    
2108 Downgrade:
2109    StrCpy $R0 "3"
2110    Exch $R0
2111    goto end
2112    
2113    
2114 NotInstalled:
2115    StrCpy $R0 "0"
2116    Exch $R0
2117 end:   
2118 FunctionEnd
2119
2120
2121 ; See if AFS Server is installed
2122 ; Returns: "1" if it is, 0 if it is not (on the stack)
2123 Function IsServerInstalled
2124    Push $R0
2125    StrCpy $R2 "AFS Server"
2126    Call GetInstalledVersion
2127    Pop $R0
2128    
2129    StrCmp $R0 "" NotInstalled
2130    
2131    StrCpy $R0 "1"
2132    Exch $R0
2133    goto end
2134    
2135 NotInstalled:
2136    StrCpy $R0 "0"
2137    Exch $R0
2138 end:   
2139 FunctionEnd
2140
2141
2142 ; See if AFS Client is installed
2143 ; Returns: "1" if it is, 0 if it is not (on the stack)
2144 Function IsClientInstalled
2145    Push $R0
2146    StrCpy $R2 "AFS Client"
2147    Call GetInstalledVersion
2148    Pop $R0
2149    
2150    StrCmp $R0 "" NotInstalled
2151    
2152    StrCpy $R0 "1"
2153    Exch $R0
2154    goto end
2155    
2156 NotInstalled:
2157    StrCpy $R0 "0"
2158    Exch $R0
2159 end:   
2160 FunctionEnd
2161
2162
2163
2164 ; See if AFS Documentation is installed
2165 ; Returns: "1" if it is, 0 if it is not (on the stack)
2166 Function IsDocumentationInstalled
2167    Push $R0
2168    StrCpy $R2 "AFS Supplemental Documentation"
2169    Call GetInstalledVersion
2170    Pop $R0
2171    
2172    StrCmp $R0 "" NotInstalled
2173    
2174    StrCpy $R0 "1"
2175    Exch $R0
2176    goto end
2177    
2178 NotInstalled:
2179    StrCpy $R0 "0"
2180    Exch $R0
2181 end:   
2182 FunctionEnd
2183
2184
2185 ; See if Control Center is installed
2186 ; Returns: "1" if it is, 0 if it is not (on the stack)
2187 Function IsControlInstalled
2188    Push $R0
2189    StrCpy $R2 "AFS Control Center"
2190    Call GetInstalledVersion
2191    Pop $R0
2192    
2193    StrCmp $R0 "" NotInstalled
2194    
2195    StrCpy $R0 "1"
2196    Exch $R0
2197    goto end
2198    
2199 NotInstalled:
2200    StrCpy $R0 "0"
2201    Exch $R0
2202 end:   
2203 FunctionEnd
2204
2205
2206 ; GetParameters
2207 ; input, none
2208 ; output, top of stack (replaces, with e.g. whatever)
2209 ; modifies no other variables.
2210
2211 Function GetParameters
2212   Push $R0
2213   Push $R1
2214   Push $R2
2215   StrCpy $R0 $CMDLINE 1
2216   StrCpy $R1 '"'
2217   StrCpy $R2 1
2218   StrCmp $R0 '"' loop
2219     StrCpy $R1 ' ' ; we're scanning for a space instead of a quote
2220   loop:
2221     StrCpy $R0 $CMDLINE 1 $R2
2222     StrCmp $R0 $R1 loop2
2223     StrCmp $R0 "" loop2
2224     IntOp $R2 $R2 + 1
2225     Goto loop
2226   loop2:
2227     IntOp $R2 $R2 + 1
2228     StrCpy $R0 $CMDLINE 1 $R2
2229     StrCmp $R0 " " loop2
2230   StrCpy $R0 $CMDLINE "" $R2
2231   Pop $R2
2232   Pop $R1
2233   Exch $R0
2234 FunctionEnd
2235
2236
2237 ;Check to see if any AFS component is installed
2238 ;Returns: Value on stack: "1" if it is, "0" if it is not
2239 Function IsAnyAFSInstalled
2240    Push $R0
2241    Push $R1
2242    Push $R2
2243    Push $R3
2244    Call IsClientInstalled
2245    Pop $R0
2246    Call IsServerInstalled
2247    Pop $R1
2248    Call IsControlInstalled
2249    Pop $R2
2250    Call IsDocumentationInstalled
2251    Pop $R3
2252    ; Now we must see if ANY of the $Rn values are 1
2253    StrCmp $R0 "1" SomethingInstalled
2254    StrCmp $R1 "1" SomethingInstalled
2255    StrCmp $R2 "1" SomethingInstalled
2256    StrCmp $R3 "1" SomethingInstalled
2257    ;Nothing installed
2258    StrCpy $R0 "0"
2259    goto end
2260 SomethingInstalled:
2261    StrCpy $R0 "1"
2262 end:
2263    Pop $R3
2264    Pop $R2
2265    Pop $R1
2266    Exch $R0
2267 FunctionEnd
2268
2269
2270 ;Install English Language Files
2271 Function AFSLangFiles
2272    ; Common files
2273    SetOutPath "$INSTDIR\Common"
2274    File "${AFS_CLIENT_BUILDDIR}\afs_config.exe"
2275    File "${AFS_CLIENT_BUILDDIR}\afs_shl_ext.dll"
2276    File "${AFS_SERVER_BUILDDIR}\afsadminutil.dll"
2277    File "${AFS_DESTDIR}\lib\afsauthent.dll"
2278    File "${AFS_DESTDIR}\lib\afspthread.dll"
2279    File "${AFS_DESTDIR}\lib\afsrpc.dll"
2280    File "${AFS_SERVER_BUILDDIR}\afsclientadmin.dll"
2281    File "${AFS_SERVER_BUILDDIR}\afsprocmgmt.dll"
2282    File "${AFS_SERVER_BUILDDIR}\afsvosadmin.dll"
2283    File "${AFS_SERVER_BUILDDIR}\TaAfsAppLib.dll"
2284    File "${AFS_SERVER_BUILDDIR}\afsvosadmin.dll"
2285    File "${AFS_SERVER_BUILDDIR}\afsbosadmin.dll"
2286    File "${AFS_SERVER_BUILDDIR}\afscfgadmin.dll"
2287    File "${AFS_SERVER_BUILDDIR}\afskasadmin.dll"
2288    File "${AFS_SERVER_BUILDDIR}\afsptsadmin.dll"
2289 !IFDEF DEBUG
2290 !IFDEF CL_1310
2291    File "${AFS_WININSTALL_DIR}\msvcr71d.dll"
2292    File "${AFS_WININSTALL_DIR}\msvcr71d.pdb"
2293 !ELSE
2294    File "${AFS_WININSTALL_DIR}\msvcrtd.dll"
2295    File "${AFS_WININSTALL_DIR}\msvcrtd.pdb"
2296 !ENDIF
2297 !ELSE
2298 !IFDEF CL_1310
2299    File "${AFS_WININSTALL_DIR}\msvcr71.dll"
2300 !ELSE
2301    File "${AFS_WININSTALL_DIR}\msvcrt.dll"
2302 !ENDIF
2303 !ENDIF
2304
2305 !ifdef DEBUG
2306    File "${AFS_CLIENT_BUILDDIR}\afs_config.pdb"
2307    File "${AFS_CLIENT_BUILDDIR}\afs_shl_ext.pdb"
2308    File "${AFS_SERVER_BUILDDIR}\afsadminutil.pdb"
2309    File "${AFS_DESTDIR}\lib\afsauthent.pdb"
2310    File "${AFS_DESTDIR}\lib\afspthread.pdb"
2311    File "${AFS_DESTDIR}\lib\afsrpc.pdb"
2312    File "${AFS_SERVER_BUILDDIR}\afsclientadmin.pdb"
2313    File "${AFS_SERVER_BUILDDIR}\afsprocmgmt.pdb"
2314    File "${AFS_SERVER_BUILDDIR}\afsvosadmin.pdb"
2315    File "${AFS_SERVER_BUILDDIR}\TaAfsAppLib.pdb"
2316    File "${AFS_SERVER_BUILDDIR}\afsvosadmin.pdb"
2317    File "${AFS_SERVER_BUILDDIR}\afsbosadmin.pdb"
2318    File "${AFS_SERVER_BUILDDIR}\afscfgadmin.pdb"
2319    File "${AFS_SERVER_BUILDDIR}\afskasadmin.pdb"
2320    File "${AFS_SERVER_BUILDDIR}\afsptsadmin.pdb"
2321 !endif
2322
2323    StrCmp $LANGUAGE ${LANG_ENGLISH} DoEnglish
2324    StrCmp $LANGUAGE ${LANG_GERMAN} DoGerman
2325    StrCmp $LANGUAGE ${LANG_SPANISH} DoSpanish
2326    StrCmp $LANGUAGE ${LANG_JAPANESE} DoJapanese
2327 !ifdef v2.0b4
2328    StrCmp $LANGUAGE ${LANG_KOREAN} DoKorean
2329 !endif
2330    StrCmp $LANGUAGE ${LANG_PORTUGUESEBR} DoPortugueseBR
2331    StrCmp $LANGUAGE ${LANG_SIMPCHINESE} DoSimpChinese
2332    StrCmp $LANGUAGE ${LANG_TRADCHINESE} DoTradChinese
2333    
2334 DoEnglish:
2335
2336    SetOutPath "$INSTDIR\Documentation"
2337    File "..\..\doc\install\Documentation\en_US\README.TXT"
2338
2339    SetOutPath "$INSTDIR\Common"
2340    File "${AFS_CLIENT_BUILDDIR}\afs_config_1033.dll"
2341    File "${AFS_CLIENT_BUILDDIR}\afs_shl_ext_1033.dll"
2342    File "${AFS_CLIENT_BUILDDIR}\afscreds_1033.dll"
2343    File "${AFS_CLIENT_BUILDDIR}\afs_cpa_1033.dll"
2344    File "${AFS_SERVER_BUILDDIR}\afseventmsg_1033.dll"
2345    ;File "${AFS_SERVER_BUILDDIR}\afs_setup_utils_1033.dll"
2346    File "${AFS_SERVER_BUILDDIR}\afsserver_1033.dll"
2347    File "${AFS_SERVER_BUILDDIR}\afssvrcfg_1033.dll"
2348    File "${AFS_SERVER_BUILDDIR}\TaAfsAccountManager_1033.dll"
2349    File "${AFS_SERVER_BUILDDIR}\TaAfsAppLib_1033.dll"
2350    File "${AFS_SERVER_BUILDDIR}\TaAfsServerManager_1033.dll"
2351    File "..\..\doc\help\en_US\afs-cc.CNT"
2352    File "..\..\doc\help\en_US\afs-cc.hlp"
2353    File "..\..\doc\help\en_US\afs-light.CNT"
2354    File "..\..\doc\help\en_US\afs-light.hlp"
2355    File "..\..\doc\help\en_US\afs-nt.CNT"
2356    File "..\..\doc\help\en_US\afs-nt.HLP"
2357    File "..\..\doc\help\en_US\taafscfg.CNT"
2358    File "..\..\doc\help\en_US\taafscfg.hlp"
2359    File "..\..\doc\help\en_US\taafssvrmgr.CNT"
2360    File "..\..\doc\help\en_US\taafssvrmgr.hlp"
2361    File "..\..\doc\help\en_US\taafsusrmgr.CNT"
2362    File "..\..\doc\help\en_US\taafsusrmgr.hlp"
2363    goto done
2364
2365 DoGerman:
2366
2367    SetOutPath "$INSTDIR\Documentation"
2368    File "..\..\doc\install\Documentation\de_DE\README.TXT"
2369
2370    SetOutPath "$INSTDIR\Common"
2371    File "${AFS_CLIENT_BUILDDIR}\afs_config_1032.dll"
2372    File "${AFS_CLIENT_BUILDDIR}\afs_shl_ext_1032.dll"
2373    File "${AFS_CLIENT_BUILDDIR}\afscreds_1032.dll"
2374    File "${AFS_CLIENT_BUILDDIR}\afs_cpa_1032.dll"
2375    File "${AFS_SERVER_BUILDDIR}\afseventmsg_1032.dll"
2376    ;File "${AFS_SERVER_BUILDDIR}\afs_setup_utils_1032.dll"
2377    File "${AFS_SERVER_BUILDDIR}\afsserver_1032.dll"
2378    File "${AFS_SERVER_BUILDDIR}\afssvrcfg_1032.dll"
2379    File "${AFS_SERVER_BUILDDIR}\TaAfsAccountManager_1032.dll"
2380    File "${AFS_SERVER_BUILDDIR}\TaAfsAppLib_1032.dll"
2381    File "${AFS_SERVER_BUILDDIR}\TaAfsServerManager_1032.dll"
2382    File "..\..\doc\help\de_DE\afs-cc.CNT"
2383    File "..\..\doc\help\de_DE\afs-cc.hlp"
2384    File "..\..\doc\help\de_DE\afs-light.CNT"
2385    File "..\..\doc\help\de_DE\afs-light.hlp"
2386    File "..\..\doc\help\de_DE\afs-nt.CNT"
2387    File "..\..\doc\help\de_DE\afs-nt.HLP"
2388    File "..\..\doc\help\de_DE\taafscfg.CNT"
2389    File "..\..\doc\help\de_DE\taafscfg.hlp"
2390    File "..\..\doc\help\de_DE\taafssvrmgr.CNT"
2391    File "..\..\doc\help\de_DE\taafssvrmgr.hlp"
2392    File "..\..\doc\help\de_DE\taafsusrmgr.CNT"
2393    File "..\..\doc\help\de_DE\taafsusrmgr.hlp"
2394
2395 !ifdef DEBUG
2396    ;File "${AFS_CLIENT_BUILDDIR}\afs_config_1033.pdb"
2397    ;File "${AFS_CLIENT_BUILDDIR}\afs_shl_ext_1033.pdb"
2398    ;File "${AFS_CLIENT_BUILDDIR}\afscreds_1033.pdb"
2399    ;File "${AFS_CLIENT_BUILDDIR}\afs_cpa_1033.pdb"
2400    ;File "${AFS_SERVER_BUILDDIR}\afseventmsg_1033.pdb"
2401    ;File "${AFS_SERVER_BUILDDIR}\afsserver_1033.pdb"
2402    ;File "${AFS_SERVER_BUILDDIR}\afssvrcfg_1033.pdb"
2403    ;File "${AFS_SERVER_BUILDDIR}\TaAfsAccountManager_1033.pdb"
2404    ;File "${AFS_SERVER_BUILDDIR}\TaAfsAppLib_1033.pdb"
2405    ;File "${AFS_SERVER_BUILDDIR}\TaAfsServerManager_1033.pdb"
2406 !IFDEF CL_1310
2407    File "${AFS_WININSTALL_DIR}\msvcr71d.dll"
2408    File "${AFS_WININSTALL_DIR}\msvcr71d.pdb"
2409 !ELSE
2410    File "${AFS_WININSTALL_DIR}\msvcrtd.dll"
2411    File "${AFS_WININSTALL_DIR}\msvcrtd.pdb"
2412 !ENDIF
2413 !endif
2414    goto done   
2415
2416 DoSpanish:
2417
2418    SetOutPath "$INSTDIR\Documentation"
2419    File "..\..\doc\install\Documentation\es_ES\README.TXT"
2420
2421    SetOutPath "$INSTDIR\Common"
2422    File "${AFS_CLIENT_BUILDDIR}\afs_config_1034.dll"
2423    File "${AFS_CLIENT_BUILDDIR}\afs_shl_ext_1034.dll"
2424    File "${AFS_CLIENT_BUILDDIR}\afscreds_1034.dll"
2425    File "${AFS_CLIENT_BUILDDIR}\afs_cpa_1034.dll"
2426    File "${AFS_SERVER_BUILDDIR}\afseventmsg_1034.dll"
2427    ;File "${AFS_SERVER_BUILDDIR}\afs_setup_utils_1034.dll"
2428    File "${AFS_SERVER_BUILDDIR}\afsserver_1034.dll"
2429    File "${AFS_SERVER_BUILDDIR}\afssvrcfg_1034.dll"
2430    File "${AFS_SERVER_BUILDDIR}\TaAfsAccountManager_1034.dll"
2431    File "${AFS_SERVER_BUILDDIR}\TaAfsAppLib_1034.dll"
2432    File "${AFS_SERVER_BUILDDIR}\TaAfsServerManager_1034.dll"
2433    File "..\..\doc\help\es_ES\afs-cc.CNT"
2434    File "..\..\doc\help\es_ES\afs-cc.hlp"
2435    File "..\..\doc\help\es_ES\afs-light.CNT"
2436    File "..\..\doc\help\es_ES\afs-light.hlp"
2437    File "..\..\doc\help\es_ES\afs-nt.CNT"
2438    File "..\..\doc\help\es_ES\afs-nt.HLP"
2439    File "..\..\doc\help\es_ES\taafscfg.CNT"
2440    File "..\..\doc\help\es_ES\taafscfg.hlp"
2441    File "..\..\doc\help\es_ES\taafssvrmgr.CNT"
2442    File "..\..\doc\help\es_ES\taafssvrmgr.hlp"
2443    File "..\..\doc\help\es_ES\taafsusrmgr.CNT"
2444    File "..\..\doc\help\es_ES\taafsusrmgr.hlp"
2445    goto done
2446
2447 DoJapanese:
2448
2449    SetOutPath "$INSTDIR\Documentation"
2450    File "..\..\doc\install\Documentation\ja_JP\README.TXT"
2451
2452    SetOutPath "$INSTDIR\Common"
2453    File "${AFS_CLIENT_BUILDDIR}\afs_config_1041.dll"
2454    File "${AFS_CLIENT_BUILDDIR}\afs_shl_ext_1041.dll"
2455    File "${AFS_CLIENT_BUILDDIR}\afscreds_1041.dll"
2456    File "${AFS_CLIENT_BUILDDIR}\afs_cpa_1041.dll"
2457    File "${AFS_SERVER_BUILDDIR}\afseventmsg_1041.dll"
2458    ;File "${AFS_SERVER_BUILDDIR}\afs_setup_utils_1041.dll"
2459    File "${AFS_SERVER_BUILDDIR}\afsserver_1041.dll"
2460    File "${AFS_SERVER_BUILDDIR}\afssvrcfg_1041.dll"
2461    File "${AFS_SERVER_BUILDDIR}\TaAfsAccountManager_1041.dll"
2462    File "${AFS_SERVER_BUILDDIR}\TaAfsAppLib_1041.dll"
2463    File "${AFS_SERVER_BUILDDIR}\TaAfsServerManager_1041.dll"
2464    File "..\..\doc\help\ja_JP\afs-cc.CNT"
2465    File "..\..\doc\help\ja_JP\afs-cc.hlp"
2466    File "..\..\doc\help\ja_JP\afs-light.CNT"
2467    File "..\..\doc\help\ja_JP\afs-light.hlp"
2468    File "..\..\doc\help\ja_JP\afs-nt.CNT"
2469    File "..\..\doc\help\ja_JP\afs-nt.HLP"
2470    File "..\..\doc\help\ja_JP\taafscfg.CNT"
2471    File "..\..\doc\help\ja_JP\taafscfg.hlp"
2472    File "..\..\doc\help\ja_JP\taafssvrmgr.CNT"
2473    File "..\..\doc\help\ja_JP\taafssvrmgr.hlp"
2474    File "..\..\doc\help\ja_JP\taafsusrmgr.CNT"
2475    File "..\..\doc\help\ja_JP\taafsusrmgr.hlp"
2476    goto done
2477    
2478 DoKorean:
2479
2480    SetOutPath "$INSTDIR\Documentation"
2481    File "..\..\doc\install\Documentation\ko_KR\README.TXT"
2482
2483    SetOutPath "$INSTDIR\Common"
2484    File "${AFS_CLIENT_BUILDDIR}\afs_config_1042.dll"
2485    File "${AFS_CLIENT_BUILDDIR}\afs_shl_ext_1042.dll"
2486    File "${AFS_CLIENT_BUILDDIR}\afscreds_1042.dll"
2487    File "${AFS_CLIENT_BUILDDIR}\afs_cpa_1042.dll"
2488    File "${AFS_SERVER_BUILDDIR}\afseventmsg_1042.dll"
2489    ;File "${AFS_SERVER_BUILDDIR}\afs_setup_utils_1042.dll"
2490    File "${AFS_SERVER_BUILDDIR}\afsserver_1042.dll"
2491    File "${AFS_SERVER_BUILDDIR}\afssvrcfg_1042.dll"
2492    File "${AFS_SERVER_BUILDDIR}\TaAfsAccountManager_1042.dll"
2493    File "${AFS_SERVER_BUILDDIR}\TaAfsAppLib_1042.dll"
2494    File "${AFS_SERVER_BUILDDIR}\TaAfsServerManager_1042.dll"
2495    File "..\..\doc\help\ko_KR\afs-cc.CNT"
2496    File "..\..\doc\help\ko_KR\afs-cc.hlp"
2497    File "..\..\doc\help\ko_KR\afs-light.CNT"
2498    File "..\..\doc\help\ko_KR\afs-light.hlp"
2499    File "..\..\doc\help\ko_KR\afs-nt.CNT"
2500    File "..\..\doc\help\ko_KR\afs-nt.HLP"
2501    File "..\..\doc\help\ko_KR\taafscfg.CNT"
2502    File "..\..\doc\help\ko_KR\taafscfg.hlp"
2503    File "..\..\doc\help\ko_KR\taafssvrmgr.CNT"
2504    File "..\..\doc\help\ko_KR\taafssvrmgr.hlp"
2505    File "..\..\doc\help\ko_KR\taafsusrmgr.CNT"
2506    File "..\..\doc\help\ko_KR\taafsusrmgr.hlp"
2507    goto done
2508
2509
2510 DoPortugueseBR:
2511
2512    SetOutPath "$INSTDIR\Documentation"
2513    File "..\..\doc\install\Documentation\pt_BR\README.TXT"
2514
2515    SetOutPath "$INSTDIR\Common"
2516    File "${AFS_CLIENT_BUILDDIR}\afs_config_1046.dll"
2517    File "${AFS_CLIENT_BUILDDIR}\afs_shl_ext_1046.dll"
2518    File "${AFS_CLIENT_BUILDDIR}\afscreds_1046.dll"
2519    File "${AFS_CLIENT_BUILDDIR}\afs_cpa_1046.dll"
2520    File "${AFS_SERVER_BUILDDIR}\afseventmsg_1046.dll"
2521    ;File "${AFS_SERVER_BUILDDIR}\afs_setup_utils_1046.dll"
2522    File "${AFS_SERVER_BUILDDIR}\afsserver_1046.dll"
2523    File "${AFS_SERVER_BUILDDIR}\afssvrcfg_1046.dll"
2524    File "${AFS_SERVER_BUILDDIR}\TaAfsAccountManager_1046.dll"
2525    File "${AFS_SERVER_BUILDDIR}\TaAfsAppLib_1046.dll"
2526    File "${AFS_SERVER_BUILDDIR}\TaAfsServerManager_1046.dll"
2527    File "..\..\doc\help\pt_BR\afs-cc.CNT"
2528    File "..\..\doc\help\pt_BR\afs-cc.hlp"
2529    File "..\..\doc\help\pt_BR\afs-light.CNT"
2530    File "..\..\doc\help\pt_BR\afs-light.hlp"
2531    File "..\..\doc\help\pt_BR\afs-nt.CNT"
2532    File "..\..\doc\help\pt_BR\afs-nt.HLP"
2533    File "..\..\doc\help\pt_BR\taafscfg.CNT"
2534    File "..\..\doc\help\pt_BR\taafscfg.hlp"
2535    File "..\..\doc\help\pt_BR\taafssvrmgr.CNT"
2536    File "..\..\doc\help\pt_BR\taafssvrmgr.hlp"
2537    File "..\..\doc\help\pt_BR\taafsusrmgr.CNT"
2538    File "..\..\doc\help\pt_BR\taafsusrmgr.hlp"
2539    goto done
2540    
2541 DoSimpChinese:
2542
2543    SetOutPath "$INSTDIR\Documentation"
2544    File "..\..\doc\install\Documentation\zh_CN\README.TXT"
2545
2546    SetOutPath "$INSTDIR\Common"
2547    File "${AFS_CLIENT_BUILDDIR}\afs_config_2052.dll"
2548    File "${AFS_CLIENT_BUILDDIR}\afs_shl_ext_2052.dll"
2549    File "${AFS_CLIENT_BUILDDIR}\afscreds_2052.dll"
2550    File "${AFS_CLIENT_BUILDDIR}\afs_cpa_2052.dll"
2551    File "${AFS_SERVER_BUILDDIR}\afseventmsg_2052.dll"
2552    ;File "${AFS_SERVER_BUILDDIR}\afs_setup_utils_2052.dll"
2553    File "${AFS_SERVER_BUILDDIR}\afsserver_2052.dll"
2554    File "${AFS_SERVER_BUILDDIR}\afssvrcfg_2052.dll"
2555    File "${AFS_SERVER_BUILDDIR}\TaAfsAccountManager_2052.dll"
2556    File "${AFS_SERVER_BUILDDIR}\TaAfsAppLib_2052.dll"
2557    File "${AFS_SERVER_BUILDDIR}\TaAfsServerManager_2052.dll"
2558    File "..\..\doc\help\zh_CN\afs-cc.CNT"
2559    File "..\..\doc\help\zh_CN\afs-cc.hlp"
2560    File "..\..\doc\help\zh_CN\afs-light.CNT"
2561    File "..\..\doc\help\zh_CN\afs-light.hlp"
2562    File "..\..\doc\help\zh_CN\afs-nt.CNT"
2563    File "..\..\doc\help\zh_CN\afs-nt.HLP"
2564    File "..\..\doc\help\zh_CN\taafscfg.CNT"
2565    File "..\..\doc\help\zh_CN\taafscfg.hlp"
2566    File "..\..\doc\help\zh_CN\taafssvrmgr.CNT"
2567    File "..\..\doc\help\zh_CN\taafssvrmgr.hlp"
2568    File "..\..\doc\help\zh_CN\taafsusrmgr.CNT"
2569    File "..\..\doc\help\zh_CN\taafsusrmgr.hlp"
2570    goto done
2571    
2572 DoTradChinese:
2573
2574    SetOutPath "$INSTDIR\Documentation"
2575    File "..\..\doc\install\Documentation\zh_TW\README.TXT"
2576
2577    SetOutPath "$INSTDIR\Common"
2578    File "${AFS_CLIENT_BUILDDIR}\afs_config_1028.dll"
2579    File "${AFS_CLIENT_BUILDDIR}\afs_shl_ext_1028.dll"
2580    File "${AFS_CLIENT_BUILDDIR}\afscreds_1028.dll"
2581    File "${AFS_CLIENT_BUILDDIR}\afs_cpa_1028.dll"
2582    File "${AFS_SERVER_BUILDDIR}\afseventmsg_1028.dll"
2583    ;File "${AFS_SERVER_BUILDDIR}\afs_setup_utils_1028.dll"
2584    File "${AFS_SERVER_BUILDDIR}\afsserver_1028.dll"
2585    File "${AFS_SERVER_BUILDDIR}\afssvrcfg_1028.dll"
2586    File "${AFS_SERVER_BUILDDIR}\TaAfsAccountManager_1028.dll"
2587    File "${AFS_SERVER_BUILDDIR}\TaAfsAppLib_1028.dll"
2588    File "${AFS_SERVER_BUILDDIR}\TaAfsServerManager_1028.dll"
2589    File "..\..\doc\help\zh_TW\afs-cc.CNT"
2590    File "..\..\doc\help\zh_TW\afs-cc.hlp"
2591    File "..\..\doc\help\zh_TW\afs-light.CNT"
2592    File "..\..\doc\help\zh_TW\afs-light.hlp"
2593    File "..\..\doc\help\zh_TW\afs-nt.CNT"
2594    File "..\..\doc\help\zh_TW\afs-nt.HLP"
2595    File "..\..\doc\help\zh_TW\taafscfg.CNT"
2596    File "..\..\doc\help\zh_TW\taafscfg.hlp"
2597    File "..\..\doc\help\zh_TW\taafssvrmgr.CNT"
2598    File "..\..\doc\help\zh_TW\taafssvrmgr.hlp"
2599    File "..\..\doc\help\zh_TW\taafsusrmgr.CNT"
2600    File "..\..\doc\help\zh_TW\taafsusrmgr.hlp"
2601    goto done
2602    
2603 done:
2604 FunctionEnd
2605
2606
2607
2608 ;====================================================
2609 ; AddToPath - Adds the given dir to the search path.
2610 ;        Input - head of the stack
2611 ;        Note - Win9x systems requires reboot
2612 ;====================================================
2613 Function AddToPath
2614   Exch $0
2615   Push $1
2616   
2617   Call IsNT
2618   Pop $1
2619   StrCmp $1 1 AddToPath_NT
2620     ; Not on NT
2621     StrCpy $1 $WINDIR 2
2622     FileOpen $1 "$1\autoexec.bat" a
2623     FileSeek $1 0 END
2624     GetFullPathName /SHORT $0 $0
2625     FileWrite $1 "$\r$\nSET PATH=%PATH%;$0$\r$\n"
2626     FileClose $1
2627     Goto AddToPath_done
2628
2629   AddToPath_NT:
2630     ReadRegStr $1 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH"
2631     StrCmp $1 "" AddToPath_NTdoIt
2632       StrCpy $0 "$1;$0"
2633       Goto AddToPath_NTdoIt
2634     AddToPath_NTdoIt:
2635       WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH" $0
2636       SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
2637   
2638   AddToPath_done:
2639     Pop $1
2640     Pop $0
2641 FunctionEnd
2642
2643 ;====================================================
2644 ; RemoveFromPath - Remove a given dir from the path
2645 ;     Input: head of the stack
2646 ;====================================================
2647 Function un.RemoveFromPath
2648   Exch $0
2649   Push $1
2650   Push $2
2651   Push $3
2652   Push $4
2653   
2654   Call un.IsNT
2655   Pop $1
2656   StrCmp $1 1 unRemoveFromPath_NT
2657     ; Not on NT
2658     StrCpy $1 $WINDIR 2
2659     FileOpen $1 "$1\autoexec.bat" r
2660     GetTempFileName $4
2661     FileOpen $2 $4 w
2662     GetFullPathName /SHORT $0 $0
2663     StrCpy $0 "SET PATH=%PATH%;$0"
2664     SetRebootFlag true
2665     Goto unRemoveFromPath_dosLoop
2666     
2667     unRemoveFromPath_dosLoop:
2668       FileRead $1 $3
2669       StrCmp $3 "$0$\r$\n" unRemoveFromPath_dosLoop
2670       StrCmp $3 "$0$\n" unRemoveFromPath_dosLoop
2671       StrCmp $3 "$0" unRemoveFromPath_dosLoop
2672       StrCmp $3 "" unRemoveFromPath_dosLoopEnd
2673       FileWrite $2 $3
2674       Goto unRemoveFromPath_dosLoop
2675     
2676     unRemoveFromPath_dosLoopEnd:
2677       FileClose $2
2678       FileClose $1
2679       StrCpy $1 $WINDIR 2
2680       Delete "$1\autoexec.bat"
2681       CopyFiles /SILENT $4 "$1\autoexec.bat"
2682       Delete $4
2683       Goto unRemoveFromPath_done
2684
2685   unRemoveFromPath_NT:
2686     StrLen $2 $0
2687     ReadRegStr $1 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH"
2688     Push $1
2689     Push $0
2690     Call un.StrStr ; Find $0 in $1
2691     Pop $0 ; pos of our dir
2692     IntCmp $0 -1 unRemoveFromPath_done
2693       ; else, it is in path
2694       StrCpy $3 $1 $0 ; $3 now has the part of the path before our dir
2695       IntOp $2 $2 + $0 ; $2 now contains the pos after our dir in the path (';')
2696       IntOp $2 $2 + 1 ; $2 now containts the pos after our dir and the semicolon.
2697       StrLen $0 $1
2698       StrCpy $1 $1 $0 $2
2699       StrCpy $3 "$3$1"
2700
2701       WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH" $3
2702       SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
2703   
2704   unRemoveFromPath_done:
2705     Pop $4
2706     Pop $3
2707     Pop $2
2708     Pop $1
2709     Pop $0
2710 FunctionEnd
2711
2712 ;====================================================
2713 ; IsNT - Returns 1 if the current system is NT, 0
2714 ;        otherwise.
2715 ;     Output: head of the stack
2716 ;====================================================
2717 Function IsNT
2718   Push $0
2719   ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
2720   StrCmp $0 "" 0 IsNT_yes
2721   ; we are not NT.
2722   Pop $0
2723   Push 0
2724   Return
2725
2726   IsNT_yes:
2727     ; NT!!!
2728     Pop $0
2729     Push 1
2730 FunctionEnd
2731
2732 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2733 ; Uninstall sutff
2734 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2735
2736
2737 ;====================================================
2738 ; StrStr - Finds a given string in another given string.
2739 ;               Returns -1 if not found and the pos if found.
2740 ;          Input: head of the stack - string to find
2741 ;                      second in the stack - string to find in
2742 ;          Output: head of the stack
2743 ;====================================================
2744 Function un.StrStr
2745   Push $0
2746   Exch
2747   Pop $0 ; $0 now have the string to find
2748   Push $1
2749   Exch 2
2750   Pop $1 ; $1 now have the string to find in
2751   Exch
2752   Push $2
2753   Push $3
2754   Push $4
2755   Push $5
2756
2757   StrCpy $2 -1
2758   StrLen $3 $0
2759   StrLen $4 $1
2760   IntOp $4 $4 - $3
2761
2762   unStrStr_loop:
2763     IntOp $2 $2 + 1
2764     IntCmp $2 $4 0 0 unStrStrReturn_notFound
2765     StrCpy $5 $1 $3 $2
2766     StrCmp $5 $0 unStrStr_done unStrStr_loop
2767
2768   unStrStrReturn_notFound:
2769     StrCpy $2 -1
2770
2771   unStrStr_done:
2772     Pop $5
2773     Pop $4
2774     Pop $3
2775     Exch $2
2776     Exch 2
2777     Pop $0
2778     Pop $1
2779 FunctionEnd
2780
2781 ;====================================================
2782 ; IsNT - Returns 1 if the current system is NT, 0
2783 ;        otherwise.
2784 ;     Output: head of the stack
2785 ;====================================================
2786 Function un.IsNT
2787   Push $0
2788   ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
2789   StrCmp $0 "" 0 unIsNT_yes
2790   ; we are not NT.
2791   Pop $0
2792   Push 0
2793   Return
2794
2795   unIsNT_yes:
2796     ; NT!!!
2797     Pop $0
2798     Push 1
2799 FunctionEnd
2800
2801 !ifdef ADDSHAREDDLLUSED
2802 ; AddSharedDLL
2803  ;
2804  ; Increments a shared DLLs reference count.
2805  ; Use by passing one item on the stack (the full path of the DLL).
2806  ;
2807  ; Usage:
2808  ;   Push $SYSDIR\myDll.dll
2809  ;   Call AddSharedDLL
2810  ;
2811
2812  Function AddSharedDLL
2813    Exch $R1
2814    Push $R0
2815    ReadRegDword $R0 HKLM Software\Microsoft\Windows\CurrentVersion\SharedDLLs $R1
2816    IntOp $R0 $R0 + 1
2817    WriteRegDWORD HKLM Software\Microsoft\Windows\CurrentVersion\SharedDLLs $R1 $R0
2818    Pop $R0
2819    Pop $R1
2820  FunctionEnd
2821
2822  
2823 ; un.RemoveSharedDLL
2824  ;
2825  ; Decrements a shared DLLs reference count, and removes if necessary.
2826  ; Use by passing one item on the stack (the full path of the DLL).
2827  ; Note: for use in the main installer (not the uninstaller), rename the
2828  ; function to RemoveSharedDLL.
2829  ;
2830  ; Usage:
2831  ;   Push $SYSDIR\myDll.dll
2832  ;   Call un.RemoveSharedDLL
2833  ;
2834
2835  Function un.RemoveSharedDLL
2836    Exch $R1
2837    Push $R0
2838    ReadRegDword $R0 HKLM Software\Microsoft\Windows\CurrentVersion\SharedDLLs $R1
2839    StrCmp $R0 "" remove
2840      IntOp $R0 $R0 - 1
2841      IntCmp $R0 0 rk rk uk
2842      rk:
2843        DeleteRegValue HKLM Software\Microsoft\Windows\CurrentVersion\SharedDLLs $R1
2844      goto Remove
2845      uk:
2846        WriteRegDWORD HKLM Software\Microsoft\Windows\CurrentVersion\SharedDLLs $R1 $R0
2847      Goto noremove
2848    remove:
2849      Delete /REBOOTOK $R1
2850    noremove:
2851    Pop $R0
2852    Pop $R1
2853  FunctionEnd
2854 !endif
2855
2856 !ifdef INSTALL_LOOPBACK
2857 Function afs.InstallMSLoopback
2858    GetTempFileName $R0
2859    File /oname=$R0 "loopback_install.dll"
2860    nsExec::Exec "rundll32.exe $R0 doLoopBackEntry quiet"
2861    Call GetWindowsVersion
2862    Pop $R1
2863    StrCmp $R1 "2000" +1 +2
2864    nsExec::Exec "rundll32.exe $R0 disableLoopBackEntry"
2865    Delete $R0
2866 FunctionEnd
2867 !endif
2868
2869
2870 ; GetWindowsVersion
2871 ;
2872 ; Based on Yazno's function, http://yazno.tripod.com/powerpimpit/
2873 ; Updated by Joost Verburg
2874 ;
2875 ; Returns on top of stack
2876 ;
2877 ; Windows Version (95, 98, ME, NT x.x, 2000, XP, 2003)
2878 ; or
2879 ; '' (Unknown Windows Version)
2880 ;
2881 ; Usage:
2882 ;   Call GetWindowsVersion
2883 ;   Pop $R0
2884 ;   ; at this point $R0 is "NT 4.0" or whatnot
2885
2886 Function GetWindowsVersion
2887
2888   Push $R0
2889   Push $R1
2890
2891   ClearErrors
2892
2893   ReadRegStr $R0 HKLM \
2894   "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
2895
2896   IfErrors 0 lbl_winnt
2897   
2898   ; we are not NT
2899   ReadRegStr $R0 HKLM \
2900   "SOFTWARE\Microsoft\Windows\CurrentVersion" VersionNumber
2901
2902   StrCpy $R1 $R0 1
2903   StrCmp $R1 '4' 0 lbl_error
2904
2905   StrCpy $R1 $R0 3
2906
2907   StrCmp $R1 '4.0' lbl_win32_95
2908   StrCmp $R1 '4.9' lbl_win32_ME lbl_win32_98
2909
2910   lbl_win32_95:
2911     StrCpy $R0 '95'
2912   Goto lbl_done
2913
2914   lbl_win32_98:
2915     StrCpy $R0 '98'
2916   Goto lbl_done
2917
2918   lbl_win32_ME:
2919     StrCpy $R0 'ME'
2920   Goto lbl_done
2921
2922   lbl_winnt:
2923
2924   StrCpy $R1 $R0 1
2925
2926   StrCmp $R1 '3' lbl_winnt_x
2927   StrCmp $R1 '4' lbl_winnt_x
2928
2929   StrCpy $R1 $R0 3
2930
2931   StrCmp $R1 '5.0' lbl_winnt_2000
2932   StrCmp $R1 '5.1' lbl_winnt_XP
2933   StrCmp $R1 '5.2' lbl_winnt_2003 lbl_error
2934
2935   lbl_winnt_x:
2936     StrCpy $R0 "NT $R0" 6
2937   Goto lbl_done
2938
2939   lbl_winnt_2000:
2940     Strcpy $R0 '2000'
2941   Goto lbl_done
2942
2943   lbl_winnt_XP:
2944     Strcpy $R0 'XP'
2945   Goto lbl_done
2946
2947   lbl_winnt_2003:
2948     Strcpy $R0 '2003'
2949   Goto lbl_done
2950
2951   lbl_error:
2952     Strcpy $R0 ''
2953   lbl_done:
2954
2955   Pop $R1
2956   Exch $R0
2957
2958 FunctionEnd
2959
2960
2961 ; Author: Lilla (lilla@earthlink.net) 2003-06-13
2962 ; function IsUserAdmin uses plugin \NSIS\PlusgIns\UserInfo.dll
2963 ; This function is based upon code in \NSIS\Contrib\UserInfo\UserInfo.nsi
2964 ; This function was tested under NSIS 2 beta 4 (latest CVS as of this writing).
2965 ;
2966 ; Usage:
2967 ;   Call IsUserAdmin
2968 ;   Pop $R0   ; at this point $R0 is "true" or "false"
2969 ;
2970 Function IsUserAdmin
2971 Push $R0
2972 Push $R1
2973 Push $R2
2974
2975 ClearErrors
2976 UserInfo::GetName
2977 IfErrors Win9x
2978 Pop $R1
2979 UserInfo::GetAccountType
2980 Pop $R2
2981
2982 StrCmp $R2 "Admin" 0 Continue
2983 ; Observation: I get here when running Win98SE. (Lilla)
2984 ; The functions UserInfo.dll looks for are there on Win98 too, 
2985 ; but just don't work. So UserInfo.dll, knowing that admin isn't required
2986 ; on Win98, returns admin anyway. (per kichik)
2987 ; MessageBox MB_OK 'User "$R1" is in the Administrators group'
2988 StrCpy $R0 "true"
2989 Goto Done
2990
2991 Continue:
2992 ; You should still check for an empty string because the functions
2993 ; UserInfo.dll looks for may not be present on Windows 95. (per kichik)
2994 StrCmp $R2 "" Win9x
2995 StrCpy $R0 "false"
2996 ;MessageBox MB_OK 'User "$R1" is in the "$R2" group'
2997 Goto Done
2998
2999 Win9x:
3000 ; comment/message below is by UserInfo.nsi author:
3001 ; This one means you don't need to care about admin or
3002 ; not admin because Windows 9x doesn't either
3003 ;MessageBox MB_OK "Error! This DLL can't run under Windows 9x!"
3004 StrCpy $R0 "false"
3005
3006 Done:
3007 ;MessageBox MB_OK 'User= "$R1"  AccountType= "$R2"  IsUserAdmin= "$R0"'
3008
3009 Pop $R2
3010 Pop $R1
3011 Exch $R0
3012 FunctionEnd
3013
3014 ; GetParent
3015  ; input, top of stack  (e.g. C:\Program Files\Poop)
3016  ; output, top of stack (replaces, with e.g. C:\Program Files)
3017  ; modifies no other variables.
3018  ;
3019  ; Usage:
3020  ;   Push "C:\Program Files\Directory\Whatever"
3021  ;   Call GetParent
3022  ;   Pop $R0
3023  ;   ; at this point $R0 will equal "C:\Program Files\Directory"
3024
3025 Function GetParent
3026
3027   Exch $R0
3028   Push $R1
3029   Push $R2
3030   Push $R3
3031   
3032   StrCpy $R1 0
3033   StrLen $R2 $R0
3034   
3035   loop:
3036     IntOp $R1 $R1 + 1
3037     IntCmp $R1 $R2 get 0 get
3038     StrCpy $R3 $R0 1 -$R1
3039     StrCmp $R3 "\" get
3040   Goto loop
3041   
3042   get:
3043     StrCpy $R0 $R0 -$R1
3044     
3045     Pop $R3
3046     Pop $R2
3047     Pop $R1
3048     Exch $R0
3049     
3050 FunctionEnd
3051
3052
3053 ;--------------------------------
3054 ;Handle what must and what must not be installed
3055 Function .onSelChange
3056    ; If they install the server, they MUST install the client
3057    SectionGetFlags ${secServer} $R0
3058    IntOp $R0 $R0 & ${SF_SELECTED}
3059    StrCmp $R0 "1" MakeClientSelected
3060    
3061    ; If they install the control center, we'll give them the client.
3062    ; It may not be required, but it's a bit more useful
3063    SectionGetFlags ${secControl} $R0
3064    IntOp $R0 $R0 & ${SF_SELECTED}
3065    StrCmp $R0 "1" MakeClientSelected
3066    goto end
3067    
3068 MakeClientSelected:
3069    SectionGetFlags ${secClient} $R0
3070    IntOp $R0 $R0 | ${SF_SELECTED}
3071    SectionSetFlags ${secClient} $R0
3072    
3073 end:
3074 FunctionEnd
3075