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 nResult=GetWebPage(szErrMsg,szDestFile,szDefaultWeb);
446 SetStatusWindow (100, "Downloading completed.");
449 SetStatusWindow(0, "");
450 MessageBox (szErrMsg, INFORMATION);
453 // setup default status
454 SetStatusWindow(0, "");
458 // Transfer file to CELLSERVDB
459 prototype BOOL InstallCellServDB(NUMBER,STRING,STRING);
460 function InstallCellServDB(DefaultItem,szDefaultWeb,szDefaultBrowse)
461 STRING szFile,svErrorMessage;
465 nResult=getWebCellSrvDB(szDefaultWeb,TARGETDIR^@CELLSERVDB_CONFIGNAME);
466 case IDC_CHECK_BROWSEFILE:
467 // open file and copy to area
468 ParsePath(szFile,szDefaultBrowse,PATH);
470 ParsePath(szFile,szDefaultBrowse,FILENAME);
471 nResult=CopyFile ( szFile ,@CELLSERVDB_CONFIGNAME );
474 MessageBox ( "CopyFile failed with error code -1!", WARNING );
476 FormErrorMessage(nResult,svErrorMessage);
477 SprintfBox ( WARNING, "",
478 "CopyFile failed!\n\nError code: %ld\nMessage text: %s",
479 nResult, svErrorMessage );
485 case IDC_CHECK_INSTALL: //need to delete because install will never overwrite
487 nResult=CopyFile (@CELLSERVDB_CONFIGNAME,@CELLSERVDB_CONFIGNAME );
490 MessageBox ( "CopyFile failed with error code -1!", WARNING );
492 FormErrorMessage(nResult,svErrorMessage);
493 SprintfBox ( WARNING, "",
494 "CopyFile failed!\n\nError code: %ld\nMessage text: %s",
495 nResult, svErrorMessage );
501 case IDC_CHECK_PREVIOUSFILE:
502 nResult=TRUE;// work is done, it will use previous file
510 // Return TRUE if silent mode active
511 prototype BOOL SilentSetCellServDB(STRING,NUMBER,NUMBER,NUMBER,BYREF STRING,BYREF STRING);
512 function SilentSetCellServDB(szDlg,option,nResult,DefaultItem,szDefaultWeb,szDefaultBrowse)
513 STRING svSection,szTemp;
517 case 0: //READ function
518 if (MODE!=SILENTMODE) then
521 SdMakeName( svSection, szDlg, "", nvSection );
522 SilentReadData( svSection, "Result", DATA_NUMBER,szTemp,nResult);
523 if (nResult!=NEXT) then
526 SilentReadData( svSection, "DefaultItem", DATA_NUMBER,szTemp,DefaultItem);
527 SilentReadData( svSection, "szDefaultWeb", DATA_STRING, szDefaultWeb,nTemp);
528 SilentReadData( svSection, "szDefaultBrowse", DATA_STRING,szDefaultBrowse,nTemp );
529 if (InstallCellServDB(DefaultItem,szDefaultWeb,szDefaultBrowse)==FALSE) then
536 SdMakeName( svSection, szDlg, "", nvSection );
537 SilentWriteData( svSection, "Result", DATA_NUMBER,szTemp, nResult );
538 SilentWriteData( svSection, "DefaultItem", DATA_NUMBER,szTemp, DefaultItem );
539 SilentWriteData( svSection, "szDefaultWeb", DATA_STRING, szDefaultWeb,nTemp );
540 SilentWriteData( svSection, "szDefaultBrowse", DATA_STRING, szDefaultBrowse,nTemp );
545 function SetCellServDB( szTitle,DefaultItem,szPreviousInstall,szDefaultWeb,szDefaultBrowse,szDefaultInstall)
546 STRING szDlg, szTemp,szResult[256],svErrorMessage,szFile,svSection;
547 NUMBER bDone, nId, nMessage, nTemp,AvailableDrives,nResult;
548 INT hwndDlg,hwndItem;
551 szDlg = "DLG_CELLSERVDB";
552 // record data produced by this dialog
553 if SilentSetCellServDB(szDlg,0,nResult,DefaultItem,szDefaultWeb,szDefaultBrowse) then
557 // ensure general initialization is complete
562 if (EzDefineDialog( szDlg, "", "",
563 DLG_CELLSERVDB ) = DLG_ERR) then
567 // Loop in dialog until the user selects a standard button
569 VarSave(SRCTARGETDIR);
576 nId = WaitOnDialog( szDlg );
577 hwndDlg = CmdGetHwndDlg( szDlg );
582 // Initialize List Control
584 CtrlSetState (szDlg, DefaultItem,BUTTON_CHECKED);
585 if !Is(FILE_EXISTS,szPreviousInstall) then
586 hwndItem = GetDlgItem( hwndDlg, IDC_CHECK_PREVIOUSFILE );
587 EnableWindow( hwndItem, FALSE);
589 hwndItem = GetDlgItem( hwndDlg, IDC_PREVIOUSFILE );
590 EnableWindow( hwndItem, DefaultItem==IDC_CHECK_PREVIOUSFILE);
591 hwndItem = GetDlgItem( hwndDlg, IDC_BROWSEFILE );
592 EnableWindow( hwndItem, DefaultItem==IDC_CHECK_BROWSEFILE);
593 hwndItem = GetDlgItem( hwndDlg, IDC_BROWSE );
594 EnableWindow( hwndItem, DefaultItem==IDC_CHECK_BROWSEFILE);
595 hwndItem = GetDlgItem( hwndDlg, IDC_WEB );
596 EnableWindow( hwndItem, DefaultItem==IDC_CHECK_WEB);
597 hwndItem = GetDlgItem( hwndDlg, IDC_INSTALL );
598 EnableWindow( hwndItem, DefaultItem==IDC_CHECK_INSTALL);
599 CtrlSetText (szDlg, IDC_PREVIOUSFILE, szPreviousInstall);
600 CtrlSetText (szDlg, IDC_BROWSEFILE, szDefaultBrowse);
601 CtrlSetText (szDlg, IDC_WEB, szDefaultWeb);
602 CtrlSetText (szDlg, IDC_INSTALL, szDefaultInstall);
604 SdGeneralInit( szDlg, hwndDlg, STYLE_NORMAL, szSdProduct );
606 //This function sets the caption for old style dialogs or
607 //sets the text in the top banner area of win2k style dialogs
608 // SdSetDlgTitle(szDlg, hwndDlg, szTitle); //Version 6.0 only
619 SdError( -1, "DLG_CELLSERVDB" );
624 SdCloseDlg( hwndDlg, nId, bDone );
627 szResult=szDefaultBrowse;
628 szTitle="Select file to be used for CellServDB";
629 nResult=BrowseFile(hwndDlg,szTitle,szResult,256);
630 CtrlSetText (szDlg, IDC_BROWSEFILE, szResult);
631 szDefaultBrowse=szResult;
633 case IDC_CHECK_BROWSEFILE:
634 hwndItem = GetDlgItem( hwndDlg, IDC_BROWSEFILE );
635 EnableWindow( hwndItem, TRUE);
636 hwndItem = GetDlgItem( hwndDlg, IDC_BROWSE );
637 EnableWindow( hwndItem, TRUE);
638 CtrlSetState (szDlg, DefaultItem,BUTTON_UNCHECKED);
639 CtrlSetState (szDlg, nId,BUTTON_CHECKED);
642 hwndItem = GetDlgItem( hwndDlg, IDC_WEB );
643 EnableWindow( hwndItem, FALSE);
644 case IDC_CHECK_PREVIOUSFILE:
645 hwndItem = GetDlgItem( hwndDlg, IDC_PREVIOUSFILE );
646 EnableWindow( hwndItem, FALSE);
647 case IDC_CHECK_INSTALL:
648 hwndItem = GetDlgItem( hwndDlg, IDC_INSTALL);
649 EnableWindow( hwndItem, FALSE);
654 case IDC_CHECK_INSTALL:
655 hwndItem = GetDlgItem( hwndDlg, IDC_INSTALL );
656 EnableWindow( hwndItem, TRUE);
657 CtrlSetState (szDlg, DefaultItem,BUTTON_UNCHECKED);
658 CtrlSetState (szDlg, nId,BUTTON_CHECKED);
660 case IDC_CHECK_BROWSEFILE:
661 hwndItem = GetDlgItem( hwndDlg, IDC_BROWSE );
662 EnableWindow( hwndItem, FALSE);
663 hwndItem = GetDlgItem( hwndDlg, IDC_BROWSEFILE );
664 EnableWindow( hwndItem, FALSE);
666 hwndItem = GetDlgItem( hwndDlg, IDC_WEB );
667 EnableWindow( hwndItem, FALSE);
668 case IDC_CHECK_PREVIOUSFILE:
669 hwndItem = GetDlgItem( hwndDlg, IDC_PREVIOUSFILE );
670 EnableWindow( hwndItem, FALSE);
676 hwndItem = GetDlgItem( hwndDlg, IDC_WEB );
677 EnableWindow( hwndItem, TRUE);
678 CtrlSetState (szDlg, DefaultItem,BUTTON_UNCHECKED);
679 CtrlSetState (szDlg, nId,BUTTON_CHECKED);
681 case IDC_CHECK_BROWSEFILE:
682 hwndItem = GetDlgItem( hwndDlg, IDC_BROWSE );
683 EnableWindow( hwndItem, FALSE);
684 hwndItem = GetDlgItem( hwndDlg, IDC_BROWSEFILE );
685 EnableWindow( hwndItem, FALSE);
686 case IDC_CHECK_INSTALL:
687 hwndItem = GetDlgItem( hwndDlg, IDC_INSTALL);
688 EnableWindow( hwndItem, FALSE);
689 case IDC_CHECK_PREVIOUSFILE:
690 hwndItem = GetDlgItem( hwndDlg, IDC_PREVIOUSFILE );
691 EnableWindow( hwndItem, FALSE);
696 case IDC_CHECK_PREVIOUSFILE:
697 hwndItem = GetDlgItem( hwndDlg, IDC_PREVIOUSFILE );
698 EnableWindow( hwndItem, TRUE);
699 CtrlSetState (szDlg, DefaultItem,BUTTON_UNCHECKED);
700 CtrlSetState (szDlg, nId,BUTTON_CHECKED);
702 case IDC_CHECK_BROWSEFILE:
703 hwndItem = GetDlgItem( hwndDlg, IDC_BROWSE );
704 EnableWindow( hwndItem, FALSE);
705 hwndItem = GetDlgItem( hwndDlg, IDC_BROWSEFILE );
706 EnableWindow( hwndItem, FALSE);
707 case IDC_CHECK_INSTALL:
708 hwndItem = GetDlgItem( hwndDlg, IDC_INSTALL);
709 EnableWindow( hwndItem, FALSE);
711 hwndItem = GetDlgItem( hwndDlg, IDC_WEB );
712 EnableWindow( hwndItem, FALSE);
718 // check standard handling
719 if (SdIsStdButton( nId ) && SdDoStdButton( nId )) then
726 CtrlGetText (szDlg, IDC_BROWSEFILE, szDefaultBrowse);
727 CtrlGetText (szDlg, IDC_WEB, szDefaultWeb);
728 if (nId != NEXT) then
731 if InstallCellServDB(DefaultItem,szDefaultWeb,szDefaultBrowse)==FALSE then
735 ReleaseDialog( szDlg );
736 VarRestore(SRCTARGETDIR);
739 // record data produced by this dialog
740 SilentSetCellServDB(szDlg,1,nId,DefaultItem,szDefaultWeb,szDefaultBrowse);
744 ////////////////////////////////////////////////////////////////////////////////
746 // Function Name: Template
748 // Description: This dialog will show a dialog template which can be
749 // used for creating any user-defined dialog with the
750 // Windows 95 look and feel.
753 ////////////////////////////////////////////////////////////////////////////////
755 prototype BOOL GetUser(BYREF STRING);
757 function GetUser(sUser)
761 nResult=GetUserLogon(sUser);
769 prototype BOOL SetDriveMaps(STRING,STRING,STRING,STRING,STRING);
770 function SetDriveMaps(szPath,szRootDrive,szRootPath,szHomeDrive,szHomePath)
773 VarSave(SRCTARGETDIR);
774 DeleteFile("afsdsbmt.ini");
775 VarRestore(SRCTARGETDIR);
776 CreateFile(handle, szPath, "afsdsbmt.ini");
777 WriteLine(handle, "[AFS Submounts]");
778 if (StrLength(szRootDrive)==2) then
779 WriteLine(handle, "all="+szRootPath);
781 if (StrLength(szHomeDrive)==2) then
782 WriteLine(handle, "home=" + szHomePath);
784 WriteLine(handle, "[AFS Mappings]");
785 if (StrLength(szRootDrive)>0) then
786 WriteLine(handle, szRootDrive+"="+szRootPath);
788 if (StrLength(szHomeDrive)>0) then
789 WriteLine(handle, szHomeDrive+"="+szHomePath);
794 // Return TRUE if silent mode active
795 prototype BOOL SilentSetHomeRoot(STRING,NUMBER,NUMBER,BYREF STRING,BYREF STRING,BYREF STRING,BYREF STRING);
796 function SilentSetHomeRoot(szDlg,option,nResult,szRootDrive,szRootPath,szHomeDrive,szHomePath)
797 STRING svSection,szTemp,szTPath,szTShare,szTDrive,szLogname;
798 NUMBER nTemp,nCount,I;
801 Logitn("SilentSetHomeRoot option=%i",option);
803 case 0: //READ function
804 if (MODE!=SILENTMODE) then
806 endif; // this section is a little more complicated, allowing installation of n mappings
807 SdMakeName( svSection, szDlg, "", nvSection );
808 Logit("SdMakeName="+svSection);
809 SilentReadData( svSection, "Result", DATA_NUMBER,szTemp,nResult);
810 Logitn("nResult=%i",nResult);
811 if (nResult!=NEXT) then
815 SilentReadData( svSection, "Count", DATA_NUMBER, szTemp,nCount);
816 Logitn("nCount=%i",nCount);
820 VarSave(SRCTARGETDIR);
822 DeleteFile("afsdsbmt.ini");
823 VarRestore(SRCTARGETDIR);
824 CreateFile(handle, WINDIR, "afsdsbmt.ini");
825 WriteLine(handle, "[AFS Submounts]");
828 Sprintf(szTemp,"Path_%i",I);
829 Logit("Path="+szTemp);
830 SilentReadData( svSection, szTemp, DATA_STRING, szTPath,nTemp);
831 Logit("TPath="+szTPath);
832 if (szTPath % "%LOGINNAME%") then
833 //Replace loginname with actual loging name
834 nTemp=StrFind(szTPath,"%LOGINNAME%");
835 StrSub(szTemp,szTPath,nTemp+11,StrLength(szTPath));
836 StrSub(szTPath,szTPath,0,nTemp);
837 if (GetUser(szLogname)) then
838 szTPath=szTPath+szLogname+szTemp;
841 Sprintf(szTemp,"Share_%i",I);
842 SilentReadData( svSection, szTemp, DATA_STRING, szTShare,nTemp);
843 WriteLine(handle, szTShare+"="+szTPath);
845 WriteLine(handle, "[AFS Mappings]");
847 Sprintf(szTemp,"Drive_%i",I);
848 SilentReadData( svSection, szTemp, DATA_STRING, szTDrive,nTemp);
849 Sprintf(szTemp,"Path_%i",I);
850 SilentReadData( svSection, szTemp, DATA_STRING, szTPath,nTemp);
851 if (szTPath % "%LOGINNAME%") then
852 //Replace loginname with actual loging name
853 nTemp=StrFind(szTPath,"%LOGINNAME%");
854 StrSub(szTemp,szTPath,nTemp+11,StrLength(szTPath));
855 StrSub(szTPath,szTPath,0,nTemp);
856 if (GetUser(szLogname)) then
857 szTPath=szTPath+szLogname+szTemp;
860 WriteLine(handle, szTDrive+"="+szTPath);
866 SdMakeName( svSection, szDlg, "", nvSection );
868 SilentWriteData( svSection, "Result", DATA_NUMBER,szTemp, nResult );
869 if (StrLength(szRootDrive)==2) then
870 Sprintf(szTemp,"Drive_%i",nCount);
871 SilentWriteData( svSection,szTemp, DATA_STRING,szRootDrive, nTemp );//root drive
872 Sprintf(szTemp,"Path_%i",nCount);
873 SilentWriteData( svSection,szTemp, DATA_STRING,szRootPath, nTemp );//root drive
874 Sprintf(szTemp,"Share_%i",nCount);
875 SilentWriteData( svSection,szTemp, DATA_STRING,"all", nTemp );//root drive
878 if (StrLength(szHomeDrive)==2) then
879 Sprintf(szTemp,"Drive_%i",nCount);
880 SilentWriteData( svSection,szTemp, DATA_STRING,szHomeDrive, nTemp );//root drive
881 Sprintf(szTemp,"Path_%i",nCount);
882 SilentWriteData( svSection,szTemp, DATA_STRING,szHomePath, nTemp );//root drive
883 Sprintf(szTemp,"Share_%i",nCount);
884 SilentWriteData( svSection,szTemp, DATA_STRING,"home", nTemp );//root drive
887 SilentWriteData( svSection, "Count", DATA_NUMBER,szTemp, nCount ); // only two can be defined through Dialog box
888 SetDriveMaps(WINDIR,szRootDrive,szRootPath,szHomeDrive,szHomePath);
893 function SetHomeRoot( szTitle,szRootDrive,szRootPath,szHomeDrive,szHomePath )
895 STRING szDlg, szTemp,svSection;
896 NUMBER bDone, nId, nMessage, nTemp,AvailableDrives,nResult;
897 INT hwndDlg,hwndItem,hwndItem2;
900 szDlg = "DLG_DRIVEPATH";
902 // record data produced by this dialog
903 Logit("SetHomeRoot");
904 if SilentSetHomeRoot(szDlg,0,nResult,szRootDrive,szRootPath,szHomeDrive,szHomePath ) then
908 GetDefaultDrive(AvailableDrives);
909 // ensure general initialization is complete
914 if (EzDefineDialog( szDlg, "", "",
915 DLG_DRIVEPATH ) = DLG_ERR) then
919 // Loop in dialog until the user selects a standard button
924 nId = WaitOnDialog( szDlg );
929 hwndDlg = CmdGetHwndDlg( szDlg );
930 // Initialize List Control
931 nResult=CtrlSetList( szDlg, IDC_HOMEDRIVELIST, AvailableDrives );
932 if (nResult != 0) then
933 // Handle error from CtrlSetList.
934 MessageBox ("Unable to create folder name list.", SEVERE);
937 if (CtrlSetCurSel(szDlg,IDC_HOMEDRIVELIST,szHomeDrive)!=0) then
939 CtrlSetCurSel(szDlg,IDC_HOMEDRIVELIST,szHomeDrive);
942 nResult=CtrlSetList( szDlg, IDC_ROOTDRIVELIST, AvailableDrives );
943 if (nResult != 0) then
944 // Handle error from CtrlSetList.
945 MessageBox ("Unable to create folder name list.", SEVERE);
948 if (CtrlSetCurSel(szDlg,IDC_ROOTDRIVELIST,szRootDrive)!=0) then
950 CtrlSetCurSel(szDlg,IDC_ROOTDRIVELIST,szRootDrive);
953 nResult=CtrlSetText( szDlg, IDC_ROOTPATH,szRootPath );
954 if (nResult != 0) then
955 MessageBox ("Unable to create szRootPath.", SEVERE);
958 nResult=CtrlSetText( szDlg, IDC_HOMEPATH,szHomePath );
959 if (nResult != 0) then
960 MessageBox ("Unable to create szHomePath.", SEVERE);
964 CtrlSetState (szDlg, IDC_ENABLEHOME,BUTTON_CHECKED);
965 CtrlSetState (szDlg, IDC_ENABLEROOT,BUTTON_CHECKED);
966 SdGeneralInit( szDlg, hwndDlg, STYLE_NORMAL, szSdProduct );
968 //This function sets the caption for old style dialogs or
969 //sets the text in the top banner area of win2k style dialogs
971 if (szRootDrive!=szHomeDrive) then
975 MessageBox("Home and Root drives cannot be the same",WARNING);
983 SdError( -1, "DLG_DRIVEPATH" );
988 SdCloseDlg( hwndDlg, nId, bDone );
992 hwndItem = GetDlgItem( hwndDlg, IDC_ROOTDRIVELIST );//get handle of control in custom dialog box
993 hwndItem2 = GetDlgItem( hwndDlg, IDC_ROOTPATH );//get handle of control in custom dialog box
994 if (CtrlGetState (szDlg, nId)==BUTTON_CHECKED) then
995 EnableWindow( hwndItem2, TRUE);
996 EnableWindow( hwndItem, TRUE);
998 EnableWindow( hwndItem2, FALSE);
999 EnableWindow( hwndItem, FALSE);
1001 case IDC_ENABLEHOME:
1002 hwndItem = GetDlgItem( hwndDlg, IDC_HOMEDRIVELIST );//get handle of control in custom dialog box
1003 hwndItem2 = GetDlgItem( hwndDlg, IDC_HOMEPATH );//get handle of control in custom dialog box
1004 if (CtrlGetState (szDlg, nId)==BUTTON_CHECKED) then
1005 EnableWindow( hwndItem2, TRUE);
1006 EnableWindow( hwndItem, TRUE);
1008 EnableWindow( hwndItem2, FALSE);
1009 EnableWindow( hwndItem, FALSE);
1012 case IDC_HOMEDRIVELIST:
1014 case IDC_ROOTDRIVELIST:
1017 CtrlGetText (szDlg, nId,szHomePath);
1020 CtrlGetText (szDlg, nId,szRootPath);
1023 // check standard handling
1024 if (SdIsStdButton( nId ) && SdDoStdButton( nId )) then
1031 CtrlGetCurSel (szDlg, nId, szRootDrive);
1032 if (CtrlGetState (szDlg, IDC_ENABLEROOT)==BUTTON_UNCHECKED) then
1033 szRootDrive="None:";
1035 CtrlGetCurSel (szDlg, nId, szHomeDrive);
1036 if (CtrlGetState (szDlg, IDC_ENABLEHOME)==BUTTON_UNCHECKED) then
1037 szHomeDrive="None:";
1040 ReleaseDialog( szDlg );
1044 // record data produced by this dialog
1046 SilentSetHomeRoot(szDlg,1,nId,szRootDrive,szRootPath,szHomeDrive,szHomePath );
1048 ListDestroy (AvailableDrives);
1054 // ---- script function prototypes -----
1057 // your script function prototypes
1061 ///////////////////////////////////////////////////////////////////////////////
1065 // The setup begins here by hiding the visible setup
1066 // window. This is done to allow all the titles, images, etc. to
1067 // be established before showing the main window. The setup is
1068 // then performed in a series of calls to script defined functions,
1069 // with error checking at each step.
1071 ///////////////////////////////////////////////////////////////////////////////
1075 Disable( BACKGROUND );
1076 if (UseDLL(SUPPORTDIR ^ SETUP_UTILS_DLL_PATH) < 0) then
1077 ShowError(@SETUPUTILS_NOT_FOUND, SEVERE);
1078 bInstallAborted = TRUE;
1082 ChangeDirectory (SUPPORTDIR);
1083 if (UseDLL("GetWebDLL.dll") != 0) then
1084 MessageBox ("DLL failed.\n\nCouldn't load"+SUPPORTDIR^"GetWebDLL.dll", INFORMATION);
1090 Logit("SetupInstall");
1092 CheckRequirements();
1093 Logit("CheckRequirements");
1096 Logit("ParseCommandLine");
1099 Logit("SetupAppInfo");
1101 LocalizeComponents();
1102 Logit("LocalizeComponents");
1104 DetectInstalledComponents();
1105 Logit("DetectInstalledComponents");
1107 // Can't upgrade, downgrade, or reinstall the light client, so if it is
1108 // already installed, we must abort. This is because on Win9x, we can't
1109 // move in-use files, and so we can't silently uninstall the light client,
1110 // which upgrade, downgrade, and reinstall require.
1111 if (bLightClientInstalled && !bWinNT) then
1112 ShowError(@LIGHT_CLIENT_ALREADY_INSTALLED_MSG, SEVERE);
1113 bInstallAborted = TRUE;
1117 if (AnyNonUpgradableSoftwareInstalled()) then
1118 ShowError(@NON_UPGRADABLE_SOFTWARE_INSTALLED_ERROR_MSG, SEVERE);
1119 bInstallAborted = TRUE;
1123 GetInstallActions();
1125 if (bWSPPInstall) then
1126 SetSilentMode(); // Tells the InstallUtils dll to run silently
1127 PrepareForWSPPInstall();
1129 // Ask user what to install
1131 if (ShowDialogs()<0) goto end_install;
1134 // The AFS path must not contain spaces. AFS code will break if it does.
1135 LongPathToShortPath(TARGETDIR);
1137 // Determine which comps to install to get the proper NLS files.
1138 GetNlsComps(szLangComp, szReadmeComp, szDocsComp, szCodePage);
1144 // Uninstall current versions before we install
1145 RemoveAllCurrentVersions();
1147 // Install the Client
1148 if (bFullClientSel) then
1149 RegDBSetDefaultRoot (HKEY_LOCAL_MACHINE);
1151 if RegDBSetKeyValueEx ("SYSTEM\\CurrentControlSet\\Services\\NetBT\\Parameters"
1152 ,"SmbDeviceEnabled", REGDB_NUMBER, "0", 8) < 0 then
1153 MessageBox ("RegDBCreateKeyEx failed.", SEVERE);
1156 pApp = &appFullClient;
1157 if (InstallApp(pApp) < 0) goto end_install;
1159 if RegDBSetKeyValueEx("SYSTEM\\CurrentControlSet\\Services\\TransarcAFSDaemon\\Parameters","Cell", REGDB_STRING, szCellName, -1) < 0 then
1160 MessageBox ("RegDBCreateKeyEx failed.", SEVERE);
1163 // Install the Light Client
1164 if (bLightClientSel) then
1165 pApp = &appLightClient;
1166 if (InstallApp(pApp) < 0) goto end_install;
1168 EzBatchAddString(LIGHT95_CLIENT_PROTSEQ, "", AFTER | REPLACE);
1172 // Install the Server
1173 if (bServerSel) then
1175 if (InstallApp(pApp) < 0) goto end_install;
1179 // Install the Control Center
1181 pApp = &appControlCenter;
1182 if (InstallApp(pApp) < 0) goto end_install;
1187 appDocs.szCompName = szDocsComp;
1189 if (InstallApp(pApp) < 0) goto end_install;
1192 // If we installed the server, then configure the bos service
1193 if (bServerSel) then
1194 if (ConfigServerService() < 0) goto end_install;
1197 // If we installed the full client, then configure the client service
1198 // and add the NetworkProviderOrder value.
1199 if (bFullClientSel) then
1200 if (ConfigClientService() < 0) goto end_install;
1201 // I'm commenting out the line below. This will result in integrated
1202 // login being off after an install. If you want it to be on after an
1203 // install, then uncomment the line.
1204 // if (SetNetworkProviderOrder() < 0) goto end_install;
1207 if (bFullClientSel || bLightClientSel) then
1211 RestorePreviousConfigs();
1213 AddPath(szCommonBinPath);
1215 // If not only installing docs, then set BATCH_INSTALL to true,
1216 // which will cause setup to want to reboot the computer.
1217 if (OnlyInstallingDocs() == FALSE) then
1218 BATCH_INSTALL = TRUE;
1221 CreateStartMenuEntries();
1223 // if (bFullClientSel || bLightClientSel || bCcSel) then
1224 // CheckCopyCellServDB();
1229 UnUseDLL(SUPPORTDIR^"GetWebDLL.dll");
1230 UnUseDLL(SUPPORTDIR ^ SETUP_UTILS_DLL_PATH);
1234 // If an unrecoverable error occurred, clean up
1235 // the partial installation. Otherwise, exit normally.
1236 if (bInstallAborted) then
1242 ///////////////////////////////////////////////////////////////////////////////
1244 // Function: ShowDialogs
1246 // Purpose: This function manages the display and navigation of
1247 // the standard dialogs that exist in a setup.
1249 ///////////////////////////////////////////////////////////////////////////////
1250 function ShowDialogs()
1251 NUMBER nResult,handle;
1252 STRING szTargetLicense;
1253 STRING szSourceLicense;
1254 STRING sRootDrive,sHomeDrive,userID,rootPath,homePath;
1256 STRING szDefaultWeb,szDefaultBrowse,szDefaultInstall,szPreviousInstall;
1257 STRING szResult[256],svResult;
1260 // beginning of dialogs label
1262 nResult = DialogShowSdWelcome();
1263 if (nResult = BACK) goto Dlg_Start;
1266 // szTargetLicense = DOCUMENTATION_LICENSE_PATH;
1267 // GetLicenseFilename (szSourceLicense);
1268 // Logit("ShowLicense");
1269 // Disable( DIALOGCACHE );
1270 // if (MODE!=SILENTMODE) then
1271 // nResult = ShowLicense(szTargetLicense,szSourceLicense);
1272 // if (nResult = 0) then
1275 // Enable( DIALOGCACHE );
1277 if (nResult = BACK) goto Dlg_Start;
1279 nResult = DialogShowSdAskComponentDialog();
1280 Logit("DialogShowSdAskComponentDialog");
1281 if (nResult = BACK) goto Dlg_License;
1284 nResult = DialogShowSdSelectFolder();
1285 Logit("DialogShowSdSelectFolder");
1286 if (nResult = BACK) goto Dlg_SdCompDlg;
1287 if (bFullClientSel || bLightClientSel) then
1288 szDefaultWeb=@CELLSERVDB_WEB;
1289 szDefaultBrowse=TARGETDIR^"*";
1290 szDefaultInstall=@CELLSERVDB_INSTALL;
1291 szPreviousInstall=WINDIR^@CELLSERVDB_CONFIGNAME;
1292 if (Is(FILE_EXISTS,szPreviousInstall)) then
1293 DefaultItem=IDC_CHECK_PREVIOUSFILE;
1295 DefaultItem=IDC_CHECK_INSTALL;
1297 Dlg_SdSelectCellServDB:
1298 Logit("SetCellServDB-next");
1299 nResult =SetCellServDB("Select AFS Cell Data base (afsdcell.ini)"
1305 Logit("SetCellServDB");
1306 if (nResult=BACK) goto Dlg_SdSelectFolder;
1307 Dlg_SdSelectCellName:
1308 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);
1309 if (nResult = BACK) goto Dlg_SdSelectCellName;
1310 if (Is(FILE_EXISTS, WINDIR^"afsdsbmt.ini")) then
1311 Logit("AskYesNo next");
1312 if (AskYesNo("Previous Drive Mapping Configuration already exist.\n\nPress Yes to keep previous configuration\nPress No to change previous configuration.",YES)=YES) then
1321 homePath = "/afs/" + szCellName + "/u/" + userID;
1322 nResult=SetHomeRoot( "Home and Root Drive Assignment\nThese drives will be mapped each time AFS is connected!",sRootDrive,rootPath,sHomeDrive,homePath );
1323 Logit("SetHomeRoot");
1324 if (nResult = BACK) goto Dlg_SdSelectCellServDB;
1326 Logit("ShowDialogs-done");
1331 ///////////////////////////////////////////////////////////////////////////////
1333 // Function: NotUpgradable
1335 // Purpose: This function will return TRUE if the passed in version is not
1338 ///////////////////////////////////////////////////////////////////////////////
1339 function NotUpgradable(pApp)
1341 // The 3.5 beta is not upgradable
1342 // if ((pApp->iVer.nMajorVersion = 3) && (pApp->iVer.nMinorVersion = 5) && (pApp->iVer.nPatchLevel = 0) && (pApp->iVer.szReleaseType = RELEASE_TYPE_BETA)) then
1350 ///////////////////////////////////////////////////////////////////////////////
1352 // Function: AnyNonUpgradableSoftwareInstalled
1354 // Purpose: This function will return TRUE if any non-upgradable software is
1357 ///////////////////////////////////////////////////////////////////////////////
1358 function AnyNonUpgradableSoftwareInstalled()
1360 if (NotUpgradable(&appFullClient) ||
1361 NotUpgradable(&appServer) ||
1362 NotUpgradable(&appControlCenter) ||
1363 NotUpgradable(&appLightClient) ||
1364 NotUpgradable(&appDocs))
1373 ///////////////////////////////////////////////////////////////////////////////
1375 // Function: UnselectComps
1377 // Purpose: This function unselects all of the componenets so that we can
1378 // completely control what gets installed. We will select each
1379 // component at the time when we want to install it.
1381 ///////////////////////////////////////////////////////////////////////////////
1382 function UnselectComps()
1384 ComponentSelectItem(MEDIA, SERVER_COMP_NAME, FALSE);
1385 ComponentSelectItem(MEDIA, CLIENT_COMP_NAME, FALSE);
1386 ComponentSelectItem(MEDIA, LIGHT_CLIENT_COMP_NAME, FALSE);
1387 ComponentSelectItem(MEDIA, CC_COMP_NAME, FALSE);
1388 ComponentSelectItem(MEDIA, DOCS_COMP_NAME, FALSE);
1389 ComponentSelectItem(MEDIA, LANG_COMP_NAME, FALSE);
1390 ComponentSelectItem(MEDIA, LANG_ENGLISH_COMP_NAME, FALSE);
1391 ComponentSelectItem(MEDIA, LANG_SIMP_CHINESE_COMP_NAME, FALSE);
1392 ComponentSelectItem(MEDIA, LANG_TRAD_CHINESE_COMP_NAME, FALSE);
1393 ComponentSelectItem(MEDIA, LANG_KOREAN_COMP_NAME, FALSE);
1394 ComponentSelectItem(MEDIA, LANG_JAPANESE_COMP_NAME, FALSE);
1395 ComponentSelectItem(MEDIA, LANG_GERMAN_COMP_NAME, FALSE);
1396 ComponentSelectItem(MEDIA, LANG_SPANISH_COMP_NAME, FALSE);
1397 ComponentSelectItem(MEDIA, LANG_PORTUGUESE_COMP_NAME, FALSE);
1398 ComponentSelectItem(MEDIA, README_COMP_NAME, FALSE);
1399 ComponentSelectItem(MEDIA, README_ENGLISH_COMP_NAME, FALSE);
1400 ComponentSelectItem(MEDIA, README_JAPANESE_COMP_NAME, FALSE);
1401 ComponentSelectItem(MEDIA, README_KOREAN_COMP_NAME, FALSE);
1402 ComponentSelectItem(MEDIA, README_SIMP_CHINESE_COMP_NAME, FALSE);
1403 ComponentSelectItem(MEDIA, README_TRAD_CHINESE_COMP_NAME, FALSE);
1404 ComponentSelectItem(MEDIA, README_GERMAN_COMP_NAME, FALSE);
1405 ComponentSelectItem(MEDIA, README_SPANISH_COMP_NAME, FALSE);
1406 ComponentSelectItem(MEDIA, README_PORTUGUESE_COMP_NAME, FALSE);
1407 ComponentSelectItem(MEDIA, DOCS_ENGLISH_COMP_NAME, FALSE);
1408 ComponentSelectItem(MEDIA, DOCS_JAPANESE_COMP_NAME, FALSE);
1409 ComponentSelectItem(MEDIA, DOCS_KOREAN_COMP_NAME, FALSE);
1410 ComponentSelectItem(MEDIA, DOCS_SIMP_CHINESE_COMP_NAME, FALSE);
1411 ComponentSelectItem(MEDIA, DOCS_TRAD_CHINESE_COMP_NAME, FALSE);
1412 ComponentSelectItem(MEDIA, DOCS_GERMAN_COMP_NAME, FALSE);
1413 ComponentSelectItem(MEDIA, DOCS_SPANISH_COMP_NAME, FALSE);
1414 ComponentSelectItem(MEDIA, DOCS_PORTUGUESE_COMP_NAME, FALSE);
1418 ///////////////////////////////////////////////////////////////////////////////
1420 // Function: DoesConfigInfoExist
1422 // Purpose: This function determines if config info exists for an app.
1424 ///////////////////////////////////////////////////////////////////////////////
1425 function DoesConfigInfoExist(pApp)
1427 RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
1429 if (RegDBKeyExist(CONFIG_INFO_KEY ^ pApp->szProductName) = 1) then
1437 ///////////////////////////////////////////////////////////////////////////////
1439 // Function: RestorePreviousConfigs
1441 // Purpose: This function restores config info for the apps we just installed.
1443 ///////////////////////////////////////////////////////////////////////////////
1444 function RestorePreviousConfigs()
1446 if (appServer.bInstallSucceeded && DoesConfigInfoExist(&appServer)) then
1447 RestoreConfigInfo(SERVER);
1450 if (appFullClient.bInstallSucceeded) then
1451 if (appFullClient.iVer.szTitle = "3.4a") then
1452 Upgrade34ClientConfigInfo();
1453 elseif (DoesConfigInfoExist(&appFullClient) = TRUE) then
1454 RestoreConfigInfo(CLIENT);
1458 if (appLightClient.bInstallSucceeded && DoesConfigInfoExist(&appLightClient)) then
1459 RestoreConfigInfo(LCLIENT);
1462 // Only restore control center info if client not installed
1463 if (appControlCenter.bInstallSucceeded && !bClientInstalled && !appFullClient.bInstallSucceeded
1464 && DoesConfigInfoExist(&appControlCenter))
1466 RestoreConfigInfo(CC);
1471 ///////////////////////////////////////////////////////////////////////////////
1473 // Function: OnlyInstallingDocs
1475 // Purpose: This function determines if only the doc files are being installed.
1477 ///////////////////////////////////////////////////////////////////////////////
1478 function OnlyInstallingDocs()
1480 if (!bServerSel && !bFullClientSel && !bLightClientSel && !bCcSel && bDocsSel) then
1488 ///////////////////////////////////////////////////////////////////////////////
1490 // Function: CreateDirs
1492 // Purpose: This function creates directories that we don't want IS to make.
1494 ///////////////////////////////////////////////////////////////////////////////
1495 function CreateDirs()
1497 // Turn off logging. It shouldn't be on when this func is called, but we
1498 // turn it off anyway just to make sure. We turn it off so that IS won't
1499 // try to delete the dirs we are about to make during an uninstall. If
1500 // we don't do this, then the first app installed that uses one of these
1501 // dirs will think that it owns that dir and won't know that other apps
1505 // Create the target dir and the shared dirs
1506 CreateDir(TARGETDIR);
1507 CreateDir(TARGETDIR ^ "Documentation");
1508 CreateDir(TARGETDIR ^ "Documentation\\Html");
1509 CreateDir(TARGETDIR ^ "Documentation\\Html\\InstallGd");
1510 CreateDir(TARGETDIR ^ "Documentation\\Html\\ReleaseNotes");
1512 // We need to manually create the Server dir so that if we have to leave
1513 // it behind during an uninstall (so that config info is preserved), IS
1514 // won't complain that it can't be deleted.
1515 if (bServerSel) then
1516 CreateDir(TARGETDIR ^ "Server\\usr\\afs\\bin");
1519 // Docs don't use the common dir
1520 if (OnlyInstallingDocs() = FALSE) then
1521 CreateDir(TARGETDIR ^ "Common");
1526 ///////////////////////////////////////////////////////////////////////////////
1528 // Function: PrepareForWSPPInstall
1530 // Purpose: This function decides what to install when doing a WSPP install.
1532 ///////////////////////////////////////////////////////////////////////////////
1533 function PrepareForWSPPInstall()
1535 SHELL_OBJECT_FOLDER = @WSPP_FOLDER_NAME;
1537 // Never install the Docs during a WSPP install
1538 appDocs.nInstallAction = ACTION_NONE;
1540 // If we have been told to replace any preinstalled software, then set
1541 // our reinstall mechanism in motion.
1542 if (bPreinstallReplace) then
1543 if (bCcInstalled && bCcSel) then
1544 appControlCenter.nInstallAction = ACTION_REINSTALL;
1546 if (bClientInstalled && bFullClientSel) then
1547 appFullClient.nInstallAction = ACTION_REINSTALL;
1549 if (bServerInstalled && bServerSel) then
1550 appServer.nInstallAction = ACTION_REINSTALL;
1552 if (bLightClientInstalled && bLightClientSel) then
1553 appLightClient.nInstallAction = ACTION_REINSTALL;
1556 // If we have been told to not install something that is already
1557 // installed, then do just that.
1558 if (bCcInstalled && bCcSel) then
1561 if (bClientInstalled && bFullClientSel) then
1562 bFullClientSel = FALSE;
1564 if (bServerInstalled && bServerSel) then
1567 if (bLightClientInstalled && bLightClientSel) then
1568 bLightClientSel = FALSE;
1574 ///////////////////////////////////////////////////////////////////////////////
1576 // Function: RemoveCurrentVersion
1578 // Purpose: This function removes the currently installed version of the app.
1579 // It provides a message to the user so they know what is going on.
1581 ///////////////////////////////////////////////////////////////////////////////
1582 function RemoveCurrentVersion(pApp)
1588 switch(pApp->nInstallAction)
1589 case ACTION_REINSTALL: szFormat = @REINSTALL_PREP_MSG;
1590 case ACTION_UPGRADE: szFormat = @UPGRADE_PREP_MSG;
1591 case ACTION_DOWNGRADE: szFormat = @DOWNGRADE_PREP_MSG;
1594 if (szFormat == "") then
1598 Sprintf(szMsg, szFormat, pApp->szProductName);
1600 if (!bWSPPInstall) then
1601 SdShowMsg(szMsg, TRUE);
1604 RemoveInstalledBits(pApp->szProductName);
1606 if (!bWSPPInstall) then
1607 SdShowMsg(szMsg, FALSE);
1612 ///////////////////////////////////////////////////////////////////////////////
1614 // Function: RemoveAllCurrentVersions
1616 // Purpose: This function removes the current install of all apps that are
1617 // begin reinstalled, upgraded, or downgraded.
1619 ///////////////////////////////////////////////////////////////////////////////
1620 function RemoveAllCurrentVersions()
1622 if (bFullClientSel) then
1623 RemoveCurrentVersion(&appFullClient);
1626 if (bServerSel) then
1627 RemoveCurrentVersion(&appServer);
1631 RemoveCurrentVersion(&appControlCenter);
1634 if (bLightClientSel) then
1635 RemoveCurrentVersion(&appLightClient);
1640 ///////////////////////////////////////////////////////////////////////////////
1642 // Function: InstallApp
1644 // Purpose: This function installs an application that is part of a suite.
1646 ///////////////////////////////////////////////////////////////////////////////
1647 function InstallApp(pApp)
1650 if (pApp->nInstallAction = ACTION_NONE) then
1654 // Start fresh with nothing selected
1657 // Select the comps we want to install. We will install the passed in app
1658 // as well as the comps that are shared by all the apps. Because of weird
1659 // IS stuff, the app comp must be selected last else IS will autoselect
1660 // things we don't want.
1661 ComponentSelectItem(MEDIA, szReadmeComp, TRUE);
1663 // Lang comps are shared by all apps except the docs app
1664 if (pApp != &appDocs) then
1665 ComponentSelectItem(MEDIA, szLangComp, TRUE);
1668 // Select the app's component
1669 ComponentSelectItem(MEDIA, pApp->szCompName, TRUE);
1671 // MessageBox("Install app: " + pApp->szCompName, INFORMATION);
1673 nResult = ProcessBeforeDataMove(pApp);
1674 if (nResult < 0) goto error;
1676 nResult = MoveFileData();
1677 if (nResult < 0) goto error;
1679 nResult = ProcessAfterDataMove();
1680 if (nResult < 0) goto error;
1682 nResult = CreateRegistrySets(pApp->szRegistrySets);
1683 if (nResult < 0) goto error;
1687 nResult = CreateRegistrySets(pApp->szNoLogRegistrySets);
1688 if (nResult < 0) goto error;
1690 nResult = ConfigUninstallDLL(pApp);
1691 if (nResult < 0) goto error;
1693 AddPath(pApp->szBinPath);
1695 // Now unselect it again
1696 ComponentSelectItem(MEDIA, pApp->szCompName, FALSE);
1698 pApp->bInstallSucceeded = TRUE;
1707 ///////////////////////////////////////////////////////////////////////////////
1709 // Function: ProcessBeforeDataMove
1711 // Purpose: This function performs any necessary operations prior to the
1712 // actual file transfer.
1714 ///////////////////////////////////////////////////////////////////////////////
1715 function ProcessBeforeDataMove(pApp)
1719 // Create app information and App Paths registry keys.
1720 InstallationInfo(pApp->szCompanyName, pApp->szProductName, pApp->Ver.szTitle, pApp->szProductKey);
1722 svLogFile = pApp->szUninstLogfileName;
1724 // Create the uninstall reg key and open the log file
1725 nResult = DeinstallStart(TARGETDIR, svLogFile, pApp->szUninstKey, 0 );
1726 if (nResult < 0) then
1727 ShowError( @ERROR_UNINSTSETUP, WARNING );
1730 szAppPath = pApp->szAppPath;
1732 // Fill in reg values for this apps reg key and uninstall reg key
1733 RegDBSetItem( REGDB_APPPATH, szAppPath );
1734 RegDBSetItem( REGDB_APPPATH_DEFAULT, szAppPath ^ pApp->szProductKey);
1735 RegDBSetItem( REGDB_UNINSTALL_NAME, pApp->szUninstDisplayName);
1742 function ShowIsSelected(comp)
1746 nSel = ComponentIsItemSelected(MEDIA , comp);
1748 str = comp + " is selected.";
1749 MessageBox(str, INFORMATION);
1751 str = comp + " is not selected.";
1756 function ShowSelectedComponents()
1758 // Visible components
1759 ShowIsSelected(CLIENT_COMP_NAME);
1760 ShowIsSelected(LIGHT_CLIENT_COMP_NAME);
1761 ShowIsSelected(SERVER_COMP_NAME);
1762 ShowIsSelected(CC_COMP_NAME);
1763 ShowIsSelected(DOCS_COMP_NAME);
1765 // Language components
1766 ShowIsSelected(LANG_COMP_NAME);
1767 ShowIsSelected(LANG_ENGLISH_COMP_NAME);
1768 ShowIsSelected(LANG_SIMP_CHINESE_COMP_NAME);
1769 ShowIsSelected(LANG_TRAD_CHINESE_COMP_NAME);
1770 ShowIsSelected(LANG_KOREAN_COMP_NAME);
1771 ShowIsSelected(LANG_JAPANESE_COMP_NAME);
1772 ShowIsSelected(LANG_GERMAN_COMP_NAME);
1773 ShowIsSelected(LANG_SPANISH_COMP_NAME);
1774 ShowIsSelected(LANG_PORTUGUESE_COMP_NAME);
1776 // Documentation components
1777 ShowIsSelected(DOCS_ENGLISH_COMP_NAME);
1778 ShowIsSelected(DOCS_JAPANESE_COMP_NAME);
1779 ShowIsSelected(DOCS_KOREAN_COMP_NAME);
1780 ShowIsSelected(DOCS_SIMP_CHINESE_COMP_NAME);
1781 ShowIsSelected(DOCS_TRAD_CHINESE_COMP_NAME);
1782 ShowIsSelected(DOCS_GERMAN_COMP_NAME);
1783 ShowIsSelected(DOCS_SPANISH_COMP_NAME);
1784 ShowIsSelected(DOCS_PORTUGUESE_COMP_NAME);
1786 // Readme files components
1787 ShowIsSelected(README_COMP_NAME);
1788 ShowIsSelected(README_ENGLISH_COMP_NAME);
1789 ShowIsSelected(README_JAPANESE_COMP_NAME);
1790 ShowIsSelected(README_KOREAN_COMP_NAME);
1791 ShowIsSelected(README_SIMP_CHINESE_COMP_NAME);
1792 ShowIsSelected(README_TRAD_CHINESE_COMP_NAME);
1793 ShowIsSelected(README_GERMAN_COMP_NAME);
1794 ShowIsSelected(README_SPANISH_COMP_NAME);
1795 ShowIsSelected(README_PORTUGUESE_COMP_NAME);
1800 ///////////////////////////////////////////////////////////////////////////////
1802 // Function: MoveFileData
1804 // Purpose: This function handles the file transfer for
1807 ///////////////////////////////////////////////////////////////////////////////
1808 function MoveFileData()
1809 NUMBER nResult, nDisk;
1812 if (!bWSPPInstall) then
1813 Enable( INDVFILESTATUS );
1814 SetStatusWindow( 0, "" );
1815 Disable( DIALOGCACHE );
1817 StatusUpdate( ON, 100 );
1820 nResult = ComponentMoveData( MEDIA, nDisk, 0 );
1822 // Reinit this call so the progress indicator resets
1823 ComponentMoveData("", nDisk, 0);
1825 HandleMoveDataError( nResult );
1833 ///////////////////////////////////////////////////////////////////////////////
1835 // Function: HandleMoveDataError
1837 // Purpose: This function handles the error (if any) during the file transfer
1840 ///////////////////////////////////////////////////////////////////////////////
1841 function HandleMoveDataError( nResult )
1842 STRING szErrMsg, svComponent , svFileGroup , svFile;
1853 ComponentError ( MEDIA , svComponent , svFileGroup , svFile , nResult );
1854 szErrMsg = @ERROR_MOVEDATA + "\n\n" +
1855 @ERROR_COMPONENT + " " + svComponent + "\n" +
1856 @ERROR_FILEGROUP + " " + svFileGroup + "\n" +
1857 @ERROR_FILE + " " + svFile;
1858 Sprintf(szMsg, szErrMsg, nResult);
1859 ShowError(szMsg, SEVERE);
1860 bInstallAborted = TRUE;
1867 ///////////////////////////////////////////////////////////////////////////////
1869 // Function: ProcessAfterDataMove
1871 // Purpose: This function performs any necessary operations needed after
1872 // all files have been transferred.
1874 ///////////////////////////////////////////////////////////////////////////////
1875 function ProcessAfterDataMove()
1876 STRING szReferenceFile;
1880 // TO DO : update self-registered files and other processes that
1881 // should be performed after the files have been transferred.
1883 // DeinstallSetReference specifies a file to be checked before
1884 // uninstallation. If the file is in use, uninstallation will not proceed.
1886 // szReferenceFile = svDir ^ pApp->szProductKey; // TO DO : If your file is in a
1887 // subfolder of svDir add that here
1889 // DeinstallSetReference( szReferenceFile );
1895 ///////////////////////////////////////////////////////////////////////////////
1897 // Function: CleanUpInstall
1899 // Purpose: This cleans up the setup. Anything that should
1900 // be released or deleted at the end of the setup should
1903 ///////////////////////////////////////////////////////////////////////////////
1904 function CleanUpInstall()
1907 if (bInstallAborted) then
1911 if (!bWSPPInstall) then
1912 DialogShowSdFinishReboot();
1915 if (BATCH_INSTALL) then // ensure locked files are properly transferred
1916 CommitSharedFiles(0);
1923 ///////////////////////////////////////////////////////////////////////////////
1925 // Function: GetLicenseFilename
1927 // Purpose: This will determine the full path to the appropriate-language
1928 // license on the CD. Will default to English if the locale cannot
1931 ///////////////////////////////////////////////////////////////////////////////
1932 function GetLicenseFilename(szLicense)
1933 number MajorLanguage;
1935 MajorLanguage = SELECTED_LANGUAGE & 255;
1937 switch(MajorLanguage)
1938 case ISLANG_CHINESE:
1939 if (SELECTED_LANGUAGE == ISLANG_CHINESE_TAIWAN) then
1940 szLicense = SRCDIR ^ LICENSE_TRAD_CHINESE_FILENAME;
1942 szLicense = SRCDIR ^ LICENSE_SIMP_CHINESE_FILENAME;
1946 szLicense = SRCDIR ^ LICENSE_KOREAN_FILENAME;
1948 case ISLANG_JAPANESE:
1949 szLicense = SRCDIR ^ LICENSE_JAPANESE_FILENAME;
1952 szLicense = SRCDIR ^ LICENSE_GERMAN_FILENAME;
1954 case ISLANG_PORTUGUESE:
1955 szLicense = SRCDIR ^ LICENSE_PORTUGUESE_FILENAME;
1957 case ISLANG_SPANISH:
1958 szLicense = SRCDIR ^ LICENSE_SPANISH_FILENAME;
1961 szLicense = SRCDIR ^ LICENSE_ENGLISH_FILENAME;
1969 ///////////////////////////////////////////////////////////////////////////////
1971 // Function: GetLanguageComp
1973 // Purpose: This will determine which language the locale is set to. Uses
1974 // this info to determine which lang, readme, and doc comps to
1975 // install. Will default to English if the locale cannot be
1978 ///////////////////////////////////////////////////////////////////////////////
1979 function GetNlsComps(szLangComp, szReadmeComp, szDocsComp, szCodePage)
1980 number MajorLanguage;
1982 MajorLanguage = SELECTED_LANGUAGE & 255;
1984 switch(MajorLanguage)
1985 case ISLANG_CHINESE:
1986 if (SELECTED_LANGUAGE == ISLANG_CHINESE_TAIWAN) then
1987 szLangComp = LANG_TRAD_CHINESE_COMP_NAME;
1988 szReadmeComp = README_TRAD_CHINESE_COMP_NAME;
1989 szDocsComp = DOCS_TRAD_CHINESE_COMP_NAME;
1990 szCodePage = "1028";
1992 szLangComp = LANG_SIMP_CHINESE_COMP_NAME;
1993 szReadmeComp = README_SIMP_CHINESE_COMP_NAME;
1994 szDocsComp = DOCS_SIMP_CHINESE_COMP_NAME;
1995 szCodePage = "2052";
1999 szLangComp = LANG_KOREAN_COMP_NAME;
2000 szReadmeComp = README_KOREAN_COMP_NAME;
2001 szDocsComp = DOCS_KOREAN_COMP_NAME;
2002 szCodePage = "1042";
2004 case ISLANG_JAPANESE:
2005 szLangComp = LANG_JAPANESE_COMP_NAME;
2006 szReadmeComp = README_JAPANESE_COMP_NAME;
2007 szDocsComp = DOCS_JAPANESE_COMP_NAME;
2008 szCodePage = "1041";
2011 szLangComp = LANG_GERMAN_COMP_NAME;
2012 szReadmeComp = README_GERMAN_COMP_NAME;
2013 szDocsComp = DOCS_GERMAN_COMP_NAME;
2014 szCodePage = "1032";
2016 case ISLANG_PORTUGUESE:
2017 szLangComp = LANG_PORTUGUESE_COMP_NAME;
2018 szReadmeComp = README_PORTUGUESE_COMP_NAME;
2019 szDocsComp = DOCS_PORTUGUESE_COMP_NAME;
2020 szCodePage = "1046";
2022 case ISLANG_SPANISH:
2023 szLangComp = LANG_SPANISH_COMP_NAME;
2024 szReadmeComp = README_SPANISH_COMP_NAME;
2025 szDocsComp = DOCS_SPANISH_COMP_NAME;
2026 szCodePage = "1034";
2029 szLangComp = LANG_ENGLISH_COMP_NAME;
2030 szReadmeComp = README_ENGLISH_COMP_NAME;
2031 szDocsComp = DOCS_ENGLISH_COMP_NAME;
2032 szCodePage = "1033";
2040 ///////////////////////////////////////////////////////////////////////////////
2042 // Function: SetupVerInfo
2044 // Purpose: This will initialize the VERINFO structures for a product.
2046 ///////////////////////////////////////////////////////////////////////////////
2047 function SetupVerInfo(pApp, szMajor, szMinor, szPatchLevel, szBetaLevel, szReleaseType, szTitle, bInstalledVerInfo)
2053 StrToNum(nMajor, szMajor);
2054 StrToNum(nMinor, szMinor);
2055 StrToNum(nPatchLevel, szPatchLevel);
2056 StrToNum(nBetaLevel, szBetaLevel);
2058 if (bInstalledVerInfo) then
2059 pApp->iVer.nMajorVersion = nMajor;
2060 pApp->iVer.nMinorVersion = nMinor;
2061 pApp->iVer.nPatchLevel = nPatchLevel;
2062 pApp->iVer.nBetaLevel = nBetaLevel;
2063 pApp->iVer.szReleaseType = szReleaseType;
2064 pApp->iVer.szTitle = szTitle;
2066 pApp->Ver.nMajorVersion = nMajor;
2067 pApp->Ver.nMinorVersion = nMinor;
2068 pApp->Ver.nPatchLevel = nPatchLevel;
2069 pApp->Ver.nBetaLevel = nBetaLevel;
2070 pApp->Ver.szReleaseType = szReleaseType;
2071 pApp->Ver.szTitle = szTitle;
2077 ///////////////////////////////////////////////////////////////////////////////
2079 // Function: FixTargetPaths
2081 // Purpose: This function updates the CommonBinPath and app paths if you
2082 // choose to install to a different directory
2084 ///////////////////////////////////////////////////////////////////////////////
2085 function FixTargetPaths()
2087 // The AFS path must not contain spaces. AFS code will break if it does.
2088 LongPathToShortPath(TARGETDIR);
2090 szCommonBinPath = TARGETDIR ^ "Common";
2093 appFullClient.szAppPath = TARGETDIR ^ "Client";
2094 appFullClient.szBinPath = TARGETDIR ^ "Client\\Program";
2097 appLightClient.szAppPath = TARGETDIR ^ "Client";
2098 appLightClient.szBinPath = TARGETDIR ^ "Client\\Program";
2101 appServer.szAppPath = TARGETDIR ^ "Server";
2102 appServer.szBinPath = TARGETDIR ^ "Server\\usr\\afs\\bin";
2105 appControlCenter.szAppPath = TARGETDIR ^ "Control Center";
2106 appControlCenter.szBinPath = TARGETDIR ^ "Control Center";
2109 appDocs.szAppPath = TARGETDIR ^ "Documentation";
2110 appDocs.szBinPath = TARGETDIR ^ "Documentation";
2115 ///////////////////////////////////////////////////////////////////////////////
2117 // Function: SetupAppInfo
2119 // Purpose: This will initialize the APPINFO structures for each product
2120 // that we can install.
2122 ///////////////////////////////////////////////////////////////////////////////
2123 function SetupAppInfo()
2126 szCommonBinPath = TARGETDIR ^ "Common";
2129 appFullClient.szCompName = CLIENT_COMP_NAME; // Component name
2130 appFullClient.szCompanyName = @COMPANY_NAME;
2131 appFullClient.szProductName = @PRODUCT_NAME_CLIENT;
2132 appFullClient.szProductKey = @PRODUCT_KEY_CLIENT;
2133 appFullClient.bUseUninstDLL = TRUE;
2134 appFullClient.szUninstDllName = CLIENT_UNINST_DLL_NAME;
2135 appFullClient.szUninstLogfileName = CLIENT_UNINST_LOGFILE_NAME;
2136 appFullClient.szUninstKey = @UNINST_KEY_CLIENT;
2137 appFullClient.szAppPath = TARGETDIR ^ "Client";
2138 appFullClient.szBinPath = TARGETDIR ^ "Client\\Program";
2139 appFullClient.bAddToPath = TRUE;
2140 appFullClient.szUninstDisplayName = @UNINST_DISPLAY_NAME_CLIENT;
2141 appFullClient.szRegistrySets = "Client,Full_Client";
2142 appFullClient.szNoLogRegistrySets = "Client_NoUninstall,WinNT_Client_NoUninstall";
2143 appFullClient.bInstallSucceeded = FALSE;
2144 SetupVerInfo(&appFullClient, @PRODUCT_VERSION_MAJOR, @PRODUCT_VERSION_MINOR, @PRODUCT_VERSION_PATCH_LEVEL, @PRODUCT_VERSION_BETA_LEVEL, @PRODUCT_VERSION_RELEASE_TYPE, @PRODUCT_VERSION_TITLE, FALSE);
2148 appLightClient.szCompName = LIGHT95_CLIENT_COMP_NAME;
2149 elseif (bWin98) then
2150 appLightClient.szCompName = LIGHT98_CLIENT_COMP_NAME;
2152 appLightClient.szCompanyName = @COMPANY_NAME;
2153 appLightClient.szProductName = @PRODUCT_NAME_LIGHT_CLIENT;
2154 appLightClient.szProductKey = @PRODUCT_KEY_LIGHT_CLIENT;
2155 appLightClient.bUseUninstDLL = TRUE;
2156 appLightClient.szUninstDllName = LIGHT_CLIENT_UNINST_DLL_NAME;
2157 appLightClient.szUninstLogfileName = LIGHT_CLIENT_UNINST_LOGFILE_NAME;
2158 appLightClient.szUninstKey = @UNINST_KEY_LIGHT_CLIENT;
2159 appLightClient.szAppPath = TARGETDIR ^ "Client";
2160 appLightClient.szBinPath = TARGETDIR ^ "Client\\Program";
2161 appLightClient.bAddToPath = TRUE;
2162 appLightClient.szUninstDisplayName = @UNINST_DISPLAY_NAME_LIGHT_CLIENT;
2163 appLightClient.szRegistrySets = "Client,LightClient";
2164 appLightClient.szNoLogRegistrySets = "Client_NoUninstall";
2165 appLightClient.bInstallSucceeded = FALSE;
2166 SetupVerInfo(&appLightClient, @PRODUCT_VERSION_MAJOR, @PRODUCT_VERSION_MINOR, @PRODUCT_VERSION_PATCH_LEVEL, @PRODUCT_VERSION_BETA_LEVEL, @PRODUCT_VERSION_RELEASE_TYPE, @PRODUCT_VERSION_TITLE, FALSE);
2169 appServer.szCompName = SERVER_COMP_NAME;
2170 appServer.szCompanyName = @COMPANY_NAME;
2171 appServer.szProductName = @PRODUCT_NAME_SERVER;
2172 appServer.szProductKey = @PRODUCT_KEY_SERVER;
2173 appServer.bUseUninstDLL = TRUE;
2174 appServer.szUninstDllName = SERVER_UNINST_DLL_NAME;
2175 appServer.szUninstLogfileName = SERVER_UNINST_LOGFILE_NAME;
2176 appServer.szUninstKey = @UNINST_KEY_SERVER;
2177 appServer.szAppPath = TARGETDIR ^ "Server";
2178 appServer.szBinPath = TARGETDIR ^ "Server\\usr\\afs\\bin";
2179 appServer.bAddToPath = TRUE;
2180 appServer.szUninstDisplayName = @UNINST_DISPLAY_NAME_SERVER;
2181 appServer.szRegistrySets = "Server";
2182 appServer.szNoLogRegistrySets = "";
2183 appServer.bInstallSucceeded = FALSE;
2184 SetupVerInfo(&appServer, @PRODUCT_VERSION_MAJOR, @PRODUCT_VERSION_MINOR, @PRODUCT_VERSION_PATCH_LEVEL, @PRODUCT_VERSION_BETA_LEVEL, @PRODUCT_VERSION_RELEASE_TYPE, @PRODUCT_VERSION_TITLE, FALSE);
2187 appControlCenter.szCompName = CC_COMP_NAME;
2188 appControlCenter.szCompanyName = @COMPANY_NAME;
2189 appControlCenter.szProductName = @PRODUCT_NAME_CC;
2190 appControlCenter.szProductKey = @PRODUCT_KEY_CC;
2191 appControlCenter.bUseUninstDLL = TRUE;
2192 appControlCenter.szUninstDllName = CC_UNINST_DLL_NAME;
2193 appControlCenter.szUninstLogfileName = CC_UNINST_LOGFILE_NAME;
2194 appControlCenter.szUninstKey = @UNINST_KEY_CC;
2195 appControlCenter.szAppPath = TARGETDIR ^ "Control Center";
2196 appControlCenter.szBinPath = TARGETDIR ^ "Control Center";
2197 appControlCenter.bAddToPath = TRUE;
2198 appControlCenter.szUninstDisplayName = @UNINST_DISPLAY_NAME_CC;
2199 appControlCenter.szRegistrySets = "Control_Center";
2200 appControlCenter.szNoLogRegistrySets = "";
2201 appControlCenter.bInstallSucceeded = FALSE;
2202 SetupVerInfo(&appControlCenter, @PRODUCT_VERSION_MAJOR, @PRODUCT_VERSION_MINOR, @PRODUCT_VERSION_PATCH_LEVEL, @PRODUCT_VERSION_BETA_LEVEL, @PRODUCT_VERSION_RELEASE_TYPE, @PRODUCT_VERSION_TITLE, FALSE);
2205 appDocs.szCompName = DOCS_COMP_NAME;
2206 appDocs.szCompanyName = @COMPANY_NAME;
2207 appDocs.szProductName = @PRODUCT_NAME_DOCS;
2208 appDocs.szProductKey = @PRODUCT_KEY_DOCS;
2209 appDocs.bUseUninstDLL = TRUE;
2210 appDocs.szUninstDllName = DOCS_UNINST_DLL_NAME;
2211 appDocs.szUninstLogfileName = DOCS_UNINST_LOGFILE_NAME;
2212 appDocs.szUninstKey = @UNINST_KEY_DOCS;
2213 appDocs.szAppPath = TARGETDIR ^ "Documentation";
2214 appDocs.szBinPath = TARGETDIR ^ "Documentation";
2215 appDocs.bAddToPath = FALSE;
2216 appDocs.szUninstDisplayName = @UNINST_DISPLAY_NAME_DOCS;
2217 appDocs.szRegistrySets = "Docs";
2218 appDocs.szNoLogRegistrySets = "";
2219 appDocs.bInstallSucceeded = FALSE;
2220 SetupVerInfo(&appDocs, @PRODUCT_VERSION_MAJOR, @PRODUCT_VERSION_MINOR, @PRODUCT_VERSION_PATCH_LEVEL, @PRODUCT_VERSION_BETA_LEVEL, @PRODUCT_VERSION_RELEASE_TYPE, @PRODUCT_VERSION_TITLE, FALSE);
2224 ///////////////////////////////////////////////////////////////////////////////
2226 // Function: SetupInstall
2228 // Purpose: This will initialize the setup. Any general initialization
2229 // needed for the installation should be performed here.
2231 ///////////////////////////////////////////////////////////////////////////////
2232 function SetupInstall()
2234 Enable( CORECOMPONENTHANDLING );
2236 szCellName=@CELLNAME_DEFAULT;
2237 bInstallAborted = FALSE;
2239 // Create list of end user selections to be displayed by DialogShowSdStartCopy()
2241 svDir = PROGRAMFILES ^ @DEFAULT_INSTALL_DIR;
2245 SdProductName( @PRODUCT_NAME );
2247 Enable( DIALOGCACHE );
2249 SetDialogTitle(DLG_ASK_YESNO, @TITLE_CAPTIONBAR);
2250 SetDialogTitle(DLG_MSG_INFORMATION, @TITLE_CAPTIONBAR);
2251 SetDialogTitle(DLG_MSG_WARNING, @TITLE_CAPTIONBAR);
2252 SetDialogTitle(DLG_MSG_SEVERE, @TITLE_CAPTIONBAR);
2253 SetDialogTitle(DLG_USER_CAPTION, @TITLE_CAPTIONBAR);
2256 ///////////////////////////////////////////////////////////////////////////////
2258 // Function: SetupScreen
2260 // Purpose: This function establishes the screen look. This includes
2261 // colors, fonts, and text to be displayed.
2263 ///////////////////////////////////////////////////////////////////////////////
2264 function SetupScreen()
2266 Enable( FULLWINDOWMODE );
2267 SetTitle( @TITLE_MAIN, 24, WHITE );
2269 SetTitle( @TITLE_CAPTIONBAR, 0, BACKGROUNDCAPTION ); // Caption bar text.
2271 Enable( BACKGROUND );
2277 ///////////////////////////////////////////////////////////////////////////////
2279 // Function: CheckRequirements
2281 // Purpose: This function checks all minimum requirements for the
2282 // application being installed. If any fail, then the user
2283 // is informed and the setup is terminated.
2285 ///////////////////////////////////////////////////////////////////////////////
2286 function CheckRequirements()
2287 NUMBER nvDx, nvDy, nvResult;
2293 bIsShellExplorer = FALSE;
2295 // Check screen resolution.
2296 GetExtents( nvDx, nvDy );
2298 if (nvDy < 480) then
2299 ShowError( @ERROR_VGARESOLUTION, WARNING );
2303 // set 'setup' operation mode
2304 bIs32BitSetup = TRUE;
2305 GetSystemInfo( ISTYPE, nvResult, svResult );
2306 if (nvResult = 16) then
2307 bIs32BitSetup = FALSE; // running 16-bit setup
2308 return 0; // no additional information required
2311 // --- 32-bit testing after this point ---
2313 // Determine the target system's operating system.
2314 GetSystemInfo( OS, nvResult, svResult );
2316 if (nvResult = IS_WINDOWSNT) then
2317 // Running Windows NT.
2320 // If the user is not an admin, then abort
2321 if (CheckIfAdmin() = -1) then
2322 ShowError(@MUST_BE_AN_ADMIN_MSG, SEVERE);
2326 // Check to see if the shell being used is EXPLORER shell.
2327 if (GetSystemInfo( OSMAJOR, nvResult, svResult ) = 0) then
2328 if (nvResult >= 4) then
2329 bIsShellExplorer = TRUE;
2333 elseif (nvResult = IS_WINDOWS95) then
2334 // IS puts us here even for Win98
2335 if (IsWin98() = 0) then
2341 bIsShellExplorer = TRUE;
2346 ///////////////////////////////////////////////////////////////////////////////
2348 // Function: DialogShowSdWelcome
2350 // Purpose: This function handles the standard welcome dialog.
2353 ///////////////////////////////////////////////////////////////////////////////
2354 function DialogShowSdWelcome()
2356 STRING szTitle, szMsg;
2361 szMsg = @WELCOME_MESSAGE;
2362 nResult = SdWelcome( szTitle, szMsg );
2368 ///////////////////////////////////////////////////////////////////////////////
2370 // Function: DialogShowSdAskDestPath
2372 // Purpose: This function asks the user for the destination folder.
2374 ///////////////////////////////////////////////////////////////////////////////
2375 function DialogShowSdAskDestPath()
2377 STRING szTitle, szMsg;
2383 nResult = SdAskDestPath( szTitle, szMsg, svDir, 0 );
2392 ///////////////////////////////////////////////////////////////////////////////
2394 // Function: GetVersionNumber
2396 // Purpose: This function converts a version number string into an integer.
2398 ///////////////////////////////////////////////////////////////////////////////
2399 function GetVersionNumber(szVerion)
2405 // This code assumes a majorversion.minorversion format.
2408 // This will get everything up to the '.'
2409 StrToNum(nMajorVersion, szVer);
2411 // Delete the part of the string we just converted
2412 StrSub(szVer, szVer, StrFind(szVer, ".") + 1, 64);
2414 // Now convert the part after the '.'
2415 StrToNum(nMinorVersion, szVer);
2417 // Turn in into a single number
2418 nVersion = (nMajorVersion * 10) + nMinorVersion;
2424 ///////////////////////////////////////////////////////////////////////////////
2426 // Function: CompareVersions
2428 // Purpose: This function compares an apps two version info structures and
2429 // determines if one is greater than the other, or if they are equal.
2431 ///////////////////////////////////////////////////////////////////////////////
2432 function CompareVersions(pApp)
2435 // Compare major versions
2436 nResult = pApp->Ver.nMajorVersion - pApp->iVer.nMajorVersion;
2437 if (nResult > 0) then return 1; endif;
2438 if (nResult < 0) then return -1; endif;
2440 // Major versions are equal, move on to minor versions
2441 nResult = pApp->Ver.nMinorVersion - pApp->iVer.nMinorVersion;
2442 if (nResult > 0) then return 1; endif;
2443 if (nResult < 0) then return -1; endif;
2445 // Minor versions are equal, move on to patch level.
2446 nResult = pApp->Ver.nPatchLevel - pApp->iVer.nPatchLevel;
2447 if (nResult > 0) then return 1; endif;
2448 if (nResult < 0) then return -1; endif;
2450 // Patch levels are equal, move on to release type.
2451 if ((pApp->Ver.szReleaseType = RELEASE_TYPE_GA) && (pApp->iVer.szReleaseType = RELEASE_TYPE_BETA)) then return 1; endif;
2452 if ((pApp->Ver.szReleaseType = RELEASE_TYPE_BETA) && (pApp->iVer.szReleaseType = RELEASE_TYPE_GA)) then return -1; endif;
2454 // Release types are equal. Special handling now required:
2456 // If this is a GA release, then there is no more info to look at, and the versions are equal.
2457 if (pApp->Ver.szReleaseType = RELEASE_TYPE_GA) then return 0; endif;
2459 // We have a Beta release, so we still have some info to check. Compare the beta release levels.
2460 nResult = pApp->Ver.nBetaLevel - pApp->iVer.nBetaLevel;
2461 if (nResult > 0) then return 1; endif;
2462 if (nResult < 0) then return -1; endif;
2464 // Beta versions are equal.
2469 ///////////////////////////////////////////////////////////////////////////////
2471 // Function: GetInstallAction
2473 // Purpose: This function decides what install action to perform for a
2474 // component and sets the display name accordingly.
2476 ///////////////////////////////////////////////////////////////////////////////
2477 function GetInstallAction(szCompName, bInstalled, szInstallMsg, szUpgradeMsg, szDowngradeMsg, szReinstallMsg, pApp)
2478 string szDisplayName;
2484 if (bInstalled) then
2485 nResult = CompareVersions(pApp);
2487 if (nResult = 0) then
2488 szDisplayName = szReinstallMsg;
2489 pApp->nInstallAction = ACTION_REINSTALL;
2491 elseif (nResult > 0) then
2492 szDisplayName = szUpgradeMsg;
2493 pApp->nInstallAction = ACTION_UPGRADE;
2494 Sprintf(szVerMsg, " %s", pApp->iVer.szTitle);
2496 else // Trying to install old version on top of new version
2497 szDisplayName = szDowngradeMsg;
2498 pApp->nInstallAction = ACTION_DOWNGRADE;
2499 Sprintf(szVerMsg, " %s", pApp->iVer.szTitle);
2502 szDisplayName = szInstallMsg;
2503 pApp->nInstallAction = ACTION_INSTALL;
2506 szDisplayName = szDisplayName + szVerMsg;
2508 ComponentSetData(MEDIA, szCompName, COMPONENT_FIELD_DISPLAYNAME, 0, szDisplayName);
2514 ///////////////////////////////////////////////////////////////////////////////
2516 // Function: GetInstallActions
2518 // Purpose: This function decides what install action to perform for each
2519 // component and sets the display name accordingly.
2521 ///////////////////////////////////////////////////////////////////////////////
2522 function GetInstallActions()
2524 // Decide what to do for each component and then set the display names appropriately
2525 GetInstallAction(CLIENT_COMP_NAME, bClientInstalled, @INSTALL_CLIENT_MSG, @UPGRADE_CLIENT_MSG, @DOWNGRADE_CLIENT_MSG, @REINSTALL_CLIENT_MSG, &appFullClient);
2526 GetInstallAction(SERVER_COMP_NAME, bServerInstalled, @INSTALL_SERVER_MSG, @UPGRADE_SERVER_MSG, @DOWNGRADE_SERVER_MSG, @REINSTALL_SERVER_MSG, &appServer);
2527 GetInstallAction(CC_COMP_NAME, bCcInstalled, @INSTALL_CC_MSG, @UPGRADE_CC_MSG, @DOWNGRADE_CC_MSG, @REINSTALL_CC_MSG, &appControlCenter);
2528 GetInstallAction(LIGHT_CLIENT_COMP_NAME, bLightClientInstalled, @INSTALL_LIGHT_CLIENT_MSG, @UPGRADE_LIGHT_CLIENT_MSG, @DOWNGRADE_LIGHT_CLIENT_MSG, @REINSTALL_LIGHT_CLIENT_MSG, &appLightClient);
2529 GetInstallAction(DOCS_COMP_NAME, bDocsInstalled, @INSTALL_DOCS_MSG, @UPGRADE_DOCS_MSG, @DOWNGRADE_DOCS_MSG, @REINSTALL_DOCS_MSG, &appDocs);
2532 ///////////////////////////////////////////////////////////////////////////////
2534 // Function: ClientSelectedOrInstalled
2536 // Purpose: This function checks whether or not the client is selected or if
2537 // it is already installed.
2539 ///////////////////////////////////////////////////////////////////////////////
2540 function ClientSelectedOrInstalled()
2542 if (bFullClientSel || bClientInstalled) then
2549 ///////////////////////////////////////////////////////////////////////////////
2551 // Function: AppVersionOk
2553 // Purpose: This function determines if a given app will have the correct
2554 // version after installation.
2556 ///////////////////////////////////////////////////////////////////////////////
2557 function AppVersionOk(bInstalled, bSel, pApp)
2560 // Here's the logic of this:
2562 // 1) If the app is not installed and
2563 // a) it's not being installed, then this app doesn't affect the version
2564 // restrictions, so return true
2565 // b) it will be installed, then it will get the version which this
2566 // installer installs, so the version will be ok
2568 // 2) If the app is installed and
2569 // a) the app is selected for reinstall, upgrade, or downgrade, then the
2570 // newly installed version will be the version this installer installs,
2571 // and so the version will be ok
2572 // b) the app is not selected for reinstall, upgrade, or downgrade, then
2573 // the version is ok only if the app's current version matches the
2574 // the version of this installer
2576 bOk = !bInstalled || bSel || (CompareVersions(pApp) = 0);
2582 ///////////////////////////////////////////////////////////////////////////////
2584 // Function: DialogShowSdAskComponentDialog
2586 // Purpose: This function asks the user which components to install
2587 // and what the destination folder should be.
2589 ///////////////////////////////////////////////////////////////////////////////
2590 function DialogShowSdAskComponentDialog()
2592 STRING szTitle, szMsg, szComponent, szFilename;
2593 BOOL bClient, bServer, bCc, bDocs, bVersionsOK;
2600 // If running WinNT hide the Light Client component. If the user wants to only
2601 // allow client installs, then hide all but the Client component as well. If not
2602 // running on NT, then hide all but the Light Client component.
2604 ComponentSetData(MEDIA, LIGHT_CLIENT_COMP_NAME, COMPONENT_FIELD_VISIBLE, FALSE, "");
2605 ComponentSelectItem(MEDIA, LIGHT_CLIENT_COMP_NAME, FALSE);
2607 if (FindFile(SRCDIR, ALLOW_ONLY_CLIENT_FLAG_FILENAME, szFilename) = 0) then
2608 ComponentSetData(MEDIA, SERVER_COMP_NAME, COMPONENT_FIELD_VISIBLE, FALSE, "");
2609 ComponentSetData(MEDIA, CC_COMP_NAME, COMPONENT_FIELD_VISIBLE, FALSE, "");
2610 ComponentSetData(MEDIA, DOCS_COMP_NAME, COMPONENT_FIELD_VISIBLE, FALSE, "");
2611 ComponentSelectItem(MEDIA, DOCS_COMP_NAME, FALSE);
2613 ComponentSelectItem(MEDIA, SERVER_COMP_NAME, FALSE);
2614 if (@CELLNAME_DEFAULT % ".") then
2615 ComponentSelectItem(MEDIA, CC_COMP_NAME, FALSE);
2617 ComponentSelectItem(MEDIA, CC_COMP_NAME, TRUE);
2620 ComponentSetData(MEDIA, CLIENT_COMP_NAME, COMPONENT_FIELD_VISIBLE, FALSE, "");
2621 ComponentSetData(MEDIA, SERVER_COMP_NAME, COMPONENT_FIELD_VISIBLE, FALSE, "");
2622 ComponentSetData(MEDIA, CC_COMP_NAME, COMPONENT_FIELD_VISIBLE, FALSE, "");
2623 ComponentSetData(MEDIA, DOCS_COMP_NAME, COMPONENT_FIELD_VISIBLE, FALSE, "");
2625 ComponentSelectItem(MEDIA, SERVER_COMP_NAME, FALSE);
2626 ComponentSelectItem(MEDIA, CLIENT_COMP_NAME, FALSE);
2627 ComponentSelectItem(MEDIA, CC_COMP_NAME, FALSE);
2628 ComponentSelectItem(MEDIA, DOCS_COMP_NAME, FALSE);
2632 nResult = SdComponentDialog(szTitle, szMsg, svDir, szComponent);
2634 // Enforce selection rules - something must be selected and
2635 // the client must be selected if the server is. However, take into
2636 // account if it is already installed.
2637 bFullClientSel = ComponentIsItemSelected(MEDIA , CLIENT_COMP_NAME);
2638 bLightClientSel = ComponentIsItemSelected(MEDIA , LIGHT_CLIENT_COMP_NAME);
2639 bServerSel = ComponentIsItemSelected(MEDIA , SERVER_COMP_NAME);
2640 bCcSel = ComponentIsItemSelected(MEDIA , CC_COMP_NAME);
2641 bDocsSel = ComponentIsItemSelected(MEDIA , DOCS_COMP_NAME);
2643 if (!bFullClientSel && !bLightClientSel && !bServerSel && !bCcSel && !bDocsSel) then
2644 ShowError(@NOTHING_SELECTED_MSG, SEVERE);
2648 if (bServerSel && !ClientSelectedOrInstalled()) then
2649 ShowError(@SERVER_NEEDS_CLIENT_MSG, SEVERE);
2653 // Also, if upgrading or downgrading, all apps must be at the same version level.
2654 // We won't upgrade one app to a higer version than another, and we won't downgrade
2655 // one app to a lowel version than another. All must be at the same level when the
2656 // install program is done. This is necessary because the apps share some files.
2660 bClient = AppVersionOk(bClientInstalled, bFullClientSel, &appFullClient);
2661 bServer = AppVersionOk(bServerInstalled, bServerSel, &appServer);
2662 bCc = AppVersionOk(bCcInstalled, bCcSel, &appControlCenter);
2663 bDocs = AppVersionOk(bDocsInstalled, bDocsSel, &appDocs);
2664 bVersionsOK = bClient && bServer && bCc && bDocs;
2667 if (!bVersionsOK) then
2668 ShowError(@APPS_NOT_SAME_VERSION, SEVERE);
2679 ///////////////////////////////////////////////////////////////////////////////
2681 // Function: DialogShowSdSetupType
2683 // Purpose: This function displays the standard setup type dialog.
2685 ///////////////////////////////////////////////////////////////////////////////
2686 function DialogShowSdSetupType()
2687 NUMBER nResult, nType;
2688 STRING szTitle, szMsg, szReserved;
2692 if (svSetupType == "") then
2693 svSetupType = "AFS Server";
2697 szMsg = @SETUP_TYPE_MSG;
2700 nResult = SdSetupTypeEx(szTitle, szMsg, szReserved, svSetupType, 0);
2706 ///////////////////////////////////////////////////////////////////////////////
2708 // Function: DialogShowSdSelectFolder
2710 // Purpose: This function displays the standard folder selection dialog.
2713 ///////////////////////////////////////////////////////////////////////////////
2714 function DialogShowSdSelectFolder()
2716 STRING szTitle, szMsg;
2718 if (SHELL_OBJECT_FOLDER = "") then
2719 SHELL_OBJECT_FOLDER = @FOLDER_NAME;
2722 // We are going to force the user to use the default folder name. This is
2723 // because we create the folder unlogged, and must therefore remove it
2724 // ourselves in our uninstall dll (which we do because IS doesn't handle
2725 // removing them correctly). Therefore, we must know the name of the
2726 // folder so we can remove it during uninstall. Also, the user can install
2727 // the AFS components during several executions of the install program,
2728 // and we don't want to allow them to pick a different folder each time.
2729 // We could solve these problems in code but we don't have time, so we
2730 // are going to force them to use our default folder name.
2735 nResult = SdSelectFolder( szTitle, szMsg, SHELL_OBJECT_FOLDER);
2741 ///////////////////////////////////////////////////////////////////////////////
2743 // Function: DialogShowSdFinishReboot
2745 // Purpose: This function will show the last dialog of the product.
2746 // It will allow the user to reboot and/or show some readme text.
2748 ///////////////////////////////////////////////////////////////////////////////
2749 function DialogShowSdFinishReboot()
2750 NUMBER nResult, nDefOptions;
2751 STRING szTitle, szMsg1, szMsg2, szOption1, szOption2;
2752 NUMBER bOpt1, bOpt2;
2754 if (!BATCH_INSTALL) then
2757 szMsg1 = @SETUP_FINISHED_MSG;
2762 nResult = SdFinish(szTitle, szMsg1, szMsg2, szOption1, szOption2, bOpt1, bOpt2 );
2766 nDefOptions = SYS_BOOTMACHINE;
2770 nResult = SdFinishReboot( szTitle, szMsg1, nDefOptions, szMsg2, 0 );
2776 ///////////////////////////////////////////////////////////////////////////////
2778 // Function: ConfigServerService
2780 // Purpose: This function will configure the AFS Server bos service via the
2783 ///////////////////////////////////////////////////////////////////////////////
2784 function ConfigServerService()
2791 if (!bWSPPInstall) then
2792 szMsg = @CONFIGURING_AFS_SERVER_SERVICE;
2793 SdShowMsg(szMsg, TRUE);
2796 nStatus = RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
2797 if (nStatus < 0) goto error;
2799 nStatus = InstallServerService(TARGETDIR ^ "\\Server\\usr\\afs\\bin\\bosctlsvc.exe");
2800 if (nStatus < 0) goto error;
2805 if (!bWSPPInstall) then
2806 SdShowMsg(szMsg, FALSE);
2810 Sprintf(szMsg, @AFS_SERVER_SERVICE_INSTALL_ERROR, nStatus);
2811 ShowError(szMsg, SEVERE);
2812 bInstallAborted = TRUE;
2820 ///////////////////////////////////////////////////////////////////////////////
2822 // Function: ConfigClientService
2824 // Purpose: This function will configure the AFS Client service via the SCM.
2826 ///////////////////////////////////////////////////////////////////////////////
2827 function ConfigClientService()
2834 if (!bWSPPInstall) then
2835 szMsg = @CONFIGURING_AFS_CLIENT_SERVICE;
2836 SdShowMsg(szMsg, TRUE);
2839 nStatus = RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
2840 if (nStatus < 0) goto error;
2842 nStatus = InstallClientService(TARGETDIR ^ "\\Client\\Program\\afsd_service.exe");
2843 if (nStatus < 0) goto error;
2848 if (!bWSPPInstall) then
2849 SdShowMsg(szMsg, FALSE);
2853 Sprintf(szMsg, @AFS_CLIENT_SERVICE_INSTALL_ERROR, nStatus);
2854 ShowError(szMsg, SEVERE);
2855 bInstallAborted = TRUE;
2862 ///////////////////////////////////////////////////////////////////////////////
2864 // Function: AddPath
2866 // Purpose: This function will add the specified path to the system PATH
2867 // environment variable.
2869 ///////////////////////////////////////////////////////////////////////////////
2870 function AddPath(szPath)
2872 LongPathToShortPath(szPath);
2873 if (bWin98 || bWin95) then
2874 if (EzBatchAddPath ("Path", szPath, "", AFTER) < 0) then
2875 ShowError(@ADD_PATH_ERROR, WARNING);
2878 if (AddToPath(szPath) < 0) then
2879 ShowError(@ADD_PATH_ERROR, WARNING);
2886 ///////////////////////////////////////////////////////////////////////////////
2888 // Function: ConfigUninstallDLL
2890 // Purpose: This function will modify the uninstall entry for these products
2891 // to use an uninstall dll.
2893 ///////////////////////////////////////////////////////////////////////////////
2894 function ConfigUninstallDLL(pApp)
2898 if (!pApp->bUseUninstDLL) then
2902 nStatus = RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
2903 if (nStatus < 0) goto error;
2905 svValue = UNINST + " -c\"" + pApp->szBinPath ^ pApp->szUninstDllName + "\" -f\"" + TARGETDIR ^ pApp->szUninstLogfileName + "\"";
2907 nStatus = RegDBSetKeyValueEx(MSUNINSTALL_KEY ^ pApp->szProductName, "UninstallString", REGDB_STRING, svValue, -1);
2908 if (nStatus < 0) goto error;
2917 ///////////////////////////////////////////////////////////////////////////////
2919 // Function: CreateServerDirs
2921 // Purpose: This function will create directories that the server programs
2922 // need. The creation of these is not logged, and so they will be
2923 // deleted by the uninstall dll.
2925 ///////////////////////////////////////////////////////////////////////////////
2926 function CreateServerDirs()
2928 CreateDir(TARGETDIR ^ "\\Server\\usr\\afs\\logs");
2929 CreateDir(TARGETDIR ^ "\\Server\\usr\\afs\\etc");
2930 CreateDir(TARGETDIR ^ "\\Server\\usr\\afs\\local");
2934 ///////////////////////////////////////////////////////////////////////////////
2936 // Function: GetDateTimeString()
2938 // Purpose: This function will return a string containing the current date
2941 ///////////////////////////////////////////////////////////////////////////////
2942 function GetDateTimeString(szDateTime)
2943 STRING szDate, szTime;
2944 NUMBER nDate, nTime;
2946 GetSystemInfo(DATE, nDate, szDate);
2947 GetSystemInfo(TIME, nTime, szTime);
2949 szDateTime = szDate + " " + szTime;
2953 ///////////////////////////////////////////////////////////////////////////////
2955 // Function: SetUserVars()
2957 // Purpose: This function will set at runtime values for user defined variables
2958 // we set up in the Registry Entries GUI tool.
2960 ///////////////////////////////////////////////////////////////////////////////
2961 function SetUserVars()
2963 string szInstallDate;
2966 string szReleaseType;
2968 // Set the install date variable's value
2969 GetDateTimeString(szInstallDate);
2971 ComponentSetTarget(MEDIA, "<INSTALL_DATE>", szInstallDate);
2973 // Set the proper client logon dll
2974 if (bFullClientSel) then
2975 ComponentSetTarget(MEDIA, "<LOGON_DLL>", TARGETDIR ^ FULL_CLIENT_LOGON_DLL);
2976 elseif (bLightClientSel) then
2977 ComponentSetTarget(MEDIA, "<LOGON_DLL>", TARGETDIR ^ LIGHT_CLIENT_LOGON_DLL);
2980 // Set the client description and title values
2981 if (bFullClientSel || bLightClientSel) then
2983 if (bFullClientSel) then
2984 szDesc = @CLIENT_DESC;
2985 szTitle = @CLIENT_TITLE;
2987 szDesc = @LIGHT_CLIENT_DESC;
2988 szTitle = @LIGHT_CLIENT_TITLE;
2991 ComponentSetTarget(MEDIA, "<CLIENT_DESC>", szDesc);
2992 ComponentSetTarget(MEDIA, "<CLIENT_TITLE>", szTitle);
2995 if (bServerSel) then
2996 ComponentSetTarget(MEDIA, "<EVENT_MSG_DLL>", TARGETDIR ^ "Common\\afseventmsg_" + szCodePage + ".dll");
2999 szReleaseType = @PRODUCT_VERSION_RELEASE_TYPE;
3000 ComponentSetTarget(MEDIA, "<RELEASE_TYPE>", szReleaseType);
3007 ///////////////////////////////////////////////////////////////////////////////
3009 // Function: SetNetworkProviderOrder()
3011 // Purpose: This function will add the AFS Client service name to the
3012 // ProviderOrder value of the
3013 // HKLM\SYSTEM\CurrentControlSet\ControlNetworkProvider\Order key.
3014 // It makes a call to the setup dll to do this.
3015 ///////////////////////////////////////////////////////////////////////////////
3016 function SetNetworkProviderOrder()
3019 nStatus = AddToNetworkProviderOrder(CLIENT_SERVICE_NAME);
3020 if (nStatus < 0) then
3021 ShowError(@SET_NETWORK_PROVIDER_ERROR, SEVERE);
3028 ///////////////////////////////////////////////////////////////////////////////
3030 // Function: CreateRegistrySets()
3032 // Purpose: This function will create the registry entries for each resgistry
3033 // set in the passed in string. The string must be a comma separated
3034 // list of registry sets created using the IS Registry Entries GUI.
3036 ///////////////////////////////////////////////////////////////////////////////
3037 function CreateRegistrySets(szRegistrySets)
3042 nRegSetListID = ListCreate(STRINGLIST);
3044 StrGetTokens(nRegSetListID, szRegistrySets, ",");
3046 nResult = ListGetFirstString(nRegSetListID, szRegSet);
3047 while (nResult != END_OF_LIST)
3048 // MessageBox(szRegSet, INFORMATION);
3049 CreateRegistrySet(szRegSet);
3050 nResult = ListGetNextString(nRegSetListID, szRegSet);
3053 ListDestroy(nRegSetListID);
3057 ///////////////////////////////////////////////////////////////////////////////
3059 // Function: ConfigAfsCreds()
3061 // Purpose: This function will config the AFS Client Credentials tool.
3063 ///////////////////////////////////////////////////////////////////////////////
3064 function ConfigAfsCreds()
3067 nResult = LaunchAppAndWait(TARGETDIR ^ "Client\\Program\\afscreds.exe", "/install", WAIT);
3068 if (nResult < 0) then
3069 ShowError(@CONFIGURING_AFS_CREDS_ERROR, INFORMATION);
3076 ///////////////////////////////////////////////////////////////////////////////
3078 // Function: IsAppInstalled
3080 // Purpose: This function will determine if an app is installed, and if it is,
3081 // will set its iVer info.
3083 ///////////////////////////////////////////////////////////////////////////////
3084 function IsAppInstalled(pApp)
3089 string szMajorVersion, szMinorVersion, szPatchLevel, szBetaLevel, szReleaseType, szTitle;
3091 nResult = RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
3092 if (nResult < 0) goto error;
3094 szKey = COMPANY_REG_KEY ^ pApp->szProductName ^ "CurrentVersion";
3096 nResult = RegDBGetKeyValueEx(szKey, "MajorVersion", nType, szMajorVersion, nSize);
3097 if (nResult < 0) goto error;
3099 nResult = RegDBGetKeyValueEx(szKey, "MinorVersion", nType, szMinorVersion, nSize);
3100 if (nResult < 0) goto error;
3102 nResult = RegDBGetKeyValueEx(szKey, "PatchLevel", nType, szPatchLevel, nSize);
3103 if (nResult < 0) goto error;
3105 nResult = RegDBGetKeyValueEx(szKey, "BetaLevel", nType, szBetaLevel, nSize);
3106 // It's ok for this to fail. Pre-3.5 3.32 releases did not use this.
3108 nResult = RegDBGetKeyValueEx(szKey, "VersionString", nType, szTitle, nSize);
3109 if (nResult < 0) goto error;
3111 nResult = RegDBGetKeyValueEx(szKey, "ReleaseType", nType, szReleaseType, nSize);
3112 if (nResult < 0) then
3113 if ((pApp->szProductName = "AFS Client") && (szTitle = "3.4a")) then
3114 // This value won't exist for 3.4a clients
3115 szReleaseType = RELEASE_TYPE_GA;
3117 // This value won't exist for any 3.5 beta versions
3118 szReleaseType = RELEASE_TYPE_BETA;
3122 SetupVerInfo(pApp, szMajorVersion, szMinorVersion, szPatchLevel, szBetaLevel, szReleaseType, szTitle, TRUE);
3131 ///////////////////////////////////////////////////////////////////////////////
3133 // Function: LocalizeComponents()
3135 // Purpose: This function updates all components to use localized text
3136 // in their status fields as appropriate
3138 ///////////////////////////////////////////////////////////////////////////////
3139 function LocalizeComponents()
3141 LocalizeComponentStatusText ("Client\\Client_Common");
3142 LocalizeComponentStatusText ("Client\\Client_Program\\Client_Headers\\Client_Afs_Headers");
3143 LocalizeComponentStatusText ("Client\\Client_Program\\Client_Headers\\Client_Main_Headers");
3144 LocalizeComponentStatusText ("Client\\Client_Program\\Client_Headers\\Client_Rx_Headers");
3145 LocalizeComponentStatusText ("Client\\Client_Program\\Client_Headers");
3146 LocalizeComponentStatusText ("Client\\Client_Program\\Client_Sample");
3147 LocalizeComponentStatusText ("Client\\Client_Program");
3148 LocalizeComponentStatusText ("Client\\Client_System32");
3149 LocalizeComponentStatusText ("Client\\Client_WinDir");
3150 LocalizeComponentStatusText ("Client");
3151 LocalizeComponentStatusText ("Components");
3152 LocalizeComponentStatusText ("Control_Center\\Control_Center_Common");
3153 LocalizeComponentStatusText ("Control_Center\\Control_Center_Program");
3154 LocalizeComponentStatusText ("Control_Center\\Control_Center_System32");
3155 LocalizeComponentStatusText ("Control_Center\\Control_Center_WinDir");
3156 LocalizeComponentStatusText ("Control_Center");
3157 LocalizeComponentStatusText ("Documentation\\English\\Cmd_Ref");
3158 LocalizeComponentStatusText ("Documentation\\English\\Doc_Misc");
3159 LocalizeComponentStatusText ("Documentation\\English\\Sys_Admin_Guide");
3160 LocalizeComponentStatusText ("Documentation\\English");
3161 LocalizeComponentStatusText ("Documentation\\German\\Cmd_Ref");
3162 LocalizeComponentStatusText ("Documentation\\German\\Doc_Misc");
3163 LocalizeComponentStatusText ("Documentation\\German\\Sys_Admin_Guide");
3164 LocalizeComponentStatusText ("Documentation\\German");
3165 LocalizeComponentStatusText ("Documentation\\Japanese\\Cmd_Ref");
3166 LocalizeComponentStatusText ("Documentation\\Japanese\\Doc_Misc");
3167 LocalizeComponentStatusText ("Documentation\\Japanese\\Sys_Admin_Guide");
3168 LocalizeComponentStatusText ("Documentation\\Japanese");
3169 LocalizeComponentStatusText ("Documentation\\Korean\\Cmd_Ref");
3170 LocalizeComponentStatusText ("Documentation\\Korean\\Doc_Misc");
3171 LocalizeComponentStatusText ("Documentation\\Korean\\Sys_Admin_Guide");
3172 LocalizeComponentStatusText ("Documentation\\Korean");
3173 LocalizeComponentStatusText ("Documentation\\Portuguese\\Cmd_Ref");
3174 LocalizeComponentStatusText ("Documentation\\Portuguese\\Doc_Misc");
3175 LocalizeComponentStatusText ("Documentation\\Portuguese\\Sys_Admin_Guide");
3176 LocalizeComponentStatusText ("Documentation\\Portuguese");
3177 LocalizeComponentStatusText ("Documentation\\Simp_Chinese\\Cmd_Ref");
3178 LocalizeComponentStatusText ("Documentation\\Simp_Chinese\\Doc_Misc");
3179 LocalizeComponentStatusText ("Documentation\\Simp_Chinese\\Sys_Admin_Guide");
3180 LocalizeComponentStatusText ("Documentation\\Simp_Chinese");
3181 LocalizeComponentStatusText ("Documentation\\Spanish\\Cmd_Ref");
3182 LocalizeComponentStatusText ("Documentation\\Spanish\\Doc_Misc");
3183 LocalizeComponentStatusText ("Documentation\\Spanish\\Sys_Admin_Guide");
3184 LocalizeComponentStatusText ("Documentation\\Spanish");
3185 LocalizeComponentStatusText ("Documentation\\Trad_Chinese\\Cmd_Ref");
3186 LocalizeComponentStatusText ("Documentation\\Trad_Chinese\\Doc_Misc");
3187 LocalizeComponentStatusText ("Documentation\\Trad_Chinese\\Sys_Admin_Guide");
3188 LocalizeComponentStatusText ("Documentation\\Trad_Chinese");
3189 LocalizeComponentStatusText ("Documentation");
3190 LocalizeComponentStatusText ("Info");
3191 LocalizeComponentStatusText ("Languages\\Lang_English");
3192 LocalizeComponentStatusText ("Languages\\Lang_German");
3193 LocalizeComponentStatusText ("Languages\\Lang_Japanese");
3194 LocalizeComponentStatusText ("Languages\\Lang_Korean");
3195 LocalizeComponentStatusText ("Languages\\Lang_Portuguese");
3196 LocalizeComponentStatusText ("Languages\\Lang_Simp_Chinese");
3197 LocalizeComponentStatusText ("Languages\\Lang_Spanish");
3198 LocalizeComponentStatusText ("Languages\\Lang_Trad_Chinese");
3199 LocalizeComponentStatusText ("Languages");
3200 LocalizeComponentStatusText ("Light_Client\\Win95\\Light95_Client_Common");
3201 LocalizeComponentStatusText ("Light_Client\\Win95\\Light95_Client_Program");
3202 LocalizeComponentStatusText ("Light_Client\\Win95\\Light95_Client_System32");
3203 LocalizeComponentStatusText ("Light_Client\\Win95\\Light95_Client_WinDir");
3204 LocalizeComponentStatusText ("Light_Client\\Win95");
3205 LocalizeComponentStatusText ("Light_Client\\Win98\\Light_Client_Common");
3206 LocalizeComponentStatusText ("Light_Client\\Win98\\Light_Client_Program");
3207 LocalizeComponentStatusText ("Light_Client\\Win98\\Light_Client_System32");
3208 LocalizeComponentStatusText ("Light_Client\\Win98\\Light_Client_WinDir");
3209 LocalizeComponentStatusText ("Light_Client\\Win98");
3210 LocalizeComponentStatusText ("Light_Client");
3211 LocalizeComponentStatusText ("Readme\\English\\Doc_Misc");
3212 LocalizeComponentStatusText ("Readme\\English\\Install_Guide");
3213 LocalizeComponentStatusText ("Readme\\English\\Release_Notes");
3214 LocalizeComponentStatusText ("Readme\\English");
3215 LocalizeComponentStatusText ("Readme\\German\\Doc_Misc");
3216 LocalizeComponentStatusText ("Readme\\German\\Install_Guide");
3217 LocalizeComponentStatusText ("Readme\\German\\Release_Notes");
3218 LocalizeComponentStatusText ("Readme\\German");
3219 LocalizeComponentStatusText ("Readme\\Japanese\\Doc_Misc");
3220 LocalizeComponentStatusText ("Readme\\Japanese\\Install_Guide");
3221 LocalizeComponentStatusText ("Readme\\Japanese\\Release_Notes");
3222 LocalizeComponentStatusText ("Readme\\Japanese");
3223 LocalizeComponentStatusText ("Readme\\Korean\\Doc_Misc");
3224 LocalizeComponentStatusText ("Readme\\Korean\\Install_Guide");
3225 LocalizeComponentStatusText ("Readme\\Korean\\Release_Notes");
3226 LocalizeComponentStatusText ("Readme\\Korean");
3227 LocalizeComponentStatusText ("Readme\\Portuguese\\Doc_Misc");
3228 LocalizeComponentStatusText ("Readme\\Portuguese\\Install_Guide");
3229 LocalizeComponentStatusText ("Readme\\Portuguese\\Release_Notes");
3230 LocalizeComponentStatusText ("Readme\\Portuguese");
3231 LocalizeComponentStatusText ("Readme\\Simp_Chinese\\Doc_Misc");
3232 LocalizeComponentStatusText ("Readme\\Simp_Chinese\\Install_Guide");
3233 LocalizeComponentStatusText ("Readme\\Simp_Chinese\\Release_Notes");
3234 LocalizeComponentStatusText ("Readme\\Simp_Chinese");
3235 LocalizeComponentStatusText ("Readme\\Spanish\\Doc_Misc");
3236 LocalizeComponentStatusText ("Readme\\Spanish\\Install_Guide");
3237 LocalizeComponentStatusText ("Readme\\Spanish\\Release_Notes");
3238 LocalizeComponentStatusText ("Readme\\Spanish");
3239 LocalizeComponentStatusText ("Readme\\Trad_Chinese\\Doc_Misc");
3240 LocalizeComponentStatusText ("Readme\\Trad_Chinese\\Install_Guide");
3241 LocalizeComponentStatusText ("Readme\\Trad_Chinese\\Release_Notes");
3242 LocalizeComponentStatusText ("Readme\\Trad_Chinese");
3243 LocalizeComponentStatusText ("Readme");
3244 LocalizeComponentStatusText ("Server\\Server_Common");
3245 LocalizeComponentStatusText ("Server\\Server_Program");
3246 LocalizeComponentStatusText ("Server\\Server_System32");
3247 LocalizeComponentStatusText ("Server\\Server_WinDir");
3248 LocalizeComponentStatusText ("Server");
3252 ///////////////////////////////////////////////////////////////////////////////
3254 // Function: LocalizeComponentStatusText()
3256 // Purpose: This function updates one component to use localized text
3257 // in its status fields as appropriate
3259 ///////////////////////////////////////////////////////////////////////////////
3260 function LocalizeComponentStatusText (svComponent)
3265 ComponentGetData (MEDIA, svComponent, COMPONENT_FIELD_STATUS, dwResult, svOriginal);
3267 if (svOriginal == "CLIENT") then
3268 svLocalized = @STATUS_INSTALLING_CLIENT;
3269 elseif (svOriginal == "SERVER") then
3270 svLocalized = @STATUS_INSTALLING_SERVER;
3271 elseif (svOriginal == "CCENTER") then
3272 svLocalized = @STATUS_INSTALLING_CCENTER;
3273 elseif (svOriginal == "LIGHT") then
3274 svLocalized = @STATUS_INSTALLING_LIGHT;
3275 elseif (svOriginal == "HEADERS") then
3276 svLocalized = @STATUS_INSTALLING_HEADERS;
3277 elseif (svOriginal == "DOCS") then
3278 svLocalized = @STATUS_INSTALLING_DOCS;
3279 elseif (svOriginal == "LANGUAGE") then
3280 svLocalized = @STATUS_INSTALLING_LANGUAGE;
3285 ComponentSetData(MEDIA, svComponent, COMPONENT_FIELD_STATUS, 0, svLocalized);
3289 ///////////////////////////////////////////////////////////////////////////////
3291 // Function: DetectInstalledComponents()
3293 // Purpose: This function will detect if any of our components is already
3296 ///////////////////////////////////////////////////////////////////////////////
3297 function DetectInstalledComponents()
3300 bClientInstalled = IsAppInstalled(&appFullClient);
3301 bServerInstalled = IsAppInstalled(&appServer);
3302 bCcInstalled = IsAppInstalled(&appControlCenter);
3303 bDocsInstalled = IsAppInstalled(&appDocs);
3305 // The light client uses the client's registry entries. There is a light
3306 // client entry, but it contains nothing under it. IS makes it but we
3308 bLightClientInstalled = IsAppInstalled(&appLightClient);
3313 ///////////////////////////////////////////////////////////////////////////////
3315 // Function: ParseCommandLine
3317 // Purpose: This function parses the command line to set up a silent install
3319 ///////////////////////////////////////////////////////////////////////////////
3320 function ParseCommandLine()
3322 STRING szTemp, szResult[MAX_STRING_LEN], szParms;
3325 bWSPPInstall = FALSE;
3326 bPreinstallReplace = FALSE;
3330 // Need a list to hold the parms
3331 listParms = ListCreate(STRINGLIST);
3333 // Break parms into semicolon separated tokens and put into list
3334 if (StrGetTokens(listParms, szParms, ";") = 0 ) then
3335 nResult = ListGetFirstString(listParms, szResult);
3337 // Do until the end of the list
3338 while (nResult != END_OF_LIST)
3339 if (StrFind(szResult, "DIR=") > -1 ) then
3340 nResult = StrSub(szTemp, szResult, 4, MAX_STRING_LEN);
3341 TARGETDIR = szTemp + "\\AFS";
3343 elseif (StrFind(szResult, "P=") > -1 ) then
3344 nResult = StrSub(szTemp, szResult, StrFind(szResult, "P=") + 2, 1);
3345 if (StrFind(szTemp, "Y") > -1 ) then
3346 bPreinstallReplace = TRUE;
3349 elseif (StrFind(szResult, "C=") > -1 ) then
3350 ProcessCompsOnCmdLn(szResult);
3353 nResult = ListGetNextString(listParms, szResult);
3359 ///////////////////////////////////////////////////////////////////////////////
3361 // Function: ProcessCompsOnCmdLn
3363 // Purpose: This function puts the components in a list and
3364 // checks for setup types on the command line.
3367 ///////////////////////////////////////////////////////////////////////////////
3368 function ProcessCompsOnCmdLn(szParms)
3369 NUMBER nResult, nIndex;
3372 bWSPPInstall = TRUE;
3374 // Strip c= off cmdln string
3375 nResult = StrSub(szParms, szParms, StrFind(szParms, "C=") + 2, StrLength(szParms) - 2);
3377 // Get each component from the cmd line
3378 while (StrLength(szParms))
3379 nIndex = StrSub(szComp, szParms, 0, StrFind(szParms, ","));
3380 if (!nIndex) then // if comma not found then last item in list
3382 nIndex = StrLength(szComp); // for extracting this string
3385 if (StrFind(szComp, "Client") > -1) then
3386 bFullClientSel = TRUE;
3387 elseif (StrFind(szComp, "Server") > -1) then
3389 elseif (StrFind(szComp, "ControlCtr") > -1) then
3393 // Delete component from the command line string
3394 StrSub(szParms, szParms, nIndex + 1, StrLength(szParms));
3399 ///////////////////////////////////////////////////////////////////////////////
3401 // Function: RemoveInstalledBits
3403 // Purpose: This function silently uninstalls a product.
3405 ///////////////////////////////////////////////////////////////////////////////
3406 function RemoveInstalledBits(szProductName)
3409 string szValue[MAX_STRING_LEN];
3410 string szProgram[256];
3411 string szCmdLine[128];
3415 // Check for a special case - version 3.4a of the AFS Client
3416 if ((szProductName = "AFS Client") && (appFullClient.iVer.szTitle = "3.4a")) then
3417 return Eradicate34Client();
3420 nStatus = RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
3421 if (nStatus < 0) goto error;
3423 nStatus = RegDBGetKeyValueEx(MSUNINSTALL_KEY ^ szProductName, "UninstallString", nType, szValue, nSize);
3424 if (nStatus < 0) goto error;
3426 nIndex = StrFind(szValue, " ");
3427 if (nIndex < 0) goto error;
3429 StrSub(szProgram, szValue, 0, nIndex);
3430 StrSub(szCmdLine, szValue, nIndex + 1, 128);
3432 // Make the uninstall run silently
3433 szCmdLine = szCmdLine + " -a";
3435 nStatus = LaunchAppAndWait(szProgram, szCmdLine, WAIT);
3436 if (nStatus < 0) goto error;
3445 ///////////////////////////////////////////////////////////////////////////////
3447 // Function: AddShortCut
3449 // Purpose: Adds a short cut to the start menu.
3451 ///////////////////////////////////////////////////////////////////////////////
3452 function AddShortCut(szFolder, szName, szCmdPath, szArgs)
3456 szCmdPath = TARGETDIR ^ szCmdPath;
3457 LongPathToQuote(szCmdPath, TRUE);
3459 szCmd = szCmdPath + " " + szArgs;
3461 nResult = AddFolderIcon(SHELL_OBJECT_FOLDER ^ szFolder, szName, szCmd, "", "", 0, "", REPLACE);
3492 ///////////////////////////////////////////////////////////////////////////////
3494 // Function: CreateStartMenuEntries
3496 // Purpose: This function creates start menu entries for our apps.
3498 ///////////////////////////////////////////////////////////////////////////////
3499 function CreateStartMenuEntries()
3501 if (bServerSel) then
3502 AddShortCut(@SERVER_GROUP_NAME, @CFG_WIZARD_ITEM_NAME, CFG_WIZARD_CMD_PATH, CFG_WIZARD_ARGS);
3505 if (bFullClientSel) then
3506 AddShortCut(@CLIENT_GROUP_NAME, @CREDS_TOOL_ITEM_NAME, CREDS_TOOL_CMD_PATH, CREDS_TOOL_ARGS);
3507 AddShortCut(@CLIENT_GROUP_NAME, @CLIENT_HELP_ITEM_NAME, CLIENT_HELP_CMD_PATH, CLIENT_HELP_ARGS);
3511 AddShortCut(@CCENTER_GROUP_NAME, @SERVER_MANAGER_ITEM_NAME, SERVER_MANAGER_CMD_PATH, SERVER_MANAGER_ARGS);
3512 AddShortCut(@CCENTER_GROUP_NAME, @ACCT_MANAGER_ITEM_NAME, ACCT_MANAGER_CMD_PATH, ACCT_MANAGER_ARGS);
3515 if (bLightClientSel) then
3516 AddShortCut(@LIGHT_GROUP_NAME, @CREDS_TOOL_ITEM_NAME, CREDS_TOOL_CMD_PATH, CREDS_TOOL_ARGS);
3517 AddShortCut(@LIGHT_GROUP_NAME, @LIGHT_CLIENT_HELP_ITEM_NAME, LIGHT_CLIENT_HELP_CMD_PATH, LIGHT_CLIENT_HELP_ARGS);
3520 AddShortCut("", @DOCUMENTATION_ITEM_NAME, DOCUMENTATION_CMD_PATH, DOCUMENTATION_ARGS);
3524 ///////////////////////////////////////////////////////////////////////////////
3526 // Function: ShowError
3528 // Purpose: This function shows an error to the user when not in silent mode,
3529 // and will log an error to a file when in silent mode.
3531 ///////////////////////////////////////////////////////////////////////////////
3532 function ShowError(szMsg, nType)
3536 if (!bWSPPInstall) then
3537 MessageBox(szMsg, nType);
3542 case WARNING: szType = "Warning: ";
3543 case SEVERE: szType = "Error: ";
3544 case INFORMATION: szType = "Note: ";
3545 default: szType = "Unknown error type: ";
3548 WriteToInstallErrorLog(szType + szMsg);
3552 ///////////////////////////////////////////////////////////////////////////////
3554 // Function: CheckCopyCellServDB
3556 // Purpose: During install the CellServDB file is copied into the Common dir.
3557 // If the user does not already have this file, we will copy it for
3558 // them into the windows directory. If they already do have the
3559 // file, then we will do nothing.
3560 ///////////////////////////////////////////////////////////////////////////////
3561 function CheckCopyCellServDB()
3565 nResult = FindFile(WINDIR, CELLSERVDB_FILENAME, szResult);
3566 if (nResult < 0) then
3567 VarSave(SRCTARGETDIR);
3568 SRCDIR = TARGETDIR ^ "Common";
3570 CopyFile(CELLSERVDB_FILENAME, CELLSERVDB_FILENAME);
3571 VarRestore(SRCTARGETDIR);
3576 // --- include script file section ---
3577 #include "sddialog.rul"