Back to index

lightning-sunbird  0.9+nobinonly
MacInstallWizard.h
Go to the documentation of this file.
00001 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is Mozilla Communicator client code, released
00016  * March 31, 1998.
00017  *
00018  * The Initial Developer of the Original Code is
00019  * Netscape Communications Corporation.
00020  * Portions created by the Initial Developer are Copyright (C) 1998-1999
00021  * the Initial Developer. All Rights Reserved.
00022  *
00023  * Contributor(s):
00024  *   Samir Gehani <sgehani@netscape.com>
00025  *
00026  * Alternatively, the contents of this file may be used under the terms of
00027  * either of the GNU General Public License Version 2 or later (the "GPL"),
00028  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00029  * in which case the provisions of the GPL or the LGPL are applicable instead
00030  * of those above. If you wish to allow use of your version of this file only
00031  * under the terms of either the GPL or the LGPL, and not to allow others to
00032  * use your version of this file under the terms of the MPL, indicate your
00033  * decision by deleting the provisions above and replace them with the notice
00034  * and other provisions required by the GPL or the LGPL. If you do not delete
00035  * the provisions above, a recipient may use your version of this file under
00036  * the terms of any one of the MPL, the GPL or the LGPL.
00037  *
00038  * ***** END LICENSE BLOCK ***** */
00039 
00040 
00041 #ifndef _MIW_H_
00042 #define _MIW_H_
00043 
00044 #include <stdlib.h>
00045 #include <stdio.h>
00046 #include <string.h>
00047 #include <unistd.h>
00048 #include <time.h>
00049 
00050 #include <TextUtils.h>
00051 #include <Resources.h>
00052 #include <LowMem.h>
00053 #include <ToolUtils.h>
00054 #include <Sound.h>
00055 #include <Gestalt.h>
00056 #include <Balloons.h>
00057 #include <Folders.h>
00058 #include <Lists.h>
00059 #include <Navigation.h>
00060 #include <MacTypes.h>
00061 #include <PLStringFuncs.h>
00062 #include <Icons.h>
00063 #include <Appearance.h>
00064 #if TARGET_CARBON || (UNIVERSAL_INTERFACES_VERSION >= 0x0330)
00065 #include <ControlDefinitions.h>
00066 #endif
00067 
00068 #include "FullPath.h"
00069 #include "MoreFilesExtras.h"
00070 #include "IterateDirectory.h"
00071 #include "Threads.h"
00072 
00073  
00074 /*-----------------------------------------------------------*
00075  *   defines 
00076  *-----------------------------------------------------------*/
00077  
00078 /* macros */
00079 #define ERR_CHECK(_funcCall)       \
00080 err = _funcCall;                          \
00081 if (err)                                         \
00082 {                                                       \
00083     ErrorHandler(err, nil);         \
00084     return;                     \
00085 }
00086 
00087 #define ERR_CHECK_MSG(_funcCall, _rv, _msg) \
00088 err = _funcCall;                \
00089 if (err)                        \
00090 {                               \
00091     ErrorHandler(err, _msg);            \
00092        return _rv;                                      \
00093 }
00094                                                                       
00095 #define ERR_CHECK_RET(_funcCall, _rv)     \
00096 err = _funcCall;                                        \
00097 if (err)                                                       \
00098 {                                                                     \
00099     ErrorHandler(err, nil);                 \
00100        return _rv;                                             \
00101 }
00102     
00103 #define UNIFY_CHAR_CODE(_targetUint32, _src1char, _src2char, _src3char, _src4char)  \
00104     _targetUint32 =                                                                 \
00105     ( (unsigned long)                                                               \
00106     (((unsigned long)((_src1char & 0x000000FF) << 24)                               \
00107     | (unsigned long)((_src2char & 0x000000FF) << 16)                               \
00108     | (unsigned long)((_src3char & 0x000000FF) << 8)                                \
00109     | (unsigned long)((_src4char & 0x000000FF)))))
00110     
00111 #define INVERT_HIGHLIGHT(_rectPtr)          \
00112             hiliteVal = LMGetHiliteMode();  \
00113             BitClr(&hiliteVal, pHiliteBit); \
00114             LMSetHiliteMode(hiliteVal);     \
00115             InvertRect(_rectPtr);
00116                                                         
00117                                     
00118 #define NUM_WINS        5
00119 #define kLicenseID      0       /* window object ids */
00120 #define kWelcomeID      1
00121 #define kSetupTypeID    2
00122 #define kComponentsID   3
00123 #define kAdditionsID    4
00124 #define kTerminalID     5
00125 
00126 #define kMIWMagic       0x0F00BAA0
00127 
00128 #define NGINST          1       /* event handling modes */
00129 #define SDI             2
00130 
00131 #define MY_EOF          '\0'    /* parser constants */
00132 #define MAC_EOL         '\r'
00133 #define WIN_EOL         '\n'
00134 #define START_SECTION   '['
00135 #define END_SECTION     ']'
00136 #define KV_DELIM        '='
00137 
00138 #define kTempFolder     "\pTemp NSInstall"  // only used in debugging
00139 #define kViewerFolder   "\p:viewer"
00140 
00141 #define kScrollBarPad   3       /* constants */ 
00142 #define kTxtRectPad     5
00143 #define kInterWidgetPad 12
00144 #define kScrollBarWidth 16 
00145 #define kScrollAmount   11
00146 
00147 #define kNumLicScrns    4   
00148 #define kNumWelcMsgs    3
00149 #define kNumWelcScrns   4
00150 
00151 #define kMaxSetupTypes  4
00152 #define kMaxComponents  64
00153 #define kMaxNumKeys     16
00154 #define kKeyMaxLen      128
00155 #define kValueMaxLen    512
00156 #define kSNameMaxLen    128   /*    v--- for KV_DELIM char   */
00157 #define kSectionMaxLen  (kKeyMaxLen+1+kValueMaxLen)*kMaxNumKeys
00158 #define kArchiveMaxLen  64
00159 #define kGenIDIFileSize 2048
00160 #define kEnableControl  0
00161 #define kDisableControl 255
00162 #define kNotSelected    0
00163 #define kSelected       1
00164 #define kNotInSetupType 0   
00165 #define kInSetupType    1   
00166 #define kDependeeOff    0
00167 #define kDependeeOn     1
00168 #define kInvalidCompIdx -999
00169 #define kMaxCoreFiles   256     
00170 #define kMaxProgUnits   100.0   
00171 #define kMaxRunApps     32
00172 #define kMaxLegacyChecks 32     
00173 #define kMaxSites       32      
00174 #define kMaxGlobalURLs  5       /* end constants */
00175 
00176 
00177 #define rRootWin        128     /* widget rsrc ids */
00178 #define rBackBtn        129
00179 #define rNextBtn        130
00180 #define rCancelBtn      174
00181 #define rNSLogo         140
00182 #define rNSLogoBox      130
00183 #define rLogoImgWell    170
00184 
00185 #define rLicBox         131
00186 #define rLicScrollBar   132
00187 
00188 #define rWelcMsgTextbox 171
00189 #define rReadmeBtn      133
00190 
00191 #define rInstType       140
00192 #define rInstDescBox    141
00193 #define rDestLocBox     142
00194 #define rDestLoc        143
00195 
00196 #define rCompListBox    150     /* note: overriden use for list and rect */
00197 #define rCompDescBox    151
00198 
00199 #define rCheckboxLDEF   128
00200 
00201 #define rStartMsgBox    160
00202 #define rAllProgBar     161
00203 #define rPerXPIProgBar  162
00204 #define rSiteSelector   163
00205 #define rSiteSelMsg     179
00206 #define rSaveCheckbox   164
00207 #define rSaveBitsMsgBox 165
00208 #define rProxySettgBtn  175
00209 #define rDLSettingsGB   178
00210 #define rDLProgBar      180
00211 #define rLabDloading     181
00212 #define rLabFrom        182
00213 #define rLabTo          183
00214 #define rLabRate        184
00215 #define rLabTimeLeft    185
00216 
00217 #define rGrayPixPattern 128
00218 
00219 #define rAlrtDelOldInst 150
00220 #define rAlrtOS85Reqd   160
00221 #define rAlrtError      170
00222 #define rWarnLessSpace  180
00223 #define rDlgProxySettg  140
00224 
00225     
00226 #define rMBar           128     /* menu rsrc ids */ 
00227 #define mApple          150
00228 #define   iAbout        1
00229 #define mFile           151
00230 #define   iQuit         1
00231 #define mEdit           152
00232 #define   iUndo         1
00233 #define   iCut          3
00234 #define   iCopy         4
00235 #define   iPaste        5
00236 #define   iClear        6
00237 
00238 #define rAboutBox       128
00239 
00240 #define rStringList     140     // common strings
00241 #define sConfigFName    1
00242 #define sInstallFName   2       
00243 #define sTempIDIName    3       
00244 #define sConfigIDIName  4       
00245 #define sInstModules    5
00246 
00247 #define rTitleStrList   170
00248 #define sNSInstTitle    1
00249 
00250 
00251 #define rParseKeys      141     /* parse keys in config.ini */
00252 #define sGeneral        1
00253 #define sRunMode        2
00254 #define sProductName    3
00255 #define sProgFolderName 4
00256 #define sProgFoldPath   5
00257 #define sDefaultType    6
00258 #define sShowDlg        7
00259 #define sTitle          8
00260 #define sMsg0           9
00261 #define sMsg1           10
00262 #define sMsg2           11
00263 
00264 #define rIndices        142     /* integer indices in string form (0-9) */
00265 
00266 
00267 #define rIDIKeys        143
00268 #define sFile           1
00269 #define sDesc           2
00270 #define sSDNSInstall    3       /* used when pasring INI */
00271 #define sCoreFile       4
00272 #define sCoreDir        5
00273 #define sNoAds          6
00274 #define sSilent         7
00275 #define sExecution      8
00276 #define sConfirmInstall 9
00277 #define sTrue           10
00278 #define sFalse          11
00279 #define sNSInstall      12      /* used when generating IDI */
00280 
00281 #define sWelcDlg        12
00282 #define sReadmeFilename 32
00283 #define sReadmeApp      33
00284 
00285 #define sLicDlg         14
00286 #define sLicFile        15
00287 
00288 #define sSetupTypeDlg   16
00289 #define sSetupType      17
00290 #define sDescShort      18
00291 #define sDescLong       19
00292 #define sC              20
00293 
00294 #define sCompDlg        21
00295 #define sAddDlg         48
00296 #define sComponent      22
00297 #define sArchive        23
00298 #define sInstSize       24
00299 #define sAttributes     25
00300 #define sURL            26
00301 #define sServerPath     45
00302 #define sDependee       31
00303 #define sRandomInstall  34
00304 
00305 #define sRunApp         35
00306 #define sTargetApp      36
00307 #define sTargetDoc      37
00308 
00309 #define sLegacyCheck    38
00310 #define sFilename       39
00311 #define sSubfolder      49
00312 #define sVersion        40
00313 #define sMessage        41
00314 
00315 #define sSiteSelector   42
00316 #define sIdentifier     50
00317 #define sDomain         43
00318 #define sDescription    44
00319 #define sRedirect       46
00320 #define sSubpath        51
00321 
00322 #define sTermDlg        27
00323         
00324 #define sSELECTED       28
00325 #define sINVISIBLE      29
00326 #define sLAUNCHAPP      30  
00327 #define sADDITIONAL     47  
00328 #define sDOWNLOAD_ONLY  52  /* end parse keys */
00329 
00330 #define rErrorList      144 /* errors */
00331 #define eErrorMessage   1
00332 #define eErr1           2
00333 #define eErr2           3
00334 #define eErr3           4
00335 #define eParam          5
00336 #define eMem            6
00337 #define eParseFailed    7
00338 #define eLoadLib        8
00339 #define eUnknownDlgID   9   
00340 #define eSpawn          10
00341 #define eMenuHdl        11
00342 #define eCfgRead        12
00343 #define eDownload       13
00344 #define eInstRead       6       // installer.ini read failed
00345 #define eDLFailed       14
00346 
00347 #define instErrsNum     13  /* number of the install.ini errors */
00348 
00349 #define rInstList       145     // install.ini strings
00350 #define sInstGeneral    1
00351 #define sNsTitle        2
00352 #define sMoTitle        3
00353 #define sBackBtn        4 
00354 #define sNextBtn        5
00355 #define sCancel         6
00356 #define sDeclineBtn     7
00357 #define sAcceptBtn      8
00358 #define sInstallBtn     9
00359 #define sLicenseFName   10
00360 #define sReadme         11
00361 #define sInstLocTitle   12
00362 #define sSelectFolder   13
00363 #define sOnDisk         14
00364 #define sInFolder       15
00365 #define sCompDescTitle  16
00366 #define sFolderDlgMsg   17
00367 #define sDiskSpcAvail   18
00368 #define sDiskSpcNeeded  19      
00369 #define sKilobytes      20  
00370 #define sExtracting     21      
00371 #define sInstalling     22
00372 #define sFileSp         23
00373 #define sSpOfSp         24  
00374 #define sProcessing     25      
00375 #define sProxySettings  26
00376 #define sProxyDlg       27
00377 #define sProxyHost      28
00378 #define sProxyPort      29
00379 #define sProxyUsername  30
00380 #define sProxyPassword  31
00381 #define sOKBtn          32
00382 #define sDLSettings     33
00383 #define sSiteSelMsg     34
00384 #define sLabDloading    35
00385 #define sLabFrom        36
00386 #define sLabTo          37
00387 #define sLabRate        38
00388 #define sTimeLeft       39
00389 #define sDownloadKB     40
00390 #define sDeleteBtn      41
00391 #define sQuitBtn        42
00392 #define sSpaceMsg1      43
00393 #define sSpaceMsg2      44
00394 #define sSpaceMsg3      45
00395 #define sPauseBtn       46
00396 #define sResumeBtn      47
00397 #define sValidating     48
00398 #define sExecuting      49
00399 
00400 #define instKeysNum     49  /* number of installer.ini keys */
00401 
00402 #define rInstMenuList   146
00403 #define sMenuGeneral    1
00404 #define sMenuAboutNs    2
00405 #define sMenuAboutMo    3
00406 #define sMenuFile       4
00407 #define sMenuQuit       5
00408 #define sMenuQuitHot    6
00409 #define sMenuEdit       7
00410 #define sMenuUndo       8
00411 #define sMenuUndoHot    9
00412 #define sMenuCut        10
00413 #define sMenuCutHot     11
00414 #define sMenuCopy       12
00415 #define sMenuCopyHot    13
00416 #define sMenuPaste      14
00417 #define sMenuPasteHot   15
00418 #define sMenuClear      16
00419 #define sMenuClearHot   17
00420  
00421 #define instMenuNum     17
00422 
00423 
00424 /*-----------------------------------------------------------*
00425  *   structs 
00426  *-----------------------------------------------------------*/
00427 typedef struct XPISpec {
00428     FSSpecPtr FSp;
00429     struct XPISpec *next;
00430 } XPISpec;
00431 
00432 typedef struct _errTableEnt {
00433     short num;
00434     Str255 msg;
00435 } ErrTableEnt;
00436 
00437 
00438 typedef struct InstComp {
00439     /* descriptions */
00440     Handle  shortDesc;
00441     Handle  longDesc;
00442     
00443     /* archive properties */
00444     Handle  archive;
00445     long    size;
00446     
00447     /* attributes */
00448     Boolean selected;
00449     Boolean invisible;
00450     Boolean launchapp;
00451     Boolean additional;
00452     Boolean download_only;
00453     
00454     /* dependees */
00455     Handle  depName[kMaxComponents];
00456     short   dep[kMaxComponents];
00457     short   numDeps;
00458     short   refcnt;
00459     
00460     /* UI highlighting */
00461     Boolean highlighted;
00462     
00463     Boolean dirty;    // dload has not been attempted, or, it failed CRC
00464 
00465 } InstComp; 
00466 
00467 typedef struct SetupType {
00468     Handle  shortDesc;
00469     Handle  longDesc;
00470     short   comp[kMaxComponents];
00471     short   numComps;
00472 } SetupType;
00473         
00474 typedef struct RunApp {
00475     Handle  targetApp;
00476     Handle  targetDoc;
00477 } RunApp;
00478 
00479 typedef struct LegacyCheck {
00480     Handle  filename;
00481     Handle  subfolder;
00482     Handle  version;
00483     Handle  message;
00484 } LegacyCheck;
00485 
00486 typedef struct SiteSelector {
00487     Handle  id;
00488     Handle  desc;
00489     Handle  domain;
00490 } SiteSelector;
00491 
00492 typedef struct Redirect {
00493     Handle  desc;
00494     Handle  subpath;
00495 } Redirect; 
00496 
00497 typedef struct Config {
00498     
00499     /*------------------------------------------------------------*
00500      *   Dialog Keys 
00501      *------------------------------------------------------------*/
00502      
00503     /* General */
00504     Handle  targetSubfolder;
00505     Handle  globalURL[kMaxGlobalURLs];
00506     short   numGlobalURLs;
00507     
00508     /* LicenseWin */
00509     Handle  licFileName;
00510     
00511     /* WelcomeWin */
00512     Handle  welcMsg[ kNumWelcMsgs ];
00513     Handle  readmeFile;
00514     Handle  readmeApp;
00515     Boolean bReadme;
00516     
00517     /* SetupTypeWin */
00518     SetupType   st[kMaxSetupTypes];
00519     short       numSetupTypes;
00520     
00521     /* ComponentsWin and AdditionsWin */
00522     short       numComps;
00523     Handle      selCompMsg;
00524     Handle      selAddMsg;
00525     Boolean     bAdditionsExist;
00526     InstComp    comp[kMaxComponents];
00527     
00528     /* TerminalWin */
00529     Handle       startMsg;
00530     short        numSites;
00531     SiteSelector site[kMaxSites];
00532     Redirect     redirect;
00533     Handle       saveBitsMsg;
00534     
00535     /* "Tunneled" IDI keys */
00536     Handle  coreFile;
00537     Handle  coreDir;
00538     Handle  noAds;
00539     Handle  silent;
00540     Handle  execution;
00541     Handle  confirmInstall;
00542     
00543     /*------------------------------------------------------------*
00544      *   Miscellaneous Keys
00545      *------------------------------------------------------------*/
00546     
00547     /* RunApp instances */
00548     RunApp      apps[kMaxRunApps];
00549     long        numRunApps;
00550     
00551     /* LegacyCheck instances */
00552     LegacyCheck checks[kMaxLegacyChecks];
00553     long        numLegacyChecks;
00554     
00555 } Config;
00556 
00557 typedef struct Options {
00558 
00559     /* from SetupTypeWin */
00560     short           instChoice;
00561     short           vRefNum;
00562     long            dirID;
00563     unsigned char*  folder;
00564         
00565     /* from ComponentsWin and AdditionsWin */
00566     short           compSelected[ kMaxComponents ];
00567     short           numCompSelected;
00568         /* NOTE: if instChoice is not last (i.e. not Custom) then populate
00569                  the compSelected list with the SetupType.comps associated */
00570                  
00571     /* from TerminalWin */
00572     short           siteChoice;
00573     Boolean         saveBits;
00574     char            *proxyHost;
00575     char            *proxyPort;
00576     char            *proxyUsername;
00577     char            *proxyPassword;
00578     
00579 } Options;
00580 
00581 typedef struct LicWin {
00582     ControlHandle   licBox;
00583     ControlHandle   scrollBar;
00584     TEHandle        licTxt;
00585 } LicWin;
00586 
00587 typedef struct WelcWin {
00588     ControlHandle   welcMsgCntl[kNumWelcMsgs];
00589     ControlHandle   readmeButton;
00590 } WelcWin;
00591 
00592 typedef struct SetupTypeWin {
00593     ControlHandle   instType;       /* pull down */
00594     ControlHandle   instDescBox;
00595     TEHandle        instDescTxt;
00596     ControlHandle   destLocBox;     /* destLoc = destination location */
00597     ControlHandle   destLoc;        /* Select Folder... */
00598 } SetupTypeWin;
00599 
00600 typedef struct CompWin {
00601     ControlHandle   selCompMsg;
00602     Rect            compListBox; /* from 'RECT' resource */
00603     ListHandle      compList;
00604     ControlHandle   compDescBox;
00605     TEHandle        compDescTxt;
00606 } CompWin;
00607 
00608 typedef struct TermWin {
00609     TEHandle        startMsg;       
00610     Rect            startMsgBox;
00611     
00612     ControlHandle   dlProgressBar;
00613     ControlHandle   allProgressBar;
00614     TEHandle        allProgressMsg;
00615     ControlHandle   xpiProgressBar;
00616     TEHandle        xpiProgressMsg;
00617     
00618     ControlHandle   dlSettingsGB;
00619     ControlHandle   dlLabels[5];
00620     TEHandle        dlProgressMsgs[5];
00621 
00622     ControlHandle   siteSelector;
00623     ControlHandle   siteSelMsg;
00624     
00625     ControlHandle   saveBitsCheckbox;
00626     TEHandle        saveBitsMsg;
00627     Rect            saveBitsMsgBox;
00628     
00629     ControlHandle   proxySettingsBtn;
00630 } TermWin;
00631 
00632 typedef enum {
00633     eInstallNotStarted = 0,
00634     eDownloading,
00635     ePaused,
00636     eResuming,
00637     eExtracting,
00638     eInstalling
00639 } InstallState;
00640 
00641 typedef struct InstWiz {
00642     
00643     /* config.ini options parsed */
00644     Config      *cfg;
00645     
00646     /* user selected Install Wizard-wide persistent options */
00647     Options     *opt;
00648     
00649     /* Window control-holding abstractions */
00650     LicWin          *lw;    /* LicenseWin */
00651     WelcWin         *ww;    /* WelcomeWin */
00652     SetupTypeWin    *stw;   /* SetupTypeWin */
00653     CompWin         *cw;    /* ComponentsWin */
00654     CompWin         *aw;    /* AdditionsWin */
00655     TermWin         *tw;    /* TerminalWin */
00656             
00657     /* General wizard controls */
00658     ControlHandle backB;
00659     ControlHandle nextB;
00660     ControlHandle cancelB;
00661     
00662     InstallState  state;
00663     int           resPos;
00664     
00665 } InstWiz;
00666 
00667 typedef struct InstINIRes {
00668     Str255  iKey[instKeysNum+1];
00669     Str255  iErr[instErrsNum+1];
00670     Str255  iMenu[instMenuNum+1];
00671 } InstINIRes;
00672 
00673 /*-----------------------------------------------------------*
00674  *   globals 
00675  *-----------------------------------------------------------*/
00676 extern WindowPtr    gWPtr;
00677 extern short        gCurrWin;
00678 extern InstWiz      *gControls;
00679 extern InstINIRes   *gStrings;
00680 extern Boolean      gDone;
00681 extern Boolean      gInstallStarted;
00682 
00683 
00684 /*-----------------------------------------------------------*
00685  *   prototypes 
00686  *-----------------------------------------------------------*/
00687 #ifdef __cplusplus
00688 extern "C" {
00689 #endif
00690 
00691 void        main(void);
00692 Boolean     VerifyEnv(void);
00693 void        Init(void);
00694 void        InitControlsObject(void);
00695 OSErr       GetCWD(long *outDirID, short *outVRefNum);
00696 void        InitOptObject(void);
00697 void        InitManagers(void);
00698 void        CleanTemp(void);
00699 pascal void CheckIfXPI(const CInfoPBRec * const, Boolean *, void *);
00700 void        MakeMenus(void);
00701 void        MainEventLoop(void);
00702 void        MainEventLoopPass();
00703 int         BreathFunc();
00704 void        ErrorHandler(short, Str255);
00705 Boolean LookupErrorMsg( short code, Str255 msg );
00706 void        Shutdown(void);
00707 
00708 /*-----------------------------------------------------------*
00709  *   Parser 
00710  *-----------------------------------------------------------*/
00711 void        ParseConfig(void);
00712 void        ParseInstall(void);
00713 Boolean     ReadINIFile(int, char **);
00714 OSErr       PopulateInstallKeys(char *);
00715 Boolean     GetResourcedString(Str255, int, int);
00716 OSErr       PopulateGeneralKeys(char *);
00717 OSErr       PopulateLicWinKeys(char *);
00718 OSErr       PopulateWelcWinKeys(char *);
00719 OSErr       PopulateSetupTypeWinKeys(char *);
00720 OSErr       PopulateCompWinKeys(char *);
00721 OSErr       PopulateTermWinKeys(char *);
00722 OSErr       PopulateIDIKeys(char *);
00723 OSErr       PopulateMiscKeys(char *);
00724 OSErr       MapDependees(void);
00725 Boolean     RandomSelect(long);
00726 short       GetComponentIndex(Handle);
00727 Boolean     FillKeyValueForIDIKey(short, Handle, char *);
00728 Boolean     FillKeyValueUsingResID(short, short, Handle, char *);
00729 Boolean     FillKeyValueUsingSLID(short, short, short, Handle, char *);
00730 Boolean     FillKeyValueSecNameKeyID(short, char *, short, Handle, char *);
00731 Boolean     FillKeyValueUsingName(char *, char *, Handle, char *);
00732 Boolean     FindKeyValue(const char *, const char *, const char *, char *);
00733 Boolean     GetNextSection(char **, char *, char *);
00734 Boolean     GetNextKeyVal(char **, char *, char*);
00735 unsigned char *CToPascal(char *);
00736 char *      PascalToC(unsigned char *);
00737 void        CopyPascalStrToC(ConstStr255Param srcPString, char* dest);
00738 OSErr ReadSystemErrors(const char *instText);
00739 
00740 
00741 /*-----------------------------------------------------------*
00742  *   EvtHandlers
00743  *-----------------------------------------------------------*/
00744 void        HandleNextEvent(EventRecord *);
00745 void        HandleMouseDown(EventRecord *);
00746 void        HandleKeyDown(EventRecord *);
00747 void        HandleMenuChoice(SInt32);
00748 void        HandleUpdateEvt(EventRecord *);
00749 void        HandleActivateEvt(EventRecord *);
00750 void        HandleOSEvt(EventRecord *);
00751 void        React2InContent(EventRecord *, WindowPtr);
00752 Boolean     DidUserCancel(EventRecord *);
00753 
00754 /*-----------------------------------------------------------*
00755  *   LicenseWin
00756  *-----------------------------------------------------------*/
00757 void        ShowLicenseWin(void);
00758 void        InLicenseContent(EventRecord*, WindowPtr);
00759 void        EnableLicenseWin(void);
00760 void        DisableLicenseWin(void);
00761 void        InitLicTxt(void);
00762 void        ShowTxt(void);
00763 void        ShowLogo(Boolean);
00764 void        InitScrollBar(ControlHandle);
00765 pascal void DoScrollProc(ControlHandle, short);
00766 void        CalcChange(ControlHandle, short *);
00767 void        ShowNavButtons(unsigned char*, unsigned char*);
00768 void        EnableNavButtons(void);
00769 void        DisableNavButtons(void);
00770 
00771 /*-----------------------------------------------------------*
00772  *   WelcomeWin
00773  *-----------------------------------------------------------*/
00774 void        ShowWelcomeWin(void);
00775 void        ShowWelcomeMsg(void);
00776 void        InWelcomeContent(EventRecord*, WindowPtr);
00777 void        ShowCancelButton(void);
00778 void        ShowReadmeButton(void);
00779 void        ShowReadme(void);
00780 void        EnableWelcomeWin(void);
00781 void        DisableWelcomeWin(void);
00782 OSErr       LaunchAppOpeningDoc (Boolean, FSSpec *, ProcessSerialNumber *, 
00783             FSSpec *, unsigned short, unsigned short);
00784 OSErr       FindAppUsingSig (OSType, FSSpec *, Boolean *, ProcessSerialNumber *);
00785 OSErr       FindRunningAppBySignature (OSType, FSSpec *, ProcessSerialNumber *);
00786 static OSErr VolHasDesktopDB (short, Boolean *);
00787 static OSErr FindAppOnVolume (OSType, short, FSSpec *);
00788 OSErr       GetSysVolume (short *);
00789 OSErr       GetIndVolume (short, short *);
00790 OSErr       GetLastModDateTime(const FSSpec *, unsigned long *);
00791 void        InitNewMenu(void);
00792 
00793 /*-----------------------------------------------------------*
00794  *   SetupTypeWin
00795  *-----------------------------------------------------------*/
00796 void        ShowSetupTypeWin(void);
00797 void        ShowSetupDescTxt(void);
00798 void        GetAllVInfo(unsigned char **, short *);
00799 pascal void OurNavEventFunction(NavEventCallbackMessage callBackSelector, 
00800             NavCBRecPtr callBackParms, NavCallBackUserData callBackUD);
00801 void        InsertCompList(int instChoice);
00802 void        DrawDiskNFolder(short, unsigned char *);
00803 void        DrawDiskSpaceMsgs(short);
00804 char*       DiskSpaceNeeded(void);
00805 void        ClearDiskSpaceMsgs(void);
00806 char*       ltoa(long);
00807 short       pstrcmp(unsigned char*, unsigned char*);
00808 unsigned char* pstrcpy(unsigned char*, unsigned char*);
00809 unsigned char* pstrcat(unsigned char*, unsigned char*);
00810 void        InSetupTypeContent(EventRecord *, WindowPtr);
00811 Boolean     LegacyFileCheck(short, long);
00812 int         CompareVersion(Handle, FSSpecPtr);
00813 Boolean     VerifyDiskSpace(void);
00814 void        EnableSetupTypeWin(void);
00815 void        DisableSetupTypeWin(void);
00816 void        strtran(char*, const char*, const char*); 
00817 
00818 /*-----------------------------------------------------------*
00819  *   ComponentsWin
00820  *-----------------------------------------------------------*/
00821 void        ShowComponentsWin(void);
00822 Boolean     PopulateCompInfo(void);
00823 void        UpdateCompWin(void);
00824 void        InComponentsContent(EventRecord*, WindowPtr);
00825 short       GetCompRow(int);
00826 void        SetOptInfo(Boolean);
00827 void        InitRowHighlight(int);
00828 void        UpdateRowHighlight(Point);
00829 void        UpdateLongDesc(int);
00830 void        ResolveDependees(int, int);
00831 void        UpdateRefCount(int, int);
00832 void        EnableComponentsWin(void);
00833 void        DisableComponentsWin(void);
00834 
00835 /*-----------------------------------------------------------*
00836  *   AdditionsWin
00837  *-----------------------------------------------------------*/
00838 void        ShowAdditionsWin(void); 
00839 Boolean     AddPopulateCompInfo(void);
00840 void        InAdditionsContent(EventRecord*, WindowPtr);
00841 void        UpdateAdditionsWin(void);
00842 short       AddGetCompRow(int);
00843 void        AddSetOptInfo(Boolean);
00844 void        AddInitRowHighlight(int);
00845 void        AddUpdateRowHighlight(Point);
00846 void        AddUpdateLongDesc(int);
00847 void        EnableAdditionsWin(void);
00848 void        DisableAdditionsWin(void);
00849  
00850 /*-----------------------------------------------------------*
00851  *   TerminalWin
00852  *-----------------------------------------------------------*/
00853 void        ShowTerminalWin(void);
00854 short       GetRectFromRes(Rect *, short);
00855 void        BeginInstall(void);
00856 void        my_c2pstrcpy(const char *, Str255);
00857 void        InTerminalContent(EventRecord*, WindowPtr);
00858 void        UpdateTerminalWin(void);
00859 void        OpenProxySettings(void);
00860 Boolean     SpawnSDThread(ThreadEntryProcPtr, ThreadID *);
00861 void        ClearDownloadSettings(void);
00862 void        ClearSaveBitsMsg(void);
00863 void        EnableTerminalWin(void);
00864 void        DisableTerminalWin(void);
00865 void        SetupPauseResumeButtons(void);
00866 void        SetPausedState(void);
00867 void        SetResumedState(void);
00868 void        DisablePauseAndResume();
00869 
00870 
00871 /*-----------------------------------------------------------*
00872  *   InstAction
00873  *-----------------------------------------------------------*/
00874  
00875  
00876 #define TYPE_UNDEF 0
00877 #define TYPE_PROXY 1
00878 #define TYPE_HTTP 2
00879 #define TYPE_FTP 3
00880 
00881 typedef struct _conn
00882 {
00883     unsigned char type; // TYPE_UNDEF, etc.
00884     char *URL;          // URL this connection is for
00885     void *conn;         // pointer to open connection
00886 } CONN;
00887 
00888 
00889 pascal void *Install(void*);
00890 long        ComputeTotalDLSize(void);
00891 short       DownloadXPIs(short, long);
00892 short       DownloadFile(Handle, long, Handle, int, int, CONN *);
00893 OSErr       DLMarkerSetCurrent(char *);
00894 OSErr       DLMarkerGetCurrent(int *, int*);
00895 OSErr       DLMarkerDelete(void);
00896 int         GetResPos(InstComp *);
00897 OSErr       GetInstallerModules(short *, long *);
00898 OSErr       GetIndexFromName(char *, int *, int *);
00899 int         ParseFTPURL(char *, char **, char **);
00900 void        CompressToFit(char *, char *, int);
00901 float       ComputeRate(int, time_t, time_t);
00902 int         DLProgressCB(int, int);
00903 void        IfRemoveOldCore(short, long);
00904 Boolean     GenerateIDIFromOpt(Str255, long, short, FSSpec *);
00905 void        AddKeyToIDI(short, Handle, char *);
00906 Boolean     ExistArchives(short, long);
00907 Boolean     CheckConn(char *URL, int type, CONN *myConn, Boolean force);
00908 OSErr       ExistsXPI(int);
00909 void        LaunchApps(short, long);
00910 void        RunApps(void);
00911 void        DeleteXPIs(short, long);
00912 void        InitDLProgControls(Boolean onlyLabels);
00913 void        ClearDLProgControls(Boolean onlyLabels);
00914 void        InitProgressBar(void);
00915 Boolean     CRCCheckDownloadedArchives(Handle dlPath, short dlPathLen, int count);
00916 Boolean     IsArchiveFile( char *path );
00917 
00918 
00919 /*-----------------------------------------------------------*
00920  *   Inflation
00921  *-----------------------------------------------------------*/
00922 OSErr       ExtractCoreFile(short, long, short, long);
00923 void        WhackDirectories(char *);
00924 OSErr       InflateFiles(void*, void*, short, long);
00925 OSErr       AppleSingleDecode(FSSpecPtr, FSSpecPtr);
00926 void        ResolveDirs(char *, char*);
00927 OSErr       DirCreateRecursive(char *);
00928 OSErr       ForceMoveFile(short, long, ConstStr255Param, long);
00929 OSErr       CleanupExtractedFiles(short, long);
00930 
00931 /*-----------------------------------------------------------*
00932  *   XPInstallGlue
00933  *-----------------------------------------------------------*/
00934 OSErr       RunAllXPIs(short xpiVRefNum, long xpiDirID, short vRefNum, long dirID);
00935 /* NB:
00936 ** See XPInstallGlue.c for rest of prototypes
00937 */
00938 
00939 /*-----------------------------------------------------------*
00940  *   GreyButton
00941  *-----------------------------------------------------------*/
00942 pascal void     FrameGreyButton( Rect *buttonFrame );
00943 void            SetFrameGreyButtonColor( short color );
00944 
00945 #ifdef __cplusplus
00946 }
00947 #endif
00948 
00949 #define kNumDLFields 4
00950 
00951 #endif /* _MIW_H_ */