Back to index

lightning-sunbird  0.9+nobinonly
setup.h
Go to the documentation of this file.
00001 /* -*- Mode: C; tab-width: 2; 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
00021  * the Initial Developer. All Rights Reserved.
00022  *
00023  * Contributor(s):
00024  *   Sean Su <ssu@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 #ifndef _SETUP_H_
00041 #define _SETUP_H_
00042 
00043 #ifdef __cplusplus
00044 #define PR_BEGIN_EXTERN_C       extern "C" {
00045 #define PR_END_EXTERN_C         }
00046 #else /* __cplusplus */
00047 #define PR_BEGIN_EXTERN_C
00048 #define PR_END_EXTERN_C
00049 #endif /* __cplusplus */
00050 
00051 #define PR_EXTERN(type) type
00052 
00053 typedef unsigned int PRUint32;
00054 typedef int PRInt32;
00055 
00056 #include "winforos2.h"
00057 #include <string.h>
00058 #include <stdlib.h>
00059 #include <stdio.h>
00060 #include <assert.h>
00061 #include <ctype.h>
00062 #include "setuprsc.h"
00063 #include "resource.h"
00064 #include "zipfile.h"
00065 
00066 #define CLASS_NAME_SETUP                "Setup"
00067 #define CLASS_NAME_SETUP_DLG            "MozillaSetupDlg"
00068 #define FILE_INI_SETUP                  "setup.ini"
00069 #define FILE_INI_CONFIG                 "config.ini"
00070 #define FILE_INI_INSTALL                "install.ini"
00071 #define FILE_IDI_GETCONFIGINI           "getconfigini.idi"
00072 #define FILE_IDI_GETARCHIVES            "getarchives.idi"
00073 #define FILE_IDI_GETREDIRECT            "getredirect.idi"
00074 #define FILE_INI_REDIRECT               "redirect.ini"
00075 #define FILE_WGET_LOG                   "wget.log"
00076 #define WIZ_TEMP_DIR                    "ns_temp"
00077 #define FILE_INSTALL_LOG                "install_wizard.log"
00078 #define FILE_INSTALL_STATUS_LOG         "install_status.log"
00079 #define FILE_ALL_JS                     "all-proxy.js"
00080 #define VR_DEFAULT_PRODUCT_NAME         "Mozilla"
00081 
00082 #define NEXT_DLG                        1
00083 #define PREV_DLG                        2
00084 #define OTHER_DLG_1                     3
00085 
00086 #define MAX_CRC_FAILED_DOWNLOAD_RETRIES 3
00087 #define MAX_FILE_DOWNLOAD_RETRIES       3
00088 
00089 #define BAR_MARGIN                      1
00090 #define BAR_SPACING                     0
00091 #define BAR_WIDTH                       6
00092 #define BAR_LIBXPNET_MARGIN             1
00093 #define BAR_LIBXPNET_SPACING            0
00094 #define BAR_LIBXPNET_WIDTH              1
00095 
00096 /* W: When for install status logging */
00097 #define W_START                         0
00098 #define W_END                           1
00099 
00100 /* W: When for crc check failed logging */
00101 #define W_STARTUP                       0
00102 #define W_DOWNLOAD                      1
00103 
00104 /* UP: Use Protocol */
00105 #define UP_FTP                          0
00106 #define UP_HTTP                         1
00107 
00108 /* LIS: Log Install Status */
00109 #define LIS_SUCCESS                     0
00110 #define LIS_FAILURE                     1
00111 
00112 /* UG: Upgrade */
00113 #define UG_NONE                         0
00114 #define UG_DELETE                       1
00115 #define UG_IGNORE                       2
00116 #define UG_GOBACK                       3
00117 
00118 /* AP: Archive Path */
00119 #define AP_NOT_FOUND                    0
00120 #define AP_TEMP_PATH                    1
00121 #define AP_SETUP_PATH                   2
00122 #define AP_ALTERNATE_PATH               3
00123 
00124 /* PP: Parse Path */
00125 #define PP_FILENAME_ONLY                1
00126 #define PP_PATH_ONLY                    2
00127 #define PP_ROOT_ONLY                    3
00128 #define PP_EXTENSION_ONLY               4
00129 
00130 /* DA: Delete Archive */
00131 #define DA_ONLY_IF_IN_ARCHIVES_LST      1
00132 #define DA_ONLY_IF_NOT_IN_ARCHIVES_LST  2
00133 #define DA_IGNORE_ARCHIVES_LST          3
00134 
00135 /* T: Timing */
00136 #define T_PRE_DOWNLOAD                  1
00137 #define T_POST_DOWNLOAD                 2
00138 #define T_PRE_XPCOM                     3
00139 #define T_POST_XPCOM                    4
00140 #define T_PRE_SMARTUPDATE               5
00141 #define T_POST_SMARTUPDATE              6
00142 #define T_PRE_LAUNCHAPP                 7
00143 #define T_POST_LAUNCHAPP                8
00144 #define T_DEPEND_REBOOT                 9
00145 #define T_PRE_ARCHIVE                   10
00146 #define T_POST_ARCHIVE                  11
00147 
00148 #define MAX_BUF                         2048
00149 #define MAX_BUF_TINY                    256
00150 #define MAX_BUF_SMALL                   512
00151 #define MAX_BUF_MEDIUM                  1024
00152 #define MAX_BUF_LARGE                   MAX_BUF
00153 #define MAX_BUF_XLARGE                  4096
00154 #define MAX_ITOA                        46
00155 #define MAX_INI_SK                      128
00156 
00157 #define ERROR_CODE_HIDE                 0
00158 #define ERROR_CODE_SHOW                 1
00159 #define DLG_NONE                        0
00160 #define DLG_COMMIT_INSTALL              1
00161 #define CX_CHECKBOX                     11
00162 #define CY_CHECKBOX                     11
00163 
00164 /* WIZ: WIZARD defines */
00165 #define WIZ_OK                          0
00166 #define WIZ_ERROR_UNDEFINED             1024
00167 #define WIZ_MEMORY_ALLOC_FAILED         1025
00168 #define WIZ_OUT_OF_MEMORY               WIZ_MEMORY_ALLOC_FAILED
00169 #define WIZ_ARCHIVES_MISSING            1026
00170 #define WIZ_CRC_PASS                    WIZ_OK
00171 #define WIZ_CRC_FAIL                    1028
00172 #define WIZ_SETUP_ALREADY_RUNNING       1029
00173 #define WIZ_TOO_MANY_NETWORK_ERRORS     1030
00174 
00175 /* E: Errors */
00176 #define E_REBOOT                        999
00177 
00178 /* FO: File Operation */
00179 #define FO_OK                           0
00180 #define FO_SUCCESS                      0
00181 #define FO_ERROR_FILE_NOT_FOUND         1
00182 #define FO_ERROR_DESTINATION_CONFLICT   2
00183 #define FO_ERROR_CHANGE_DIR             3
00184 #define FO_ERROR_WRITE                  4
00185 
00186 /* Mode of Setup to run in */
00187 #define NORMAL                          0
00188 #define SILENT                          1
00189 #define AUTO                            2
00190 
00191 /* ST: Setup Type */
00192 #define ST_RADIO0                       0
00193 #define ST_RADIO1                       1
00194 #define ST_RADIO2                       2
00195 #define ST_RADIO3                       3
00196 
00197 /* SM: Setup Type Mode */
00198 #define SM_SINGLE                       0
00199 #define SM_MULTI                        1
00200 
00201 /* SIC: Setup Info Component*/
00202 #define SIC_SELECTED                    0x00000001
00203 #define SIC_INVISIBLE                   0x00000002
00204 #define SIC_LAUNCHAPP                   0x00000004
00205 #define SIC_DOWNLOAD_REQUIRED           0x00000008
00206 #define SIC_DOWNLOAD_ONLY               0x00000010
00207 #define SIC_ADDITIONAL                  0x00000020
00208 #define SIC_DISABLED                    0x00000040
00209 #define SIC_FORCE_UPGRADE               0x00000080
00210 #define SIC_IGNORE_DOWNLOAD_ERROR       0x00000100
00211 #define SIC_IGNORE_XPINSTALL_ERROR      0x00000200
00212 #define SIC_UNCOMPRESS                  0x00000400
00213 #define SIC_SUPERSEDE                   0x00000800
00214 
00215 /* AC: Additional Components */
00216 #define AC_NONE                         0
00217 #define AC_COMPONENTS                   1
00218 #define AC_ADDITIONAL_COMPONENTS        2
00219 #define AC_ALL                          3
00220 
00221 /* OS: Operating System */
00222 #define OS_WARP3                        0x00000001
00223 #define OS_WARP4                        0x00000002
00224 #define OS_CP1                          0x00000004
00225 #define OS_CP2                          0x00000008
00226 
00227 /* DSR: Disk Space Required */
00228 #define DSR_DESTINATION                 0
00229 #define DSR_SYSTEM                      1
00230 #define DSR_TEMP                        2
00231 #define DSR_DOWNLOAD_SIZE               3
00232 
00233 /* SS: Site Selector */
00234 #define SS_HIDE                         0
00235 #define SS_SHOW                         1
00236 
00237 /* PUS: Previous Unfinished State */
00238 #define PUS_NONE                         0
00239 #define PUS_DOWNLOAD                     1
00240 #define PUS_UNPACK_XPCOM                 2
00241 #define PUS_INSTALL_XPI                  3
00242 #define SETUP_STATE_DOWNLOAD             "downloading"
00243 #define SETUP_STATE_UNPACK_XPCOM         "unpacking xpcom"
00244 #define SETUP_STATE_INSTALL_XPI          "installing xpi"
00245 
00246 
00247 typedef struct dlgSetup
00248 {
00249   DWORD   dwDlgID;
00250   WNDPROC fDlgProc;
00251   LPSTR   szTitle;
00252 } diS;
00253 
00254 typedef struct dlgWelcome
00255 {
00256   BOOL  bShowDialog;
00257   LPSTR szTitle;
00258   LPSTR szMessage0;
00259   LPSTR szMessage1;
00260   LPSTR szMessage2;
00261 } diW;
00262 
00263 typedef struct dlgLicense
00264 {
00265   BOOL  bShowDialog;
00266   LPSTR szTitle;
00267   LPSTR szLicenseFilename;
00268   LPSTR szMessage0;
00269   LPSTR szMessage1;
00270 } diL;
00271 
00272 typedef struct dlgQuickLaunch
00273 {
00274   BOOL  bShowDialog;
00275   LPSTR szTitle;
00276   LPSTR szMessage0;
00277   LPSTR szMessage1;
00278   LPSTR szMessage2;
00279   BOOL  bTurboMode;
00280   BOOL  bTurboModeEnabled;
00281 } diQL;
00282 
00283 
00284 typedef struct stStruct
00285 {
00286   BOOL  bVisible;
00287   DWORD dwCItems;
00288   DWORD dwCItemsSelected[MAX_BUF]; /* components */
00289   LPSTR szDescriptionShort;
00290   LPSTR szDescriptionLong;
00291 } st;
00292 
00293 typedef struct dlgSetupType
00294 {
00295   BOOL  bShowDialog;
00296   LPSTR szTitle;
00297   LPSTR szMessage0;
00298   LPSTR szReadmeFilename;
00299   LPSTR szReadmeApp;
00300   st    stSetupType0;
00301   st    stSetupType1;
00302   st    stSetupType2;
00303   st    stSetupType3;
00304 } diST;
00305 
00306 typedef struct dlgSelectComponents
00307 {
00308   BOOL  bShowDialog;
00309   DWORD bShowDialogSM;
00310   LPSTR szTitle;
00311   LPSTR szMessage0;
00312 } diSC;
00313 
00314 typedef struct oiCBstruct
00315 {
00316   BOOL  bEnabled;
00317   BOOL  bCheckBoxState;
00318   LPSTR szDescription;
00319 } oiCBs;
00320 
00321 typedef struct dlgOS2Integration
00322 {
00323   BOOL  bShowDialog;
00324   LPSTR szTitle;
00325   LPSTR szMessage0;
00326   LPSTR szMessage1;
00327   oiCBs oiCBMakeDefaultBrowser;
00328   oiCBs oiCBAssociateHTML;
00329   oiCBs oiCBUpdateCONFIGSYS;
00330   LPSTR szHomeDirectory;
00331 } diOI;
00332 
00333 typedef struct dlgProgramFolder
00334 {
00335   BOOL  bShowDialog;
00336   LPSTR szTitle;
00337   LPSTR szMessage0;
00338 } diPF;
00339 
00340 typedef struct dlgAdditionalOptions
00341 {
00342   BOOL  bShowDialog;
00343   LPSTR szTitle;
00344   LPSTR szMessage0;
00345   LPSTR szMessage1;
00346   BOOL  bSaveInstaller;
00347   BOOL  bRecaptureHomepage;
00348   BOOL  bShowHomepageOption;
00349   DWORD dwUseProtocol;
00350   BOOL  bUseProtocolSettings;
00351   BOOL  bShowProtocols;
00352 } diDO;
00353 
00354 typedef struct dlgAdvancedSettings
00355 {
00356   BOOL  bShowDialog;
00357   LPSTR szTitle;
00358   LPSTR szMessage0;
00359   LPSTR szProxyServer;
00360   LPSTR szProxyPort;
00361   LPSTR szProxyUser;
00362   LPSTR szProxyPasswd;
00363 } diAS;
00364 
00365 typedef struct dlgStartInstall
00366 {
00367   BOOL  bShowDialog;
00368   LPSTR szTitle;
00369   LPSTR szMessageInstall;
00370   LPSTR szMessageDownload;
00371 } diSI;
00372 
00373 typedef struct dlgDownload
00374 {
00375   BOOL  bShowDialog;
00376   LPSTR szTitle;
00377   LPSTR szMessageDownload0;
00378   LPSTR szMessageRetry0;
00379 } diD;
00380 
00381 typedef struct dlgReboot
00382 {
00383   DWORD dwShowDialog;
00384   LPSTR szTitle;
00385 } diR;
00386 
00387 typedef struct setupStruct
00388 {
00389   ULONG     ulMode;
00390   ULONG     ulCustomType;
00391   ULONG     ulNumberOfComponents;
00392   LPSTR     szPath;
00393   LPSTR     szSubPath;
00394   LPSTR     szProgramName;
00395   LPSTR     szCompanyName;
00396   LPSTR     szProductName;
00397   LPSTR     szProductNameInternal;
00398   LPSTR     szProductNamePrevious;
00399   LPSTR     szUninstallFilename;
00400   LPSTR     szUserAgent;
00401   LPSTR     szProgramFolderName;
00402   LPSTR     szProgramFolderPath;
00403   LPSTR     szAlternateArchiveSearchPath;
00404   LPSTR     szParentProcessFilename;
00405   BOOL      bLockPath;
00406 } setupGen;
00407 
00408 typedef struct sinfoXpcomFile
00409 {
00410   LPSTR       szSource;
00411   LPSTR       szDestination;
00412   LPSTR       szMessage;
00413   BOOL        bCleanup;
00414   ULONG       ulInstallSize;
00415 } siCF;
00416 
00417 typedef struct sinfoComponentDep siCD;
00418 struct sinfoComponentDep
00419 {
00420   LPSTR szDescriptionShort;
00421   LPSTR szReferenceName;
00422   siCD  *Next;
00423   siCD  *Prev;
00424 };
00425 
00426 typedef struct sinfoComponent siC;
00427 struct sinfoComponent
00428 {
00429   ULONG           ulInstallSize;
00430   ULONG           ulInstallSizeSystem;
00431   ULONG           ulInstallSizeArchive;
00432   long            lRandomInstallPercentage;
00433   long            lRandomInstallValue;
00434   DWORD           dwAttributes;
00435   LPSTR           szArchiveName;
00436   LPSTR           szArchiveNameUncompressed;
00437   LPSTR           szArchivePath;
00438   LPSTR           szDestinationPath;
00439   LPSTR           szDescriptionShort;
00440   LPSTR           szDescriptionLong;
00441   LPSTR           szParameter;
00442   LPSTR           szReferenceName;
00443   BOOL            bForceUpgrade;
00444   BOOL            bSupersede;
00445   int             iNetRetries;
00446   int             iCRCRetries;
00447   int             iNetTimeOuts;
00448   siCD            *siCDDependencies;
00449   siCD            *siCDDependees;
00450   siC             *Next;
00451   siC             *Prev;
00452 };
00453 
00454 typedef struct ssInfo ssi;
00455 struct ssInfo
00456 {
00457   LPSTR szDescription;
00458   LPSTR szDomain;
00459   LPSTR szIdentifier;
00460   ssi   *Next;
00461   ssi   *Prev;
00462 };
00463 
00464 typedef struct dlgInstall
00465 {
00466     char szSystemFont[MAX_BUF];
00467     char szDefinedFont[MAX_BUF];
00468     char szFontName[MAX_BUF];
00469     char szFontSize[MAX_BUF];
00470     char szCharSet[MAX_BUF];
00471     char szOk_[MAX_BUF];
00472     char szOk[MAX_BUF];
00473     char szCancel_[MAX_BUF];
00474     char szCancel[MAX_BUF];
00475     char szNext_[MAX_BUF];
00476     char szBack_[MAX_BUF];
00477     char szProxySettings_[MAX_BUF];
00478     char szProxySettings[MAX_BUF];
00479     char szServer[MAX_BUF];
00480     char szPort[MAX_BUF];
00481     char szUserId[MAX_BUF];
00482     char szPassword[MAX_BUF];
00483     char szSelectDirectory[MAX_BUF];
00484     char szDirectories_[MAX_BUF];
00485     char szDrives_[MAX_BUF];
00486     char szStatus[MAX_BUF];
00487     char szFile[MAX_BUF];
00488     char szUrl[MAX_BUF];
00489     char szTo[MAX_BUF];
00490     char szAccept_[MAX_BUF];
00491     char szDecline_[MAX_BUF];
00492     char szSetupMessage[MAX_BUF];
00493     char szYesRestart[MAX_BUF];
00494     char szNoRestart[MAX_BUF];
00495     char szAdditionalComponents_[MAX_BUF];
00496     char szDescription[MAX_BUF];
00497     char szTotalDownloadSize[MAX_BUF];
00498     char szSpaceAvailable[MAX_BUF];
00499     char szComponents_[MAX_BUF];
00500     char szDestinationDirectory[MAX_BUF];
00501     char szBrowse_[MAX_BUF];
00502     char szCurrentSettings[MAX_BUF];
00503     char szInstall_[MAX_BUF];
00504     char szDelete_[MAX_BUF];
00505     char szExtracting[MAX_BUF];
00506     char szReadme_[MAX_BUF];
00507     char szPause_[MAX_BUF];
00508     char szResume_[MAX_BUF];
00509     char szChecked[MAX_BUF];
00510     char szUnchecked[MAX_BUF];
00511 } installGui;
00512 
00513 /* structure message stream */
00514 typedef struct sEMsgStream sems;
00515 struct sEMsgStream
00516 {
00517   char   szURL[MAX_BUF];
00518   char   szConfirmationMessage[MAX_BUF];
00519   char   *szMessage;
00520   DWORD  dwMessageBufSize;
00521   BOOL   bEnabled;
00522   BOOL   bSendMessage;
00523   BOOL   bShowConfirmation;
00524 };
00525 
00526 /* structure system info*/
00527 typedef struct sSysInfo sysinfo;
00528 struct sSysInfo
00529 {
00530   ULONG ulOSType;
00531   ULONG ulMajorVersion;
00532   ULONG ulMinorVersion;
00533   ULONG ulBuildNumber;
00534   char  szExtraString[MAX_BUF];
00535   ULONG ulMemoryTotalPhysical;
00536   ULONG ulMemoryAvailablePhysical;
00537   LONG  lScreenX;
00538   LONG  lScreenY;
00539   LONG  lDlgFrameX;
00540   LONG  lDlgFrameY;
00541   LONG  lTitleBarY;
00542   BOOL  bScreenReader;
00543 };
00544 
00545 typedef struct diskSpaceNode dsN;
00546 struct diskSpaceNode
00547 {
00548   ULONG           ulSpaceRequired;
00549   LPSTR           szPath;
00550   LPSTR           szVDSPath;
00551   dsN             *Next;
00552   dsN             *Prev;
00553 };
00554 
00555 #endif /* _SETUP_H */
00556