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