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