source: trunk/is_5_gsdl_cdrom/Script Files/setup.rul@ 3030

Last change on this file since 3030 was 3030, checked in by sjboddie, 22 years ago

Initial revision

  • Property svn:keywords set to Author Date Id Revision
File size: 16.6 KB
Line 
1////////////////////////////////////////////////////////////////////////////////
2//
3// IIIIIII SSSSSS
4// II SS InstallShield (R)
5// II SSSSSS (c) 1996-1997, InstallShield Software Corporation
6// II SS (c) 1990-1996, InstallShield Corporation
7// IIIIIII SSSSSS All Rights Reserved.
8//
9//
10// This code is generated as a starting setup template. You should
11// modify it to provide all necessary steps for your setup.
12//
13//
14// File Name: Setup.rul
15//
16// Description: InstallShield script
17//
18// Comments: This template script performs a basic setup. With minor
19// modifications, this template can be adapted to create
20// new, customized setups.
21//
22////////////////////////////////////////////////////////////////////////////////
23
24
25// Include header files
26
27 #include "sdlang.h"
28 #include "sddialog.h"
29
30////////////////////// string defines ////////////////////////////
31
32 #define UNINST_LOGFILE_NAME "Uninst.isu"
33
34//////////////////// installation declarations ///////////////////
35
36// ----- DLL function prototypes -----
37
38
39 // your DLL function prototypes
40
41
42// ---- script function prototypes -----
43
44 // generated by the Project Wizard
45 prototype ShowDialogs();
46 prototype MoveFileData();
47 prototype HandleMoveDataError( NUMBER );
48 prototype ProcessBeforeDataMove();
49 prototype ProcessAfterDataMove();
50 prototype SetupRegistry();
51 prototype SetupFolders();
52 prototype CleanUpInstall();
53 prototype SetupInstall();
54 prototype SetupScreen();
55 prototype CheckRequirements();
56 prototype DialogShowSdLicense();
57 prototype DialogShowSdFinishReboot();
58
59 // your script function prototypes
60 prototype DialogSelectCollections();
61 prototype DialogGetAdminPassword();
62 prototype SetAdminPassword();
63 prototype CheckWin32s();
64
65 // ----- global variables ------
66
67 // generated by the Project Wizard
68 BOOL bIsShellExplorer, bInstallAborted, bIs32BitSetup;
69 STRING svDir;
70 STRING svName, svCompany, svSerial;
71 STRING svDefGroup;
72 STRING szAppPath;
73 STRING svSetupType;
74
75
76 // your global variables
77 STRING svAdminPassword, svLogFile;
78 BOOL bWinNT;
79
80
81
82///////////////////////////////////////////////////////////////////////////////
83//
84// MAIN PROGRAM
85//
86// The setup begins here by hiding the visible setup
87// window. This is done to allow all the titles, images, etc. to
88// be established before showing the main window. The setup is
89// then performed in a series of calls to script defined functions,
90// with error checking at each step.
91//
92///////////////////////////////////////////////////////////////////////////////
93program
94 Disable( BACKGROUND );
95
96 CheckRequirements();
97
98 SetupInstall();
99
100 SetupScreen();
101
102 CheckWin32s();
103
104 if (ShowDialogs()<0) goto end_install;
105
106 if (ProcessBeforeDataMove()<0) goto end_install;
107
108 if (MoveFileData()<0) goto end_install;
109
110 if (ProcessAfterDataMove()<0) goto end_install;
111
112 if (SetupRegistry()<0) goto end_install;
113
114 if (SetupFolders()<0) goto end_install;
115
116
117 end_install:
118
119 CleanUpInstall();
120
121 // If an unrecoverable error occurred, clean up
122 // the partial installation. Otherwise, exit normally.
123
124 if (bInstallAborted) then
125 abort;
126 endif;
127
128endprogram
129
130///////////////////////////////////////////////////////////////////////////////
131//
132// Function: ShowDialogs
133//
134// Purpose: This function manages the display and navigation of
135// the standard dialogs that exist in a setup.
136//
137///////////////////////////////////////////////////////////////////////////////
138function ShowDialogs()
139 NUMBER nResult;
140
141begin
142
143 Dlg_Start:
144 // beginning of dialogs label
145
146 Dlg_SdLicense:
147 nResult = DialogShowSdLicense();
148 if (nResult = BACK) goto Dlg_Start;
149
150 Dlg_SelectCollections:
151 nResult = DialogSelectCollections();
152
153 if (nResult = BACK) goto Dlg_SdLicense;
154
155 Dlg_GetAdminPassWord:
156 nResult = DialogGetAdminPassword();
157 if (nResult = BACK) goto Dlg_SelectCollections;
158
159 return 0;
160
161end;
162
163///////////////////////////////////////////////////////////////////////////////
164//
165// Function: ProcessBeforeDataMove
166//
167// Purpose: This function performs any necessary operations prior to the
168// actual file transfer.
169//
170///////////////////////////////////////////////////////////////////////////////
171function ProcessBeforeDataMove()
172 NUMBER nResult;
173
174begin
175
176 // Create app information, uninstallation, and App Paths registry keys.
177
178 InstallationInfo( @COMPANY_NAME, @PRODUCT_NAME, @PRODUCT_VERSION, @PRODUCT_KEY );
179
180 svLogFile = UNINST_LOGFILE_NAME;
181
182 nResult = DeinstallStart( svDir, svLogFile, @UNINST_KEY, 0 );
183 if (nResult < 0) then
184 MessageBox( @ERROR_UNINSTSETUP, WARNING );
185 endif;
186
187 szAppPath = TARGETDIR;
188
189 if ((bIs32BitSetup) && (bIsShellExplorer)) then
190 RegDBSetItem( REGDB_APPPATH, szAppPath );
191 RegDBSetItem( REGDB_APPPATH_DEFAULT, szAppPath ^ @PRODUCT_KEY );
192 RegDBSetItem( REGDB_UNINSTALL_NAME, @UNINST_DISPLAY_NAME );
193 endif;
194
195 // TO DO : any other tasks you want to perform before file transfer
196
197 return 0;
198end;
199
200///////////////////////////////////////////////////////////////////////////////
201//
202// Function: MoveFileData
203//
204// Purpose: This function handles the file transfer for
205// the setup.
206//
207///////////////////////////////////////////////////////////////////////////////
208function MoveFileData()
209 NUMBER nResult, nDisk;
210
211begin
212
213 nDisk = 1;
214 SetStatusWindow( 0, "" );
215 Disable( DIALOGCACHE );
216 Enable( STATUS );
217 StatusUpdate( ON, 100 );
218 nResult = ComponentMoveData( MEDIA, nDisk, 0 );
219
220 HandleMoveDataError( nResult );
221
222 Disable( STATUS );
223
224 return nResult;
225
226end;
227
228
229///////////////////////////////////////////////////////////////////////////////
230//
231// Function: HandleMoveDataError
232//
233// Purpose: This function handles the error (if any) during the file transfer
234// operation.
235//
236///////////////////////////////////////////////////////////////////////////////
237function HandleMoveDataError( nResult )
238 STRING szErrMsg, svComponent , svFileGroup , svFile;
239
240begin
241
242 svComponent = "";
243 svFileGroup = "";
244 svFile = "";
245
246 switch (nResult)
247 case 0:
248 return 0;
249 default:
250 ComponentError ( MEDIA , svComponent , svFileGroup , svFile , nResult );
251 szErrMsg = @ERROR_MOVEDATA + "\n\n" +
252 @ERROR_COMPONENT + " " + svComponent + "\n" +
253 @ERROR_FILEGROUP + " " + svFileGroup + "\n" +
254 @ERROR_FILE + " " + svFile;
255 SprintfBox( SEVERE, @TITLE_CAPTIONBAR, szErrMsg, nResult );
256 bInstallAborted = TRUE;
257 return nResult;
258 endswitch;
259
260end;
261
262///////////////////////////////////////////////////////////////////////////////
263//
264// Function: ProcessAfterDataMove
265//
266// Purpose: This function performs any necessary operations needed after
267// all files have been transferred.
268//
269///////////////////////////////////////////////////////////////////////////////
270function ProcessAfterDataMove()
271 STRING szReferenceFile;
272
273begin
274
275 SetAdminPassword();
276
277 szReferenceFile = svDir ^ @PRODUCT_KEY;
278 DeinstallSetReference( szReferenceFile );
279
280 return 0;
281end;
282
283///////////////////////////////////////////////////////////////////////////////
284//
285// Function: SetupRegistry
286//
287// Purpose: This function makes the registry entries for this setup.
288//
289///////////////////////////////////////////////////////////////////////////////
290function SetupRegistry()
291 NUMBER nResult;
292
293begin
294
295 // TO DO : Add all your registry entry keys here.
296 // Call registry functions and/or create keys from
297 // the InstallShield IDE's Resources pane.
298
299 nResult = CreateRegistrySet( "" );
300
301 return nResult;
302 end;
303
304///////////////////////////////////////////////////////////////////////////////
305//
306// Function: SetupFolders
307//
308// Purpose: This function creates all the folders and shortcuts for the
309// setup. This includes program groups and items for Windows 3.1.
310//
311///////////////////////////////////////////////////////////////////////////////
312function SetupFolders()
313 NUMBER nResult;
314 STRING szIsData;
315 NUMBER nType;
316
317begin
318
319 if (Is(USER_ADMINISTRATOR,szIsData)==TRUE) then
320 nType = COMMON;
321 else
322 nType = PERSONAL;
323
324 endif;
325
326 ProgDefGroupType(nType);
327
328 if (CreateProgramFolder(@FOLDER_NAME) < 0) then
329 MessageBox("CreateProgramFolder failed.", SEVERE);
330 endif;
331
332 // The following adds the shortcuts.
333 if (AddFolderIcon(@FOLDER_NAME, @README, "\"" + TARGETDIR ^ "README.TXT\"", "",
334 "", 0, "", REPLACE) < 0) then
335 MessageBox("AddFolderIcon failed.", SEVERE);
336 endif;
337
338 if (AddFolderIcon(@FOLDER_NAME, @TEXT_UNINSTALL, UNINST + " -f\"" + svLogFile + "\"",
339 "", "", 0, "", REPLACE) < 0) then
340 MessageBox("AddFolderIcon failed.", SEVERE);
341 endif;
342
343 if (AddFolderIcon(@FOLDER_NAME, @FOLDER_NAME, "\"" + TARGETDIR ^ "server.exe\"", "",
344 "", 0, "", REPLACE) < 0) then
345 MessageBox("AddFolderIcon failed.", SEVERE);
346 endif;
347
348 nResult = CreateShellObjects( "" );
349
350 return nResult;
351 end;
352
353///////////////////////////////////////////////////////////////////////////////
354//
355// Function: CleanUpInstall
356//
357// Purpose: This cleans up the setup. Anything that should
358// be released or deleted at the end of the setup should
359// be done here.
360//
361///////////////////////////////////////////////////////////////////////////////
362function CleanUpInstall()
363
364begin
365
366
367 if (bInstallAborted) then
368 return 0;
369 endif;
370
371 DialogShowSdFinishReboot();
372
373 if (BATCH_INSTALL) then // ensure locked files are properly transferred
374 CommitSharedFiles(0);
375 endif;
376
377 return 0;
378end;
379
380///////////////////////////////////////////////////////////////////////////////
381//
382// Function: SetupInstall
383//
384// Purpose: This will initialize the setup. Any general initialization
385// needed for the installation should be performed here.
386//
387///////////////////////////////////////////////////////////////////////////////
388function SetupInstall()
389
390begin
391
392 Enable( CORECOMPONENTHANDLING );
393
394 bInstallAborted = FALSE;
395
396 svDir = PROGRAMFILES ^ "gsdl";
397 TARGETDIR = svDir;
398
399 SdProductName( @PRODUCT_NAME );
400
401 Enable( DIALOGCACHE );
402
403 return 0;
404end;
405
406///////////////////////////////////////////////////////////////////////////////
407//
408// Function: SetupScreen
409//
410// Purpose: This function establishes the screen look. This includes
411// colors, fonts, and text to be displayed.
412//
413///////////////////////////////////////////////////////////////////////////////
414function SetupScreen()
415
416begin
417
418 Enable( FULLWINDOWMODE );
419 Enable( INDVFILESTATUS );
420 SetTitle( @TITLE_MAIN, 24, WHITE );
421
422 SetTitle( @TITLE_CAPTIONBAR, 0, BACKGROUNDCAPTION ); // Caption bar text.
423
424 Enable( BACKGROUND );
425
426 Delay( 1 );
427end;
428
429///////////////////////////////////////////////////////////////////////////////
430//
431// Function: CheckRequirements
432//
433// Purpose: This function checks all minimum requirements for the
434// application being installed. If any fail, then the user
435// is informed and the setup is terminated.
436//
437///////////////////////////////////////////////////////////////////////////////
438function CheckRequirements()
439 NUMBER nvDx, nvDy, nvResult;
440 STRING svResult, szIsData;
441
442begin
443
444 bWinNT = FALSE;
445 bIsShellExplorer = FALSE;
446
447 // Check screen resolution.
448 GetExtents( nvDx, nvDy );
449
450 if (nvDy < 480) then
451 MessageBox( @ERROR_VGARESOLUTION, WARNING );
452 abort;
453 endif;
454
455 // set 'setup' operation mode
456 bIs32BitSetup = TRUE;
457 GetSystemInfo( ISTYPE, nvResult, svResult );
458 if (nvResult = 16) then
459 bIs32BitSetup = FALSE; // running 16-bit setup
460 return 0; // no additional information required
461 endif;
462
463 // --- 32-bit testing after this point ---
464
465 // Determine the target system's operating system.
466 GetSystemInfo( OS, nvResult, svResult );
467
468 if (nvResult = IS_WINDOWSNT) then
469 // Running Windows NT.
470 bWinNT = TRUE;
471
472 // Check to see if the shell being used is EXPLORER shell.
473 if (GetSystemInfo( OSMAJOR, nvResult, svResult ) = 0) then
474 if (nvResult >= 4) then
475 bIsShellExplorer = TRUE;
476 endif;
477 endif;
478
479 elseif (nvResult = IS_WINDOWS95) then
480 bIsShellExplorer = TRUE;
481
482 endif;
483
484end;
485
486
487///////////////////////////////////////////////////////////////////////////////
488//
489// Function: DialogShowSdLicense
490//
491// Purpose: This function displays the license agreement dialog.
492//
493//
494///////////////////////////////////////////////////////////////////////////////
495function DialogShowSdLicense()
496 NUMBER nResult;
497 STRING szTitle, szMsg, szQuestion, szLicenseFile;
498
499begin
500
501 szLicenseFile = SUPPORTDIR ^ "license.txt";
502 szTitle = "";
503 szMsg = "";
504 szQuestion = "";
505 nResult = SdLicense( szTitle, szMsg, szQuestion, szLicenseFile );
506
507 return nResult;
508end;
509
510
511///////////////////////////////////////////////////////////////////////////////
512//
513// Function: DialogShowSdFinishReboot
514//
515// Purpose: This function will show the last dialog of the product.
516// It will allow the user to reboot and/or show some readme text.
517//
518///////////////////////////////////////////////////////////////////////////////
519function DialogShowSdFinishReboot()
520 NUMBER nResult, nDefOptions;
521 STRING szTitle, szMsg1, szMsg2, szOption1, szOption2;
522 NUMBER bOpt1, bOpt2;
523
524begin
525
526 szTitle = "";
527 szMsg1 = @TEXT_FINISH1;
528 szMsg2 = "";
529 bOpt1 = TRUE;
530 bOpt2 = FALSE;
531 szOption1 = @TEXT_README;
532 szOption2 = "";
533 nResult = SdFinish(szTitle, szMsg1, szMsg2, szOption1, szOption2, bOpt1, bOpt2);
534
535 if (bOpt1 = TRUE) then
536 LaunchAppAndWait("notepad", TARGETDIR ^ "README.TXT", WAIT);
537 endif;
538
539 return 0;
540
541end;
542
543 function DialogSelectCollections()
544 NUMBER nResult;
545 STRING szTitle, szMsg;
546
547 begin
548
549 szTitle = @TEXT_SELECT_COLLECTIONS;
550 szMsg = @TEXT_SELECT_COLLECTIONS_DESC;
551
552 nResult = SdComponentDialog(szTitle, szMsg, svDir, "collections");
553 TARGETDIR = svDir;
554
555 return nResult;
556 end;
557
558function DialogGetAdminPassword()
559 STRING szTitle, szMsg, szField1;
560 NUMBER nResult;
561
562begin
563
564 svAdminPassword = "admin"; // the default
565
566 szTitle = @TEXT_ADMIN_PW;
567 szMsg = @TEXT_ADMIN_PW_DESC;
568 szField1 = @TEXT_PW;
569
570 nResult = SdShowDlgEdit1(szTitle, szMsg, szField1, svAdminPassword);
571
572 return nResult;
573end;
574
575
576// use setpw to set the admin password in the users.db database
577function SetAdminPassword()
578 STRING cmd, cmdline, dbfile;
579
580begin
581
582 dbfile = TARGETDIR ^ "etc" ^ "users.db";
583 cmd = "\"" + SRCDIR ^ ".." ^ "bin" ^ "windows" ^ "setpw.exe\"";
584 cmdline = " -u admin -p " + svAdminPassword + " -o \"" + dbfile + "\"";
585
586 if (LaunchApp(cmd, cmdline) != 0) then
587 MessageBox(@TEXT_SETPW_FAIL, WARNING);
588 endif;
589
590end;
591
592function CheckWin32s()
593 STRING szTitle, szMsg, svResult, szInfo, svPath, svVersionNumber;
594 NUMBER nvResult,nResult, nvWin32, nvOSTYPE, nvOLDWIN32S, nvWIN32SINSTALLED;
595
596begin
597
598 if (GetSystemInfo (OS, nvOSTYPE, svResult) < 0) then
599 MessageBox("Couldn't get Operating System info.", SEVERE);
600 endif;
601
602 // get information about win32s
603 nvOLDWIN32S=0;
604 GetSystemInfo (WIN32SINSTALLED, nvWIN32SINSTALLED, svResult);
605 if (nvWIN32SINSTALLED == TRUE) then
606 GetSystemInfo (WIN32SMAJOR, nvWin32, svResult);
607 if (nvWin32 == 0) then
608 nvOLDWIN32S = 1;
609 else
610 GetSystemInfo (WIN32SMINOR, nvWin32, svResult);
611 if (nvWin32 < 30) then
612 nvOLDWIN32S = 1;
613 endif;
614 endif;
615 endif;
616
617 // run Win32s installation if required.
618 if ((nvOSTYPE == IS_WINDOWS) || (nvOSTYPE == IS_WIN32S)) then
619 if ((nvWIN32SINSTALLED == 0)) then
620 if (CreateProgramFolder(@FOLDER_NAME) < 0) then
621 MessageBox("CreateProgramFolder failed.", SEVERE);
622 endif;
623
624 if (AddFolderIcon(@FOLDER_NAME, @INSTALL_GSDL, "\"" + SRCDIR ^ "setup.exe\"", "",
625 "", 0, "", REPLACE) < 0) then
626 MessageBox("AddFolderIcon failed.", SEVERE);
627 endif;
628
629 MessageBox(@TEXT_ERROR_NO_WIN32S, INFORMATION);
630 LaunchApp(SRCDIR ^ "bin" ^ "windows" ^ "win32s" ^ "setup.exe","");
631 exit;
632 else
633 if (nvOLDWIN32S == 1) then
634 MessageBox(@TEXT_ERROR_OLD_WIN32S, INFORMATION);
635 endif;
636 endif;
637 endif;
638end;
639
640///////////////////////////////////////////////////////////////////////////////
641//
642//
643//
644///////////////////////////////////////////////////////////////////////////////
645
646// --- include script file section ---
647
648#include "sddialog.rul"
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
Note: See TracBrowser for help on using the repository browser.