3 // Copyright 2000, International Business Machines Corporation and others.
4 // All Rights Reserved.
6 // This software has been released under the terms of the IBM Public
7 // License. For details, see the LICENSE file in the top-level source
8 // directory or online at http://www.openafs.org/dl/license10.html
12 // Include header files
18 ////////////////////// string defines ////////////////////////////
20 // If the user places a file with this name in the same directory as
21 // the setup files, only the client component will be available for
22 // install. The contents of this file are not used.
23 #define ALLOW_ONLY_CLIENT_FLAG_FILENAME "setup.co"
26 #define RELEASE_TYPE_GA "GA"
27 #define RELEASE_TYPE_BETA "Beta"
29 // Client logon dll names
30 #define FULL_CLIENT_LOGON_DLL "Client\\PROGRAM\\afslogon.dll"
31 #define LIGHT_CLIENT_LOGON_DLL "Client\\PROGRAM\\afslog95.dll"
33 // Uninstall log file names for each component
34 #define SERVER_UNINST_LOGFILE_NAME "Server_Uninst.isu"
35 #define CLIENT_UNINST_LOGFILE_NAME "Client_Uninst.isu"
36 #define LIGHT_CLIENT_UNINST_LOGFILE_NAME "Light_Client_Uninst.isu"
37 #define CC_UNINST_LOGFILE_NAME "CC_Uninst.isu"
38 #define DOCS_UNINST_LOGFILE_NAME "Docs_Uninst.isu"
40 // Uninstall dll names for each component
41 #define SERVER_UNINST_DLL_NAME "ServerUninst.dll"
42 #define CLIENT_UNINST_DLL_NAME "ClientUninst.dll"
43 #define CC_UNINST_DLL_NAME "CCUninst.dll"
44 #define LIGHT_CLIENT_UNINST_DLL_NAME "LightClientUninst.dll"
45 #define DOCS_UNINST_DLL_NAME "DocsUninst.dll"
47 // These are the components the user sees
48 #define CLIENT_COMP_NAME "Client"
49 #define LIGHT_CLIENT_COMP_NAME "Light_Client"
50 #define SERVER_COMP_NAME "Server"
51 #define CC_COMP_NAME "Control_Center"
53 // Light Client platform components
54 #define LIGHT95_CLIENT_COMP_NAME "Light_Client\\Win95"
55 #define LIGHT98_CLIENT_COMP_NAME "Light_Client\\Win98"
57 // This is added to autoexec.bat on Win95 systems
58 #define LIGHT95_CLIENT_PROTSEQ "AFS_RPC_PROTSEQ=ncacn_ip_tcp"
60 // Language components
61 #define LANG_COMP_NAME "Languages"
62 #define LANG_ENGLISH_COMP_NAME "Languages\\Lang_English"
63 #define LANG_SIMP_CHINESE_COMP_NAME "Languages\\Lang_Simp_Chinese"
64 #define LANG_TRAD_CHINESE_COMP_NAME "Languages\\Lang_Trad_Chinese"
65 #define LANG_KOREAN_COMP_NAME "Languages\\Lang_Korean"
66 #define LANG_JAPANESE_COMP_NAME "Languages\\Lang_Japanese"
67 #define LANG_GERMAN_COMP_NAME "Languages\\Lang_German"
68 #define LANG_SPANISH_COMP_NAME "Languages\\Lang_Spanish"
69 #define LANG_PORTUGUESE_COMP_NAME "Languages\\Lang_Portuguese"
71 // Documentation components
72 #define DOCS_COMP_NAME "Documentation"
73 #define DOCS_ENGLISH_COMP_NAME "Documentation\\English"
74 #define DOCS_JAPANESE_COMP_NAME "Documentation\\Japanese"
75 #define DOCS_KOREAN_COMP_NAME "Documentation\\Korean"
76 #define DOCS_SIMP_CHINESE_COMP_NAME "Documentation\\Simp_Chinese"
77 #define DOCS_TRAD_CHINESE_COMP_NAME "Documentation\\Trad_Chinese"
78 #define DOCS_GERMAN_COMP_NAME "Documentation\\German"
79 #define DOCS_SPANISH_COMP_NAME "Documentation\\Spanish"
80 #define DOCS_PORTUGUESE_COMP_NAME "Documentation\\Portuguese"
82 // Readme files components
83 #define README_COMP_NAME "Readme"
84 #define README_ENGLISH_COMP_NAME "Readme\\English"
85 #define README_JAPANESE_COMP_NAME "Readme\\Japanese"
86 #define README_KOREAN_COMP_NAME "Readme\\Korean"
87 #define README_SIMP_CHINESE_COMP_NAME "Readme\\Simp_Chinese"
88 #define README_TRAD_CHINESE_COMP_NAME "Readme\\Trad_Chinese"
89 #define README_GERMAN_COMP_NAME "Readme\\German"
90 #define README_SPANISH_COMP_NAME "Readme\\Spanish"
91 #define README_PORTUGUESE_COMP_NAME "Readme\\Portuguese"
94 #define LICENSE_ENGLISH_FILENAME "License\\en_US.rtf"
95 #define LICENSE_JAPANESE_FILENAME "License\\ja_JP.rtf"
96 #define LICENSE_KOREAN_FILENAME "License\\ko_KR.rtf"
97 #define LICENSE_SIMP_CHINESE_FILENAME "License\\zh_CN.rtf"
98 #define LICENSE_TRAD_CHINESE_FILENAME "License\\zh_TW.rtf"
99 #define LICENSE_GERMAN_FILENAME "License\\de_DE.rtf"
100 #define LICENSE_SPANISH_FILENAME "License\\es_ES.rtf"
101 #define LICENSE_PORTUGUESE_FILENAME "License\\pt_BR.rtf"
103 #define SETUP_UTILS_DLL_PATH "InstallUtils.dll"
105 // Some registry keys
106 #define MSUNINSTALL_KEY "\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall"
107 #define COMPANY_REG_KEY "Software\\TransarcCorporation\\"
108 #define CONFIG_INFO_KEY "Software\\AfsPreservedConfigInfo"
110 #define CLIENT_SERVICE_NAME "TransarcAFSDaemon"
112 // Client help file names
113 #define CLIENT_HELP_FILE_NAME "Common\\afs-nt.hlp"
114 #define LIGHT_CLIENT_HELP_FILE_NAME "Common\\afs-light.hlp"
116 #define MAX_STRING_LEN 512
119 #define ACTION_NONE 0
120 #define ACTION_INSTALL 1
121 #define ACTION_REINSTALL 2
122 #define ACTION_UPGRADE 3
123 #define ACTION_DOWNGRADE 4
125 // Documenation start menu info
126 #define DOCUMENTATION_CMD_PATH "Documentation\\Html\\index.htm"
127 #define DOCUMENTATION_ARGS ""
129 #define DOCUMENTATION_LICENSE_PATH "Documentation\\Html\\license.rtf"
131 // Application start menu info
132 #define CFG_WIZARD_CMD_PATH "Server\\usr\\afs\\bin\\afssvrcfg.exe"
133 #define CFG_WIZARD_ARGS "/wizard"
134 #define CREDS_TOOL_CMD_PATH "Client\\Program\\afscreds.exe"
135 #define CREDS_TOOL_ARGS "/show"
136 #define CLIENT_HELP_CMD_PATH "Common\\afs-nt.hlp"
137 #define CLIENT_HELP_ARGS ""
138 #define LIGHT_CLIENT_HELP_CMD_PATH "Common\\afs-light.hlp"
139 #define LIGHT_CLIENT_HELP_ARGS ""
140 #define SERVER_MANAGER_CMD_PATH "Control Center\\TaAfsServerManager.exe"
141 #define SERVER_MANAGER_ARGS ""
142 #define ACCT_MANAGER_CMD_PATH "Control Center\\TaAfsAccountManager.exe"
143 #define ACCT_MANAGER_ARGS ""
145 #define CELLSERVDB_FILENAME "afsdcell.ini"
155 //////////////////// installation declarations ///////////////////
163 string szReleaseType[32];
168 // NOTE: There is a problem with the IS registry set functionality in that if
169 // you specify to write a value under an existing key, at uninstall time
170 // not just the value will be removed, but the KEY AND ALL ITS SUBKEYS
171 // will also be removed. So the registry sets can only be used to
172 // create entries in the registry that are for values under keys that
175 // There are some values that we need to create that live under existing
176 // NT keys, so when we create them we must turn off logging. The
177 // szNoLogRegistrySets tell us which to create without logging.
181 string szCompName[64];
182 string szCompanyName[64];
183 string szProductName[128];
184 VERINFO Ver; // Version of this product
185 VERINFO iVer; // Verison of this product that is already installed
186 string szProductKey[128];
188 string szUninstDllName[64];
189 string szUninstLogfileName[64];
190 string szUninstKey[128];
191 string szAppPath[256]; // Below TARGETDIR
192 string szBinPath[256]; // Path to binaries and uninstall dll
193 BOOL bAddToPath; // TRUE if bin path should be added to path env var
194 string szUninstDisplayName[128];
195 string szRegistrySets[256]; // Comma separated list of registry sets to install
196 string szNoLogRegistrySets[256]; // Comma separated list of registry sets to install without logging
198 BOOL bInstallSucceeded;
203 // ----- DLL function prototypes -----
206 // ----- DLL prototypes -----
208 // your DLL prototypes
209 prototype int InstallUtils.InstallServerService(string);
210 prototype int InstallUtils.InstallClientService(string);
211 prototype int InstallUtils.AddToPath(string);
212 prototype int InstallUtils.AddToNetworkProviderOrder(string);
213 prototype int InstallUtils.CheckIfAdmin();
214 prototype int InstallUtils.SetSilentMode();
215 prototype int InstallUtils.WriteToInstallErrorLog(string);
216 prototype int InstallUtils.RestoreConfigInfo(int);
217 prototype int InstallUtils.Eradicate34Client();
218 prototype int InstallUtils.Upgrade34ClientConfigInfo();
219 prototype int InstallUtils.IsWin98();
220 prototype int InstallUtils.ShowLicense(string,string);
223 // ---- script function prototypes -----
225 // generated by the Project Wizard
226 prototype ShowDialogs();
227 prototype MoveFileData();
228 prototype HandleMoveDataError( NUMBER );
229 prototype ProcessBeforeDataMove(APPINFO POINTER);
230 prototype ProcessAfterDataMove();
231 prototype SetupRegistry();
232 prototype CleanUpInstall();
233 prototype SetupInstall();
234 prototype SetupScreen();
235 prototype CheckRequirements();
236 prototype DialogShowSdWelcome();
237 prototype DialogShowSdAskDestPath();
238 prototype DialogShowSdSetupType();
239 prototype DialogShowSdSelectFolder();
240 prototype DialogShowSdFinishReboot();
242 // your script function prototypes
243 prototype FixTargetPaths();
244 prototype SetupAppInfo();
245 prototype LocalizeComponents();
246 prototype LocalizeComponentStatusText (STRING);
247 prototype InstallApp(APPINFO POINTER);
248 prototype DialogShowSdAskComponentDialog();
249 prototype ShowIsSelected(string);
250 prototype ShowSelectedComponents();
251 prototype ConfigClientService();
252 prototype ConfigServerService();
253 prototype AddPath(string);
254 prototype AddBinPaths();
255 prototype ConfigUninstallDLL(APPINFO POINTER);
256 prototype CreateServerDirs();
257 prototype SetUserVars();
258 prototype SetNetworkProviderOrder();
259 prototype CreateRegistrySets(string);
260 prototype ConfigAfsCreds();
261 prototype GetLicenseFilename(BYREF string);
262 prototype GetNlsComps(BYREF string, BYREF string, BYREF string, BYREF string);
263 prototype DetectInstalledComponents();
264 prototype IsAppInstalled(APPINFO POINTER);
265 prototype ProcessCompsOnCmdLn(string);
266 prototype ParseCommandLine();
267 prototype GetVersionNumber(string);
268 prototype GetInstallAction(string, BOOL, string, string, string, string, APPINFO POINTER);
269 prototype GetInstallActions();
270 prototype ClientSelectedOrInstalled();
271 prototype RenameUninstDll(APPINFO POINTER);
272 prototype RemoveInstalledBits(string);
273 prototype PrepareForWSPPInstall();
274 prototype CreateStartMenuEntries();
275 prototype ShowError(string, int);
276 prototype GetDateTimeString(BYREF string);
277 prototype OnlyInstallingDocs();
278 prototype CreateDirs();
279 prototype AddShortCut(string, string, string, string);
280 prototype CheckCopyCellServDB();
281 prototype RestorePreviousConfigs();
282 prototype RemoveCurrentVersion(APPINFO POINTER);
283 prototype DoesConfigInfoExist(APPINFO POINTER);
284 prototype UnselectComps();
285 prototype AnyNonUpgradableSoftwareInstalled();
286 prototype RemoveAllCurrentVersions();
287 prototype AppVersionOk(BOOL, BOOL, APPINFO POINTER);
288 prototype SetupVerInfo(APPINFO POINTER, string, string, string, string, string, string, BOOL);
289 prototype NotUpgradable(APPINFO POINTER);
290 prototype CompareVersions(APPINFO POINTER);
292 // ----- global variables ------
294 // generated by the Project Wizard
295 BOOL bWin95, bWin98, bWinNT, bIsShellExplorer, bInstallAborted, bIs32BitSetup;
297 STRING svName, svCompany, svSerial;
303 // your global variables
304 APPINFO appFullClient;
305 APPINFO appLightClient;
307 APPINFO appControlCenter;
309 APPINFO POINTER pApp;
311 BOOL bFullClientSel, bServerSel, bCcSel, bLightClientSel, bDocsSel;
312 string szCommonBinPath;
314 BOOL bClientInstalled, bServerInstalled, bCcInstalled, bLightClientInstalled, bDocsInstalled;
315 string szLangComp, szReadmeComp, szDocsComp;
319 BOOL bPreinstallReplace;
322 ////////////////////////////////////////////////////////////////////////////////
324 // Function Name: Template
326 // Description: This dialog will show a dialog template which can be
327 // used for creating any user-defined dialog with the
328 // Windows 95 look and feel.
331 ////////////////////////////////////////////////////////////////////////////////
333 number nvSection,nFileIsLocked;
334 STRING szTemp,szCellName;
336 #define IDC_HOMEPATH 301
337 #define IDC_ROOTPATH 302
338 #define IDC_HOMEDRIVELIST 1007
339 #define IDC_ROOTDRIVELIST 1008
340 #define IDC_ENABLEROOT 1010
341 #define IDC_ENABLEHOME 1011
342 #define IDC_INSTALL 1011
344 #define IDC_CHECK_INSTALL 1018
345 #define IDC_CHECK_WEB 1019
346 #define IDC_CHECK_BROWSEFILE 1020
347 #define IDC_CHECK_PREVIOUSFILE 1021
348 #define IDC_PREVIOUSFILE 1024
349 #define IDC_BROWSE 1025
350 #define IDC_BROWSEFILE 1026
351 #define DLG_TEMPLATE 13029
352 #define DLG_DRIVEPATH 13030
353 #define DLG_CELLSERVDB 13031
354 #define IDC_PATH 13032
356 prototype Logit(STRING);
357 function Logit(szMsg)
361 OpenFileMode(FILE_MODE_APPEND);
362 if (OpenFile (handle, "y:\\dest", "silent.log") < 0) then
363 CreateFile(handle,"y:\\dest", "silent.log");
365 WriteLine(handle,szMsg);
369 prototype Logitn(STRING,NUMBER);
370 function Logitn(szMsg,i)
377 prototype INT GetWebDll.BrowseFile(NUMBER,BYREF STRING,BYREF STRING,NUMBER);
378 prototype INT GetWebDll.GetWebPage(BYREF STRING,BYREF STRING,BYREF STRING);
379 prototype INT GetWebDll.GetUserLogon(BYREF STRING);
380 prototype SetCellServDB(STRING,BYREF NUMBER,BYREF STRING,BYREF STRING,BYREF STRING,BYREF STRING);
381 prototype FormErrorMessage(NUMBER,BYREF STRING);
382 prototype SetHomeRoot( STRING,BYREF STRING,BYREF STRING,BYREF STRING,BYREF STRING );
383 prototype BOOL getWebCellSrvDB(STRING,STRING);
385 prototype BOOL GetDefaultDrive(BYREF NUMBER);
386 function GetDefaultDrive(listAv)
391 listAc = ListCreate (STRINGLIST);
393 SetStatusWindow (50, "Scaning for available Drives...");
394 nResult=GetValidDrivesList (listAc, -1,-1);
395 SetStatusWindow (100, "Completed.");
398 SetStatusWindow(0, "");
399 MessageBox ("Scan Drive Error" , SEVERE);
402 SetStatusWindow(0, "");
403 listAv = ListCreate (STRINGLIST);
404 ListAddString(listAv,"None:",AFTER);
405 ListGetFirstString(listAc, iitem);
407 Sprintf(item,"%c",I);
408 nResult=ListFindString(listAc,item);
409 if nResult==END_OF_LIST then
410 ListAddString(listAv,item+":",AFTER);
412 ListGetNextString(listAc,iitem);
418 function FormErrorMessage(nResult,szResult)
421 case COPY_ERR_CREATEDIR:
422 szResult=TARGETDIR+ "could not be created. Make sure that you have access rights to the target drive.";
423 case COPY_ERR_MEMORY:
424 szResult="The function was unable to allocate the memory required to complete the copy file process. Terminate as many running applications as possible to free memory.";
425 case COPY_ERR_NODISKSPACE:
426 szResult="The function could not find enough disk space on "+TARGETDIR+" to copy the files. Free disk space on the target drive.";
427 case COPY_ERR_OPENINPUT:
428 szResult="The function was unable to open the input file in "+SRCDIR+". Make sure the source file is a valid filename and that both the source file and target directory exist.";
429 case COPY_ERR_OPENOUTPUT:
430 szResult="The function was unable to copy the requested file.";
431 case COPY_ERR_TARGETREADONLY:
432 szResult="The file in "+TARGETDIR+" is read-only. Remove the read-only attribute from the target file and try again.";
434 szResult="Unknown error";
438 function getWebCellSrvDB(szDefaultWeb,szDestFile)
440 STRING szFile,szErrMsg,szURL;
444 SetStatusWindow (50, "Now Downloading CellServDB file...");
445 CreateDir(TARGETDIR);
446 nResult=GetWebPage(szErrMsg,szDestFile,szDefaultWeb);
447 SetStatusWindow (100, "Downloading completed.");
450 SetStatusWindow(0, "");
451 MessageBox (szErrMsg, INFORMATION);
454 // setup default status
455 SetStatusWindow(0, "");
459 // Transfer file to CELLSERVDB
460 prototype BOOL InstallCellServDB(NUMBER,STRING,STRING);
461 function InstallCellServDB(DefaultItem,szDefaultWeb,szDefaultBrowse)
462 STRING szFile,svErrorMessage;
466 nResult=getWebCellSrvDB(szDefaultWeb,TARGETDIR^@CELLSERVDB_CONFIGNAME);
467 case IDC_CHECK_BROWSEFILE:
468 // open file and copy to area
469 ParsePath(szFile,szDefaultBrowse,PATH);
471 ParsePath(szFile,szDefaultBrowse,FILENAME);
472 nResult=CopyFile ( szFile ,@CELLSERVDB_CONFIGNAME );
475 MessageBox ( "CopyFile failed with error code -1!", WARNING );
477 FormErrorMessage(nResult,svErrorMessage);
478 SprintfBox ( WARNING, "",
479 "CopyFile failed!\n\nError code: %ld\nMessage text: %s",
480 nResult, svErrorMessage );
486 case IDC_CHECK_INSTALL: //need to delete because install will never overwrite
488 nResult=CopyFile (@CELLSERVDB_CONFIGNAME,@CELLSERVDB_CONFIGNAME );
491 MessageBox ( "CopyFile failed with error code -1!", WARNING );
493 FormErrorMessage(nResult,svErrorMessage);
494 SprintfBox ( WARNING, "",
495 "CopyFile failed!\n\nError code: %ld\nMessage text: %s",
496 nResult, svErrorMessage );
502 case IDC_CHECK_PREVIOUSFILE:
503 nResult=TRUE;// work is done, it will use previous file
511 // Return TRUE if silent mode active
512 prototype BOOL SilentSetCellServDB(STRING,NUMBER,NUMBER,NUMBER,BYREF STRING,BYREF STRING);
513 function SilentSetCellServDB(szDlg,option,nResult,DefaultItem,szDefaultWeb,szDefaultBrowse)
514 STRING svSection,szTemp;
518 case 0: //READ function
519 if (MODE!=SILENTMODE) then
522 SdMakeName( svSection, szDlg, "", nvSection );
523 SilentReadData( svSection, "Result", DATA_NUMBER,szTemp,nResult);
524 if (nResult!=NEXT) then
527 SilentReadData( svSection, "DefaultItem", DATA_NUMBER,szTemp,DefaultItem);
528 SilentReadData( svSection, "szDefaultWeb", DATA_STRING, szDefaultWeb,nTemp);
529 SilentReadData( svSection, "szDefaultBrowse", DATA_STRING,szDefaultBrowse,nTemp );
530 if (InstallCellServDB(DefaultItem,szDefaultWeb,szDefaultBrowse)==FALSE) then
537 SdMakeName( svSection, szDlg, "", nvSection );
538 SilentWriteData( svSection, "Result", DATA_NUMBER,szTemp, nResult );
539 SilentWriteData( svSection, "DefaultItem", DATA_NUMBER,szTemp, DefaultItem );
540 SilentWriteData( svSection, "szDefaultWeb", DATA_STRING, szDefaultWeb,nTemp );
541 SilentWriteData( svSection, "szDefaultBrowse", DATA_STRING, szDefaultBrowse,nTemp );
546 function SetCellServDB( szTitle,DefaultItem,szPreviousInstall,szDefaultWeb,szDefaultBrowse,szDefaultInstall)
547 STRING szDlg, szTemp,szResult[256],svErrorMessage,szFile,svSection;
548 NUMBER bDone, nId, nMessage, nTemp,AvailableDrives,nResult;
549 INT hwndDlg,hwndItem;
552 szDlg = "DLG_CELLSERVDB";
553 // record data produced by this dialog
554 if SilentSetCellServDB(szDlg,0,nResult,DefaultItem,szDefaultWeb,szDefaultBrowse) then
558 // ensure general initialization is complete
563 if (EzDefineDialog( szDlg, "", "",
564 DLG_CELLSERVDB ) = DLG_ERR) then
568 // Loop in dialog until the user selects a standard button
570 VarSave(SRCTARGETDIR);
577 nId = WaitOnDialog( szDlg );
578 hwndDlg = CmdGetHwndDlg( szDlg );
583 // Initialize List Control
585 CtrlSetState (szDlg, DefaultItem,BUTTON_CHECKED);
586 if !Is(FILE_EXISTS,szPreviousInstall) then
587 hwndItem = GetDlgItem( hwndDlg, IDC_CHECK_PREVIOUSFILE );
588 EnableWindow( hwndItem, FALSE);
590 hwndItem = GetDlgItem( hwndDlg, IDC_PREVIOUSFILE );
591 EnableWindow( hwndItem, DefaultItem==IDC_CHECK_PREVIOUSFILE);
592 hwndItem = GetDlgItem( hwndDlg, IDC_BROWSEFILE );
593 EnableWindow( hwndItem, DefaultItem==IDC_CHECK_BROWSEFILE);
594 hwndItem = GetDlgItem( hwndDlg, IDC_BROWSE );
595 EnableWindow( hwndItem, DefaultItem==IDC_CHECK_BROWSEFILE);
596 hwndItem = GetDlgItem( hwndDlg, IDC_WEB );
597 EnableWindow( hwndItem, DefaultItem==IDC_CHECK_WEB);
598 hwndItem = GetDlgItem( hwndDlg, IDC_INSTALL );
599 EnableWindow( hwndItem, DefaultItem==IDC_CHECK_INSTALL);
600 CtrlSetText (szDlg, IDC_PREVIOUSFILE, szPreviousInstall);
601 CtrlSetText (szDlg, IDC_BROWSEFILE, szDefaultBrowse);
602 CtrlSetText (szDlg, IDC_WEB, szDefaultWeb);
603 CtrlSetText (szDlg, IDC_INSTALL, szDefaultInstall);
605 SdGeneralInit( szDlg, hwndDlg, STYLE_NORMAL, szSdProduct );
607 //This function sets the caption for old style dialogs or
608 //sets the text in the top banner area of win2k style dialogs
609 // SdSetDlgTitle(szDlg, hwndDlg, szTitle); //Version 6.0 only
620 SdError( -1, "DLG_CELLSERVDB" );
625 SdCloseDlg( hwndDlg, nId, bDone );
628 szResult=szDefaultBrowse;
629 szTitle="Select file to be used for CellServDB";
630 nResult=BrowseFile(hwndDlg,szTitle,szResult,256);
631 CtrlSetText (szDlg, IDC_BROWSEFILE, szResult);
632 szDefaultBrowse=szResult;
634 case IDC_CHECK_BROWSEFILE:
635 hwndItem = GetDlgItem( hwndDlg, IDC_BROWSEFILE );
636 EnableWindow( hwndItem, TRUE);
637 hwndItem = GetDlgItem( hwndDlg, IDC_BROWSE );
638 EnableWindow( hwndItem, TRUE);
639 CtrlSetState (szDlg, DefaultItem,BUTTON_UNCHECKED);
640 CtrlSetState (szDlg, nId,BUTTON_CHECKED);
643 hwndItem = GetDlgItem( hwndDlg, IDC_WEB );
644 EnableWindow( hwndItem, FALSE);
645 case IDC_CHECK_PREVIOUSFILE:
646 hwndItem = GetDlgItem( hwndDlg, IDC_PREVIOUSFILE );
647 EnableWindow( hwndItem, FALSE);
648 case IDC_CHECK_INSTALL:
649 hwndItem = GetDlgItem( hwndDlg, IDC_INSTALL);
650 EnableWindow( hwndItem, FALSE);
655 case IDC_CHECK_INSTALL:
656 hwndItem = GetDlgItem( hwndDlg, IDC_INSTALL );
657 EnableWindow( hwndItem, TRUE);
658 CtrlSetState (szDlg, DefaultItem,BUTTON_UNCHECKED);
659 CtrlSetState (szDlg, nId,BUTTON_CHECKED);
661 case IDC_CHECK_BROWSEFILE:
662 hwndItem = GetDlgItem( hwndDlg, IDC_BROWSE );
663 EnableWindow( hwndItem, FALSE);
664 hwndItem = GetDlgItem( hwndDlg, IDC_BROWSEFILE );
665 EnableWindow( hwndItem, FALSE);
667 hwndItem = GetDlgItem( hwndDlg, IDC_WEB );
668 EnableWindow( hwndItem, FALSE);
669 case IDC_CHECK_PREVIOUSFILE:
670 hwndItem = GetDlgItem( hwndDlg, IDC_PREVIOUSFILE );
671 EnableWindow( hwndItem, FALSE);
677 hwndItem = GetDlgItem( hwndDlg, IDC_WEB );
678 EnableWindow( hwndItem, TRUE);
679 CtrlSetState (szDlg, DefaultItem,BUTTON_UNCHECKED);
680 CtrlSetState (szDlg, nId,BUTTON_CHECKED);
682 case IDC_CHECK_BROWSEFILE:
683 hwndItem = GetDlgItem( hwndDlg, IDC_BROWSE );
684 EnableWindow( hwndItem, FALSE);
685 hwndItem = GetDlgItem( hwndDlg, IDC_BROWSEFILE );
686 EnableWindow( hwndItem, FALSE);
687 case IDC_CHECK_INSTALL:
688 hwndItem = GetDlgItem( hwndDlg, IDC_INSTALL);
689 EnableWindow( hwndItem, FALSE);
690 case IDC_CHECK_PREVIOUSFILE:
691 hwndItem = GetDlgItem( hwndDlg, IDC_PREVIOUSFILE );
692 EnableWindow( hwndItem, FALSE);
697 case IDC_CHECK_PREVIOUSFILE:
698 hwndItem = GetDlgItem( hwndDlg, IDC_PREVIOUSFILE );
699 EnableWindow( hwndItem, TRUE);
700 CtrlSetState (szDlg, DefaultItem,BUTTON_UNCHECKED);
701 CtrlSetState (szDlg, nId,BUTTON_CHECKED);
703 case IDC_CHECK_BROWSEFILE:
704 hwndItem = GetDlgItem( hwndDlg, IDC_BROWSE );
705 EnableWindow( hwndItem, FALSE);
706 hwndItem = GetDlgItem( hwndDlg, IDC_BROWSEFILE );
707 EnableWindow( hwndItem, FALSE);
708 case IDC_CHECK_INSTALL:
709 hwndItem = GetDlgItem( hwndDlg, IDC_INSTALL);
710 EnableWindow( hwndItem, FALSE);
712 hwndItem = GetDlgItem( hwndDlg, IDC_WEB );
713 EnableWindow( hwndItem, FALSE);
719 // check standard handling
720 if (SdIsStdButton( nId ) && SdDoStdButton( nId )) then
727 CtrlGetText (szDlg, IDC_BROWSEFILE, szDefaultBrowse);
728 CtrlGetText (szDlg, IDC_WEB, szDefaultWeb);
729 if (nId != NEXT) then
732 if InstallCellServDB(DefaultItem,szDefaultWeb,szDefaultBrowse)==FALSE then
736 ReleaseDialog( szDlg );
737 VarRestore(SRCTARGETDIR);
740 // record data produced by this dialog
741 SilentSetCellServDB(szDlg,1,nId,DefaultItem,szDefaultWeb,szDefaultBrowse);
745 ////////////////////////////////////////////////////////////////////////////////
747 // Function Name: Template
749 // Description: This dialog will show a dialog template which can be
750 // used for creating any user-defined dialog with the
751 // Windows 95 look and feel.
754 ////////////////////////////////////////////////////////////////////////////////
756 prototype BOOL GetUser(BYREF STRING);
758 function GetUser(sUser)
762 nResult=GetUserLogon(sUser);
770 prototype BOOL SetDriveMaps(STRING,STRING,STRING,STRING,STRING);
771 function SetDriveMaps(szPath,szRootDrive,szRootPath,szHomeDrive,szHomePath)
774 VarSave(SRCTARGETDIR);
775 DeleteFile("afsdsbmt.ini");
776 VarRestore(SRCTARGETDIR);
777 CreateFile(handle, szPath, "afsdsbmt.ini");
778 WriteLine(handle, "[AFS Submounts]");
779 if (StrLength(szRootDrive)==2) then
780 WriteLine(handle, "all="+szRootPath);
782 if (StrLength(szHomeDrive)==2) then
783 WriteLine(handle, "home=" + szHomePath);
785 WriteLine(handle, "[AFS Mappings]");
786 if (StrLength(szRootDrive)>0) then
787 WriteLine(handle, szRootDrive+"="+szRootPath);
789 if (StrLength(szHomeDrive)>0) then
790 WriteLine(handle, szHomeDrive+"="+szHomePath);
795 // Return TRUE if silent mode active
796 prototype BOOL SilentSetHomeRoot(STRING,NUMBER,NUMBER,BYREF STRING,BYREF STRING,BYREF STRING,BYREF STRING);
797 function SilentSetHomeRoot(szDlg,option,nResult,szRootDrive,szRootPath,szHomeDrive,szHomePath)
798 STRING svSection,szTemp,szTPath,szTShare,szTDrive,szLogname;
799 NUMBER nTemp,nCount,I;
802 Logitn("SilentSetHomeRoot option=%i",option);
804 case 0: //READ function
805 if (MODE!=SILENTMODE) then
807 endif; // this section is a little more complicated, allowing installation of n mappings
808 SdMakeName( svSection, szDlg, "", nvSection );
809 Logit("SdMakeName="+svSection);
810 SilentReadData( svSection, "Result", DATA_NUMBER,szTemp,nResult);
811 Logitn("nResult=%i",nResult);
812 if (nResult!=NEXT) then
816 SilentReadData( svSection, "Count", DATA_NUMBER, szTemp,nCount);
817 Logitn("nCount=%i",nCount);
821 VarSave(SRCTARGETDIR);
823 DeleteFile("afsdsbmt.ini");
824 VarRestore(SRCTARGETDIR);
825 CreateFile(handle, WINDIR, "afsdsbmt.ini");
826 WriteLine(handle, "[AFS Submounts]");
829 Sprintf(szTemp,"Path_%i",I);
830 Logit("Path="+szTemp);
831 SilentReadData( svSection, szTemp, DATA_STRING, szTPath,nTemp);
832 Logit("TPath="+szTPath);
833 if (szTPath % "%LOGINNAME%") then
834 //Replace loginname with actual loging name
835 nTemp=StrFind(szTPath,"%LOGINNAME%");
836 StrSub(szTemp,szTPath,nTemp+11,StrLength(szTPath));
837 StrSub(szTPath,szTPath,0,nTemp);
838 if (GetUser(szLogname)) then
839 szTPath=szTPath+szLogname+szTemp;
842 Sprintf(szTemp,"Share_%i",I);
843 SilentReadData( svSection, szTemp, DATA_STRING, szTShare,nTemp);
844 WriteLine(handle, szTShare+"="+szTPath);
846 WriteLine(handle, "[AFS Mappings]");
848 Sprintf(szTemp,"Drive_%i",I);
849 SilentReadData( svSection, szTemp, DATA_STRING, szTDrive,nTemp);
850 Sprintf(szTemp,"Path_%i",I);
851 SilentReadData( svSection, szTemp, DATA_STRING, szTPath,nTemp);
852 if (szTPath % "%LOGINNAME%") then
853 //Replace loginname with actual loging name
854 nTemp=StrFind(szTPath,"%LOGINNAME%");
855 StrSub(szTemp,szTPath,nTemp+11,StrLength(szTPath));
856 StrSub(szTPath,szTPath,0,nTemp);
857 if (GetUser(szLogname)) then
858 szTPath=szTPath+szLogname+szTemp;
861 WriteLine(handle, szTDrive+"="+szTPath);
867 SdMakeName( svSection, szDlg, "", nvSection );
869 SilentWriteData( svSection, "Result", DATA_NUMBER,szTemp, nResult );
870 if (StrLength(szRootDrive)==2) then
871 Sprintf(szTemp,"Drive_%i",nCount);
872 SilentWriteData( svSection,szTemp, DATA_STRING,szRootDrive, nTemp );//root drive
873 Sprintf(szTemp,"Path_%i",nCount);
874 SilentWriteData( svSection,szTemp, DATA_STRING,szRootPath, nTemp );//root drive
875 Sprintf(szTemp,"Share_%i",nCount);
876 SilentWriteData( svSection,szTemp, DATA_STRING,"all", nTemp );//root drive
879 if (StrLength(szHomeDrive)==2) then
880 Sprintf(szTemp,"Drive_%i",nCount);
881 SilentWriteData( svSection,szTemp, DATA_STRING,szHomeDrive, nTemp );//root drive
882 Sprintf(szTemp,"Path_%i",nCount);
883 SilentWriteData( svSection,szTemp, DATA_STRING,szHomePath, nTemp );//root drive
884 Sprintf(szTemp,"Share_%i",nCount);
885 SilentWriteData( svSection,szTemp, DATA_STRING,"home", nTemp );//root drive
888 SilentWriteData( svSection, "Count", DATA_NUMBER,szTemp, nCount ); // only two can be defined through Dialog box
889 SetDriveMaps(WINDIR,szRootDrive,szRootPath,szHomeDrive,szHomePath);
894 function SetHomeRoot( szTitle,szRootDrive,szRootPath,szHomeDrive,szHomePath )
896 STRING szDlg, szTemp,svSection;
897 NUMBER bDone, nId, nMessage, nTemp,AvailableDrives,nResult;
898 INT hwndDlg,hwndItem,hwndItem2;
901 szDlg = "DLG_DRIVEPATH";
903 // record data produced by this dialog
904 Logit("SetHomeRoot");
905 if SilentSetHomeRoot(szDlg,0,nResult,szRootDrive,szRootPath,szHomeDrive,szHomePath ) then
909 GetDefaultDrive(AvailableDrives);
910 // ensure general initialization is complete
915 if (EzDefineDialog( szDlg, "", "",
916 DLG_DRIVEPATH ) = DLG_ERR) then
920 // Loop in dialog until the user selects a standard button
925 nId = WaitOnDialog( szDlg );
930 hwndDlg = CmdGetHwndDlg( szDlg );
931 // Initialize List Control
932 nResult=CtrlSetList( szDlg, IDC_HOMEDRIVELIST, AvailableDrives );
933 if (nResult != 0) then
934 // Handle error from CtrlSetList.
935 MessageBox ("Unable to create folder name list.", SEVERE);
938 if (CtrlSetCurSel(szDlg,IDC_HOMEDRIVELIST,szHomeDrive)!=0) then
940 CtrlSetCurSel(szDlg,IDC_HOMEDRIVELIST,szHomeDrive);
943 nResult=CtrlSetList( szDlg, IDC_ROOTDRIVELIST, AvailableDrives );
944 if (nResult != 0) then
945 // Handle error from CtrlSetList.
946 MessageBox ("Unable to create folder name list.", SEVERE);
949 if (CtrlSetCurSel(szDlg,IDC_ROOTDRIVELIST,szRootDrive)!=0) then
951 CtrlSetCurSel(szDlg,IDC_ROOTDRIVELIST,szRootDrive);
954 nResult=CtrlSetText( szDlg, IDC_ROOTPATH,szRootPath );
955 if (nResult != 0) then
956 MessageBox ("Unable to create szRootPath.", SEVERE);
959 nResult=CtrlSetText( szDlg, IDC_HOMEPATH,szHomePath );
960 if (nResult != 0) then
961 MessageBox ("Unable to create szHomePath.", SEVERE);
965 CtrlSetState (szDlg, IDC_ENABLEHOME,BUTTON_CHECKED);
966 CtrlSetState (szDlg, IDC_ENABLEROOT,BUTTON_CHECKED);
967 SdGeneralInit( szDlg, hwndDlg, STYLE_NORMAL, szSdProduct );
969 //This function sets the caption for old style dialogs or
970 //sets the text in the top banner area of win2k style dialogs
972 if (szRootDrive!=szHomeDrive) then
976 MessageBox("Home and Root drives cannot be the same",WARNING);
984 SdError( -1, "DLG_DRIVEPATH" );
989 SdCloseDlg( hwndDlg, nId, bDone );
993 hwndItem = GetDlgItem( hwndDlg, IDC_ROOTDRIVELIST );//get handle of control in custom dialog box
994 hwndItem2 = GetDlgItem( hwndDlg, IDC_ROOTPATH );//get handle of control in custom dialog box
995 if (CtrlGetState (szDlg, nId)==BUTTON_CHECKED) then
996 EnableWindow( hwndItem2, TRUE);
997 EnableWindow( hwndItem, TRUE);
999 EnableWindow( hwndItem2, FALSE);
1000 EnableWindow( hwndItem, FALSE);
1002 case IDC_ENABLEHOME:
1003 hwndItem = GetDlgItem( hwndDlg, IDC_HOMEDRIVELIST );//get handle of control in custom dialog box
1004 hwndItem2 = GetDlgItem( hwndDlg, IDC_HOMEPATH );//get handle of control in custom dialog box
1005 if (CtrlGetState (szDlg, nId)==BUTTON_CHECKED) then
1006 EnableWindow( hwndItem2, TRUE);
1007 EnableWindow( hwndItem, TRUE);
1009 EnableWindow( hwndItem2, FALSE);
1010 EnableWindow( hwndItem, FALSE);
1013 case IDC_HOMEDRIVELIST:
1015 case IDC_ROOTDRIVELIST:
1018 CtrlGetText (szDlg, nId,szHomePath);
1021 CtrlGetText (szDlg, nId,szRootPath);
1024 // check standard handling
1025 if (SdIsStdButton( nId ) && SdDoStdButton( nId )) then
1032 CtrlGetCurSel (szDlg, nId, szRootDrive);
1033 if (CtrlGetState (szDlg, IDC_ENABLEROOT)==BUTTON_UNCHECKED) then
1034 szRootDrive="None:";
1036 CtrlGetCurSel (szDlg, nId, szHomeDrive);
1037 if (CtrlGetState (szDlg, IDC_ENABLEHOME)==BUTTON_UNCHECKED) then
1038 szHomeDrive="None:";
1041 ReleaseDialog( szDlg );
1045 // record data produced by this dialog
1047 SilentSetHomeRoot(szDlg,1,nId,szRootDrive,szRootPath,szHomeDrive,szHomePath );
1049 ListDestroy (AvailableDrives);
1055 // ---- script function prototypes -----
1058 // your script function prototypes
1062 ///////////////////////////////////////////////////////////////////////////////
1066 // The setup begins here by hiding the visible setup
1067 // window. This is done to allow all the titles, images, etc. to
1068 // be established before showing the main window. The setup is
1069 // then performed in a series of calls to script defined functions,
1070 // with error checking at each step.
1072 ///////////////////////////////////////////////////////////////////////////////
1076 Disable( BACKGROUND );
1077 if (UseDLL(SUPPORTDIR ^ SETUP_UTILS_DLL_PATH) < 0) then
1078 ShowError(@SETUPUTILS_NOT_FOUND, SEVERE);
1079 bInstallAborted = TRUE;
1083 ChangeDirectory (SUPPORTDIR);
1084 if (UseDLL("GetWebDLL.dll") != 0) then
1085 MessageBox ("DLL failed.\n\nCouldn't load"+SUPPORTDIR^"GetWebDLL.dll", INFORMATION);
1091 Logit("SetupInstall");
1093 CheckRequirements();
1094 Logit("CheckRequirements");
1097 Logit("ParseCommandLine");
1100 Logit("SetupAppInfo");
1102 LocalizeComponents();
1103 Logit("LocalizeComponents");
1105 DetectInstalledComponents();
1106 Logit("DetectInstalledComponents");
1108 // Can't upgrade, downgrade, or reinstall the light client, so if it is
1109 // already installed, we must abort. This is because on Win9x, we can't
1110 // move in-use files, and so we can't silently uninstall the light client,
1111 // which upgrade, downgrade, and reinstall require.
1112 if (bLightClientInstalled && !bWinNT) then
1113 ShowError(@LIGHT_CLIENT_ALREADY_INSTALLED_MSG, SEVERE);
1114 bInstallAborted = TRUE;
1118 if (AnyNonUpgradableSoftwareInstalled()) then
1119 ShowError(@NON_UPGRADABLE_SOFTWARE_INSTALLED_ERROR_MSG, SEVERE);
1120 bInstallAborted = TRUE;
1124 GetInstallActions();
1126 if (bWSPPInstall) then
1127 SetSilentMode(); // Tells the InstallUtils dll to run silently
1128 PrepareForWSPPInstall();
1130 // Ask user what to install
1132 if (ShowDialogs()<0) goto end_install;
1135 // The AFS path must not contain spaces. AFS code will break if it does.
1136 LongPathToShortPath(TARGETDIR);
1138 // Determine which comps to install to get the proper NLS files.
1139 GetNlsComps(szLangComp, szReadmeComp, szDocsComp, szCodePage);
1145 // Uninstall current versions before we install
1146 RemoveAllCurrentVersions();
1148 // Install the Client
1149 if (bFullClientSel) then
1150 RegDBSetDefaultRoot (HKEY_LOCAL_MACHINE);
1152 if RegDBSetKeyValueEx ("SYSTEM\\CurrentControlSet\\Services\\NetBT\\Parameters"
1153 ,"SmbDeviceEnabled", REGDB_NUMBER, "0", 8) < 0 then
1154 MessageBox ("RegDBCreateKeyEx failed.", SEVERE);
1157 pApp = &appFullClient;
1158 if (InstallApp(pApp) < 0) goto end_install;
1160 if RegDBSetKeyValueEx("SYSTEM\\CurrentControlSet\\Services\\TransarcAFSDaemon\\Parameters","Cell", REGDB_STRING, szCellName, -1) < 0 then
1161 MessageBox ("RegDBCreateKeyEx failed.", SEVERE);
1164 // Install the Light Client
1165 if (bLightClientSel) then
1166 pApp = &appLightClient;
1167 if (InstallApp(pApp) < 0) goto end_install;
1169 EzBatchAddString(LIGHT95_CLIENT_PROTSEQ, "", AFTER | REPLACE);
1173 // Install the Server
1174 if (bServerSel) then
1176 if (InstallApp(pApp) < 0) goto end_install;
1180 // Install the Control Center
1182 pApp = &appControlCenter;
1183 if (InstallApp(pApp) < 0) goto end_install;
1188 appDocs.szCompName = szDocsComp;
1190 if (InstallApp(pApp) < 0) goto end_install;
1193 // If we installed the server, then configure the bos service
1194 if (bServerSel) then
1195 if (ConfigServerService() < 0) goto end_install;
1198 // If we installed the full client, then configure the client service
1199 // and add the NetworkProviderOrder value.
1200 if (bFullClientSel) then
1201 if (ConfigClientService() < 0) goto end_install;
1202 // I'm commenting out the line below. This will result in integrated
1203 // login being off after an install. If you want it to be on after an
1204 // install, then uncomment the line.
1205 // if (SetNetworkProviderOrder() < 0) goto end_install;
1208 if (bFullClientSel || bLightClientSel) then
1212 RestorePreviousConfigs();
1214 AddPath(szCommonBinPath);
1216 // If not only installing docs, then set BATCH_INSTALL to true,
1217 // which will cause setup to want to reboot the computer.
1218 if (OnlyInstallingDocs() == FALSE) then
1219 BATCH_INSTALL = TRUE;
1222 CreateStartMenuEntries();
1224 // if (bFullClientSel || bLightClientSel || bCcSel) then
1225 // CheckCopyCellServDB();
1230 UnUseDLL(SUPPORTDIR^"GetWebDLL.dll");
1231 UnUseDLL(SUPPORTDIR ^ SETUP_UTILS_DLL_PATH);
1235 // If an unrecoverable error occurred, clean up
1236 // the partial installation. Otherwise, exit normally.
1237 if (bInstallAborted) then
1243 ///////////////////////////////////////////////////////////////////////////////
1245 // Function: ShowDialogs
1247 // Purpose: This function manages the display and navigation of
1248 // the standard dialogs that exist in a setup.
1250 ///////////////////////////////////////////////////////////////////////////////
1251 function ShowDialogs()
1252 NUMBER nResult,handle;
1253 STRING szTargetLicense;
1254 STRING szSourceLicense;
1255 STRING sRootDrive,sHomeDrive,userID,rootPath,homePath;
1257 STRING szDefaultWeb,szDefaultBrowse,szDefaultInstall,szPreviousInstall;
1258 STRING szResult[256],svResult;
1261 // beginning of dialogs label
1263 nResult = DialogShowSdWelcome();
1264 if (nResult = BACK) goto Dlg_Start;
1267 // szTargetLicense = DOCUMENTATION_LICENSE_PATH;
1268 // GetLicenseFilename (szSourceLicense);
1269 // Logit("ShowLicense");
1270 // Disable( DIALOGCACHE );
1271 // if (MODE!=SILENTMODE) then
1272 // nResult = ShowLicense(szTargetLicense,szSourceLicense);
1273 // if (nResult = 0) then
1276 // Enable( DIALOGCACHE );
1278 if (nResult = BACK) goto Dlg_Start;
1280 nResult = DialogShowSdAskComponentDialog();
1281 Logit("DialogShowSdAskComponentDialog");
1282 if (nResult = BACK) goto Dlg_License;
1285 nResult = DialogShowSdSelectFolder();
1286 Logit("DialogShowSdSelectFolder");
1287 if (nResult = BACK) goto Dlg_SdCompDlg;
1288 if (bFullClientSel || bLightClientSel) then
1289 szDefaultWeb=@CELLSERVDB_WEB;
1290 szDefaultBrowse=TARGETDIR^"*";
1291 szDefaultInstall=@CELLSERVDB_INSTALL;
1292 szPreviousInstall=WINDIR^@CELLSERVDB_CONFIGNAME;
1293 if (Is(FILE_EXISTS,szPreviousInstall)) then
1294 DefaultItem=IDC_CHECK_PREVIOUSFILE;
1296 DefaultItem=IDC_CHECK_INSTALL;
1298 Dlg_SdSelectCellServDB:
1299 Logit("SetCellServDB-next");
1300 nResult =SetCellServDB("Select AFS Cell Data base (afsdcell.ini)"
1306 Logit("SetCellServDB");
1307 if (nResult=BACK) goto Dlg_SdSelectFolder;
1308 Dlg_SdSelectCellName:
1309 nResult=SdShowDlgEdit1 ("Select AFS Cell Name","A valid cell name should be entered here.\nIf you don't know your cell name, you may enter one after installation using the AFS Control Center.","Enter Cell Name:", szCellName);
1310 if (nResult = BACK) goto Dlg_SdSelectCellName;
1311 if (Is(FILE_EXISTS, WINDIR^"afsdsbmt.ini")) then
1312 Logit("AskYesNo next");
1313 if (AskYesNo("Previous Drive Mapping Configuration already exist.\n\nPress Yes to keep previous configuration\nPress No to change previous configuration.",YES)=YES) then
1322 homePath = "/afs/" + szCellName + "/u/" + userID;
1323 nResult=SetHomeRoot( "Home and Root Drive Assignment\nThese drives will be mapped each time AFS is connected!",sRootDrive,rootPath,sHomeDrive,homePath );
1324 Logit("SetHomeRoot");
1325 if (nResult = BACK) goto Dlg_SdSelectCellServDB;
1327 Logit("ShowDialogs-done");
1332 ///////////////////////////////////////////////////////////////////////////////
1334 // Function: NotUpgradable
1336 // Purpose: This function will return TRUE if the passed in version is not
1339 ///////////////////////////////////////////////////////////////////////////////
1340 function NotUpgradable(pApp)
1342 // The 3.5 beta is not upgradable
1343 // if ((pApp->iVer.nMajorVersion = 3) && (pApp->iVer.nMinorVersion = 5) && (pApp->iVer.nPatchLevel = 0) && (pApp->iVer.szReleaseType = RELEASE_TYPE_BETA)) then
1351 ///////////////////////////////////////////////////////////////////////////////
1353 // Function: AnyNonUpgradableSoftwareInstalled
1355 // Purpose: This function will return TRUE if any non-upgradable software is
1358 ///////////////////////////////////////////////////////////////////////////////
1359 function AnyNonUpgradableSoftwareInstalled()
1361 if (NotUpgradable(&appFullClient) ||
1362 NotUpgradable(&appServer) ||
1363 NotUpgradable(&appControlCenter) ||
1364 NotUpgradable(&appLightClient) ||
1365 NotUpgradable(&appDocs))
1374 ///////////////////////////////////////////////////////////////////////////////
1376 // Function: UnselectComps
1378 // Purpose: This function unselects all of the componenets so that we can
1379 // completely control what gets installed. We will select each
1380 // component at the time when we want to install it.
1382 ///////////////////////////////////////////////////////////////////////////////
1383 function UnselectComps()
1385 ComponentSelectItem(MEDIA, SERVER_COMP_NAME, FALSE);
1386 ComponentSelectItem(MEDIA, CLIENT_COMP_NAME, FALSE);
1387 ComponentSelectItem(MEDIA, LIGHT_CLIENT_COMP_NAME, FALSE);
1388 ComponentSelectItem(MEDIA, CC_COMP_NAME, FALSE);
1389 ComponentSelectItem(MEDIA, DOCS_COMP_NAME, FALSE);
1390 ComponentSelectItem(MEDIA, LANG_COMP_NAME, FALSE);
1391 ComponentSelectItem(MEDIA, LANG_ENGLISH_COMP_NAME, FALSE);
1392 ComponentSelectItem(MEDIA, LANG_SIMP_CHINESE_COMP_NAME, FALSE);
1393 ComponentSelectItem(MEDIA, LANG_TRAD_CHINESE_COMP_NAME, FALSE);
1394 ComponentSelectItem(MEDIA, LANG_KOREAN_COMP_NAME, FALSE);
1395 ComponentSelectItem(MEDIA, LANG_JAPANESE_COMP_NAME, FALSE);
1396 ComponentSelectItem(MEDIA, LANG_GERMAN_COMP_NAME, FALSE);
1397 ComponentSelectItem(MEDIA, LANG_SPANISH_COMP_NAME, FALSE);
1398 ComponentSelectItem(MEDIA, LANG_PORTUGUESE_COMP_NAME, FALSE);
1399 ComponentSelectItem(MEDIA, README_COMP_NAME, FALSE);
1400 ComponentSelectItem(MEDIA, README_ENGLISH_COMP_NAME, FALSE);
1401 ComponentSelectItem(MEDIA, README_JAPANESE_COMP_NAME, FALSE);
1402 ComponentSelectItem(MEDIA, README_KOREAN_COMP_NAME, FALSE);
1403 ComponentSelectItem(MEDIA, README_SIMP_CHINESE_COMP_NAME, FALSE);
1404 ComponentSelectItem(MEDIA, README_TRAD_CHINESE_COMP_NAME, FALSE);
1405 ComponentSelectItem(MEDIA, README_GERMAN_COMP_NAME, FALSE);
1406 ComponentSelectItem(MEDIA, README_SPANISH_COMP_NAME, FALSE);
1407 ComponentSelectItem(MEDIA, README_PORTUGUESE_COMP_NAME, FALSE);
1408 ComponentSelectItem(MEDIA, DOCS_ENGLISH_COMP_NAME, FALSE);
1409 ComponentSelectItem(MEDIA, DOCS_JAPANESE_COMP_NAME, FALSE);
1410 ComponentSelectItem(MEDIA, DOCS_KOREAN_COMP_NAME, FALSE);
1411 ComponentSelectItem(MEDIA, DOCS_SIMP_CHINESE_COMP_NAME, FALSE);
1412 ComponentSelectItem(MEDIA, DOCS_TRAD_CHINESE_COMP_NAME, FALSE);
1413 ComponentSelectItem(MEDIA, DOCS_GERMAN_COMP_NAME, FALSE);
1414 ComponentSelectItem(MEDIA, DOCS_SPANISH_COMP_NAME, FALSE);
1415 ComponentSelectItem(MEDIA, DOCS_PORTUGUESE_COMP_NAME, FALSE);
1419 ///////////////////////////////////////////////////////////////////////////////
1421 // Function: DoesConfigInfoExist
1423 // Purpose: This function determines if config info exists for an app.
1425 ///////////////////////////////////////////////////////////////////////////////
1426 function DoesConfigInfoExist(pApp)
1428 RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
1430 if (RegDBKeyExist(CONFIG_INFO_KEY ^ pApp->szProductName) = 1) then
1438 ///////////////////////////////////////////////////////////////////////////////
1440 // Function: RestorePreviousConfigs
1442 // Purpose: This function restores config info for the apps we just installed.
1444 ///////////////////////////////////////////////////////////////////////////////
1445 function RestorePreviousConfigs()
1447 if (appServer.bInstallSucceeded && DoesConfigInfoExist(&appServer)) then
1448 RestoreConfigInfo(SERVER);
1451 if (appFullClient.bInstallSucceeded) then
1452 if (appFullClient.iVer.szTitle = "3.4a") then
1453 Upgrade34ClientConfigInfo();
1454 elseif (DoesConfigInfoExist(&appFullClient) = TRUE) then
1455 RestoreConfigInfo(CLIENT);
1459 if (appLightClient.bInstallSucceeded && DoesConfigInfoExist(&appLightClient)) then
1460 RestoreConfigInfo(LCLIENT);
1463 // Only restore control center info if client not installed
1464 if (appControlCenter.bInstallSucceeded && !bClientInstalled && !appFullClient.bInstallSucceeded
1465 && DoesConfigInfoExist(&appControlCenter))
1467 RestoreConfigInfo(CC);
1472 ///////////////////////////////////////////////////////////////////////////////
1474 // Function: OnlyInstallingDocs
1476 // Purpose: This function determines if only the doc files are being installed.
1478 ///////////////////////////////////////////////////////////////////////////////
1479 function OnlyInstallingDocs()
1481 if (!bServerSel && !bFullClientSel && !bLightClientSel && !bCcSel && bDocsSel) then
1489 ///////////////////////////////////////////////////////////////////////////////
1491 // Function: CreateDirs
1493 // Purpose: This function creates directories that we don't want IS to make.
1495 ///////////////////////////////////////////////////////////////////////////////
1496 function CreateDirs()
1498 // Turn off logging. It shouldn't be on when this func is called, but we
1499 // turn it off anyway just to make sure. We turn it off so that IS won't
1500 // try to delete the dirs we are about to make during an uninstall. If
1501 // we don't do this, then the first app installed that uses one of these
1502 // dirs will think that it owns that dir and won't know that other apps
1506 // Create the target dir and the shared dirs
1507 CreateDir(TARGETDIR);
1508 CreateDir(TARGETDIR ^ "Documentation");
1509 CreateDir(TARGETDIR ^ "Documentation\\Html");
1510 CreateDir(TARGETDIR ^ "Documentation\\Html\\InstallGd");
1511 CreateDir(TARGETDIR ^ "Documentation\\Html\\ReleaseNotes");
1513 // We need to manually create the Server dir so that if we have to leave
1514 // it behind during an uninstall (so that config info is preserved), IS
1515 // won't complain that it can't be deleted.
1516 if (bServerSel) then
1517 CreateDir(TARGETDIR ^ "Server\\usr\\afs\\bin");
1520 // Docs don't use the common dir
1521 if (OnlyInstallingDocs() = FALSE) then
1522 CreateDir(TARGETDIR ^ "Common");
1527 ///////////////////////////////////////////////////////////////////////////////
1529 // Function: PrepareForWSPPInstall
1531 // Purpose: This function decides what to install when doing a WSPP install.
1533 ///////////////////////////////////////////////////////////////////////////////
1534 function PrepareForWSPPInstall()
1536 SHELL_OBJECT_FOLDER = @WSPP_FOLDER_NAME;
1538 // Never install the Docs during a WSPP install
1539 appDocs.nInstallAction = ACTION_NONE;
1541 // If we have been told to replace any preinstalled software, then set
1542 // our reinstall mechanism in motion.
1543 if (bPreinstallReplace) then
1544 if (bCcInstalled && bCcSel) then
1545 appControlCenter.nInstallAction = ACTION_REINSTALL;
1547 if (bClientInstalled && bFullClientSel) then
1548 appFullClient.nInstallAction = ACTION_REINSTALL;
1550 if (bServerInstalled && bServerSel) then
1551 appServer.nInstallAction = ACTION_REINSTALL;
1553 if (bLightClientInstalled && bLightClientSel) then
1554 appLightClient.nInstallAction = ACTION_REINSTALL;
1557 // If we have been told to not install something that is already
1558 // installed, then do just that.
1559 if (bCcInstalled && bCcSel) then
1562 if (bClientInstalled && bFullClientSel) then
1563 bFullClientSel = FALSE;
1565 if (bServerInstalled && bServerSel) then
1568 if (bLightClientInstalled && bLightClientSel) then
1569 bLightClientSel = FALSE;
1575 ///////////////////////////////////////////////////////////////////////////////
1577 // Function: RemoveCurrentVersion
1579 // Purpose: This function removes the currently installed version of the app.
1580 // It provides a message to the user so they know what is going on.
1582 ///////////////////////////////////////////////////////////////////////////////
1583 function RemoveCurrentVersion(pApp)
1589 switch(pApp->nInstallAction)
1590 case ACTION_REINSTALL: szFormat = @REINSTALL_PREP_MSG;
1591 case ACTION_UPGRADE: szFormat = @UPGRADE_PREP_MSG;
1592 case ACTION_DOWNGRADE: szFormat = @DOWNGRADE_PREP_MSG;
1595 if (szFormat == "") then
1599 Sprintf(szMsg, szFormat, pApp->szProductName);
1601 if (!bWSPPInstall) then
1602 SdShowMsg(szMsg, TRUE);
1605 RemoveInstalledBits(pApp->szProductName);
1607 if (!bWSPPInstall) then
1608 SdShowMsg(szMsg, FALSE);
1613 ///////////////////////////////////////////////////////////////////////////////
1615 // Function: RemoveAllCurrentVersions
1617 // Purpose: This function removes the current install of all apps that are
1618 // begin reinstalled, upgraded, or downgraded.
1620 ///////////////////////////////////////////////////////////////////////////////
1621 function RemoveAllCurrentVersions()
1623 if (bFullClientSel) then
1624 RemoveCurrentVersion(&appFullClient);
1627 if (bServerSel) then
1628 RemoveCurrentVersion(&appServer);
1632 RemoveCurrentVersion(&appControlCenter);
1635 if (bLightClientSel) then
1636 RemoveCurrentVersion(&appLightClient);
1641 ///////////////////////////////////////////////////////////////////////////////
1643 // Function: InstallApp
1645 // Purpose: This function installs an application that is part of a suite.
1647 ///////////////////////////////////////////////////////////////////////////////
1648 function InstallApp(pApp)
1651 if (pApp->nInstallAction = ACTION_NONE) then
1655 // Start fresh with nothing selected
1658 // Select the comps we want to install. We will install the passed in app
1659 // as well as the comps that are shared by all the apps. Because of weird
1660 // IS stuff, the app comp must be selected last else IS will autoselect
1661 // things we don't want.
1662 ComponentSelectItem(MEDIA, szReadmeComp, TRUE);
1664 // Lang comps are shared by all apps except the docs app
1665 if (pApp != &appDocs) then
1666 ComponentSelectItem(MEDIA, szLangComp, TRUE);
1669 // Select the app's component
1670 ComponentSelectItem(MEDIA, pApp->szCompName, TRUE);
1672 // MessageBox("Install app: " + pApp->szCompName, INFORMATION);
1674 nResult = ProcessBeforeDataMove(pApp);
1675 if (nResult < 0) goto error;
1677 nResult = MoveFileData();
1678 if (nResult < 0) goto error;
1680 nResult = ProcessAfterDataMove();
1681 if (nResult < 0) goto error;
1683 nResult = CreateRegistrySets(pApp->szRegistrySets);
1684 if (nResult < 0) goto error;
1688 nResult = CreateRegistrySets(pApp->szNoLogRegistrySets);
1689 if (nResult < 0) goto error;
1691 nResult = ConfigUninstallDLL(pApp);
1692 if (nResult < 0) goto error;
1694 AddPath(pApp->szBinPath);
1696 // Now unselect it again
1697 ComponentSelectItem(MEDIA, pApp->szCompName, FALSE);
1699 pApp->bInstallSucceeded = TRUE;
1708 ///////////////////////////////////////////////////////////////////////////////
1710 // Function: ProcessBeforeDataMove
1712 // Purpose: This function performs any necessary operations prior to the
1713 // actual file transfer.
1715 ///////////////////////////////////////////////////////////////////////////////
1716 function ProcessBeforeDataMove(pApp)
1720 // Create app information and App Paths registry keys.
1721 InstallationInfo(pApp->szCompanyName, pApp->szProductName, pApp->Ver.szTitle, pApp->szProductKey);
1723 svLogFile = pApp->szUninstLogfileName;
1725 // Create the uninstall reg key and open the log file
1726 nResult = DeinstallStart(TARGETDIR, svLogFile, pApp->szUninstKey, 0 );
1727 if (nResult < 0) then
1728 ShowError( @ERROR_UNINSTSETUP, WARNING );
1731 szAppPath = pApp->szAppPath;
1733 // Fill in reg values for this apps reg key and uninstall reg key
1734 RegDBSetItem( REGDB_APPPATH, szAppPath );
1735 RegDBSetItem( REGDB_APPPATH_DEFAULT, szAppPath ^ pApp->szProductKey);
1736 RegDBSetItem( REGDB_UNINSTALL_NAME, pApp->szUninstDisplayName);
1743 function ShowIsSelected(comp)
1747 nSel = ComponentIsItemSelected(MEDIA , comp);
1749 str = comp + " is selected.";
1750 MessageBox(str, INFORMATION);
1752 str = comp + " is not selected.";
1757 function ShowSelectedComponents()
1759 // Visible components
1760 ShowIsSelected(CLIENT_COMP_NAME);
1761 ShowIsSelected(LIGHT_CLIENT_COMP_NAME);
1762 ShowIsSelected(SERVER_COMP_NAME);
1763 ShowIsSelected(CC_COMP_NAME);
1764 ShowIsSelected(DOCS_COMP_NAME);
1766 // Language components
1767 ShowIsSelected(LANG_COMP_NAME);
1768 ShowIsSelected(LANG_ENGLISH_COMP_NAME);
1769 ShowIsSelected(LANG_SIMP_CHINESE_COMP_NAME);
1770 ShowIsSelected(LANG_TRAD_CHINESE_COMP_NAME);
1771 ShowIsSelected(LANG_KOREAN_COMP_NAME);
1772 ShowIsSelected(LANG_JAPANESE_COMP_NAME);
1773 ShowIsSelected(LANG_GERMAN_COMP_NAME);
1774 ShowIsSelected(LANG_SPANISH_COMP_NAME);
1775 ShowIsSelected(LANG_PORTUGUESE_COMP_NAME);
1777 // Documentation components
1778 ShowIsSelected(DOCS_ENGLISH_COMP_NAME);
1779 ShowIsSelected(DOCS_JAPANESE_COMP_NAME);
1780 ShowIsSelected(DOCS_KOREAN_COMP_NAME);
1781 ShowIsSelected(DOCS_SIMP_CHINESE_COMP_NAME);
1782 ShowIsSelected(DOCS_TRAD_CHINESE_COMP_NAME);
1783 ShowIsSelected(DOCS_GERMAN_COMP_NAME);
1784 ShowIsSelected(DOCS_SPANISH_COMP_NAME);
1785 ShowIsSelected(DOCS_PORTUGUESE_COMP_NAME);
1787 // Readme files components
1788 ShowIsSelected(README_COMP_NAME);
1789 ShowIsSelected(README_ENGLISH_COMP_NAME);
1790 ShowIsSelected(README_JAPANESE_COMP_NAME);
1791 ShowIsSelected(README_KOREAN_COMP_NAME);
1792 ShowIsSelected(README_SIMP_CHINESE_COMP_NAME);
1793 ShowIsSelected(README_TRAD_CHINESE_COMP_NAME);
1794 ShowIsSelected(README_GERMAN_COMP_NAME);
1795 ShowIsSelected(README_SPANISH_COMP_NAME);
1796 ShowIsSelected(README_PORTUGUESE_COMP_NAME);
1801 ///////////////////////////////////////////////////////////////////////////////
1803 // Function: MoveFileData
1805 // Purpose: This function handles the file transfer for
1808 ///////////////////////////////////////////////////////////////////////////////
1809 function MoveFileData()
1810 NUMBER nResult, nDisk;
1813 if (!bWSPPInstall) then
1814 Enable( INDVFILESTATUS );
1815 SetStatusWindow( 0, "" );
1816 Disable( DIALOGCACHE );
1818 StatusUpdate( ON, 100 );
1821 nResult = ComponentMoveData( MEDIA, nDisk, 0 );
1823 // Reinit this call so the progress indicator resets
1824 ComponentMoveData("", nDisk, 0);
1826 HandleMoveDataError( nResult );
1834 ///////////////////////////////////////////////////////////////////////////////
1836 // Function: HandleMoveDataError
1838 // Purpose: This function handles the error (if any) during the file transfer
1841 ///////////////////////////////////////////////////////////////////////////////
1842 function HandleMoveDataError( nResult )
1843 STRING szErrMsg, svComponent , svFileGroup , svFile;
1854 ComponentError ( MEDIA , svComponent , svFileGroup , svFile , nResult );
1855 szErrMsg = @ERROR_MOVEDATA + "\n\n" +
1856 @ERROR_COMPONENT + " " + svComponent + "\n" +
1857 @ERROR_FILEGROUP + " " + svFileGroup + "\n" +
1858 @ERROR_FILE + " " + svFile;
1859 Sprintf(szMsg, szErrMsg, nResult);
1860 ShowError(szMsg, SEVERE);
1861 bInstallAborted = TRUE;
1868 ///////////////////////////////////////////////////////////////////////////////
1870 // Function: ProcessAfterDataMove
1872 // Purpose: This function performs any necessary operations needed after
1873 // all files have been transferred.
1875 ///////////////////////////////////////////////////////////////////////////////
1876 function ProcessAfterDataMove()
1877 STRING szReferenceFile;
1881 // TO DO : update self-registered files and other processes that
1882 // should be performed after the files have been transferred.
1884 // DeinstallSetReference specifies a file to be checked before
1885 // uninstallation. If the file is in use, uninstallation will not proceed.
1887 // szReferenceFile = svDir ^ pApp->szProductKey; // TO DO : If your file is in a
1888 // subfolder of svDir add that here
1890 // DeinstallSetReference( szReferenceFile );
1896 ///////////////////////////////////////////////////////////////////////////////
1898 // Function: CleanUpInstall
1900 // Purpose: This cleans up the setup. Anything that should
1901 // be released or deleted at the end of the setup should
1904 ///////////////////////////////////////////////////////////////////////////////
1905 function CleanUpInstall()
1908 if (bInstallAborted) then
1912 if (!bWSPPInstall) then
1913 DialogShowSdFinishReboot();
1916 if (BATCH_INSTALL) then // ensure locked files are properly transferred
1917 CommitSharedFiles(0);
1924 ///////////////////////////////////////////////////////////////////////////////
1926 // Function: GetLicenseFilename
1928 // Purpose: This will determine the full path to the appropriate-language
1929 // license on the CD. Will default to English if the locale cannot
1932 ///////////////////////////////////////////////////////////////////////////////
1933 function GetLicenseFilename(szLicense)
1934 number MajorLanguage;
1936 MajorLanguage = SELECTED_LANGUAGE & 255;
1938 switch(MajorLanguage)
1939 case ISLANG_CHINESE:
1940 if (SELECTED_LANGUAGE == ISLANG_CHINESE_TAIWAN) then
1941 szLicense = SRCDIR ^ LICENSE_TRAD_CHINESE_FILENAME;
1943 szLicense = SRCDIR ^ LICENSE_SIMP_CHINESE_FILENAME;
1947 szLicense = SRCDIR ^ LICENSE_KOREAN_FILENAME;
1949 case ISLANG_JAPANESE:
1950 szLicense = SRCDIR ^ LICENSE_JAPANESE_FILENAME;
1953 szLicense = SRCDIR ^ LICENSE_GERMAN_FILENAME;
1955 case ISLANG_PORTUGUESE:
1956 szLicense = SRCDIR ^ LICENSE_PORTUGUESE_FILENAME;
1958 case ISLANG_SPANISH:
1959 szLicense = SRCDIR ^ LICENSE_SPANISH_FILENAME;
1962 szLicense = SRCDIR ^ LICENSE_ENGLISH_FILENAME;
1970 ///////////////////////////////////////////////////////////////////////////////
1972 // Function: GetLanguageComp
1974 // Purpose: This will determine which language the locale is set to. Uses
1975 // this info to determine which lang, readme, and doc comps to
1976 // install. Will default to English if the locale cannot be
1979 ///////////////////////////////////////////////////////////////////////////////
1980 function GetNlsComps(szLangComp, szReadmeComp, szDocsComp, szCodePage)
1981 number MajorLanguage;
1983 MajorLanguage = SELECTED_LANGUAGE & 255;
1985 switch(MajorLanguage)
1986 case ISLANG_CHINESE:
1987 if (SELECTED_LANGUAGE == ISLANG_CHINESE_TAIWAN) then
1988 szLangComp = LANG_TRAD_CHINESE_COMP_NAME;
1989 szReadmeComp = README_TRAD_CHINESE_COMP_NAME;
1990 szDocsComp = DOCS_TRAD_CHINESE_COMP_NAME;
1991 szCodePage = "1028";
1993 szLangComp = LANG_SIMP_CHINESE_COMP_NAME;
1994 szReadmeComp = README_SIMP_CHINESE_COMP_NAME;
1995 szDocsComp = DOCS_SIMP_CHINESE_COMP_NAME;
1996 szCodePage = "2052";
2000 szLangComp = LANG_KOREAN_COMP_NAME;
2001 szReadmeComp = README_KOREAN_COMP_NAME;
2002 szDocsComp = DOCS_KOREAN_COMP_NAME;
2003 szCodePage = "1042";
2005 case ISLANG_JAPANESE:
2006 szLangComp = LANG_JAPANESE_COMP_NAME;
2007 szReadmeComp = README_JAPANESE_COMP_NAME;
2008 szDocsComp = DOCS_JAPANESE_COMP_NAME;
2009 szCodePage = "1041";
2012 szLangComp = LANG_GERMAN_COMP_NAME;
2013 szReadmeComp = README_GERMAN_COMP_NAME;
2014 szDocsComp = DOCS_GERMAN_COMP_NAME;
2015 szCodePage = "1032";
2017 case ISLANG_PORTUGUESE:
2018 szLangComp = LANG_PORTUGUESE_COMP_NAME;
2019 szReadmeComp = README_PORTUGUESE_COMP_NAME;
2020 szDocsComp = DOCS_PORTUGUESE_COMP_NAME;
2021 szCodePage = "1046";
2023 case ISLANG_SPANISH:
2024 szLangComp = LANG_SPANISH_COMP_NAME;
2025 szReadmeComp = README_SPANISH_COMP_NAME;
2026 szDocsComp = DOCS_SPANISH_COMP_NAME;
2027 szCodePage = "1034";
2030 szLangComp = LANG_ENGLISH_COMP_NAME;
2031 szReadmeComp = README_ENGLISH_COMP_NAME;
2032 szDocsComp = DOCS_ENGLISH_COMP_NAME;
2033 szCodePage = "1033";
2041 ///////////////////////////////////////////////////////////////////////////////
2043 // Function: SetupVerInfo
2045 // Purpose: This will initialize the VERINFO structures for a product.
2047 ///////////////////////////////////////////////////////////////////////////////
2048 function SetupVerInfo(pApp, szMajor, szMinor, szPatchLevel, szBetaLevel, szReleaseType, szTitle, bInstalledVerInfo)
2054 StrToNum(nMajor, szMajor);
2055 StrToNum(nMinor, szMinor);
2056 StrToNum(nPatchLevel, szPatchLevel);
2057 StrToNum(nBetaLevel, szBetaLevel);
2059 if (bInstalledVerInfo) then
2060 pApp->iVer.nMajorVersion = nMajor;
2061 pApp->iVer.nMinorVersion = nMinor;
2062 pApp->iVer.nPatchLevel = nPatchLevel;
2063 pApp->iVer.nBetaLevel = nBetaLevel;
2064 pApp->iVer.szReleaseType = szReleaseType;
2065 pApp->iVer.szTitle = szTitle;
2067 pApp->Ver.nMajorVersion = nMajor;
2068 pApp->Ver.nMinorVersion = nMinor;
2069 pApp->Ver.nPatchLevel = nPatchLevel;
2070 pApp->Ver.nBetaLevel = nBetaLevel;
2071 pApp->Ver.szReleaseType = szReleaseType;
2072 pApp->Ver.szTitle = szTitle;
2078 ///////////////////////////////////////////////////////////////////////////////
2080 // Function: FixTargetPaths
2082 // Purpose: This function updates the CommonBinPath and app paths if you
2083 // choose to install to a different directory
2085 ///////////////////////////////////////////////////////////////////////////////
2086 function FixTargetPaths()
2088 // The AFS path must not contain spaces. AFS code will break if it does.
2089 LongPathToShortPath(TARGETDIR);
2091 szCommonBinPath = TARGETDIR ^ "Common";
2094 appFullClient.szAppPath = TARGETDIR ^ "Client";
2095 appFullClient.szBinPath = TARGETDIR ^ "Client\\Program";
2098 appLightClient.szAppPath = TARGETDIR ^ "Client";
2099 appLightClient.szBinPath = TARGETDIR ^ "Client\\Program";
2102 appServer.szAppPath = TARGETDIR ^ "Server";
2103 appServer.szBinPath = TARGETDIR ^ "Server\\usr\\afs\\bin";
2106 appControlCenter.szAppPath = TARGETDIR ^ "Control Center";
2107 appControlCenter.szBinPath = TARGETDIR ^ "Control Center";
2110 appDocs.szAppPath = TARGETDIR ^ "Documentation";
2111 appDocs.szBinPath = TARGETDIR ^ "Documentation";
2116 ///////////////////////////////////////////////////////////////////////////////
2118 // Function: SetupAppInfo
2120 // Purpose: This will initialize the APPINFO structures for each product
2121 // that we can install.
2123 ///////////////////////////////////////////////////////////////////////////////
2124 function SetupAppInfo()
2127 szCommonBinPath = TARGETDIR ^ "Common";
2130 appFullClient.szCompName = CLIENT_COMP_NAME; // Component name
2131 appFullClient.szCompanyName = @COMPANY_NAME;
2132 appFullClient.szProductName = @PRODUCT_NAME_CLIENT;
2133 appFullClient.szProductKey = @PRODUCT_KEY_CLIENT;
2134 appFullClient.bUseUninstDLL = TRUE;
2135 appFullClient.szUninstDllName = CLIENT_UNINST_DLL_NAME;
2136 appFullClient.szUninstLogfileName = CLIENT_UNINST_LOGFILE_NAME;
2137 appFullClient.szUninstKey = @UNINST_KEY_CLIENT;
2138 appFullClient.szAppPath = TARGETDIR ^ "Client";
2139 appFullClient.szBinPath = TARGETDIR ^ "Client\\Program";
2140 appFullClient.bAddToPath = TRUE;
2141 appFullClient.szUninstDisplayName = @UNINST_DISPLAY_NAME_CLIENT;
2142 appFullClient.szRegistrySets = "Client,Full_Client";
2143 appFullClient.szNoLogRegistrySets = "Client_NoUninstall,WinNT_Client_NoUninstall";
2144 appFullClient.bInstallSucceeded = FALSE;
2145 SetupVerInfo(&appFullClient, @PRODUCT_VERSION_MAJOR, @PRODUCT_VERSION_MINOR, @PRODUCT_VERSION_PATCH_LEVEL, @PRODUCT_VERSION_BETA_LEVEL, @PRODUCT_VERSION_RELEASE_TYPE, @PRODUCT_VERSION_TITLE, FALSE);
2149 appLightClient.szCompName = LIGHT95_CLIENT_COMP_NAME;
2150 elseif (bWin98) then
2151 appLightClient.szCompName = LIGHT98_CLIENT_COMP_NAME;
2153 appLightClient.szCompanyName = @COMPANY_NAME;
2154 appLightClient.szProductName = @PRODUCT_NAME_LIGHT_CLIENT;
2155 appLightClient.szProductKey = @PRODUCT_KEY_LIGHT_CLIENT;
2156 appLightClient.bUseUninstDLL = TRUE;
2157 appLightClient.szUninstDllName = LIGHT_CLIENT_UNINST_DLL_NAME;
2158 appLightClient.szUninstLogfileName = LIGHT_CLIENT_UNINST_LOGFILE_NAME;
2159 appLightClient.szUninstKey = @UNINST_KEY_LIGHT_CLIENT;
2160 appLightClient.szAppPath = TARGETDIR ^ "Client";
2161 appLightClient.szBinPath = TARGETDIR ^ "Client\\Program";
2162 appLightClient.bAddToPath = TRUE;
2163 appLightClient.szUninstDisplayName = @UNINST_DISPLAY_NAME_LIGHT_CLIENT;
2164 appLightClient.szRegistrySets = "Client,LightClient";
2165 appLightClient.szNoLogRegistrySets = "Client_NoUninstall";
2166 appLightClient.bInstallSucceeded = FALSE;
2167 SetupVerInfo(&appLightClient, @PRODUCT_VERSION_MAJOR, @PRODUCT_VERSION_MINOR, @PRODUCT_VERSION_PATCH_LEVEL, @PRODUCT_VERSION_BETA_LEVEL, @PRODUCT_VERSION_RELEASE_TYPE, @PRODUCT_VERSION_TITLE, FALSE);
2170 appServer.szCompName = SERVER_COMP_NAME;
2171 appServer.szCompanyName = @COMPANY_NAME;
2172 appServer.szProductName = @PRODUCT_NAME_SERVER;
2173 appServer.szProductKey = @PRODUCT_KEY_SERVER;
2174 appServer.bUseUninstDLL = TRUE;
2175 appServer.szUninstDllName = SERVER_UNINST_DLL_NAME;
2176 appServer.szUninstLogfileName = SERVER_UNINST_LOGFILE_NAME;
2177 appServer.szUninstKey = @UNINST_KEY_SERVER;
2178 appServer.szAppPath = TARGETDIR ^ "Server";
2179 appServer.szBinPath = TARGETDIR ^ "Server\\usr\\afs\\bin";
2180 appServer.bAddToPath = TRUE;
2181 appServer.szUninstDisplayName = @UNINST_DISPLAY_NAME_SERVER;
2182 appServer.szRegistrySets = "Server";
2183 appServer.szNoLogRegistrySets = "";
2184 appServer.bInstallSucceeded = FALSE;
2185 SetupVerInfo(&appServer, @PRODUCT_VERSION_MAJOR, @PRODUCT_VERSION_MINOR, @PRODUCT_VERSION_PATCH_LEVEL, @PRODUCT_VERSION_BETA_LEVEL, @PRODUCT_VERSION_RELEASE_TYPE, @PRODUCT_VERSION_TITLE, FALSE);
2188 appControlCenter.szCompName = CC_COMP_NAME;
2189 appControlCenter.szCompanyName = @COMPANY_NAME;
2190 appControlCenter.szProductName = @PRODUCT_NAME_CC;
2191 appControlCenter.szProductKey = @PRODUCT_KEY_CC;
2192 appControlCenter.bUseUninstDLL = TRUE;
2193 appControlCenter.szUninstDllName = CC_UNINST_DLL_NAME;
2194 appControlCenter.szUninstLogfileName = CC_UNINST_LOGFILE_NAME;
2195 appControlCenter.szUninstKey = @UNINST_KEY_CC;
2196 appControlCenter.szAppPath = TARGETDIR ^ "Control Center";
2197 appControlCenter.szBinPath = TARGETDIR ^ "Control Center";
2198 appControlCenter.bAddToPath = TRUE;
2199 appControlCenter.szUninstDisplayName = @UNINST_DISPLAY_NAME_CC;
2200 appControlCenter.szRegistrySets = "Control_Center";
2201 appControlCenter.szNoLogRegistrySets = "";
2202 appControlCenter.bInstallSucceeded = FALSE;
2203 SetupVerInfo(&appControlCenter, @PRODUCT_VERSION_MAJOR, @PRODUCT_VERSION_MINOR, @PRODUCT_VERSION_PATCH_LEVEL, @PRODUCT_VERSION_BETA_LEVEL, @PRODUCT_VERSION_RELEASE_TYPE, @PRODUCT_VERSION_TITLE, FALSE);
2206 appDocs.szCompName = DOCS_COMP_NAME;
2207 appDocs.szCompanyName = @COMPANY_NAME;
2208 appDocs.szProductName = @PRODUCT_NAME_DOCS;
2209 appDocs.szProductKey = @PRODUCT_KEY_DOCS;
2210 appDocs.bUseUninstDLL = TRUE;
2211 appDocs.szUninstDllName = DOCS_UNINST_DLL_NAME;
2212 appDocs.szUninstLogfileName = DOCS_UNINST_LOGFILE_NAME;
2213 appDocs.szUninstKey = @UNINST_KEY_DOCS;
2214 appDocs.szAppPath = TARGETDIR ^ "Documentation";
2215 appDocs.szBinPath = TARGETDIR ^ "Documentation";
2216 appDocs.bAddToPath = FALSE;
2217 appDocs.szUninstDisplayName = @UNINST_DISPLAY_NAME_DOCS;
2218 appDocs.szRegistrySets = "Docs";
2219 appDocs.szNoLogRegistrySets = "";
2220 appDocs.bInstallSucceeded = FALSE;
2221 SetupVerInfo(&appDocs, @PRODUCT_VERSION_MAJOR, @PRODUCT_VERSION_MINOR, @PRODUCT_VERSION_PATCH_LEVEL, @PRODUCT_VERSION_BETA_LEVEL, @PRODUCT_VERSION_RELEASE_TYPE, @PRODUCT_VERSION_TITLE, FALSE);
2225 ///////////////////////////////////////////////////////////////////////////////
2227 // Function: SetupInstall
2229 // Purpose: This will initialize the setup. Any general initialization
2230 // needed for the installation should be performed here.
2232 ///////////////////////////////////////////////////////////////////////////////
2233 function SetupInstall()
2235 Enable( CORECOMPONENTHANDLING );
2237 szCellName=@CELLNAME_DEFAULT;
2238 bInstallAborted = FALSE;
2240 // Create list of end user selections to be displayed by DialogShowSdStartCopy()
2242 svDir = PROGRAMFILES ^ @DEFAULT_INSTALL_DIR;
2246 SdProductName( @PRODUCT_NAME );
2248 Enable( DIALOGCACHE );
2250 SetDialogTitle(DLG_ASK_YESNO, @TITLE_CAPTIONBAR);
2251 SetDialogTitle(DLG_MSG_INFORMATION, @TITLE_CAPTIONBAR);
2252 SetDialogTitle(DLG_MSG_WARNING, @TITLE_CAPTIONBAR);
2253 SetDialogTitle(DLG_MSG_SEVERE, @TITLE_CAPTIONBAR);
2254 SetDialogTitle(DLG_USER_CAPTION, @TITLE_CAPTIONBAR);
2257 ///////////////////////////////////////////////////////////////////////////////
2259 // Function: SetupScreen
2261 // Purpose: This function establishes the screen look. This includes
2262 // colors, fonts, and text to be displayed.
2264 ///////////////////////////////////////////////////////////////////////////////
2265 function SetupScreen()
2267 Enable( FULLWINDOWMODE );
2268 SetTitle( @TITLE_MAIN, 24, WHITE );
2270 SetTitle( @TITLE_CAPTIONBAR, 0, BACKGROUNDCAPTION ); // Caption bar text.
2272 Enable( BACKGROUND );
2278 ///////////////////////////////////////////////////////////////////////////////
2280 // Function: CheckRequirements
2282 // Purpose: This function checks all minimum requirements for the
2283 // application being installed. If any fail, then the user
2284 // is informed and the setup is terminated.
2286 ///////////////////////////////////////////////////////////////////////////////
2287 function CheckRequirements()
2288 NUMBER nvDx, nvDy, nvResult;
2294 bIsShellExplorer = FALSE;
2296 // Check screen resolution.
2297 GetExtents( nvDx, nvDy );
2299 if (nvDy < 480) then
2300 ShowError( @ERROR_VGARESOLUTION, WARNING );
2304 // set 'setup' operation mode
2305 bIs32BitSetup = TRUE;
2306 GetSystemInfo( ISTYPE, nvResult, svResult );
2307 if (nvResult = 16) then
2308 bIs32BitSetup = FALSE; // running 16-bit setup
2309 return 0; // no additional information required
2312 // --- 32-bit testing after this point ---
2314 // Determine the target system's operating system.
2315 GetSystemInfo( OS, nvResult, svResult );
2317 if (nvResult = IS_WINDOWSNT) then
2318 // Running Windows NT.
2321 // If the user is not an admin, then abort
2322 if (CheckIfAdmin() = -1) then
2323 ShowError(@MUST_BE_AN_ADMIN_MSG, SEVERE);
2327 // Check to see if the shell being used is EXPLORER shell.
2328 if (GetSystemInfo( OSMAJOR, nvResult, svResult ) = 0) then
2329 if (nvResult >= 4) then
2330 bIsShellExplorer = TRUE;
2334 elseif (nvResult = IS_WINDOWS95) then
2335 // IS puts us here even for Win98
2336 if (IsWin98() = 0) then
2342 bIsShellExplorer = TRUE;
2347 ///////////////////////////////////////////////////////////////////////////////
2349 // Function: DialogShowSdWelcome
2351 // Purpose: This function handles the standard welcome dialog.
2354 ///////////////////////////////////////////////////////////////////////////////
2355 function DialogShowSdWelcome()
2357 STRING szTitle, szMsg;
2362 szMsg = @WELCOME_MESSAGE;
2363 nResult = SdWelcome( szTitle, szMsg );
2369 ///////////////////////////////////////////////////////////////////////////////
2371 // Function: DialogShowSdAskDestPath
2373 // Purpose: This function asks the user for the destination folder.
2375 ///////////////////////////////////////////////////////////////////////////////
2376 function DialogShowSdAskDestPath()
2378 STRING szTitle, szMsg;
2384 nResult = SdAskDestPath( szTitle, szMsg, svDir, 0 );
2393 ///////////////////////////////////////////////////////////////////////////////
2395 // Function: GetVersionNumber
2397 // Purpose: This function converts a version number string into an integer.
2399 ///////////////////////////////////////////////////////////////////////////////
2400 function GetVersionNumber(szVerion)
2406 // This code assumes a majorversion.minorversion format.
2409 // This will get everything up to the '.'
2410 StrToNum(nMajorVersion, szVer);
2412 // Delete the part of the string we just converted
2413 StrSub(szVer, szVer, StrFind(szVer, ".") + 1, 64);
2415 // Now convert the part after the '.'
2416 StrToNum(nMinorVersion, szVer);
2418 // Turn in into a single number
2419 nVersion = (nMajorVersion * 10) + nMinorVersion;
2425 ///////////////////////////////////////////////////////////////////////////////
2427 // Function: CompareVersions
2429 // Purpose: This function compares an apps two version info structures and
2430 // determines if one is greater than the other, or if they are equal.
2432 ///////////////////////////////////////////////////////////////////////////////
2433 function CompareVersions(pApp)
2436 // Compare major versions
2437 nResult = pApp->Ver.nMajorVersion - pApp->iVer.nMajorVersion;
2438 if (nResult > 0) then return 1; endif;
2439 if (nResult < 0) then return -1; endif;
2441 // Major versions are equal, move on to minor versions
2442 nResult = pApp->Ver.nMinorVersion - pApp->iVer.nMinorVersion;
2443 if (nResult > 0) then return 1; endif;
2444 if (nResult < 0) then return -1; endif;
2446 // Minor versions are equal, move on to patch level.
2447 nResult = pApp->Ver.nPatchLevel - pApp->iVer.nPatchLevel;
2448 if (nResult > 0) then return 1; endif;
2449 if (nResult < 0) then return -1; endif;
2451 // Patch levels are equal, move on to release type.
2452 if ((pApp->Ver.szReleaseType = RELEASE_TYPE_GA) && (pApp->iVer.szReleaseType = RELEASE_TYPE_BETA)) then return 1; endif;
2453 if ((pApp->Ver.szReleaseType = RELEASE_TYPE_BETA) && (pApp->iVer.szReleaseType = RELEASE_TYPE_GA)) then return -1; endif;
2455 // Release types are equal. Special handling now required:
2457 // If this is a GA release, then there is no more info to look at, and the versions are equal.
2458 if (pApp->Ver.szReleaseType = RELEASE_TYPE_GA) then return 0; endif;
2460 // We have a Beta release, so we still have some info to check. Compare the beta release levels.
2461 nResult = pApp->Ver.nBetaLevel - pApp->iVer.nBetaLevel;
2462 if (nResult > 0) then return 1; endif;
2463 if (nResult < 0) then return -1; endif;
2465 // Beta versions are equal.
2470 ///////////////////////////////////////////////////////////////////////////////
2472 // Function: GetInstallAction
2474 // Purpose: This function decides what install action to perform for a
2475 // component and sets the display name accordingly.
2477 ///////////////////////////////////////////////////////////////////////////////
2478 function GetInstallAction(szCompName, bInstalled, szInstallMsg, szUpgradeMsg, szDowngradeMsg, szReinstallMsg, pApp)
2479 string szDisplayName;
2485 if (bInstalled) then
2486 nResult = CompareVersions(pApp);
2488 if (nResult = 0) then
2489 szDisplayName = szReinstallMsg;
2490 pApp->nInstallAction = ACTION_REINSTALL;
2492 elseif (nResult > 0) then
2493 szDisplayName = szUpgradeMsg;
2494 pApp->nInstallAction = ACTION_UPGRADE;
2495 Sprintf(szVerMsg, " %s", pApp->iVer.szTitle);
2497 else // Trying to install old version on top of new version
2498 szDisplayName = szDowngradeMsg;
2499 pApp->nInstallAction = ACTION_DOWNGRADE;
2500 Sprintf(szVerMsg, " %s", pApp->iVer.szTitle);
2503 szDisplayName = szInstallMsg;
2504 pApp->nInstallAction = ACTION_INSTALL;
2507 szDisplayName = szDisplayName + szVerMsg;
2509 ComponentSetData(MEDIA, szCompName, COMPONENT_FIELD_DISPLAYNAME, 0, szDisplayName);
2515 ///////////////////////////////////////////////////////////////////////////////
2517 // Function: GetInstallActions
2519 // Purpose: This function decides what install action to perform for each
2520 // component and sets the display name accordingly.
2522 ///////////////////////////////////////////////////////////////////////////////
2523 function GetInstallActions()
2525 // Decide what to do for each component and then set the display names appropriately
2526 GetInstallAction(CLIENT_COMP_NAME, bClientInstalled, @INSTALL_CLIENT_MSG, @UPGRADE_CLIENT_MSG, @DOWNGRADE_CLIENT_MSG, @REINSTALL_CLIENT_MSG, &appFullClient);
2527 GetInstallAction(SERVER_COMP_NAME, bServerInstalled, @INSTALL_SERVER_MSG, @UPGRADE_SERVER_MSG, @DOWNGRADE_SERVER_MSG, @REINSTALL_SERVER_MSG, &appServer);
2528 GetInstallAction(CC_COMP_NAME, bCcInstalled, @INSTALL_CC_MSG, @UPGRADE_CC_MSG, @DOWNGRADE_CC_MSG, @REINSTALL_CC_MSG, &appControlCenter);
2529 GetInstallAction(LIGHT_CLIENT_COMP_NAME, bLightClientInstalled, @INSTALL_LIGHT_CLIENT_MSG, @UPGRADE_LIGHT_CLIENT_MSG, @DOWNGRADE_LIGHT_CLIENT_MSG, @REINSTALL_LIGHT_CLIENT_MSG, &appLightClient);
2530 GetInstallAction(DOCS_COMP_NAME, bDocsInstalled, @INSTALL_DOCS_MSG, @UPGRADE_DOCS_MSG, @DOWNGRADE_DOCS_MSG, @REINSTALL_DOCS_MSG, &appDocs);
2533 ///////////////////////////////////////////////////////////////////////////////
2535 // Function: ClientSelectedOrInstalled
2537 // Purpose: This function checks whether or not the client is selected or if
2538 // it is already installed.
2540 ///////////////////////////////////////////////////////////////////////////////
2541 function ClientSelectedOrInstalled()
2543 if (bFullClientSel || bClientInstalled) then
2550 ///////////////////////////////////////////////////////////////////////////////
2552 // Function: AppVersionOk
2554 // Purpose: This function determines if a given app will have the correct
2555 // version after installation.
2557 ///////////////////////////////////////////////////////////////////////////////
2558 function AppVersionOk(bInstalled, bSel, pApp)
2561 // Here's the logic of this:
2563 // 1) If the app is not installed and
2564 // a) it's not being installed, then this app doesn't affect the version
2565 // restrictions, so return true
2566 // b) it will be installed, then it will get the version which this
2567 // installer installs, so the version will be ok
2569 // 2) If the app is installed and
2570 // a) the app is selected for reinstall, upgrade, or downgrade, then the
2571 // newly installed version will be the version this installer installs,
2572 // and so the version will be ok
2573 // b) the app is not selected for reinstall, upgrade, or downgrade, then
2574 // the version is ok only if the app's current version matches the
2575 // the version of this installer
2577 bOk = !bInstalled || bSel || (CompareVersions(pApp) = 0);
2583 ///////////////////////////////////////////////////////////////////////////////
2585 // Function: DialogShowSdAskComponentDialog
2587 // Purpose: This function asks the user which components to install
2588 // and what the destination folder should be.
2590 ///////////////////////////////////////////////////////////////////////////////
2591 function DialogShowSdAskComponentDialog()
2593 STRING szTitle, szMsg, szComponent, szFilename;
2594 BOOL bClient, bServer, bCc, bDocs, bVersionsOK;
2601 // If running WinNT hide the Light Client component. If the user wants to only
2602 // allow client installs, then hide all but the Client component as well. If not
2603 // running on NT, then hide all but the Light Client component.
2605 ComponentSetData(MEDIA, LIGHT_CLIENT_COMP_NAME, COMPONENT_FIELD_VISIBLE, FALSE, "");
2606 ComponentSelectItem(MEDIA, LIGHT_CLIENT_COMP_NAME, FALSE);
2608 if (FindFile(SRCDIR, ALLOW_ONLY_CLIENT_FLAG_FILENAME, szFilename) = 0) then
2609 ComponentSetData(MEDIA, SERVER_COMP_NAME, COMPONENT_FIELD_VISIBLE, FALSE, "");
2610 ComponentSetData(MEDIA, CC_COMP_NAME, COMPONENT_FIELD_VISIBLE, FALSE, "");
2611 ComponentSetData(MEDIA, DOCS_COMP_NAME, COMPONENT_FIELD_VISIBLE, FALSE, "");
2612 ComponentSelectItem(MEDIA, DOCS_COMP_NAME, FALSE);
2614 ComponentSelectItem(MEDIA, SERVER_COMP_NAME, FALSE);
2615 if (@CELLNAME_DEFAULT % ".") then
2616 ComponentSelectItem(MEDIA, CC_COMP_NAME, FALSE);
2618 ComponentSelectItem(MEDIA, CC_COMP_NAME, TRUE);
2621 ComponentSetData(MEDIA, CLIENT_COMP_NAME, COMPONENT_FIELD_VISIBLE, FALSE, "");
2622 ComponentSetData(MEDIA, SERVER_COMP_NAME, COMPONENT_FIELD_VISIBLE, FALSE, "");
2623 ComponentSetData(MEDIA, CC_COMP_NAME, COMPONENT_FIELD_VISIBLE, FALSE, "");
2624 ComponentSetData(MEDIA, DOCS_COMP_NAME, COMPONENT_FIELD_VISIBLE, FALSE, "");
2626 ComponentSelectItem(MEDIA, SERVER_COMP_NAME, FALSE);
2627 ComponentSelectItem(MEDIA, CLIENT_COMP_NAME, FALSE);
2628 ComponentSelectItem(MEDIA, CC_COMP_NAME, FALSE);
2629 ComponentSelectItem(MEDIA, DOCS_COMP_NAME, FALSE);
2633 nResult = SdComponentDialog(szTitle, szMsg, svDir, szComponent);
2635 // Enforce selection rules - something must be selected and
2636 // the client must be selected if the server is. However, take into
2637 // account if it is already installed.
2638 bFullClientSel = ComponentIsItemSelected(MEDIA , CLIENT_COMP_NAME);
2639 bLightClientSel = ComponentIsItemSelected(MEDIA , LIGHT_CLIENT_COMP_NAME);
2640 bServerSel = ComponentIsItemSelected(MEDIA , SERVER_COMP_NAME);
2641 bCcSel = ComponentIsItemSelected(MEDIA , CC_COMP_NAME);
2642 bDocsSel = ComponentIsItemSelected(MEDIA , DOCS_COMP_NAME);
2644 if (!bFullClientSel && !bLightClientSel && !bServerSel && !bCcSel && !bDocsSel) then
2645 ShowError(@NOTHING_SELECTED_MSG, SEVERE);
2649 if (bServerSel && !ClientSelectedOrInstalled()) then
2650 ShowError(@SERVER_NEEDS_CLIENT_MSG, SEVERE);
2654 // Also, if upgrading or downgrading, all apps must be at the same version level.
2655 // We won't upgrade one app to a higer version than another, and we won't downgrade
2656 // one app to a lowel version than another. All must be at the same level when the
2657 // install program is done. This is necessary because the apps share some files.
2661 bClient = AppVersionOk(bClientInstalled, bFullClientSel, &appFullClient);
2662 bServer = AppVersionOk(bServerInstalled, bServerSel, &appServer);
2663 bCc = AppVersionOk(bCcInstalled, bCcSel, &appControlCenter);
2664 bDocs = AppVersionOk(bDocsInstalled, bDocsSel, &appDocs);
2665 bVersionsOK = bClient && bServer && bCc && bDocs;
2668 if (!bVersionsOK) then
2669 ShowError(@APPS_NOT_SAME_VERSION, SEVERE);
2680 ///////////////////////////////////////////////////////////////////////////////
2682 // Function: DialogShowSdSetupType
2684 // Purpose: This function displays the standard setup type dialog.
2686 ///////////////////////////////////////////////////////////////////////////////
2687 function DialogShowSdSetupType()
2688 NUMBER nResult, nType;
2689 STRING szTitle, szMsg, szReserved;
2693 if (svSetupType == "") then
2694 svSetupType = "AFS Server";
2698 szMsg = @SETUP_TYPE_MSG;
2701 nResult = SdSetupTypeEx(szTitle, szMsg, szReserved, svSetupType, 0);
2707 ///////////////////////////////////////////////////////////////////////////////
2709 // Function: DialogShowSdSelectFolder
2711 // Purpose: This function displays the standard folder selection dialog.
2714 ///////////////////////////////////////////////////////////////////////////////
2715 function DialogShowSdSelectFolder()
2717 STRING szTitle, szMsg;
2719 if (SHELL_OBJECT_FOLDER = "") then
2720 SHELL_OBJECT_FOLDER = @FOLDER_NAME;
2723 // We are going to force the user to use the default folder name. This is
2724 // because we create the folder unlogged, and must therefore remove it
2725 // ourselves in our uninstall dll (which we do because IS doesn't handle
2726 // removing them correctly). Therefore, we must know the name of the
2727 // folder so we can remove it during uninstall. Also, the user can install
2728 // the AFS components during several executions of the install program,
2729 // and we don't want to allow them to pick a different folder each time.
2730 // We could solve these problems in code but we don't have time, so we
2731 // are going to force them to use our default folder name.
2736 nResult = SdSelectFolder( szTitle, szMsg, SHELL_OBJECT_FOLDER);
2742 ///////////////////////////////////////////////////////////////////////////////
2744 // Function: DialogShowSdFinishReboot
2746 // Purpose: This function will show the last dialog of the product.
2747 // It will allow the user to reboot and/or show some readme text.
2749 ///////////////////////////////////////////////////////////////////////////////
2750 function DialogShowSdFinishReboot()
2751 NUMBER nResult, nDefOptions;
2752 STRING szTitle, szMsg1, szMsg2, szOption1, szOption2;
2753 NUMBER bOpt1, bOpt2;
2755 if (!BATCH_INSTALL) then
2758 szMsg1 = @SETUP_FINISHED_MSG;
2763 nResult = SdFinish(szTitle, szMsg1, szMsg2, szOption1, szOption2, bOpt1, bOpt2 );
2767 nDefOptions = SYS_BOOTMACHINE;
2771 nResult = SdFinishReboot( szTitle, szMsg1, nDefOptions, szMsg2, 0 );
2777 ///////////////////////////////////////////////////////////////////////////////
2779 // Function: ConfigServerService
2781 // Purpose: This function will configure the AFS Server bos service via the
2784 ///////////////////////////////////////////////////////////////////////////////
2785 function ConfigServerService()
2792 if (!bWSPPInstall) then
2793 szMsg = @CONFIGURING_AFS_SERVER_SERVICE;
2794 SdShowMsg(szMsg, TRUE);
2797 nStatus = RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
2798 if (nStatus < 0) goto error;
2800 nStatus = InstallServerService(TARGETDIR ^ "\\Server\\usr\\afs\\bin\\bosctlsvc.exe");
2801 if (nStatus < 0) goto error;
2806 if (!bWSPPInstall) then
2807 SdShowMsg(szMsg, FALSE);
2811 Sprintf(szMsg, @AFS_SERVER_SERVICE_INSTALL_ERROR, nStatus);
2812 ShowError(szMsg, SEVERE);
2813 bInstallAborted = TRUE;
2821 ///////////////////////////////////////////////////////////////////////////////
2823 // Function: ConfigClientService
2825 // Purpose: This function will configure the AFS Client service via the SCM.
2827 ///////////////////////////////////////////////////////////////////////////////
2828 function ConfigClientService()
2835 if (!bWSPPInstall) then
2836 szMsg = @CONFIGURING_AFS_CLIENT_SERVICE;
2837 SdShowMsg(szMsg, TRUE);
2840 nStatus = RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
2841 if (nStatus < 0) goto error;
2843 nStatus = InstallClientService(TARGETDIR ^ "\\Client\\Program\\afsd_service.exe");
2844 if (nStatus < 0) goto error;
2849 if (!bWSPPInstall) then
2850 SdShowMsg(szMsg, FALSE);
2854 Sprintf(szMsg, @AFS_CLIENT_SERVICE_INSTALL_ERROR, nStatus);
2855 ShowError(szMsg, SEVERE);
2856 bInstallAborted = TRUE;
2863 ///////////////////////////////////////////////////////////////////////////////
2865 // Function: AddPath
2867 // Purpose: This function will add the specified path to the system PATH
2868 // environment variable.
2870 ///////////////////////////////////////////////////////////////////////////////
2871 function AddPath(szPath)
2873 LongPathToShortPath(szPath);
2874 if (bWin98 || bWin95) then
2875 if (EzBatchAddPath ("Path", szPath, "", AFTER) < 0) then
2876 ShowError(@ADD_PATH_ERROR, WARNING);
2879 if (AddToPath(szPath) < 0) then
2880 ShowError(@ADD_PATH_ERROR, WARNING);
2887 ///////////////////////////////////////////////////////////////////////////////
2889 // Function: ConfigUninstallDLL
2891 // Purpose: This function will modify the uninstall entry for these products
2892 // to use an uninstall dll.
2894 ///////////////////////////////////////////////////////////////////////////////
2895 function ConfigUninstallDLL(pApp)
2899 if (!pApp->bUseUninstDLL) then
2903 nStatus = RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
2904 if (nStatus < 0) goto error;
2906 svValue = UNINST + " -c\"" + pApp->szBinPath ^ pApp->szUninstDllName + "\" -f\"" + TARGETDIR ^ pApp->szUninstLogfileName + "\"";
2908 nStatus = RegDBSetKeyValueEx(MSUNINSTALL_KEY ^ pApp->szProductName, "UninstallString", REGDB_STRING, svValue, -1);
2909 if (nStatus < 0) goto error;
2918 ///////////////////////////////////////////////////////////////////////////////
2920 // Function: CreateServerDirs
2922 // Purpose: This function will create directories that the server programs
2923 // need. The creation of these is not logged, and so they will be
2924 // deleted by the uninstall dll.
2926 ///////////////////////////////////////////////////////////////////////////////
2927 function CreateServerDirs()
2929 CreateDir(TARGETDIR ^ "\\Server\\usr\\afs\\logs");
2930 CreateDir(TARGETDIR ^ "\\Server\\usr\\afs\\etc");
2931 CreateDir(TARGETDIR ^ "\\Server\\usr\\afs\\local");
2935 ///////////////////////////////////////////////////////////////////////////////
2937 // Function: GetDateTimeString()
2939 // Purpose: This function will return a string containing the current date
2942 ///////////////////////////////////////////////////////////////////////////////
2943 function GetDateTimeString(szDateTime)
2944 STRING szDate, szTime;
2945 NUMBER nDate, nTime;
2947 GetSystemInfo(DATE, nDate, szDate);
2948 GetSystemInfo(TIME, nTime, szTime);
2950 szDateTime = szDate + " " + szTime;
2954 ///////////////////////////////////////////////////////////////////////////////
2956 // Function: SetUserVars()
2958 // Purpose: This function will set at runtime values for user defined variables
2959 // we set up in the Registry Entries GUI tool.
2961 ///////////////////////////////////////////////////////////////////////////////
2962 function SetUserVars()
2964 string szInstallDate;
2967 string szReleaseType;
2969 // Set the install date variable's value
2970 GetDateTimeString(szInstallDate);
2972 ComponentSetTarget(MEDIA, "<INSTALL_DATE>", szInstallDate);
2974 // Set the proper client logon dll
2975 if (bFullClientSel) then
2976 ComponentSetTarget(MEDIA, "<LOGON_DLL>", TARGETDIR ^ FULL_CLIENT_LOGON_DLL);
2977 elseif (bLightClientSel) then
2978 ComponentSetTarget(MEDIA, "<LOGON_DLL>", TARGETDIR ^ LIGHT_CLIENT_LOGON_DLL);
2981 // Set the client description and title values
2982 if (bFullClientSel || bLightClientSel) then
2984 if (bFullClientSel) then
2985 szDesc = @CLIENT_DESC;
2986 szTitle = @CLIENT_TITLE;
2988 szDesc = @LIGHT_CLIENT_DESC;
2989 szTitle = @LIGHT_CLIENT_TITLE;
2992 ComponentSetTarget(MEDIA, "<CLIENT_DESC>", szDesc);
2993 ComponentSetTarget(MEDIA, "<CLIENT_TITLE>", szTitle);
2996 if (bServerSel) then
2997 ComponentSetTarget(MEDIA, "<EVENT_MSG_DLL>", TARGETDIR ^ "Common\\afseventmsg_" + szCodePage + ".dll");
3000 szReleaseType = @PRODUCT_VERSION_RELEASE_TYPE;
3001 ComponentSetTarget(MEDIA, "<RELEASE_TYPE>", szReleaseType);
3008 ///////////////////////////////////////////////////////////////////////////////
3010 // Function: SetNetworkProviderOrder()
3012 // Purpose: This function will add the AFS Client service name to the
3013 // ProviderOrder value of the
3014 // HKLM\SYSTEM\CurrentControlSet\ControlNetworkProvider\Order key.
3015 // It makes a call to the setup dll to do this.
3016 ///////////////////////////////////////////////////////////////////////////////
3017 function SetNetworkProviderOrder()
3020 nStatus = AddToNetworkProviderOrder(CLIENT_SERVICE_NAME);
3021 if (nStatus < 0) then
3022 ShowError(@SET_NETWORK_PROVIDER_ERROR, SEVERE);
3029 ///////////////////////////////////////////////////////////////////////////////
3031 // Function: CreateRegistrySets()
3033 // Purpose: This function will create the registry entries for each resgistry
3034 // set in the passed in string. The string must be a comma separated
3035 // list of registry sets created using the IS Registry Entries GUI.
3037 ///////////////////////////////////////////////////////////////////////////////
3038 function CreateRegistrySets(szRegistrySets)
3043 nRegSetListID = ListCreate(STRINGLIST);
3045 StrGetTokens(nRegSetListID, szRegistrySets, ",");
3047 nResult = ListGetFirstString(nRegSetListID, szRegSet);
3048 while (nResult != END_OF_LIST)
3049 // MessageBox(szRegSet, INFORMATION);
3050 CreateRegistrySet(szRegSet);
3051 nResult = ListGetNextString(nRegSetListID, szRegSet);
3054 ListDestroy(nRegSetListID);
3058 ///////////////////////////////////////////////////////////////////////////////
3060 // Function: ConfigAfsCreds()
3062 // Purpose: This function will config the AFS Client Credentials tool.
3064 ///////////////////////////////////////////////////////////////////////////////
3065 function ConfigAfsCreds()
3068 nResult = LaunchAppAndWait(TARGETDIR ^ "Client\\Program\\afscreds.exe", "/install", WAIT);
3069 if (nResult < 0) then
3070 ShowError(@CONFIGURING_AFS_CREDS_ERROR, INFORMATION);
3077 ///////////////////////////////////////////////////////////////////////////////
3079 // Function: IsAppInstalled
3081 // Purpose: This function will determine if an app is installed, and if it is,
3082 // will set its iVer info.
3084 ///////////////////////////////////////////////////////////////////////////////
3085 function IsAppInstalled(pApp)
3090 string szMajorVersion, szMinorVersion, szPatchLevel, szBetaLevel, szReleaseType, szTitle;
3092 nResult = RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
3093 if (nResult < 0) goto error;
3095 szKey = COMPANY_REG_KEY ^ pApp->szProductName ^ "CurrentVersion";
3097 nResult = RegDBGetKeyValueEx(szKey, "MajorVersion", nType, szMajorVersion, nSize);
3098 if (nResult < 0) goto error;
3100 nResult = RegDBGetKeyValueEx(szKey, "MinorVersion", nType, szMinorVersion, nSize);
3101 if (nResult < 0) goto error;
3103 nResult = RegDBGetKeyValueEx(szKey, "PatchLevel", nType, szPatchLevel, nSize);
3104 if (nResult < 0) goto error;
3106 nResult = RegDBGetKeyValueEx(szKey, "BetaLevel", nType, szBetaLevel, nSize);
3107 // It's ok for this to fail. Pre-3.5 3.32 releases did not use this.
3109 nResult = RegDBGetKeyValueEx(szKey, "VersionString", nType, szTitle, nSize);
3110 if (nResult < 0) goto error;
3112 nResult = RegDBGetKeyValueEx(szKey, "ReleaseType", nType, szReleaseType, nSize);
3113 if (nResult < 0) then
3114 if ((pApp->szProductName = "AFS Client") && (szTitle = "3.4a")) then
3115 // This value won't exist for 3.4a clients
3116 szReleaseType = RELEASE_TYPE_GA;
3118 // This value won't exist for any 3.5 beta versions
3119 szReleaseType = RELEASE_TYPE_BETA;
3123 SetupVerInfo(pApp, szMajorVersion, szMinorVersion, szPatchLevel, szBetaLevel, szReleaseType, szTitle, TRUE);
3132 ///////////////////////////////////////////////////////////////////////////////
3134 // Function: LocalizeComponents()
3136 // Purpose: This function updates all components to use localized text
3137 // in their status fields as appropriate
3139 ///////////////////////////////////////////////////////////////////////////////
3140 function LocalizeComponents()
3142 LocalizeComponentStatusText ("Client\\Client_Common");
3143 LocalizeComponentStatusText ("Client\\Client_Program\\Client_Headers\\Client_Afs_Headers");
3144 LocalizeComponentStatusText ("Client\\Client_Program\\Client_Headers\\Client_Main_Headers");
3145 LocalizeComponentStatusText ("Client\\Client_Program\\Client_Headers\\Client_Rx_Headers");
3146 LocalizeComponentStatusText ("Client\\Client_Program\\Client_Headers");
3147 LocalizeComponentStatusText ("Client\\Client_Program\\Client_Sample");
3148 LocalizeComponentStatusText ("Client\\Client_Program");
3149 LocalizeComponentStatusText ("Client\\Client_System32");
3150 LocalizeComponentStatusText ("Client\\Client_WinDir");
3151 LocalizeComponentStatusText ("Client");
3152 LocalizeComponentStatusText ("Components");
3153 LocalizeComponentStatusText ("Control_Center\\Control_Center_Common");
3154 LocalizeComponentStatusText ("Control_Center\\Control_Center_Program");
3155 LocalizeComponentStatusText ("Control_Center\\Control_Center_System32");
3156 LocalizeComponentStatusText ("Control_Center\\Control_Center_WinDir");
3157 LocalizeComponentStatusText ("Control_Center");
3158 LocalizeComponentStatusText ("Documentation\\English\\Cmd_Ref");
3159 LocalizeComponentStatusText ("Documentation\\English\\Doc_Misc");
3160 LocalizeComponentStatusText ("Documentation\\English\\Sys_Admin_Guide");
3161 LocalizeComponentStatusText ("Documentation\\English");
3162 LocalizeComponentStatusText ("Documentation\\German\\Cmd_Ref");
3163 LocalizeComponentStatusText ("Documentation\\German\\Doc_Misc");
3164 LocalizeComponentStatusText ("Documentation\\German\\Sys_Admin_Guide");
3165 LocalizeComponentStatusText ("Documentation\\German");
3166 LocalizeComponentStatusText ("Documentation\\Japanese\\Cmd_Ref");
3167 LocalizeComponentStatusText ("Documentation\\Japanese\\Doc_Misc");
3168 LocalizeComponentStatusText ("Documentation\\Japanese\\Sys_Admin_Guide");
3169 LocalizeComponentStatusText ("Documentation\\Japanese");
3170 LocalizeComponentStatusText ("Documentation\\Korean\\Cmd_Ref");
3171 LocalizeComponentStatusText ("Documentation\\Korean\\Doc_Misc");
3172 LocalizeComponentStatusText ("Documentation\\Korean\\Sys_Admin_Guide");
3173 LocalizeComponentStatusText ("Documentation\\Korean");
3174 LocalizeComponentStatusText ("Documentation\\Portuguese\\Cmd_Ref");
3175 LocalizeComponentStatusText ("Documentation\\Portuguese\\Doc_Misc");
3176 LocalizeComponentStatusText ("Documentation\\Portuguese\\Sys_Admin_Guide");
3177 LocalizeComponentStatusText ("Documentation\\Portuguese");
3178 LocalizeComponentStatusText ("Documentation\\Simp_Chinese\\Cmd_Ref");
3179 LocalizeComponentStatusText ("Documentation\\Simp_Chinese\\Doc_Misc");
3180 LocalizeComponentStatusText ("Documentation\\Simp_Chinese\\Sys_Admin_Guide");
3181 LocalizeComponentStatusText ("Documentation\\Simp_Chinese");
3182 LocalizeComponentStatusText ("Documentation\\Spanish\\Cmd_Ref");
3183 LocalizeComponentStatusText ("Documentation\\Spanish\\Doc_Misc");
3184 LocalizeComponentStatusText ("Documentation\\Spanish\\Sys_Admin_Guide");
3185 LocalizeComponentStatusText ("Documentation\\Spanish");
3186 LocalizeComponentStatusText ("Documentation\\Trad_Chinese\\Cmd_Ref");
3187 LocalizeComponentStatusText ("Documentation\\Trad_Chinese\\Doc_Misc");
3188 LocalizeComponentStatusText ("Documentation\\Trad_Chinese\\Sys_Admin_Guide");
3189 LocalizeComponentStatusText ("Documentation\\Trad_Chinese");
3190 LocalizeComponentStatusText ("Documentation");
3191 LocalizeComponentStatusText ("Info");
3192 LocalizeComponentStatusText ("Languages\\Lang_English");
3193 LocalizeComponentStatusText ("Languages\\Lang_German");
3194 LocalizeComponentStatusText ("Languages\\Lang_Japanese");
3195 LocalizeComponentStatusText ("Languages\\Lang_Korean");
3196 LocalizeComponentStatusText ("Languages\\Lang_Portuguese");
3197 LocalizeComponentStatusText ("Languages\\Lang_Simp_Chinese");
3198 LocalizeComponentStatusText ("Languages\\Lang_Spanish");
3199 LocalizeComponentStatusText ("Languages\\Lang_Trad_Chinese");
3200 LocalizeComponentStatusText ("Languages");
3201 LocalizeComponentStatusText ("Light_Client\\Win95\\Light95_Client_Common");
3202 LocalizeComponentStatusText ("Light_Client\\Win95\\Light95_Client_Program");
3203 LocalizeComponentStatusText ("Light_Client\\Win95\\Light95_Client_System32");
3204 LocalizeComponentStatusText ("Light_Client\\Win95\\Light95_Client_WinDir");
3205 LocalizeComponentStatusText ("Light_Client\\Win95");
3206 LocalizeComponentStatusText ("Light_Client\\Win98\\Light_Client_Common");
3207 LocalizeComponentStatusText ("Light_Client\\Win98\\Light_Client_Program");
3208 LocalizeComponentStatusText ("Light_Client\\Win98\\Light_Client_System32");
3209 LocalizeComponentStatusText ("Light_Client\\Win98\\Light_Client_WinDir");
3210 LocalizeComponentStatusText ("Light_Client\\Win98");
3211 LocalizeComponentStatusText ("Light_Client");
3212 LocalizeComponentStatusText ("Readme\\English\\Doc_Misc");
3213 LocalizeComponentStatusText ("Readme\\English\\Install_Guide");
3214 LocalizeComponentStatusText ("Readme\\English\\Release_Notes");
3215 LocalizeComponentStatusText ("Readme\\English");
3216 LocalizeComponentStatusText ("Readme\\German\\Doc_Misc");
3217 LocalizeComponentStatusText ("Readme\\German\\Install_Guide");
3218 LocalizeComponentStatusText ("Readme\\German\\Release_Notes");
3219 LocalizeComponentStatusText ("Readme\\German");
3220 LocalizeComponentStatusText ("Readme\\Japanese\\Doc_Misc");
3221 LocalizeComponentStatusText ("Readme\\Japanese\\Install_Guide");
3222 LocalizeComponentStatusText ("Readme\\Japanese\\Release_Notes");
3223 LocalizeComponentStatusText ("Readme\\Japanese");
3224 LocalizeComponentStatusText ("Readme\\Korean\\Doc_Misc");
3225 LocalizeComponentStatusText ("Readme\\Korean\\Install_Guide");
3226 LocalizeComponentStatusText ("Readme\\Korean\\Release_Notes");
3227 LocalizeComponentStatusText ("Readme\\Korean");
3228 LocalizeComponentStatusText ("Readme\\Portuguese\\Doc_Misc");
3229 LocalizeComponentStatusText ("Readme\\Portuguese\\Install_Guide");
3230 LocalizeComponentStatusText ("Readme\\Portuguese\\Release_Notes");
3231 LocalizeComponentStatusText ("Readme\\Portuguese");
3232 LocalizeComponentStatusText ("Readme\\Simp_Chinese\\Doc_Misc");
3233 LocalizeComponentStatusText ("Readme\\Simp_Chinese\\Install_Guide");
3234 LocalizeComponentStatusText ("Readme\\Simp_Chinese\\Release_Notes");
3235 LocalizeComponentStatusText ("Readme\\Simp_Chinese");
3236 LocalizeComponentStatusText ("Readme\\Spanish\\Doc_Misc");
3237 LocalizeComponentStatusText ("Readme\\Spanish\\Install_Guide");
3238 LocalizeComponentStatusText ("Readme\\Spanish\\Release_Notes");
3239 LocalizeComponentStatusText ("Readme\\Spanish");
3240 LocalizeComponentStatusText ("Readme\\Trad_Chinese\\Doc_Misc");
3241 LocalizeComponentStatusText ("Readme\\Trad_Chinese\\Install_Guide");
3242 LocalizeComponentStatusText ("Readme\\Trad_Chinese\\Release_Notes");
3243 LocalizeComponentStatusText ("Readme\\Trad_Chinese");
3244 LocalizeComponentStatusText ("Readme");
3245 LocalizeComponentStatusText ("Server\\Server_Common");
3246 LocalizeComponentStatusText ("Server\\Server_Program");
3247 LocalizeComponentStatusText ("Server\\Server_System32");
3248 LocalizeComponentStatusText ("Server\\Server_WinDir");
3249 LocalizeComponentStatusText ("Server");
3253 ///////////////////////////////////////////////////////////////////////////////
3255 // Function: LocalizeComponentStatusText()
3257 // Purpose: This function updates one component to use localized text
3258 // in its status fields as appropriate
3260 ///////////////////////////////////////////////////////////////////////////////
3261 function LocalizeComponentStatusText (svComponent)
3266 ComponentGetData (MEDIA, svComponent, COMPONENT_FIELD_STATUS, dwResult, svOriginal);
3268 if (svOriginal == "CLIENT") then
3269 svLocalized = @STATUS_INSTALLING_CLIENT;
3270 elseif (svOriginal == "SERVER") then
3271 svLocalized = @STATUS_INSTALLING_SERVER;
3272 elseif (svOriginal == "CCENTER") then
3273 svLocalized = @STATUS_INSTALLING_CCENTER;
3274 elseif (svOriginal == "LIGHT") then
3275 svLocalized = @STATUS_INSTALLING_LIGHT;
3276 elseif (svOriginal == "HEADERS") then
3277 svLocalized = @STATUS_INSTALLING_HEADERS;
3278 elseif (svOriginal == "DOCS") then
3279 svLocalized = @STATUS_INSTALLING_DOCS;
3280 elseif (svOriginal == "LANGUAGE") then
3281 svLocalized = @STATUS_INSTALLING_LANGUAGE;
3286 ComponentSetData(MEDIA, svComponent, COMPONENT_FIELD_STATUS, 0, svLocalized);
3290 ///////////////////////////////////////////////////////////////////////////////
3292 // Function: DetectInstalledComponents()
3294 // Purpose: This function will detect if any of our components is already
3297 ///////////////////////////////////////////////////////////////////////////////
3298 function DetectInstalledComponents()
3301 bClientInstalled = IsAppInstalled(&appFullClient);
3302 bServerInstalled = IsAppInstalled(&appServer);
3303 bCcInstalled = IsAppInstalled(&appControlCenter);
3304 bDocsInstalled = IsAppInstalled(&appDocs);
3306 // The light client uses the client's registry entries. There is a light
3307 // client entry, but it contains nothing under it. IS makes it but we
3309 bLightClientInstalled = IsAppInstalled(&appLightClient);
3314 ///////////////////////////////////////////////////////////////////////////////
3316 // Function: ParseCommandLine
3318 // Purpose: This function parses the command line to set up a silent install
3320 ///////////////////////////////////////////////////////////////////////////////
3321 function ParseCommandLine()
3323 STRING szTemp, szResult[MAX_STRING_LEN], szParms;
3326 bWSPPInstall = FALSE;
3327 bPreinstallReplace = FALSE;
3331 // Need a list to hold the parms
3332 listParms = ListCreate(STRINGLIST);
3334 // Break parms into semicolon separated tokens and put into list
3335 if (StrGetTokens(listParms, szParms, ";") = 0 ) then
3336 nResult = ListGetFirstString(listParms, szResult);
3338 // Do until the end of the list
3339 while (nResult != END_OF_LIST)
3340 if (StrFind(szResult, "DIR=") > -1 ) then
3341 nResult = StrSub(szTemp, szResult, 4, MAX_STRING_LEN);
3342 TARGETDIR = szTemp + "\\AFS";
3344 elseif (StrFind(szResult, "P=") > -1 ) then
3345 nResult = StrSub(szTemp, szResult, StrFind(szResult, "P=") + 2, 1);
3346 if (StrFind(szTemp, "Y") > -1 ) then
3347 bPreinstallReplace = TRUE;
3350 elseif (StrFind(szResult, "C=") > -1 ) then
3351 ProcessCompsOnCmdLn(szResult);
3354 nResult = ListGetNextString(listParms, szResult);
3360 ///////////////////////////////////////////////////////////////////////////////
3362 // Function: ProcessCompsOnCmdLn
3364 // Purpose: This function puts the components in a list and
3365 // checks for setup types on the command line.
3368 ///////////////////////////////////////////////////////////////////////////////
3369 function ProcessCompsOnCmdLn(szParms)
3370 NUMBER nResult, nIndex;
3373 bWSPPInstall = TRUE;
3375 // Strip c= off cmdln string
3376 nResult = StrSub(szParms, szParms, StrFind(szParms, "C=") + 2, StrLength(szParms) - 2);
3378 // Get each component from the cmd line
3379 while (StrLength(szParms))
3380 nIndex = StrSub(szComp, szParms, 0, StrFind(szParms, ","));
3381 if (!nIndex) then // if comma not found then last item in list
3383 nIndex = StrLength(szComp); // for extracting this string
3386 if (StrFind(szComp, "Client") > -1) then
3387 bFullClientSel = TRUE;
3388 elseif (StrFind(szComp, "Server") > -1) then
3390 elseif (StrFind(szComp, "ControlCtr") > -1) then
3394 // Delete component from the command line string
3395 StrSub(szParms, szParms, nIndex + 1, StrLength(szParms));
3400 ///////////////////////////////////////////////////////////////////////////////
3402 // Function: RemoveInstalledBits
3404 // Purpose: This function silently uninstalls a product.
3406 ///////////////////////////////////////////////////////////////////////////////
3407 function RemoveInstalledBits(szProductName)
3410 string szValue[MAX_STRING_LEN];
3411 string szProgram[256];
3412 string szCmdLine[128];
3416 // Check for a special case - version 3.4a of the AFS Client
3417 if ((szProductName = "AFS Client") && (appFullClient.iVer.szTitle = "3.4a")) then
3418 return Eradicate34Client();
3421 nStatus = RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
3422 if (nStatus < 0) goto error;
3424 nStatus = RegDBGetKeyValueEx(MSUNINSTALL_KEY ^ szProductName, "UninstallString", nType, szValue, nSize);
3425 if (nStatus < 0) goto error;
3427 nIndex = StrFind(szValue, " ");
3428 if (nIndex < 0) goto error;
3430 StrSub(szProgram, szValue, 0, nIndex);
3431 StrSub(szCmdLine, szValue, nIndex + 1, 128);
3433 // Make the uninstall run silently
3434 szCmdLine = szCmdLine + " -a";
3436 nStatus = LaunchAppAndWait(szProgram, szCmdLine, WAIT);
3437 if (nStatus < 0) goto error;
3446 ///////////////////////////////////////////////////////////////////////////////
3448 // Function: AddShortCut
3450 // Purpose: Adds a short cut to the start menu.
3452 ///////////////////////////////////////////////////////////////////////////////
3453 function AddShortCut(szFolder, szName, szCmdPath, szArgs)
3457 szCmdPath = TARGETDIR ^ szCmdPath;
3458 LongPathToQuote(szCmdPath, TRUE);
3460 szCmd = szCmdPath + " " + szArgs;
3462 nResult = AddFolderIcon(SHELL_OBJECT_FOLDER ^ szFolder, szName, szCmd, "", "", 0, "", REPLACE);
3493 ///////////////////////////////////////////////////////////////////////////////
3495 // Function: CreateStartMenuEntries
3497 // Purpose: This function creates start menu entries for our apps.
3499 ///////////////////////////////////////////////////////////////////////////////
3500 function CreateStartMenuEntries()
3502 if (bServerSel) then
3503 AddShortCut(@SERVER_GROUP_NAME, @CFG_WIZARD_ITEM_NAME, CFG_WIZARD_CMD_PATH, CFG_WIZARD_ARGS);
3506 if (bFullClientSel) then
3507 AddShortCut(@CLIENT_GROUP_NAME, @CREDS_TOOL_ITEM_NAME, CREDS_TOOL_CMD_PATH, CREDS_TOOL_ARGS);
3508 AddShortCut(@CLIENT_GROUP_NAME, @CLIENT_HELP_ITEM_NAME, CLIENT_HELP_CMD_PATH, CLIENT_HELP_ARGS);
3512 AddShortCut(@CCENTER_GROUP_NAME, @SERVER_MANAGER_ITEM_NAME, SERVER_MANAGER_CMD_PATH, SERVER_MANAGER_ARGS);
3513 AddShortCut(@CCENTER_GROUP_NAME, @ACCT_MANAGER_ITEM_NAME, ACCT_MANAGER_CMD_PATH, ACCT_MANAGER_ARGS);
3516 if (bLightClientSel) then
3517 AddShortCut(@LIGHT_GROUP_NAME, @CREDS_TOOL_ITEM_NAME, CREDS_TOOL_CMD_PATH, CREDS_TOOL_ARGS);
3518 AddShortCut(@LIGHT_GROUP_NAME, @LIGHT_CLIENT_HELP_ITEM_NAME, LIGHT_CLIENT_HELP_CMD_PATH, LIGHT_CLIENT_HELP_ARGS);
3521 AddShortCut("", @DOCUMENTATION_ITEM_NAME, DOCUMENTATION_CMD_PATH, DOCUMENTATION_ARGS);
3525 ///////////////////////////////////////////////////////////////////////////////
3527 // Function: ShowError
3529 // Purpose: This function shows an error to the user when not in silent mode,
3530 // and will log an error to a file when in silent mode.
3532 ///////////////////////////////////////////////////////////////////////////////
3533 function ShowError(szMsg, nType)
3537 if (!bWSPPInstall) then
3538 MessageBox(szMsg, nType);
3543 case WARNING: szType = "Warning: ";
3544 case SEVERE: szType = "Error: ";
3545 case INFORMATION: szType = "Note: ";
3546 default: szType = "Unknown error type: ";
3549 WriteToInstallErrorLog(szType + szMsg);
3553 ///////////////////////////////////////////////////////////////////////////////
3555 // Function: CheckCopyCellServDB
3557 // Purpose: During install the CellServDB file is copied into the Common dir.
3558 // If the user does not already have this file, we will copy it for
3559 // them into the windows directory. If they already do have the
3560 // file, then we will do nothing.
3561 ///////////////////////////////////////////////////////////////////////////////
3562 function CheckCopyCellServDB()
3566 nResult = FindFile(WINDIR, CELLSERVDB_FILENAME, szResult);
3567 if (nResult < 0) then
3568 VarSave(SRCTARGETDIR);
3569 SRCDIR = TARGETDIR ^ "Common";
3571 CopyFile(CELLSERVDB_FILENAME, CELLSERVDB_FILENAME);
3572 VarRestore(SRCTARGETDIR);
3577 // --- include script file section ---
3578 #include "sddialog.rul"