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