d47d579d9b6147f2a0360d5d77e3d14ca22eff9b
[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 !IFDEF CL_1310
558    !insertmacro UpgradeDLL "${AFS_WININSTALL_DIR}\mfc71d.dll" "$SYSDIR\mfc71d.dll"
559 !ELSE
560 !IFDEF CL_1300
561    !insertmacro UpgradeDLL "${AFS_WININSTALL_DIR}\mfc70d.dll" "$SYSDIR\mfc70d.dll"
562 !ELSE
563    !insertmacro UpgradeDLL "${AFS_WININSTALL_DIR}\mfc42d.dll" "$SYSDIR\mfc42d.dll"
564 !ENDIF
565 !ENDIF
566 !ELSE
567    ;File "${SDK_DIR}\REDIST\msvcrt.dll"
568 !IFDEF CL_1310
569    !insertmacro UpgradeDLL "${AFS_WININSTALL_DIR}\mfc71.dll" "$SYSDIR\mfc71.dll"
570 !ELSE
571 !IFDEF CL_1300
572    !insertmacro UpgradeDLL "${AFS_WININSTALL_DIR}\mfc70.dll" "$SYSDIR\mfc70.dll"
573 !ELSE
574    !insertmacro UpgradeDLL "${AFS_WININSTALL_DIR}\mfc42.dll" "$SYSDIR\mfc42.dll"
575 !ENDIF
576 !ENDIF
577 !ENDIF
578    
579   ; Do WINDOWSDIR components
580   ; Get AFS CellServDB file
581   Call afs.GetCellServDB
582   ;Call afs.InstallMSLoopback
583   
584   ; Include Kerberos for Windows files in the installer...
585   ;SetOutPath "$INSTDIR\kfw\bin\"
586   ;File "${KFW_SOURCE}\bin\*"
587   ;SetOutPath "$INSTDIR\kfw\doc"
588   ;File "${KFW_SOURCE}\doc\*"
589   
590   ReadINIStr $R0 $0 "Field 2" "State"
591   StrCmp $R0 "1" UsePkg DontUsePkg
592  UsePkg:
593    SetOutPath "$WINDIR"
594    File "afsdcell.ini"
595 DontUsePkg:
596    ReadINIStr $R0 $0 "Field 6" "State"
597    StrCmp $R0 "1" UseFile DontUseFile
598 UseFile:
599    ReadINIStr $R0 $0 "Field 7" "State"
600    CopyFiles $R0 "$WINDIR\afsdcell.ini"
601 DontUseFile:
602    
603   ;Store install folder
604   WriteRegStr HKCU "${AFS_REGKEY_ROOT}\Client" "" $INSTDIR
605   Call AFSCommon.Install
606   
607   ; Write registry entries
608   WriteRegStr HKCR "*\shellex\ContextMenuHandlers\AFS Client Shell Extension" "" "{DC515C27-6CAC-11D1-BAE7-00C04FD140D2}"
609   WriteRegStr HKCR "CLSID\{DC515C27-6CAC-11D1-BAE7-00C04FD140D2}" "" "AFS Client Shell Extension"
610   WriteRegStr HKCR "CLSID\{DC515C27-6CAC-11D1-BAE7-00C04FD140D2}\InprocServer32" "" "$INSTDIR\Client\Program\afs_shl_ext.dll"
611   WriteRegStr HKCR "CLSID\{DC515C27-6CAC-11D1-BAE7-00C04FD140D2}\InprocServer32" "ThreadingModel" "Apartment"
612   WriteRegStr HKCR "FOLDER\shellex\ContextMenuHandlers\AFS Client Shell Extension" "" "{DC515C27-6CAC-11D1-BAE7-00C04FD140D2}"
613   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved" "{DC515C27-6CAC-11D1-BAE7-00C04FD140D2}" "AFS Client Shell Extension"
614   
615   ; AFS Reg entries
616   DeleteRegKey HKLM "${AFS_REGKEY_ROOT}\AFS Client\CurrentVersion"
617   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Client\CurrentVersion" "VersionString" ${MUI_VERSION}
618   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Client\CurrentVersion" "Title" "AFS Client"
619   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Client\CurrentVersion" "Description" "AFS Client"
620   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Client\CurrentVersion" "PathName" "$INSTDIR\Client\Program"
621   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Client\CurrentVersion" "Software Type" "File System"
622   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Client\CurrentVersion" "MajorVersion" ${MUI_MAJORVERSION}
623   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Client\CurrentVersion" "MinorVersion" ${MUI_MINORVERSION}
624   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Client\CurrentVersion" "PatchLevel" ${MUI_PATCHLEVEL}
625   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Client\${MUI_VERSION}" "VersionString" ${MUI_VERSION}
626   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Client\${MUI_VERSION}" "Title" "AFS Client"
627   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Client\${MUI_VERSION}" "Description" "AFS Client"
628   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Client\${MUI_VERSION}" "Software Type" "File System"
629   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Client\${MUI_VERSION}" "PathName" "$INSTDIR\Client\Program"
630   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Client\${MUI_VERSION}" "MajorVersion" ${MUI_MAJORVERSION}
631   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Client\${MUI_VERSION}" "MinorVersion" ${MUI_MINORVERSION}
632   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Client\${MUI_VERSION}" "PatchLevel" ${MUI_PATCHLEVEL}
633
634    ; Set network settings
635   WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Services\NetBT\Parameters" "SmbDeviceEnabled" 0
636   
637   ;Write start menu entries
638   CreateDirectory "$SMPROGRAMS\OpenAFS\Client"
639   CreateShortCut "$SMPROGRAMS\OpenAFS\Uninstall OpenAFS.lnk" "$INSTDIR\Uninstall.exe"
640   CreateShortCut "$SMPROGRAMS\OpenAFS\Client\Authentication.lnk" "$INSTDIR\Client\Program\afscreds.exe" 
641   CreateShortCut "$SMSTARTUP\AFS Credentials.lnk" "$INSTDIR\Client\Program\afscreds.exe" 
642
643   Push "$INSTDIR\Client\Program"
644   Call AddToPath
645   Push "$INSTDIR\Common"
646   Call AddToPath
647   
648   ; Add kfw to path too
649   Push "$INSTDIR\kfw\bin"
650   Call AddToPath
651    
652   ; Create the AFS service
653   SetOutPath "$INSTDIR\Common"
654   File "${AFS_WININSTALL_DIR}\Service.exe"
655   nsExec::Exec "net stop TransarcAFSDaemon"
656   ;IMPORTANT!  If we are not refreshing the config files, do NOT remove the service
657   ;Don't re-install because it must be present or we wouldn't have passed the Reg check
658   ReadINIStr $R2 $1 "Field 2" "State"
659
660   StrCmp $R2 "" skipremove
661   nsExec::Exec '$INSTDIR\Common\Service.exe u TransarcAFSDaemon'
662   nsExec::Exec '$INSTDIR\Common\Service.exe TransarcAFSDaemon "$INSTDIR\Client\Program\afsd_service.exe" "OpenAFS Client Service"'
663 skipremove:
664   Delete "$INSTDIR\Common\service.exe"
665
666   ; Daemon entries
667   WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon" "(Default)" ""
668   WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" "AuthentProviderPath" "$INSTDIR\Client\Program\afslogon.dll"
669   WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" "Class" 2
670   WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" "LogonOptions" 2
671   WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" "LogonScript" "$INSTDIR\Client\Program\afscreds.exe -:%s -x"
672   WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" "Name" "OpenAFSDaemon"
673   WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" "ProviderPath" "$INSTDIR\Client\Program\afslogon.dll"
674
675   ;Write cell name
676   ReadINIStr $R0 $1 "Field 2" "State"
677   WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" "Cell" $R0
678   WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" "ShowTrayIcon" 1
679   WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" "SecurityLevel" 1  
680   SetRebootFlag true
681   
682   WriteUninstaller "$INSTDIR\Uninstall.exe"
683   
684 SectionEnd
685
686 ;------------------------
687 ; OpenAFS SERVER  
688 Section "AFS Server" SecServer
689
690   SetShellVarContext all
691
692   CreateDirectory "$INSTDIR\Server\usr\afs\etc"
693   CreateDirectory "$INSTDIR\Server\usr\afs\local"
694   CreateDirectory "$INSTDIR\Server\usr\afs\logs"
695   
696   SetOutPath "$INSTDIR\Server\usr\afs\bin"  
697   File "${AFS_SERVER_BUILDDIR}\afskill.exe"
698   File "${AFS_SERVER_BUILDDIR}\afssvrcfg.exe"
699   File "${AFS_SERVER_BUILDDIR}\bosctlsvc.exe"
700   File "${AFS_SERVER_BUILDDIR}\bosserver.exe"
701   File "${AFS_SERVER_BUILDDIR}\buserver.exe"
702   File "${AFS_ETC_BUILDDIR}\butc.exe"
703   File "${AFS_SERVER_BUILDDIR}\fileserver.exe"
704   File "${AFS_ETC_BUILDDIR}\fms.exe"
705   File "${AFS_SERVER_BUILDDIR}\kaserver.exe"
706   File "${AFS_SERVER_BUILDDIR}\ptserver.exe"
707   File "${AFS_SERVER_BUILDDIR}\salvager.exe"
708   File "${AFS_SERVER_BUILDDIR}\upclient.exe"
709   File "${AFS_SERVER_BUILDDIR}\upserver.exe"
710   File "${AFS_SERVER_BUILDDIR}\vlserver.exe"
711   File "${AFS_SERVER_BUILDDIR}\volinfo.exe"
712   File "${AFS_SERVER_BUILDDIR}\volserver.exe"
713  
714  ;AFS Server common files
715  SetOutPath "$INSTDIR\Common"
716  File "${AFS_SERVER_BUILDDIR}\afsvosadmin.dll"
717  File "${AFS_SERVER_BUILDDIR}\afsbosadmin.dll"
718  File "${AFS_SERVER_BUILDDIR}\afscfgadmin.dll"
719  File "${AFS_SERVER_BUILDDIR}\afskasadmin.dll"
720  File "${AFS_SERVER_BUILDDIR}\afsptsadmin.dll"
721  SetOutPath "$INSTDIR\Common"
722    Call AFSLangFiles
723    
724    SetOutPath "$WINDIR"
725    File "${AFS_SERVER_BUILDDIR}\afsserver.cpl"
726    
727   ;Store install folder
728   WriteRegStr HKCU "${AFS_REGKEY_ROOT}\AFS Server" "" $INSTDIR
729   
730   DeleteRegKey HKLM "${AFS_REGKEY_ROOT}\AFS Server\CurrentVersion"
731   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Server\CurrentVersion" "VersionString" ${MUI_VERSION}
732   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Server\CurrentVersion" "Title" "AFS Server"
733   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Server\CurrentVersion" "Description" "AFS Server for Windows"
734   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Server\CurrentVersion" "PathName" "$INSTDIR\Server"
735   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Server\CurrentVersion" "Software Type" "File System"
736   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Server\CurrentVersion" "MajorVersion" ${MUI_MAJORVERSION}
737   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Server\CurrentVersion" "MinorVersion" ${MUI_MINORVERSION}
738   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Server\CurrentVersion" "PatchLevel" ${MUI_PATCHLEVEL}
739   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Server\${MUI_VERSION}" "VersionString" ${MUI_VERSION}
740   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Server\${MUI_VERSION}" "Title" "AFS Server"
741   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Server\${MUI_VERSION}" "Description" "AFS Server for Windows"
742   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Server\${MUI_VERSION}" "Software Type" "File System"
743   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Server\${MUI_VERSION}" "PathName" "$INSTDIR\Server"
744   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Server\${MUI_VERSION}" "MajorVersion" ${MUI_MAJORVERSION}
745   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Server\${MUI_VERSION}" "MinorVersion" ${MUI_MINORVERSION}
746   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Server\${MUI_VERSION}" "PatchLevel" ${MUI_PATCHLEVEL}
747
748   ; Install the service
749   SetOutPath "$INSTDIR\Common"
750   File "${AFS_WININSTALL_DIR}\Service.exe"
751   nsExec::Exec "net stop TransarcAFSServer"
752   nsExec::Exec '$INSTDIR\Common\service.exe u TransarcAFSServer'
753   nsExec::Exec '$INSTDIR\Common\service.exe TransarcAFSServer "$INSTDIR\Server\usr\afs\bin\bosctlsvc.exe" "OpenAFS AFS Server"'
754   Delete "$INSTDIR\Common\service.exe"
755   
756   CreateDirectory "$SMPROGRAMS\OpenAFS\Server"
757   CreateShortCut "$SMPROGRAMS\OpenAFS\Server\Configuration Wizard.lnk" "$INSTDIR\Server\usr\afs\bin\afssvrcfg.exe" "/wizard"
758   
759   WriteUninstaller "$INSTDIR\Uninstall.exe"
760
761 SectionEnd
762
763
764 ;----------------------------
765 ; OpenAFS Control Center
766 Section "AFS Control Center" SecControl
767
768   SetShellVarContext all
769
770    SetOutPath "$INSTDIR\Control Center"
771   File "${AFS_SERVER_BUILDDIR}\TaAfsAccountManager.exe"
772   File "${AFS_SERVER_BUILDDIR}\TaAfsAdmSvr.exe"
773   File "${AFS_SERVER_BUILDDIR}\TaAfsServerManager.exe"
774    
775  ;AFS Server common files
776  Call AFSCommon.Install
777  Call AFSLangFiles
778  SetOutPath "$INSTDIR\Common"
779
780   SetOutPath "$INSTDIR\Common"
781 !IFDEF DEBUG
782 !IFDEF CL1310
783   File "${AFS_WININSTALL_DIR}\msvcr71d.dll"
784   File "${AFS_WININSTALL_DIR}\msvcr71d.pdb"
785   File "${AFS_WININSTALL_DIR}\msvcrtd.dll"
786   File "${AFS_WININSTALL_DIR}\msvcrtd.pdb"
787 !ELSE
788 !IFDEF CL1300
789   File "${AFS_WININSTALL_DIR}\msvcr70d.dll"
790   File "${AFS_WININSTALL_DIR}\msvcr70d.pdb"
791   File "${AFS_WININSTALL_DIR}\msvcrtd.dll"
792   File "${AFS_WININSTALL_DIR}\msvcrtd.pdb"
793 !ELSE
794   File "${AFS_WININSTALL_DIR}\msvcrtd.dll"
795   File "${AFS_WININSTALL_DIR}\msvcrtd.pdb"
796 !ENDIF
797 !ENDIF
798 !ELSE
799 !IFDEF CL1310
800   File "${AFS_WININSTALL_DIR}\msvcr71.dll"
801   File "${AFS_WININSTALL_DIR}\msvcrt.dll"
802 !ELSE
803 !IFDEF CL1300
804   File "${AFS_WININSTALL_DIR}\msvcr70.dll"
805   File "${AFS_WININSTALL_DIR}\msvcrt.dll"
806 !ELSE
807   File "${AFS_WININSTALL_DIR}\msvcrt.dll"
808 !ENDIF
809 !ENDIF
810 !ENDIF
811    
812    ;Store install folder
813   WriteRegStr HKCU "${AFS_REGKEY_ROOT}\AFS Control Center\CurrentVersion" "PathName" $INSTDIR
814   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Control Center\CurrentVersion" "VersionString" ${MUI_VERSION}
815   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Control Center\CurrentVersion" "MajorVersion" ${MUI_MAJORVERSION}
816   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Control Center\CurrentVersion" "MinorVersion" ${MUI_MINORVERSION}
817   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Control Center\CurrentVersion" "PatchLevel" ${MUI_PATCHLEVEL}
818   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Control Center\${MUI_VERSION}" "VersionString" ${MUI_VERSION}
819   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Control Center\${MUI_VERSION}" "MajorVersion" ${MUI_MAJORVERSION}
820   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Control Center\${MUI_VERSION}" "MinorVersion" ${MUI_MINORVERSION}
821   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Control Center\${MUI_VERSION}" "PatchLevel" ${MUI_PATCHLEVEL}
822   
823
824   ;Write start menu entries
825   CreateDirectory "$SMPROGRAMS\OpenAFS\Control Center"
826   CreateShortCut "$SMPROGRAMS\OpenAFS\Control Center\Account Manager.lnk" "$INSTDIR\Control Center\TaAfsAccountManager.exe"
827   CreateShortCut "$SMPROGRAMS\OpenAFS\Control Center\Server Manager.lnk" "$INSTDIR\Control Center\TaAfsServerManager.exe"
828   
829   WriteUninstaller "$INSTDIR\Uninstall.exe"
830
831 SectionEnd   
832
833
834 ;----------------------------
835 ; OpenAFS Supplemental Documentation
836 Section "Supplemental Documentation" SecDocs
837   SetShellVarContext all
838
839    StrCmp $LANGUAGE ${LANG_ENGLISH} DoEnglish
840    StrCmp $LANGUAGE ${LANG_GERMAN} DoGerman
841    StrCmp $LANGUAGE ${LANG_SPANISH} DoSpanish
842    StrCmp $LANGUAGE ${LANG_JAPANESE} DoJapanese
843    ;StrCmp $LANGUAGE ${LANG_KOREAN} DoKorean
844    StrCmp $LANGUAGE ${LANG_PORTUGUESEBR} DoPortugueseBR
845    StrCmp $LANGUAGE ${LANG_SIMPCHINESE} DoSimpChinese
846    StrCmp $LANGUAGE ${LANG_TRADCHINESE} DoTradChinese
847    
848    
849 DoEnglish:
850    SetOutPath "$INSTDIR\Documentation\html"
851    File "..\..\doc\install\Documentation\en_US\html\*"
852    SetOutPath "$INSTDIR\Documentation\html\CmdRef"
853    File "..\..\doc\install\Documentation\en_US\html\CmdRef\*"
854    SetOutPath "$INSTDIR\Documentation\html\InstallGd"
855    File "..\..\doc\install\Documentation\en_US\html\InstallGd\*"
856    SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes"
857    File "..\..\doc\install\Documentation\en_US\html\ReleaseNotes\*"
858    SetOutPath "$INSTDIR\Documentation\html\SysAdminGd"
859    File "..\..\doc\install\Documentation\en_US\html\SysAdminGd\*"
860    goto DoneLanguage
861    
862 DoGerman:
863    SetOutPath "$INSTDIR\Documentation"
864    File "..\..\doc\install\Documentation\de_DE\README.TXT"
865    SetOutPath "$INSTDIR\Documentation\html"
866    File "..\..\doc\install\Documentation\de_DE\html\*"
867    SetOutPath "$INSTDIR\Documentation\html\CmdRef"
868    ;File "..\..\doc\install\Documentation\de_DE\html\CmdRef\*"
869    SetOutPath "$INSTDIR\Documentation\html\InstallGd"
870    File "..\..\doc\install\Documentation\de_DE\html\InstallGd\*"
871    ;SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes"
872    ;File "..\..\doc\install\Documentation\de_DE\html\ReleaseNotes\*"
873    ;SetOutPath "$INSTDIR\Documentation\html\SysAdminGd"
874    ;File "..\..\doc\install\Documentation\de_DE\html\SysAdminGd\*"
875    goto DoneLanguage
876    
877 DoSpanish:
878    SetOutPath "$INSTDIR\Documentation"
879    File "..\..\doc\install\Documentation\es_ES\README.TXT"
880    SetOutPath "$INSTDIR\Documentation\html"
881    File "..\..\doc\install\Documentation\es_ES\html\*"
882    SetOutPath "$INSTDIR\Documentation\html\CmdRef"
883    ;File "..\..\doc\install\Documentation\es_ES\html\CmdRef\*"
884    SetOutPath "$INSTDIR\Documentation\html\InstallGd"
885    ;File "..\..\doc\install\Documentation\es_ES\html\InstallGd\*"
886    SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes"
887    ;File "..\..\doc\install\Documentation\es_ES\html\ReleaseNotes\*"
888    SetOutPath "$INSTDIR\Documentation\html\SysAdminGd"
889    ;File "..\..\doc\install\Documentation\es_ES\html\SysAdminGd\*"
890    goto DoneLanguage
891
892 DoJapanese:
893    SetOutPath "$INSTDIR\Documentation"
894    File "..\..\doc\install\Documentation\ja_JP\README.TXT"
895    SetOutPath "$INSTDIR\Documentation\html"
896    File "..\..\doc\install\Documentation\ja_JP\html\*"
897    SetOutPath "$INSTDIR\Documentation\html\CmdRef"
898    File "..\..\doc\install\Documentation\ja_JP\html\CmdRef\*"
899    SetOutPath "$INSTDIR\Documentation\html\InstallGd"
900    File "..\..\doc\install\Documentation\ja_JP\html\InstallGd\*"
901    SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes"
902    ;File "..\..\doc\install\Documentation\ja_JP\html\ReleaseNotes\*"
903    SetOutPath "$INSTDIR\Documentation\html\SysAdminGd"
904    ;File "..\..\doc\install\Documentation\ja_JP\html\SysAdminGd\*"
905    goto DoneLanguage
906    
907 DoKorean:
908    SetOutPath "$INSTDIR\Documentation"
909    File "..\..\doc\install\Documentation\ko_KR\README.TXT"
910    SetOutPath "$INSTDIR\Documentation\html"
911    File "..\..\doc\install\Documentation\ko_KR\html\*"
912    ;SetOutPath "$INSTDIR\Documentation\html\CmdRef"
913    ;File "..\..\doc\install\Documentation\ko_KR\html\CmdRef\*"
914    SetOutPath "$INSTDIR\Documentation\html\InstallGd"
915    File "..\..\doc\install\Documentation\ko_KR\html\InstallGd\*"
916    SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes"
917    File "..\..\doc\install\Documentation\ko_KR\html\ReleaseNotes\*"
918    SetOutPath "$INSTDIR\Documentation\html\SysAdminGd"
919    File "..\..\doc\install\Documentation\ko_KR\html\SysAdminGd\*"
920    goto DoneLanguage
921    
922 DoPortugueseBR:
923    SetOutPath "$INSTDIR\Documentation"
924    File "..\..\doc\install\Documentation\pt_BR\README.TXT"
925    SetOutPath "$INSTDIR\Documentation\html"
926    File "..\..\doc\install\Documentation\pt_BR\html\*"
927    ;SetOutPath "$INSTDIR\Documentation\html\CmdRef"
928    ;File "..\..\doc\install\Documentation\pt_BR\html\CmdRef\*"
929    SetOutPath "$INSTDIR\Documentation\html\InstallGd"
930    File "..\..\doc\install\Documentation\pt_BR\html\InstallGd\*"
931    SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes"
932    File "..\..\doc\install\Documentation\pt_BR\html\ReleaseNotes\*"
933    ;SetOutPath "$INSTDIR\Documentation\html\SysAdminGd"
934    ;File "..\..\doc\install\Documentation\pt_BR\html\SysAdminGd\*"
935    goto DoneLanguage
936
937 DoSimpChinese:
938    SetOutPath "$INSTDIR\Documentation"
939    File "..\..\doc\install\Documentation\zh_CN\README.TXT"
940    SetOutPath "$INSTDIR\Documentation\html"
941    File "..\..\doc\install\Documentation\zh_CN\html\*"
942    ;SetOutPath "$INSTDIR\Documentation\html\CmdRef"
943    ;File "..\..\doc\install\Documentation\zh_CN\html\CmdRef\*"
944    SetOutPath "$INSTDIR\Documentation\html\InstallGd"
945    File "..\..\doc\install\Documentation\zh_CN\html\InstallGd\*"
946    SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes"
947    File "..\..\doc\install\Documentation\zh_CN\html\ReleaseNotes\*"
948    ;SetOutPath "$INSTDIR\Documentation\html\SysAdminGd"
949    ;File "..\..\doc\install\Documentation\zh_CN\html\SysAdminGd\*"
950    goto DoneLanguage
951    
952 DoTradChinese:
953    SetOutPath "$INSTDIR\Documentation"
954    File "..\..\doc\install\Documentation\zh_TW\README.TXT"
955    SetOutPath "$INSTDIR\Documentation\html"
956    File "..\..\doc\install\Documentation\zh_TW\html\*"
957    ;SetOutPath "$INSTDIR\Documentation\html\CmdRef"
958    ;File "..\..\doc\install\Documentation\zh_TW\html\CmdRef\*"
959    SetOutPath "$INSTDIR\Documentation\html\InstallGd"
960    File "..\..\doc\install\Documentation\zh_TW\html\InstallGd\*"
961    SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes"
962    File "..\..\doc\install\Documentation\zh_TW\html\ReleaseNotes\*"
963    ;SetOutPath "$INSTDIR\Documentation\html\SysAdminGd"
964    ;File "..\..\doc\install\Documentation\zh_TW\html\SysAdminGd\*"
965    goto DoneLanguage
966    
967    
968 DoneLanguage:
969    ;Store install folder
970   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Supplemental Documentation" "" $INSTDIR
971   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Supplemental Documentation\CurrentVersion" "VersionString" ${MUI_VERSION}
972   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Supplemental Documentation\CurrentVersion" "MajorVersion" ${MUI_MAJORVERSION}
973   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Supplemental Documentation\CurrentVersion" "MinorVersion" ${MUI_MINORVERSION}
974   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Supplemental Documentation\CurrentVersion" "PatchLevel" ${MUI_PATCHLEVEL}
975   WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Supplemental Documentation\${MUI_VERSION}" "VersionString" ${MUI_VERSION}
976   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Supplemental Documentation\${MUI_VERSION}" "MajorVersion" ${MUI_MAJORVERSION}
977   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Supplemental Documentation\${MUI_VERSION}" "MinorVersion" ${MUI_MINORVERSION}
978   WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Supplemental Documentation\${MUI_VERSION}" "PatchLevel" ${MUI_PATCHLEVEL}
979
980   ; Write start menu shortcut
981   SetOutPath "$SMPROGRAMS\OpenAFS"
982   CreateShortCut "$SMPROGRAMS\OpenAFS\Documentation.lnk" "$INSTDIR\Documentation\html\index.htm"
983   
984   
985   WriteUninstaller "$INSTDIR\Uninstall.exe"
986   CreateShortCut "$SMPROGRAMS\OpenAFS\Uninstall OpenAFS.lnk" "$INSTDIR\Uninstall.exe"
987 SectionEnd  
988   
989 ;Display the Finish header
990 ;Insert this macro after the sections if you are not using a finish page
991 ;!insertmacro MUI_SECTIONS_FINISHHEADER
992
993 ;--------------------------------
994 ;Installer Functions
995
996 Function .onInit
997
998   !insertmacro MUI_LANGDLL_DISPLAY
999   
1000   ; Set the default install options
1001         Push $0
1002
1003    Call IsUserAdmin
1004    Pop $R0
1005    StrCmp $R0 "true" contInstall
1006
1007    MessageBox MB_OK|MB_ICONSTOP|MB_TOPMOST "You must be an administrator of this machine to install this software."
1008    Abort
1009    
1010 contInstall:
1011    Call ShouldClientInstall
1012    Pop $R2
1013    
1014    StrCmp $R2 "0" NoClient
1015    StrCmp $R2 "2" UpgradeClient
1016    
1017         StrCpy $1 ${secClient} ; Gotta remember which section we are at now...
1018         SectionGetFlags ${secClient} $0
1019         IntOp $0 $0 | ${SF_SELECTED}
1020         SectionSetFlags ${secClient} $0
1021     ;# !insertmacro SelectSection ${secClient}
1022    goto skipClient
1023 NoClient:
1024         StrCpy $1 ${secClient} ; Gotta remember which section we are at now...
1025         SectionGetFlags ${secClient} $0
1026         IntOp $0 $0 | ${SECTION_OFF}
1027         SectionSetFlags ${secClient} $0
1028    goto skipClient
1029 UpgradeClient:
1030         SectionGetFlags ${secClient} $0
1031         IntOp $0 $0 | ${SF_SELECTED}
1032         SectionSetFlags ${secClient} $0
1033    SectionSetText ${secClient} $(UPGRADE_CLIENT)
1034    goto skipClient
1035
1036    
1037 skipClient:   
1038    
1039    
1040    Call IsServerInstalled
1041    Pop $R2
1042    StrCmp $R2 "0" NoServer
1043    
1044         SectionGetFlags ${secServer} $0
1045         IntOp $0 $0 & ${SF_SELECTED}
1046         SectionSetFlags ${secServer} $0
1047         ;# !insertmacro UnselectSection ${secServer}
1048    goto skipServer
1049
1050 NoServer:
1051         SectionGetFlags ${secServer} $0
1052         IntOp $0 $0 & ${SECTION_OFF}
1053         SectionSetFlags ${secServer} $0
1054         ;# !insertmacro UnselectSection ${secServer}
1055    
1056 skipServer:   
1057         SectionGetFlags ${secControl} $0
1058         IntOp $0 $0 & ${SECTION_OFF}
1059         SectionSetFlags ${secControl} $0
1060         ;# !insertmacro UnselectSection ${secControl}
1061
1062         SectionGetFlags ${secDocs} $0
1063         IntOp $0 $0 | ${SF_SELECTED}
1064         SectionSetFlags ${secDocs} $0
1065         ;# !insertmacro UnselectSection ${secDocs}
1066
1067         Pop $0
1068   
1069   
1070   
1071   GetTempFilename $0
1072   File /oname=$0 CellServPage.ini
1073   GetTempFilename $1
1074   File /oname=$1 AFSCell.ini
1075   ;File /oname=$1 ConfigURL.ini
1076   
1077 FunctionEnd
1078
1079
1080
1081
1082
1083 ;--------------------------------
1084 ; These are our cleanup functions
1085 Function .onInstFailed
1086 Delete $0
1087
1088 FunctionEnd
1089
1090 Function .onInstSuccess
1091 Delete $0
1092
1093 FunctionEnd
1094
1095
1096 ;--------------------------------
1097 ;Descriptions
1098
1099 !insertmacro MUI_FUNCTIONS_DESCRIPTION_BEGIN
1100   !insertmacro MUI_DESCRIPTION_TEXT ${SecServer} $(DESC_SecServer)
1101   !insertmacro MUI_DESCRIPTION_TEXT ${SecClient} $(DESC_SecClient)
1102   !insertmacro MUI_DESCRIPTION_TEXT ${SecControl} $(DESC_SecControl)
1103   !insertmacro MUI_DESCRIPTION_TEXT ${SecDocs} $(DESC_SecDocs)
1104 !insertmacro MUI_FUNCTIONS_DESCRIPTION_END
1105  
1106 ;--------------------------------
1107 ;Uninstaller Section
1108
1109 Section "Uninstall"
1110   
1111   SetShellVarContext all
1112   ; Stop the running processes
1113   GetTempFileName $R0
1114   File /oname=$R0 "${AFS_WININSTALL_DIR}\Killer.exe"
1115   nsExec::Exec '$R0 afscreds.exe'
1116   nsExec::Exec '$R0 krbcc32s.exe'
1117
1118   ; Delete the AFS service
1119   GetTempFileName $R0
1120   File /oname=$R0 "${AFS_WININSTALL_DIR}\Service.exe"
1121   nsExec::Exec "net stop TransarcAFSDaemon"
1122   nsExec::Exec "net stop TransarcAFSServer"
1123   nsExec::Exec '$R0 u TransarcAFSDaemon'
1124   nsExec::Exec '$R0 u TransarcAFSServer'
1125   Delete $R0
1126   
1127   Push "$INSTDIR\Client\Program"
1128   Call un.RemoveFromPath
1129   Push "$INSTDIR\Common"
1130   Call un.RemoveFromPath
1131   Push "$INSTDIR\kfw\bin"
1132   Call un.RemoveFromPath
1133   
1134   ; Delete documentation
1135   Delete "$INSTDIR\Documentation\README.TXT"
1136   Delete "$INSTDIR\Documentation\html\*"
1137   Delete "$INSTDIR\Documentation\html\CmdRef\*"
1138   Delete "$INSTDIR\Documentation\html\InstallGd\*"
1139   Delete "$INSTDIR\Documentation\html\ReleaseNotes\*"
1140   Delete "$INSTDIR\Documentation\html\SysAdminGd\*"
1141
1142    Delete /REBOOTOK "$INSTDIR\Common\afs_config.exe"
1143    Delete /REBOOTOK "$INSTDIR\Common\afs_shl_ext.dll"
1144    Delete /REBOOTOK "$INSTDIR\Common\afsadminutil.dll"
1145    Delete /REBOOTOK "$INSTDIR\Common\lib\afsauthent.dll"
1146    Delete /REBOOTOK "$INSTDIR\Common\lib\afspthread.dll"
1147    Delete /REBOOTOK "$INSTDIR\Common\lib\afsrpc.dll"
1148    Delete /REBOOTOK "$INSTDIR\Common\afsclientadmin.dll"
1149    Delete /REBOOTOK "$INSTDIR\Common\afsprocmgmt.dll"
1150    Delete /REBOOTOK "$INSTDIR\Common\afsvosadmin.dll"
1151    Delete /REBOOTOK "$INSTDIR\Common\TaAfsAppLib.dll"
1152    Delete /REBOOTOK "$INSTDIR\Common\afsvosadmin.dll"
1153    Delete /REBOOTOK "$INSTDIR\Common\afsbosadmin.dll"
1154    Delete /REBOOTOK "$INSTDIR\Common\afscfgadmin.dll"
1155    Delete /REBOOTOK "$INSTDIR\Common\afskasadmin.dll"
1156    Delete /REBOOTOK "$INSTDIR\Common\afsptsadmin.dll"
1157 !IFDEF DEBUG
1158 !IFDEF CL1310
1159    Delete /REBOOTOK "$INSTDIR\Common\msvcr71d.dll"
1160    Delete /REBOOTOK "$INSTDIR\Common\msvcr71d.pdb"
1161 !ELSE
1162    Delete /REBOOTOK "$INSTDIR\Common\msvcrtd.dll"
1163    Delete /REBOOTOK "$INSTDIR\Common\msvcrtd.pdb"
1164 !ENDIF
1165 !ELSE
1166 !IFDEF CL1310
1167    Delete /REBOOTOK "$INSTDIR\Common\msvcr71.dll"
1168 !ELSE
1169    Delete /REBOOTOK "$INSTDIR\Common\msvcrt.dll"
1170 !ENDIF
1171 !ENDIF
1172   
1173    Call un.IsSilent
1174    Pop $R1
1175    StrCmp $R1 "/S" SkipAsk
1176 ;  IfFileExists "$WINDIR\afsdcell.ini" CellExists SkipDelAsk
1177 ;  CellExists:
1178   MessageBox MB_YESNO "Would you like to keep your configuration files?" IDYES SkipDel
1179   SkipAsk:
1180   Delete "$WINDIR\afsdcell.ini"
1181
1182   Delete "$WINDIR\afsdsbmt.ini"
1183   Delete "$WINDIR\krb5.ini"
1184   Delete "$WINDIR\afsdns.ini"
1185   Delete "$WINDIR\afs_freelance.ini"
1186   
1187   SkipDel:
1188   Delete "$WINDIR\afsd_init.log"
1189   Delete "$INSTDIR\Uninstall.exe"
1190
1191   ; Remove server
1192   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\afskill.exe"
1193   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\afssvrcfg.exe"
1194   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\bosctlsvc.exe"
1195   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\bosserver.exe"
1196   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\buserver.exe"
1197   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\butc.exe"
1198   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\fileserver.exe"
1199   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\fms.exe"
1200   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\kaserver.exe"
1201   Delete /REBOOTOK "$INSTDIR\Server\usr\afs\bin\ptserver.exe"
1202   Delete "$INSTDIR\Server\usr\afs\bin\salvager.exe"
1203   Delete "$INSTDIR\Server\usr\afs\bin\ServerUninst.dll"
1204   Delete "$INSTDIR\Server\usr\afs\bin\upclient.exe"
1205   Delete "$INSTDIR\Server\usr\afs\bin\upserver.exe"
1206   Delete "$INSTDIR\Server\usr\afs\bin\vlserver.exe"
1207   Delete "$INSTDIR\Server\usr\afs\bin\volinfo.exe"
1208   Delete "$INSTDIR\Server\usr\afs\bin\volserver.exe"
1209   RMDir /r "$INSTDIR\Server\usr\afs\bin"
1210   RmDir /r "$INSTDIR\Server\usr\afs\etc"
1211   RmDir /r "$INSTDIR\Server\usr\afs\local"
1212   RMDIR /r "$INSTDIR\Server\usr\afs\logs"
1213   
1214   Delete /REBOOTOK "$WINDIR\afsserver.cpl"
1215   Delete /REBOOTOK "$WINDIR\afs_cpa.cpl"
1216   
1217   RMDir /r "$INSTDIR\Documentation\html\CmdRef"
1218   RMDir /r "$INSTDIR\Documentation\html\InstallGd"
1219   RMDir /r "$INSTDIR\Documentation\html\ReleaseNotes"
1220   RMDir /r "$INSTDIR\Documentation\html\SysAdminGd"
1221   RMDIr /r "$INSTDIR\Documentation\html"
1222   
1223   RMDir "$INSTDIR\Documentation"
1224   ; Delete DOC short cut
1225   Delete /REBOOTOK "$INSTDIR\Client\Program\afscreds.exe"
1226   Delete /REBOOTOK "$INSTDIR\Client\Program\*"
1227   Delete /REBOOTOK "$INSTDIR\Client\Program\Include\*"
1228   Delete /REBOOTOK "$INSTDIR\Client\Program\Include\afs\*"
1229   Delete /REBOOTOK "$INSTDIR\Client\Program\Include\rx\*"
1230   Delete /REBOOTOK "$INSTDIR\Client\Program\Sample\*"
1231   RMDir  "$INSTDIR\Client\Program\Sample"
1232   RMDir  "$INSTDIR\Client\Program\Include\afs"
1233   RMDir  "$INSTDIR\Client\Program\Include\rx"
1234   RMDir  "$INSTDIR\Client\Program\Include"
1235   RMDir  "$INSTDIR\Client\Program"
1236   RMDir  "$INSTDIR\Client"
1237   
1238 !IFDEF DEBUG
1239 !IFDEF CL1310
1240   Delete /REBOOTOK "$INSTDIR\Common\msvcr71d.dll"
1241   Delete /REBOOTOK "$INSTDIR\Common\msvcr71d.pdb"
1242 !ELSE
1243   Delete /REBOOTOK "$INSTDIR\Common\msvcrtd.dll"
1244   Delete /REBOOTOK "$INSTDIR\Common\msvcrtd.pdb"
1245 !ENDIF
1246 !ELSE
1247 !IFDEF CL1310
1248   Delete /REBOOTOK "$INSTDIR\Common\msvcr71.dll"
1249 !ELSE
1250   Delete /REBOOTOK "$INSTDIR\Common\msvcrt.dll"
1251 !ENDIF
1252 !ENDIF
1253   Delete /REBOOTOK "$INSTDIR\Common\*"
1254   RMDir "$INSTDIR\Common"
1255
1256   ;Remove KfW files
1257   Delete /REBOOTOK "$INSTDIR\kfw\bin\*"
1258   RMDIR  /r "$INSTDIR\kfw\bin"
1259   Delete /REBOOTOK "$INSTDIR\kfw\doc\*"
1260   RMDIR  /r "$INSTDIR\kfw\doc"
1261   RMDIR  /r "$INSTDIR\kfw"
1262
1263   Delete "$SMPROGRAMS\OpenAFS\Documentation.lnk"
1264
1265   ; Remove control center
1266   Delete /REBOOTOK "$INSTDIR\Control Center\TaAfsAccountManager.exe"
1267   Delete /REBOOTOK "$INSTDIR\Control Center\TaAfsAdmSvr.exe"
1268   Delete /REBOOTOK "$INSTDIR\Control Center\TaAfsServerManager.exe"
1269   Delete /REBOOTOK "$INSTDIR\Control Center\CCUninst.dll"
1270   RMDir  "$INSTDIR\Control Center"
1271   
1272   Delete "$SMPROGRAMS\OpenAFS\Uninstall OpenAFS.lnk"
1273   Delete "$SMPROGRAMS\OpenAFS\Client\Authentication.lnk"
1274   Delete "$SMPROGRAMS\OpenAFS\Control Center\Account Manager.lnk"
1275   Delete "$SMPROGRAMS\OpenAFS\Control Center\Server Manager.lnk"
1276   RMDIR "$SMPROGRAMS\OpenAFS\Control Center"
1277   RMDir /r "$SMPROGRAMS\OpenAFS\Client"
1278   RMDir /r "$SMPROGRAMS\OpenAFS"
1279   Delete "$SMSTARTUP\AFS Credentials.lnk"
1280   
1281   ReadRegStr $R0 HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon" "CachePath"
1282   IfErrors +2
1283   Delete "$R0\AFSCache"
1284   Delete "C:\AFSCache"
1285
1286   DeleteRegKey HKCR "*\shellex\ContextMenuHandlers\AFS Client Shell Extension"
1287   DeleteRegKey HKCR "CLSID\{DC515C27-6CAC-11D1-BAE7-00C04FD140D2}\InprocServer32"
1288   DeleteRegKey HKCR "CLSID\{DC515C27-6CAC-11D1-BAE7-00C04FD140D2}"
1289   DeleteRegKey HKCR "FOLDER\shellex\ContextMenuHandlers\AFS Client Shell Extension"
1290   DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved" "{DC515C27-6CAC-11D1-BAE7-00C04FD140D2}"
1291
1292   DeleteRegKey HKLM "${AFS_REGKEY_ROOT}\AFS Client\CurrentVersion"
1293   DeleteRegKey HKLM "${AFS_REGKEY_ROOT}\AFS Client"
1294   DeleteRegKey HKLM "${AFS_REGKEY_ROOT}\AFS Supplemental Documentation\CurrentVersion"
1295   DeleteRegKey HKLM "${AFS_REGKEY_ROOT}\AFS Supplemental Documentation"
1296   DeleteRegKey HKLM "${AFS_REGKEY_ROOT}\AFS Control Center\CurrentVersion"
1297   DeleteRegKey HKLM "${AFS_REGKEY_ROOT}\AFS Control Center"
1298   DeleteRegKey HKLM "${AFS_REGKEY_ROOT}\AFS Server\CurrentVersion"
1299   DeleteRegKey HKLM "${AFS_REGKEY_ROOT}\AFS Server"
1300   DeleteRegKey /ifempty HKLM "${AFS_REGKEY_ROOT}"
1301   DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenAFS"
1302   DeleteRegValue HKLM "SYSTEM\CurrentControlSet\Services\NetBT\Parameters" "SmbDeviceEnabled"
1303  
1304   RMDir  "$INSTDIR"
1305
1306   ;Display the Finish header
1307   !insertmacro MUI_UNFINISHHEADER
1308
1309 SectionEnd
1310
1311 ;--------------------------------
1312 ;Uninstaller Functions
1313
1314 Function un.onInit
1315
1316   ;Get language from registry
1317   ReadRegStr $LANGUAGE HKCU "Software\OpenAFS\AFS" "Installer Language"
1318
1319 FunctionEnd
1320
1321 Function un.onUninstSuccess
1322
1323    MessageBox MB_OK "Please reboot your machine to complete uninstallation of the software"
1324
1325 FunctionEnd
1326
1327 ;------------------------------
1328 ; Get the CellServDB file from the Internet
1329
1330 Function afs.GetCellServDB
1331
1332 ;Check if we should download CellServDB
1333 ;ReadINIStr $R0 $0 "Field 4" "State"
1334 ;StrCmp $R0 "0" CheckIncl
1335
1336    ReadINIStr $R0 $0 "Field 5" "State"
1337    NSISdl::download $R0 "$WINDIR\afsdcell.ini"
1338    Pop $R0 ;Get the return value
1339    StrCmp $R0 "success" +2
1340       MessageBox MB_OK|MB_ICONSTOP "Download failed: $R0"
1341    goto done
1342 CheckIncl:
1343    ReadINIStr $R0 $0 "Field 3" "State"
1344    StrCmp $R0 "0" CheckOther
1345    SetOutPath "$WINDIR"
1346    File "afsdcell.ini"
1347    goto done
1348    
1349 CheckOther:
1350    ReadINIStr $R0 $0 "Field 7" "State"
1351    CopyFiles $R0 "$WINDIR\afsdcell.ini"
1352    
1353 done:
1354
1355 FunctionEnd
1356
1357
1358
1359 ;-------------------------------
1360 ;Do the page to get the CellServDB
1361
1362 Function AFSPageGetCellServDB
1363   ; Set the install options here
1364   
1365 startOver:
1366   WriteINIStr $0 "Field 2" "Flags" "DISABLED"
1367   WriteINIStr $0 "Field 3" "State" "1"
1368   
1369   !insertmacro MUI_HEADER_TEXT "CellServDB Configuration" "Please choose a method for installing the CellServDB file:" 
1370   InstallOptions::dialog $0
1371   Pop $R1
1372   StrCmp $R1 "cancel" exit
1373   StrCmp $R1 "back" done
1374   StrCmp $R1 "success" done
1375 exit: Quit
1376 done:
1377
1378    ; Check that if a file is set, a filename is entered...
1379    ReadINIStr $R0 $0 "Field 6" "State"
1380    StrCmp $R0 "1" CheckFileName Skip
1381 CheckFileName:
1382    ReadINIStr $R0 $0 "Field 7" "State"
1383    IfFileExists $R0 Skip
1384
1385    MessageBox MB_OK|MB_ICONSTOP $(CellError)
1386    WriteINIStr $0 "Field 6" "State" "0"
1387    goto startOver
1388    
1389    Skip:
1390    
1391 FunctionEnd
1392
1393
1394 Function AFSPageGetCellName
1395    Call IsSilent
1396    Pop $R1
1397    StrCmp $R1 "/S" exit
1398   !insertmacro MUI_HEADER_TEXT "Cell Name Configuration" "Please enter the name for your default cell:" 
1399   InstallOptions::dialog $1
1400   Pop $R1
1401   StrCmp $R1 "cancel" exit
1402   StrCmp $R1 "back" done
1403   StrCmp $R1 "success" done
1404 exit: Quit
1405 done:
1406 FunctionEnd
1407
1408 ;-------------
1409 ; Common install routines for each module
1410 Function AFSCommon.Install
1411
1412 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenAFS" "DisplayName" "OpenAFS for Windows"
1413 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenAFS" "UninstallString" "$INSTDIR\uninstall.exe"
1414 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenAFS" "DisplayVersion" "${MUI_VERSION}"
1415 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenAFS" "URLInfoAbout" "http://www.openafs.org/"
1416
1417 FunctionEnd
1418
1419
1420 ; Check if install should be silent
1421 Function IsSilent
1422   Push $0
1423   Push $CMDLINE
1424   Push "/S"
1425   Call StrStr
1426   Pop $0
1427   StrCpy $0 $0 3
1428   StrCmp $0 "/S" silent
1429   StrCmp $0 "/S " silent
1430     StrCpy $0 0
1431     Goto notsilent
1432   silent: StrCpy $0 1
1433   notsilent: Exch $0
1434 FunctionEnd
1435
1436
1437
1438 ; Check if uninstall should be silent
1439 Function un.IsSilent
1440   Push $0
1441   Push $CMDLINE
1442   Push "/S"
1443   Call un.StrStr
1444   Pop $0
1445   StrCpy $0 $0 3
1446   StrCmp $0 "/S" silent
1447   StrCmp $0 "/S " silent
1448     StrCpy $0 0
1449     Goto notsilent
1450   silent: StrCpy $0 1
1451   notsilent: Exch $0
1452 FunctionEnd
1453
1454
1455
1456 ; StrStr function
1457 Function StrStr
1458   Exch $R1 ; st=haystack,old$R1, $R1=needle
1459   Exch    ; st=old$R1,haystack
1460   Exch $R2 ; st=old$R1,old$R2, $R2=haystack
1461   Push $R3
1462   Push $R4
1463   Push $R5
1464   StrLen $R3 $R1
1465   StrCpy $R4 0
1466   ; $R1=needle
1467   ; $R2=haystack
1468   ; $R3=len(needle)
1469   ; $R4=cnt
1470   ; $R5=tmp
1471   loop:
1472     StrCpy $R5 $R2 $R3 $R4
1473     StrCmp $R5 $R1 done
1474     StrCmp $R5 "" done
1475     IntOp $R4 $R4 + 1
1476     Goto loop
1477   done:
1478   StrCpy $R1 $R2 "" $R4
1479   Pop $R5
1480   Pop $R4
1481   Pop $R3
1482   Pop $R2
1483   Exch $R1
1484 FunctionEnd
1485
1486 ;-------------------
1487 ; Get the currently installed version and place it on the stack
1488 ; Modifies: Nothing
1489 Function GetInstalledVersion
1490    Push $R0
1491    Push $R1
1492    Push $R4
1493    
1494    ReadRegDWORD $R0 HKLM "Software\TransarcCorporation\$R2\CurrentVersion" "VersionString"
1495    StrCmp $R0 "" NotTransarc
1496    
1497    
1498 NotTransarc:
1499    ReadRegDWORD $R0 HKLM "${AFS_REGKEY_ROOT}\$R2\CurrentVersion" "VersionString"
1500    StrCmp $R0 "" done
1501    
1502 done:
1503    Pop $R4
1504    Pop $R1
1505    Exch $R0
1506 FunctionEnd
1507
1508
1509 ;-------------------------------
1510 ; Check if the client should be checked for default install
1511 Function ShouldClientInstall
1512    Push $R0
1513    StrCpy $R2 "Client"
1514    Call GetInstalledVersion
1515    Pop $R0
1516    
1517    StrCmp $R0 "" NotInstalled
1518    
1519    StrCpy $R0 "0"
1520    Exch $R0
1521    goto end
1522    
1523 NotInstalled:
1524    StrCpy $R0 "1"
1525    Exch $R0
1526 end:   
1527 FunctionEnd
1528
1529
1530 ; See if AFS Client is installed
1531 Function IsServerInstalled
1532    Push $R0
1533    StrCpy $R2 "AFS Server"
1534    Call GetInstalledVersion
1535    Pop $R0
1536    
1537    StrCmp $R0 "" NotInstalled
1538    
1539    StrCpy $R0 "1"
1540    Exch $R0
1541    goto end
1542    
1543 NotInstalled:
1544    StrCpy $R0 "0"
1545    Exch $R0
1546 end:   
1547 FunctionEnd
1548
1549
1550 ; See if AFS Server is installed
1551 Function IsClientInstalled
1552    Push $R0
1553    StrCpy $R2 "AFS Client"
1554    Call GetInstalledVersion
1555    Pop $R0
1556    
1557    StrCmp $R0 "" NotInstalled
1558    
1559    StrCpy $R0 "1"
1560    Exch $R0
1561    goto end
1562    
1563 NotInstalled:
1564    StrCpy $R0 "0"
1565    Exch $R0
1566 end:   
1567 FunctionEnd
1568
1569
1570
1571 ; See if AFS Documentation is installed
1572 Function IsDocumentationInstalled
1573    Push $R0
1574    StrCpy $R2 "AFS Supplemental Documentation"
1575    Call GetInstalledVersion
1576    Pop $R0
1577    
1578    StrCmp $R0 "" NotInstalled
1579    
1580    StrCpy $R0 "1"
1581    Exch $R0
1582    goto end
1583    
1584 NotInstalled:
1585    StrCpy $R0 "0"
1586    Exch $R0
1587 end:   
1588 FunctionEnd
1589
1590
1591 ; See if COntrol Center is installed
1592 Function IsControlInstalled
1593    Push $R0
1594    StrCpy $R2 "Control_Center"
1595    Call GetInstalledVersion
1596    Pop $R0
1597    
1598    StrCmp $R0 "" NotInstalled
1599    
1600    StrCpy $R0 "1"
1601    Exch $R0
1602    goto end
1603    
1604 NotInstalled:
1605    StrCpy $R0 "0"
1606    Exch $R0
1607 end:   
1608 FunctionEnd
1609
1610
1611 ; GetParameters
1612 ; input, none
1613 ; output, top of stack (replaces, with e.g. whatever)
1614 ; modifies no other variables.
1615
1616 Function GetParameters
1617   Push $R0
1618   Push $R1
1619   Push $R2
1620   StrCpy $R0 $CMDLINE 1
1621   StrCpy $R1 '"'
1622   StrCpy $R2 1
1623   StrCmp $R0 '"' loop
1624     StrCpy $R1 ' ' ; we're scanning for a space instead of a quote
1625   loop:
1626     StrCpy $R0 $CMDLINE 1 $R2
1627     StrCmp $R0 $R1 loop2
1628     StrCmp $R0 "" loop2
1629     IntOp $R2 $R2 + 1
1630     Goto loop
1631   loop2:
1632     IntOp $R2 $R2 + 1
1633     StrCpy $R0 $CMDLINE 1 $R2
1634     StrCmp $R0 " " loop2
1635   StrCpy $R0 $CMDLINE "" $R2
1636   Pop $R2
1637   Pop $R1
1638   Exch $R0
1639 FunctionEnd
1640
1641
1642 ;Check to see if any AFS component is installed
1643 Function IsAnyAFSInstalled
1644
1645 FunctionEnd
1646
1647
1648 ;Install English Language Files
1649 Function AFSLangFiles
1650    ; Common files
1651    SetOutPath "$INSTDIR\Common"
1652    File "${AFS_CLIENT_BUILDDIR}\afs_config.exe"
1653    File "${AFS_CLIENT_BUILDDIR}\afs_shl_ext.dll"
1654    File "${AFS_SERVER_BUILDDIR}\afsadminutil.dll"
1655    File "${AFS_DESTDIR}\lib\afsauthent.dll"
1656    File "${AFS_DESTDIR}\lib\afspthread.dll"
1657    File "${AFS_DESTDIR}\lib\afsrpc.dll"
1658    File "${AFS_SERVER_BUILDDIR}\afsclientadmin.dll"
1659    File "${AFS_SERVER_BUILDDIR}\afsprocmgmt.dll"
1660    File "${AFS_SERVER_BUILDDIR}\afsvosadmin.dll"
1661    File "${AFS_SERVER_BUILDDIR}\TaAfsAppLib.dll"
1662    File "${AFS_SERVER_BUILDDIR}\afsvosadmin.dll"
1663    File "${AFS_SERVER_BUILDDIR}\afsbosadmin.dll"
1664    File "${AFS_SERVER_BUILDDIR}\afscfgadmin.dll"
1665    File "${AFS_SERVER_BUILDDIR}\afskasadmin.dll"
1666    File "${AFS_SERVER_BUILDDIR}\afsptsadmin.dll"
1667 !IFDEF DEBUG
1668 !IFDEF CL1310
1669    File "${AFS_WININSTALL_DIR}\msvcr71d.dll"
1670    File "${AFS_WININSTALL_DIR}\msvcr71d.pdb"
1671 !ELSE
1672    File "${AFS_WININSTALL_DIR}\msvcrtd.dll"
1673    File "${AFS_WININSTALL_DIR}\msvcrtd.pdb"
1674 !ENDIF
1675 !ELSE
1676 !IFDEF CL1310
1677    File "${AFS_WININSTALL_DIR}\msvcr71.dll"
1678 !ELSE
1679    File "${AFS_WININSTALL_DIR}\msvcrt.dll"
1680 !ENDIF
1681 !ENDIF
1682
1683 !ifdef DEBUG
1684    File "${AFS_CLIENT_BUILDDIR}\afs_config.pdb"
1685    File "${AFS_CLIENT_BUILDDIR}\afs_shl_ext.pdb"
1686    File "${AFS_SERVER_BUILDDIR}\afsadminutil.pdb"
1687    File "${AFS_DESTDIR}\lib\afsauthent.pdb"
1688    File "${AFS_DESTDIR}\lib\afspthread.pdb"
1689    File "${AFS_DESTDIR}\lib\afsrpc.pdb"
1690    File "${AFS_SERVER_BUILDDIR}\afsclientadmin.pdb"
1691    File "${AFS_SERVER_BUILDDIR}\afsprocmgmt.pdb"
1692    File "${AFS_SERVER_BUILDDIR}\afsvosadmin.pdb"
1693    File "${AFS_SERVER_BUILDDIR}\TaAfsAppLib.pdb"
1694    File "${AFS_SERVER_BUILDDIR}\afsvosadmin.pdb"
1695    File "${AFS_SERVER_BUILDDIR}\afsbosadmin.pdb"
1696    File "${AFS_SERVER_BUILDDIR}\afscfgadmin.pdb"
1697    File "${AFS_SERVER_BUILDDIR}\afskasadmin.pdb"
1698    File "${AFS_SERVER_BUILDDIR}\afsptsadmin.pdb"
1699 !endif
1700
1701    StrCmp $LANGUAGE ${LANG_ENGLISH} DoEnglish
1702    StrCmp $LANGUAGE ${LANG_GERMAN} DoGerman
1703    StrCmp $LANGUAGE ${LANG_SPANISH} DoSpanish
1704    StrCmp $LANGUAGE ${LANG_JAPANESE} DoJapanese
1705    ;StrCmp $LANGUAGE ${LANG_KOREAN} DoKorean
1706    StrCmp $LANGUAGE ${LANG_PORTUGUESEBR} DoPortugueseBR
1707    StrCmp $LANGUAGE ${LANG_SIMPCHINESE} DoSimpChinese
1708    StrCmp $LANGUAGE ${LANG_TRADCHINESE} DoTradChinese
1709    
1710 DoEnglish:
1711
1712    SetOutPath "$INSTDIR\Documentation"
1713    File "..\..\doc\install\Documentation\en_US\README.TXT"
1714
1715    SetOutPath "$INSTDIR\Common"
1716    File "${AFS_CLIENT_BUILDDIR}\afs_config_1033.dll"
1717    File "${AFS_CLIENT_BUILDDIR}\afs_shl_ext_1033.dll"
1718    File "${AFS_CLIENT_BUILDDIR}\afscreds_1033.dll"
1719    File "${AFS_CLIENT_BUILDDIR}\afs_cpa_1033.dll"
1720    File "${AFS_SERVER_BUILDDIR}\afseventmsg_1033.dll"
1721    ;File "${AFS_SERVER_BUILDDIR}\afs_setup_utils_1033.dll"
1722    File "${AFS_SERVER_BUILDDIR}\afsserver_1033.dll"
1723    File "${AFS_SERVER_BUILDDIR}\afssvrcfg_1033.dll"
1724    File "${AFS_SERVER_BUILDDIR}\TaAfsAccountManager_1033.dll"
1725    File "${AFS_SERVER_BUILDDIR}\TaAfsAppLib_1033.dll"
1726    File "${AFS_SERVER_BUILDDIR}\TaAfsServerManager_1033.dll"
1727    File "..\..\doc\help\en_US\afs-cc.CNT"
1728    File "..\..\doc\help\en_US\afs-cc.hlp"
1729    File "..\..\doc\help\en_US\afs-light.CNT"
1730    File "..\..\doc\help\en_US\afs-light.hlp"
1731    File "..\..\doc\help\en_US\afs-nt.CNT"
1732    File "..\..\doc\help\en_US\afs-nt.HLP"
1733    File "..\..\doc\help\en_US\taafscfg.CNT"
1734    File "..\..\doc\help\en_US\taafscfg.hlp"
1735    File "..\..\doc\help\en_US\taafssvrmgr.CNT"
1736    File "..\..\doc\help\en_US\taafssvrmgr.hlp"
1737    File "..\..\doc\help\en_US\taafsusrmgr.CNT"
1738    File "..\..\doc\help\en_US\taafsusrmgr.hlp"
1739    goto done
1740
1741 DoGerman:
1742
1743    SetOutPath "$INSTDIR\Documentation"
1744    File "..\..\doc\install\Documentation\de_DE\README.TXT"
1745
1746    SetOutPath "$INSTDIR\Common"
1747    File "${AFS_CLIENT_BUILDDIR}\afs_config_1032.dll"
1748    File "${AFS_CLIENT_BUILDDIR}\afs_shl_ext_1032.dll"
1749    File "${AFS_CLIENT_BUILDDIR}\afscreds_1032.dll"
1750    File "${AFS_CLIENT_BUILDDIR}\afs_cpa_1032.dll"
1751    File "${AFS_SERVER_BUILDDIR}\afseventmsg_1032.dll"
1752    ;File "${AFS_SERVER_BUILDDIR}\afs_setup_utils_1032.dll"
1753    File "${AFS_SERVER_BUILDDIR}\afsserver_1032.dll"
1754    File "${AFS_SERVER_BUILDDIR}\afssvrcfg_1032.dll"
1755    File "${AFS_SERVER_BUILDDIR}\TaAfsAccountManager_1032.dll"
1756    File "${AFS_SERVER_BUILDDIR}\TaAfsAppLib_1032.dll"
1757    File "${AFS_SERVER_BUILDDIR}\TaAfsServerManager_1032.dll"
1758    File "..\..\doc\help\de_DE\afs-cc.CNT"
1759    File "..\..\doc\help\de_DE\afs-cc.hlp"
1760    File "..\..\doc\help\de_DE\afs-light.CNT"
1761    File "..\..\doc\help\de_DE\afs-light.hlp"
1762    File "..\..\doc\help\de_DE\afs-nt.CNT"
1763    File "..\..\doc\help\de_DE\afs-nt.HLP"
1764    File "..\..\doc\help\de_DE\taafscfg.CNT"
1765    File "..\..\doc\help\de_DE\taafscfg.hlp"
1766    File "..\..\doc\help\de_DE\taafssvrmgr.CNT"
1767    File "..\..\doc\help\de_DE\taafssvrmgr.hlp"
1768    File "..\..\doc\help\de_DE\taafsusrmgr.CNT"
1769    File "..\..\doc\help\de_DE\taafsusrmgr.hlp"
1770
1771 !ifdef DEBUG
1772    ;File "${AFS_CLIENT_BUILDDIR}\afs_config_1033.pdb"
1773    ;File "${AFS_CLIENT_BUILDDIR}\afs_shl_ext_1033.pdb"
1774    ;File "${AFS_CLIENT_BUILDDIR}\afscreds_1033.pdb"
1775    ;File "${AFS_CLIENT_BUILDDIR}\afs_cpa_1033.pdb"
1776    ;File "${AFS_SERVER_BUILDDIR}\afseventmsg_1033.pdb"
1777    ;File "${AFS_SERVER_BUILDDIR}\afsserver_1033.pdb"
1778    ;File "${AFS_SERVER_BUILDDIR}\afssvrcfg_1033.pdb"
1779    ;File "${AFS_SERVER_BUILDDIR}\TaAfsAccountManager_1033.pdb"
1780    ;File "${AFS_SERVER_BUILDDIR}\TaAfsAppLib_1033.pdb"
1781    ;File "${AFS_SERVER_BUILDDIR}\TaAfsServerManager_1033.pdb"
1782 !IFDEF CL1310
1783    File "${AFS_WININSTALL_DIR}\msvcr71d.dll"
1784    File "${AFS_WININSTALL_DIR}\msvcr71d.pdb"
1785 !ELSE
1786    File "${AFS_WININSTALL_DIR}\msvcrtd.dll"
1787    File "${AFS_WININSTALL_DIR}\msvcrtd.pdb"
1788 !ENDIF
1789 !endif
1790    goto done   
1791
1792 DoSpanish:
1793
1794    SetOutPath "$INSTDIR\Documentation"
1795    File "..\..\doc\install\Documentation\es_ES\README.TXT"
1796
1797    SetOutPath "$INSTDIR\Common"
1798    File "${AFS_CLIENT_BUILDDIR}\afs_config_1034.dll"
1799    File "${AFS_CLIENT_BUILDDIR}\afs_shl_ext_1034.dll"
1800    File "${AFS_CLIENT_BUILDDIR}\afscreds_1034.dll"
1801    File "${AFS_CLIENT_BUILDDIR}\afs_cpa_1034.dll"
1802    File "${AFS_SERVER_BUILDDIR}\afseventmsg_1034.dll"
1803    ;File "${AFS_SERVER_BUILDDIR}\afs_setup_utils_1034.dll"
1804    File "${AFS_SERVER_BUILDDIR}\afsserver_1034.dll"
1805    File "${AFS_SERVER_BUILDDIR}\afssvrcfg_1034.dll"
1806    File "${AFS_SERVER_BUILDDIR}\TaAfsAccountManager_1034.dll"
1807    File "${AFS_SERVER_BUILDDIR}\TaAfsAppLib_1034.dll"
1808    File "${AFS_SERVER_BUILDDIR}\TaAfsServerManager_1034.dll"
1809    File "..\..\doc\help\es_ES\afs-cc.CNT"
1810    File "..\..\doc\help\es_ES\afs-cc.hlp"
1811    File "..\..\doc\help\es_ES\afs-light.CNT"
1812    File "..\..\doc\help\es_ES\afs-light.hlp"
1813    File "..\..\doc\help\es_ES\afs-nt.CNT"
1814    File "..\..\doc\help\es_ES\afs-nt.HLP"
1815    File "..\..\doc\help\es_ES\taafscfg.CNT"
1816    File "..\..\doc\help\es_ES\taafscfg.hlp"
1817    File "..\..\doc\help\es_ES\taafssvrmgr.CNT"
1818    File "..\..\doc\help\es_ES\taafssvrmgr.hlp"
1819    File "..\..\doc\help\es_ES\taafsusrmgr.CNT"
1820    File "..\..\doc\help\es_ES\taafsusrmgr.hlp"
1821    goto done
1822
1823 DoJapanese:
1824
1825    SetOutPath "$INSTDIR\Documentation"
1826    File "..\..\doc\install\Documentation\ja_JP\README.TXT"
1827
1828    SetOutPath "$INSTDIR\Common"
1829    File "${AFS_CLIENT_BUILDDIR}\afs_config_1041.dll"
1830    File "${AFS_CLIENT_BUILDDIR}\afs_shl_ext_1041.dll"
1831    File "${AFS_CLIENT_BUILDDIR}\afscreds_1041.dll"
1832    File "${AFS_CLIENT_BUILDDIR}\afs_cpa_1041.dll"
1833    File "${AFS_SERVER_BUILDDIR}\afseventmsg_1041.dll"
1834    ;File "${AFS_SERVER_BUILDDIR}\afs_setup_utils_1041.dll"
1835    File "${AFS_SERVER_BUILDDIR}\afsserver_1041.dll"
1836    File "${AFS_SERVER_BUILDDIR}\afssvrcfg_1041.dll"
1837    File "${AFS_SERVER_BUILDDIR}\TaAfsAccountManager_1041.dll"
1838    File "${AFS_SERVER_BUILDDIR}\TaAfsAppLib_1041.dll"
1839    File "${AFS_SERVER_BUILDDIR}\TaAfsServerManager_1041.dll"
1840    File "..\..\doc\help\ja_JP\afs-cc.CNT"
1841    File "..\..\doc\help\ja_JP\afs-cc.hlp"
1842    File "..\..\doc\help\ja_JP\afs-light.CNT"
1843    File "..\..\doc\help\ja_JP\afs-light.hlp"
1844    File "..\..\doc\help\ja_JP\afs-nt.CNT"
1845    File "..\..\doc\help\ja_JP\afs-nt.HLP"
1846    File "..\..\doc\help\ja_JP\taafscfg.CNT"
1847    File "..\..\doc\help\ja_JP\taafscfg.hlp"
1848    File "..\..\doc\help\ja_JP\taafssvrmgr.CNT"
1849    File "..\..\doc\help\ja_JP\taafssvrmgr.hlp"
1850    File "..\..\doc\help\ja_JP\taafsusrmgr.CNT"
1851    File "..\..\doc\help\ja_JP\taafsusrmgr.hlp"
1852    goto done
1853    
1854 DoKorean:
1855
1856    SetOutPath "$INSTDIR\Documentation"
1857    File "..\..\doc\install\Documentation\ko_KR\README.TXT"
1858
1859    SetOutPath "$INSTDIR\Common"
1860    File "${AFS_CLIENT_BUILDDIR}\afs_config_1042.dll"
1861    File "${AFS_CLIENT_BUILDDIR}\afs_shl_ext_1042.dll"
1862    File "${AFS_CLIENT_BUILDDIR}\afscreds_1042.dll"
1863    File "${AFS_CLIENT_BUILDDIR}\afs_cpa_1042.dll"
1864    File "${AFS_SERVER_BUILDDIR}\afseventmsg_1042.dll"
1865    ;File "${AFS_SERVER_BUILDDIR}\afs_setup_utils_1042.dll"
1866    File "${AFS_SERVER_BUILDDIR}\afsserver_1042.dll"
1867    File "${AFS_SERVER_BUILDDIR}\afssvrcfg_1042.dll"
1868    File "${AFS_SERVER_BUILDDIR}\TaAfsAccountManager_1042.dll"
1869    File "${AFS_SERVER_BUILDDIR}\TaAfsAppLib_1042.dll"
1870    File "${AFS_SERVER_BUILDDIR}\TaAfsServerManager_1042.dll"
1871    File "..\..\doc\help\ko_KR\afs-cc.CNT"
1872    File "..\..\doc\help\ko_KR\afs-cc.hlp"
1873    File "..\..\doc\help\ko_KR\afs-light.CNT"
1874    File "..\..\doc\help\ko_KR\afs-light.hlp"
1875    File "..\..\doc\help\ko_KR\afs-nt.CNT"
1876    File "..\..\doc\help\ko_KR\afs-nt.HLP"
1877    File "..\..\doc\help\ko_KR\taafscfg.CNT"
1878    File "..\..\doc\help\ko_KR\taafscfg.hlp"
1879    File "..\..\doc\help\ko_KR\taafssvrmgr.CNT"
1880    File "..\..\doc\help\ko_KR\taafssvrmgr.hlp"
1881    File "..\..\doc\help\ko_KR\taafsusrmgr.CNT"
1882    File "..\..\doc\help\ko_KR\taafsusrmgr.hlp"
1883    goto done
1884
1885
1886 DoPortugueseBR:
1887
1888    SetOutPath "$INSTDIR\Documentation"
1889    File "..\..\doc\install\Documentation\pt_BR\README.TXT"
1890
1891    SetOutPath "$INSTDIR\Common"
1892    File "${AFS_CLIENT_BUILDDIR}\afs_config_1046.dll"
1893    File "${AFS_CLIENT_BUILDDIR}\afs_shl_ext_1046.dll"
1894    File "${AFS_CLIENT_BUILDDIR}\afscreds_1046.dll"
1895    File "${AFS_CLIENT_BUILDDIR}\afs_cpa_1046.dll"
1896    File "${AFS_SERVER_BUILDDIR}\afseventmsg_1046.dll"
1897    ;File "${AFS_SERVER_BUILDDIR}\afs_setup_utils_1046.dll"
1898    File "${AFS_SERVER_BUILDDIR}\afsserver_1046.dll"
1899    File "${AFS_SERVER_BUILDDIR}\afssvrcfg_1046.dll"
1900    File "${AFS_SERVER_BUILDDIR}\TaAfsAccountManager_1046.dll"
1901    File "${AFS_SERVER_BUILDDIR}\TaAfsAppLib_1046.dll"
1902    File "${AFS_SERVER_BUILDDIR}\TaAfsServerManager_1046.dll"
1903    File "..\..\doc\help\pt_BR\afs-cc.CNT"
1904    File "..\..\doc\help\pt_BR\afs-cc.hlp"
1905    File "..\..\doc\help\pt_BR\afs-light.CNT"
1906    File "..\..\doc\help\pt_BR\afs-light.hlp"
1907    File "..\..\doc\help\pt_BR\afs-nt.CNT"
1908    File "..\..\doc\help\pt_BR\afs-nt.HLP"
1909    File "..\..\doc\help\pt_BR\taafscfg.CNT"
1910    File "..\..\doc\help\pt_BR\taafscfg.hlp"
1911    File "..\..\doc\help\pt_BR\taafssvrmgr.CNT"
1912    File "..\..\doc\help\pt_BR\taafssvrmgr.hlp"
1913    File "..\..\doc\help\pt_BR\taafsusrmgr.CNT"
1914    File "..\..\doc\help\pt_BR\taafsusrmgr.hlp"
1915    goto done
1916    
1917 DoSimpChinese:
1918
1919    SetOutPath "$INSTDIR\Documentation"
1920    File "..\..\doc\install\Documentation\zh_CN\README.TXT"
1921
1922    SetOutPath "$INSTDIR\Common"
1923    File "${AFS_CLIENT_BUILDDIR}\afs_config_2052.dll"
1924    File "${AFS_CLIENT_BUILDDIR}\afs_shl_ext_2052.dll"
1925    File "${AFS_CLIENT_BUILDDIR}\afscreds_2052.dll"
1926    File "${AFS_CLIENT_BUILDDIR}\afs_cpa_2052.dll"
1927    File "${AFS_SERVER_BUILDDIR}\afseventmsg_2052.dll"
1928    ;File "${AFS_SERVER_BUILDDIR}\afs_setup_utils_2052.dll"
1929    File "${AFS_SERVER_BUILDDIR}\afsserver_2052.dll"
1930    File "${AFS_SERVER_BUILDDIR}\afssvrcfg_2052.dll"
1931    File "${AFS_SERVER_BUILDDIR}\TaAfsAccountManager_2052.dll"
1932    File "${AFS_SERVER_BUILDDIR}\TaAfsAppLib_2052.dll"
1933    File "${AFS_SERVER_BUILDDIR}\TaAfsServerManager_2052.dll"
1934    File "..\..\doc\help\zh_CN\afs-cc.CNT"
1935    File "..\..\doc\help\zh_CN\afs-cc.hlp"
1936    File "..\..\doc\help\zh_CN\afs-light.CNT"
1937    File "..\..\doc\help\zh_CN\afs-light.hlp"
1938    File "..\..\doc\help\zh_CN\afs-nt.CNT"
1939    File "..\..\doc\help\zh_CN\afs-nt.HLP"
1940    File "..\..\doc\help\zh_CN\taafscfg.CNT"
1941    File "..\..\doc\help\zh_CN\taafscfg.hlp"
1942    File "..\..\doc\help\zh_CN\taafssvrmgr.CNT"
1943    File "..\..\doc\help\zh_CN\taafssvrmgr.hlp"
1944    File "..\..\doc\help\zh_CN\taafsusrmgr.CNT"
1945    File "..\..\doc\help\zh_CN\taafsusrmgr.hlp"
1946    goto done
1947    
1948 DoTradChinese:
1949
1950    SetOutPath "$INSTDIR\Documentation"
1951    File "..\..\doc\install\Documentation\zh_TW\README.TXT"
1952
1953    SetOutPath "$INSTDIR\Common"
1954    File "${AFS_CLIENT_BUILDDIR}\afs_config_1028.dll"
1955    File "${AFS_CLIENT_BUILDDIR}\afs_shl_ext_1028.dll"
1956    File "${AFS_CLIENT_BUILDDIR}\afscreds_1028.dll"
1957    File "${AFS_CLIENT_BUILDDIR}\afs_cpa_1028.dll"
1958    File "${AFS_SERVER_BUILDDIR}\afseventmsg_1028.dll"
1959    ;File "${AFS_SERVER_BUILDDIR}\afs_setup_utils_1028.dll"
1960    File "${AFS_SERVER_BUILDDIR}\afsserver_1028.dll"
1961    File "${AFS_SERVER_BUILDDIR}\afssvrcfg_1028.dll"
1962    File "${AFS_SERVER_BUILDDIR}\TaAfsAccountManager_1028.dll"
1963    File "${AFS_SERVER_BUILDDIR}\TaAfsAppLib_1028.dll"
1964    File "${AFS_SERVER_BUILDDIR}\TaAfsServerManager_1028.dll"
1965    File "..\..\doc\help\zh_TW\afs-cc.CNT"
1966    File "..\..\doc\help\zh_TW\afs-cc.hlp"
1967    File "..\..\doc\help\zh_TW\afs-light.CNT"
1968    File "..\..\doc\help\zh_TW\afs-light.hlp"
1969    File "..\..\doc\help\zh_TW\afs-nt.CNT"
1970    File "..\..\doc\help\zh_TW\afs-nt.HLP"
1971    File "..\..\doc\help\zh_TW\taafscfg.CNT"
1972    File "..\..\doc\help\zh_TW\taafscfg.hlp"
1973    File "..\..\doc\help\zh_TW\taafssvrmgr.CNT"
1974    File "..\..\doc\help\zh_TW\taafssvrmgr.hlp"
1975    File "..\..\doc\help\zh_TW\taafsusrmgr.CNT"
1976    File "..\..\doc\help\zh_TW\taafsusrmgr.hlp"
1977    goto done
1978    
1979 done:
1980 FunctionEnd
1981
1982
1983
1984 ;====================================================
1985 ; AddToPath - Adds the given dir to the search path.
1986 ;        Input - head of the stack
1987 ;        Note - Win9x systems requires reboot
1988 ;====================================================
1989 Function AddToPath
1990   Exch $0
1991   Push $1
1992   
1993   Call IsNT
1994   Pop $1
1995   StrCmp $1 1 AddToPath_NT
1996     ; Not on NT
1997     StrCpy $1 $WINDIR 2
1998     FileOpen $1 "$1\autoexec.bat" a
1999     FileSeek $1 0 END
2000     GetFullPathName /SHORT $0 $0
2001     FileWrite $1 "$\r$\nSET PATH=%PATH%;$0$\r$\n"
2002     FileClose $1
2003     Goto AddToPath_done
2004
2005   AddToPath_NT:
2006     ReadRegStr $1 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH"
2007     StrCmp $1 "" AddToPath_NTdoIt
2008       StrCpy $0 "$1;$0"
2009       Goto AddToPath_NTdoIt
2010     AddToPath_NTdoIt:
2011       WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH" $0
2012       SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
2013   
2014   AddToPath_done:
2015     Pop $1
2016     Pop $0
2017 FunctionEnd
2018
2019 ;====================================================
2020 ; RemoveFromPath - Remove a given dir from the path
2021 ;     Input: head of the stack
2022 ;====================================================
2023 Function un.RemoveFromPath
2024   Exch $0
2025   Push $1
2026   Push $2
2027   Push $3
2028   Push $4
2029   
2030   Call un.IsNT
2031   Pop $1
2032   StrCmp $1 1 unRemoveFromPath_NT
2033     ; Not on NT
2034     StrCpy $1 $WINDIR 2
2035     FileOpen $1 "$1\autoexec.bat" r
2036     GetTempFileName $4
2037     FileOpen $2 $4 w
2038     GetFullPathName /SHORT $0 $0
2039     StrCpy $0 "SET PATH=%PATH%;$0"
2040     SetRebootFlag true
2041     Goto unRemoveFromPath_dosLoop
2042     
2043     unRemoveFromPath_dosLoop:
2044       FileRead $1 $3
2045       StrCmp $3 "$0$\r$\n" unRemoveFromPath_dosLoop
2046       StrCmp $3 "$0$\n" unRemoveFromPath_dosLoop
2047       StrCmp $3 "$0" unRemoveFromPath_dosLoop
2048       StrCmp $3 "" unRemoveFromPath_dosLoopEnd
2049       FileWrite $2 $3
2050       Goto unRemoveFromPath_dosLoop
2051     
2052     unRemoveFromPath_dosLoopEnd:
2053       FileClose $2
2054       FileClose $1
2055       StrCpy $1 $WINDIR 2
2056       Delete "$1\autoexec.bat"
2057       CopyFiles /SILENT $4 "$1\autoexec.bat"
2058       Delete $4
2059       Goto unRemoveFromPath_done
2060
2061   unRemoveFromPath_NT:
2062     StrLen $2 $0
2063     ReadRegStr $1 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH"
2064     Push $1
2065     Push $0
2066     Call un.StrStr ; Find $0 in $1
2067     Pop $0 ; pos of our dir
2068     IntCmp $0 -1 unRemoveFromPath_done
2069       ; else, it is in path
2070       StrCpy $3 $1 $0 ; $3 now has the part of the path before our dir
2071       IntOp $2 $2 + $0 ; $2 now contains the pos after our dir in the path (';')
2072       IntOp $2 $2 + 1 ; $2 now containts the pos after our dir and the semicolon.
2073       StrLen $0 $1
2074       StrCpy $1 $1 $0 $2
2075       StrCpy $3 "$3$1"
2076
2077       WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH" $3
2078       SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
2079   
2080   unRemoveFromPath_done:
2081     Pop $4
2082     Pop $3
2083     Pop $2
2084     Pop $1
2085     Pop $0
2086 FunctionEnd
2087
2088 ;====================================================
2089 ; IsNT - Returns 1 if the current system is NT, 0
2090 ;        otherwise.
2091 ;     Output: head of the stack
2092 ;====================================================
2093 Function IsNT
2094   Push $0
2095   ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
2096   StrCmp $0 "" 0 IsNT_yes
2097   ; we are not NT.
2098   Pop $0
2099   Push 0
2100   Return
2101
2102   IsNT_yes:
2103     ; NT!!!
2104     Pop $0
2105     Push 1
2106 FunctionEnd
2107
2108 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2109 ; Uninstall sutff
2110 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2111
2112
2113 ;====================================================
2114 ; StrStr - Finds a given string in another given string.
2115 ;               Returns -1 if not found and the pos if found.
2116 ;          Input: head of the stack - string to find
2117 ;                      second in the stack - string to find in
2118 ;          Output: head of the stack
2119 ;====================================================
2120 Function un.StrStr
2121   Push $0
2122   Exch
2123   Pop $0 ; $0 now have the string to find
2124   Push $1
2125   Exch 2
2126   Pop $1 ; $1 now have the string to find in
2127   Exch
2128   Push $2
2129   Push $3
2130   Push $4
2131   Push $5
2132
2133   StrCpy $2 -1
2134   StrLen $3 $0
2135   StrLen $4 $1
2136   IntOp $4 $4 - $3
2137
2138   unStrStr_loop:
2139     IntOp $2 $2 + 1
2140     IntCmp $2 $4 0 0 unStrStrReturn_notFound
2141     StrCpy $5 $1 $3 $2
2142     StrCmp $5 $0 unStrStr_done unStrStr_loop
2143
2144   unStrStrReturn_notFound:
2145     StrCpy $2 -1
2146
2147   unStrStr_done:
2148     Pop $5
2149     Pop $4
2150     Pop $3
2151     Exch $2
2152     Exch 2
2153     Pop $0
2154     Pop $1
2155 FunctionEnd
2156
2157 ;====================================================
2158 ; IsNT - Returns 1 if the current system is NT, 0
2159 ;        otherwise.
2160 ;     Output: head of the stack
2161 ;====================================================
2162 Function un.IsNT
2163   Push $0
2164   ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
2165   StrCmp $0 "" 0 unIsNT_yes
2166   ; we are not NT.
2167   Pop $0
2168   Push 0
2169   Return
2170
2171   unIsNT_yes:
2172     ; NT!!!
2173     Pop $0
2174     Push 1
2175 FunctionEnd
2176
2177 ; AddSharedDLL
2178  ;
2179  ; Increments a shared DLLs reference count.
2180  ; Use by passing one item on the stack (the full path of the DLL).
2181  ;
2182  ; Usage:
2183  ;   Push $SYSDIR\myDll.dll
2184  ;   Call AddSharedDLL
2185  ;
2186
2187  Function AddSharedDLL
2188    Exch $R1
2189    Push $R0
2190    ReadRegDword $R0 HKLM Software\Microsoft\Windows\CurrentVersion\SharedDLLs $R1
2191    IntOp $R0 $R0 + 1
2192    WriteRegDWORD HKLM Software\Microsoft\Windows\CurrentVersion\SharedDLLs $R1 $R0
2193    Pop $R0
2194    Pop $R1
2195  FunctionEnd
2196
2197  
2198 ; un.RemoveSharedDLL
2199  ;
2200  ; Decrements a shared DLLs reference count, and removes if necessary.
2201  ; Use by passing one item on the stack (the full path of the DLL).
2202  ; Note: for use in the main installer (not the uninstaller), rename the
2203  ; function to RemoveSharedDLL.
2204  ;
2205  ; Usage:
2206  ;   Push $SYSDIR\myDll.dll
2207  ;   Call un.RemoveSharedDLL
2208  ;
2209
2210  Function un.RemoveSharedDLL
2211    Exch $R1
2212    Push $R0
2213    ReadRegDword $R0 HKLM Software\Microsoft\Windows\CurrentVersion\SharedDLLs $R1
2214    StrCmp $R0 "" remove
2215      IntOp $R0 $R0 - 1
2216      IntCmp $R0 0 rk rk uk
2217      rk:
2218        DeleteRegValue HKLM Software\Microsoft\Windows\CurrentVersion\SharedDLLs $R1
2219      goto Remove
2220      uk:
2221        WriteRegDWORD HKLM Software\Microsoft\Windows\CurrentVersion\SharedDLLs $R1 $R0
2222      Goto noremove
2223    remove:
2224      Delete /REBOOTOK $R1
2225    noremove:
2226    Pop $R0
2227    Pop $R1
2228  FunctionEnd
2229
2230  Function afs.InstallMSLoopback
2231    ;GetTempFileName $R0
2232    ;File /oname=$R0 "loopback_install.dll"
2233    ;nsExec::Exec "rundll32.exe $R0 doLoopBackEntry quiet"
2234    ;Call GetWindowsVersion
2235    ;Pop $R1
2236    ;StrCmp $R1 "2000" +1 +2
2237    ;nsExec::Exec "rundll32.exe $R0 disableLoopBackEntry"
2238    ;Delete $R0
2239 FunctionEnd
2240
2241
2242
2243 ; GetWindowsVersion
2244 ;
2245 ; Based on Yazno's function, http://yazno.tripod.com/powerpimpit/
2246 ; Updated by Joost Verburg
2247 ;
2248 ; Returns on top of stack
2249 ;
2250 ; Windows Version (95, 98, ME, NT x.x, 2000, XP, 2003)
2251 ; or
2252 ; '' (Unknown Windows Version)
2253 ;
2254 ; Usage:
2255 ;   Call GetWindowsVersion
2256 ;   Pop $R0
2257 ;   ; at this point $R0 is "NT 4.0" or whatnot
2258
2259 Function GetWindowsVersion
2260
2261   Push $R0
2262   Push $R1
2263
2264   ClearErrors
2265
2266   ReadRegStr $R0 HKLM \
2267   "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
2268
2269   IfErrors 0 lbl_winnt
2270   
2271   ; we are not NT
2272   ReadRegStr $R0 HKLM \
2273   "SOFTWARE\Microsoft\Windows\CurrentVersion" VersionNumber
2274
2275   StrCpy $R1 $R0 1
2276   StrCmp $R1 '4' 0 lbl_error
2277
2278   StrCpy $R1 $R0 3
2279
2280   StrCmp $R1 '4.0' lbl_win32_95
2281   StrCmp $R1 '4.9' lbl_win32_ME lbl_win32_98
2282
2283   lbl_win32_95:
2284     StrCpy $R0 '95'
2285   Goto lbl_done
2286
2287   lbl_win32_98:
2288     StrCpy $R0 '98'
2289   Goto lbl_done
2290
2291   lbl_win32_ME:
2292     StrCpy $R0 'ME'
2293   Goto lbl_done
2294
2295   lbl_winnt:
2296
2297   StrCpy $R1 $R0 1
2298
2299   StrCmp $R1 '3' lbl_winnt_x
2300   StrCmp $R1 '4' lbl_winnt_x
2301
2302   StrCpy $R1 $R0 3
2303
2304   StrCmp $R1 '5.0' lbl_winnt_2000
2305   StrCmp $R1 '5.1' lbl_winnt_XP
2306   StrCmp $R1 '5.2' lbl_winnt_2003 lbl_error
2307
2308   lbl_winnt_x:
2309     StrCpy $R0 "NT $R0" 6
2310   Goto lbl_done
2311
2312   lbl_winnt_2000:
2313     Strcpy $R0 '2000'
2314   Goto lbl_done
2315
2316   lbl_winnt_XP:
2317     Strcpy $R0 'XP'
2318   Goto lbl_done
2319
2320   lbl_winnt_2003:
2321     Strcpy $R0 '2003'
2322   Goto lbl_done
2323
2324   lbl_error:
2325     Strcpy $R0 ''
2326   lbl_done:
2327
2328   Pop $R1
2329   Exch $R0
2330
2331 FunctionEnd
2332
2333
2334 ; Author: Lilla (lilla@earthlink.net) 2003-06-13
2335 ; function IsUserAdmin uses plugin \NSIS\PlusgIns\UserInfo.dll
2336 ; This function is based upon code in \NSIS\Contrib\UserInfo\UserInfo.nsi
2337 ; This function was tested under NSIS 2 beta 4 (latest CVS as of this writing).
2338 ;
2339 ; Usage:
2340 ;   Call IsUserAdmin
2341 ;   Pop $R0   ; at this point $R0 is "true" or "false"
2342 ;
2343 Function IsUserAdmin
2344 Push $R0
2345 Push $R1
2346 Push $R2
2347
2348 ClearErrors
2349 UserInfo::GetName
2350 IfErrors Win9x
2351 Pop $R1
2352 UserInfo::GetAccountType
2353 Pop $R2
2354
2355 StrCmp $R2 "Admin" 0 Continue
2356 ; Observation: I get here when running Win98SE. (Lilla)
2357 ; The functions UserInfo.dll looks for are there on Win98 too, 
2358 ; but just don't work. So UserInfo.dll, knowing that admin isn't required
2359 ; on Win98, returns admin anyway. (per kichik)
2360 ; MessageBox MB_OK 'User "$R1" is in the Administrators group'
2361 StrCpy $R0 "true"
2362 Goto Done
2363
2364 Continue:
2365 ; You should still check for an empty string because the functions
2366 ; UserInfo.dll looks for may not be present on Windows 95. (per kichik)
2367 StrCmp $R2 "" Win9x
2368 StrCpy $R0 "false"
2369 ;MessageBox MB_OK 'User "$R1" is in the "$R2" group'
2370 Goto Done
2371
2372 Win9x:
2373 ; comment/message below is by UserInfo.nsi author:
2374 ; This one means you don't need to care about admin or
2375 ; not admin because Windows 9x doesn't either
2376 ;MessageBox MB_OK "Error! This DLL can't run under Windows 9x!"
2377 StrCpy $R0 "false"
2378
2379 Done:
2380 ;MessageBox MB_OK 'User= "$R1"  AccountType= "$R2"  IsUserAdmin= "$R0"'
2381
2382 Pop $R2
2383 Pop $R1
2384 Exch $R0
2385 FunctionEnd