DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Untracked file

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636
function registerProgramFolderKey(winreg, fFolderPath)
{
  var subkey;
  var err;
  var szCurrentMozillaVersion;

  /* set the Program Folder Path in the Mozilla key in the Windows Registry */
  winreg.createKey("SOFTWARE\\$CompanyName$","");

  subkey  = "SOFTWARE\\$CompanyName$\\$ProductName$";
  winreg.createKey(subkey,"");
  err     = winreg.setValueString(subkey, "CurrentVersion", "$UserAgent$");

  subkey  = "SOFTWARE\\$CompanyName$\\Mozilla";
  szCurrentMozillaVersion = winreg.getValueString(subkey, "CurrentVersion");
  logComment("szCurrentMozillaVersion: " + szCurrentMozillaVersion);

  if((szCurrentMozillaVersion == "") || (szCurrentMozillaVersion == null))
  {
    // A Mozilla\CurrentVersion key must be set so that Java can work. 
    // (bug 229627)
    subkey  = "SOFTWARE\\$CompanyName$\\Mozilla";
    winreg.createKey(subkey,"");
    err     = winreg.setValueString(subkey, "CurrentVersion", "$GreVersion$");
  }

  subkey  = "SOFTWARE\\$CompanyName$\\$ProductName$\\$UserAgent$";
  winreg.createKey(subkey,"");

  subkey  = "SOFTWARE\\$CompanyName$\\$ProductName$\\$UserAgent$\\Main";
  winreg.createKey(subkey,"");
  err     = winreg.setValueString(subkey, "Program Folder Path", fFolderPath);
}

function createShortcuts() 
{
  var subkey;
  var valname;
  var szStartMenuPrograms;
  var szStartMenu;
  var szFolderDesktop;
  var szFolderQuickLaunch;
  var szFolderAppData;
  var winreg;
  var fTemp;
  var fProgram;
  var fDefShortcuts;
  var fileExe;
  var scExeDesc;
  var scFolderName;
  var fFolderDesktop;
  var fFolderPrograms;
  var fFolderProgramsStr;
  var fFolderQuickLaunch;
  var is_winnt;
  var szCurrentVersion;
  var folderQuickLaunchExists;

  winreg               = getWinRegistry();
  fProgram             = getFolder("Program");
  fDefShortcuts        = getFolder("Program","defaults/shortcuts");
  fTemp                = fProgram + "$MainExeFile$";
  fileExe              = getFolder("file:///", fTemp);
  scExeDesc            = "$ProductName$";
  scFolderName         = "$ProductName$";
  scSafeModeDesc       = "$ProductName$ (Safe Mode)";
  scSafeModeParam      = "-safe-mode";

  if (winreg) {
    // determine if the script is running under NT or not
    winreg.setRootKey(winreg.HKEY_LOCAL_MACHINE);
    subkey              = "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion";
    szCurrentVersion    = winreg.getValueString(subkey, "CurrentVersion");
    logComment("szCurrentVersion: " + szCurrentVersion);
    is_winnt = szCurrentVersion != "";
    logComment("is_winnt value: " + is_winnt);

    // Locate the various folders we're about to install shortcuts into.     
    if(!is_winnt || restrictedAccess) {
      winreg.setRootKey(winreg.HKEY_CURRENT_USER);
      subkey              = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders";
      szStartMenuPrograms = winreg.getValueString(subkey, "Programs");
      szStartMenu         = winreg.getValueString(subkey, "Start Menu");
      szFolderDesktop     = winreg.getValueString(subkey, "Desktop");
	  }
    else {
      winreg.setRootKey(winreg.HKEY_LOCAL_MACHINE);
      subkey              = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders";
      szStartMenuPrograms = winreg.getValueString(subkey, "Common Programs");
      szStartMenu         = winreg.getValueString(subkey, "Common Start Menu");
      szFolderDesktop     = winreg.getValueString(subkey, "Common Desktop");
    }

    // Locate the Start Menu Programs Folder
    winreg.setRootKey(winreg.HKEY_CURRENT_USER);
    subkey              = "SOFTWARE\\$CompanyName$\\$ProductName$\\$UserAgent$\\Main";
    fFolderProgramsStr  = winreg.getValueString(subkey, "Program Folder Path");
    fFolderPrograms = getFolder("file:///", fFolderProgramsStr || szStartMenuPrograms);

    // Locate the Desktop Folder
    winreg.setRootKey(winreg.HKEY_CURRENT_USER);
    fFolderDesktop = getFolder("file:///", szFolderDesktop);

    // Locate the Quick Launch folder
    winreg.setRootKey(winreg.HKEY_CURRENT_USER);
    subkey              = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders";
    szFolderAppData     = winreg.getValueString(subkey, "AppData");
    szFolderQuickLaunch = szFolderAppData + "\\Microsoft\\Internet Explorer\\Quick Launch";
    fFolderQuickLaunch  = getFolder("file:///", szFolderQuickLaunch);
    folderQuickLaunchExists = File.isDirectory(fFolderQuickLaunch);
    if(!folderQuickLaunchExists) {
      subkey                  = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\GrpConv\\MapGroups";
      szFolderQuickLaunch     = winreg.getValueString(subkey, "Quick Launch");
      folderQuickLaunchExists = File.isDirectory(fFolderPrograms);
      if(folderQuickLaunchExists)
        fFolderQuickLaunch = getFolder("file:///", szFolderQuickLaunch);
    }
    logComment("folderQuickLaunchExists: " + folderQuickLaunchExists);

    logComment("Folder StartMenuPrograms: " + szStartMenuPrograms);
    logComment("Folder StartMenu        : " + szStartMenu);
    logComment("Folder FolderDesktop    : " + szFolderDesktop);
    logComment("Folder FolderQuickLaunch: " + szFolderQuickLaunch);
    logComment("fileExe                 : " + fileExe);
    logComment("fFolderPrograms         : " + fFolderPrograms);
    logComment("scExeDesc               : " + scExeDesc);
    logComment("fProgram                : " + fProgram);

    // Explicitly create the fFolderPrograms even though the windowsShortcut 
    // function creates the folder. This is so that the folder creation gets 
    // logged for uninstall to remove it.
    if(winreg.getValueNumber(subkey, "Create Start Menu Shortcut") != 0 && !File.exists(fFolderPrograms))
      File.dirCreate(fFolderPrograms);
    if(winreg.getValueNumber(subkey, "Create Start Menu Shortcut") != 0 && !File.exists(fDefShortcuts))
      File.dirCreate(fDefShortcuts);

    // Create the Shortcuts
    winreg.setRootKey(winreg.HKEY_CURRENT_USER);
    subkey              = "SOFTWARE\\$CompanyName$\\$ProductName$\\$UserAgent$\\Main";
    if (winreg.getValueNumber(subkey, "Create Desktop Shortcut") != 0)
      File.windowsShortcut(fileExe, fFolderDesktop, scExeDesc, fProgram, "", fileExe, 0);
    if (winreg.getValueNumber(subkey, "Create Start Menu Shortcut") != 0) {
      File.windowsShortcut(fileExe, fFolderPrograms, scExeDesc, fProgram, "", fileExe, 0);
      File.windowsShortcut(fileExe, fFolderPrograms,  scSafeModeDesc, fProgram, scSafeModeParam,  fileExe, 0);
    }
    if (winreg.getValueNumber(subkey, "Create Quick Launch Shortcut") != 0 && folderQuickLaunchExists)
      File.windowsShortcut(fileExe, fFolderQuickLaunch, scExeDesc, fProgram,  "", fileExe, 0);
    // Always create the default shortcuts. 
    File.windowsShortcut(fileExe, fDefShortcuts,    scExeDesc,      fProgram, "",               fileExe, 0);
    File.windowsShortcut(fileExe, fDefShortcuts,    scSafeModeDesc, fProgram, scSafeModeParam,  fileExe, 0);

    if(!restrictedAccess) {
      winreg.setRootKey(winreg.HKEY_LOCAL_MACHINE);
      registerProgramFolderKey(winreg, fFolderPrograms);

      // This is so that Windows Media Player works with us      
      var subkey = "SOFTWARE\\Microsoft\\MediaPlayer\\ShimInclusionList\\$MainExeFile$";
      winreg.createKey(subkey, "");
    }

    winreg.setRootKey(winreg.HKEY_CURRENT_USER);
    registerProgramFolderKey(winreg, fFolderPrograms);
  }
  else
    logComment("winreg is null");
}

function IsWinnt()
{
  /* Determines if the script is running under NT or not.
   *
   */
  var winreg = getWinRegistry();
  var subkey;
  var szCurrentVersion;

  winreg.setRootKey(winreg.HKEY_LOCAL_MACHINE);
  subkey              = "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion";
  szCurrentVersion    = winreg.getValueString(subkey, "CurrentVersion");
  logComment("szCurrentVersion: " + szCurrentVersion);
  
  return szCurrentVersion != "";
}

function registerMainKeys(winreg)
{
  var subkey;  //the name of the subkey you are poking around in
  var data;
  var err;

  winreg.createKey("SOFTWARE\\$CompanyName$","");

  subkey  = "SOFTWARE\\$CompanyName$\\$ProductName$";
  winreg.createKey(subkey,"");
  err     = winreg.setValueString(subkey, "CurrentVersion", "$UserAgent$");

  subkey  = "SOFTWARE\\$CompanyName$\\$ProductName$\\$UserAgent$";
  winreg.createKey(subkey,"");

  subkey  = "SOFTWARE\\$CompanyName$\\$ProductName$\\$UserAgent$\\Main";
  winreg.createKey(subkey,"");

  err     = winreg.setValueString(subkey, "Install Directory", fProgram);

  // The following keys are required to be created to supply information
  // about the location of the Gecko Embedded Client to 3rd party apps.
  // "SOFTWARE\\Mozilla" must not be localized!
  subkey  = "SOFTWARE\\Mozilla\\$ProductName$ $UserAgentShort$";
  winreg.createKey(subkey,"");
  err     = winreg.setValueString(subkey, "GeckoVer", "1.0.1");

  subkey  = "SOFTWARE\\Mozilla\\$ProductName$ $UserAgentShort$\\Extensions";
  winreg.createKey(subkey,"");
  err     = winreg.setValueString(subkey, "Components", fProgram + "Components");
  err     = winreg.setValueString(subkey, "Plugins", fProgram + "Plugins");

  subkey  = "SOFTWARE\\Mozilla\\$ProductName$ $UserAgentShort$\\bin";
  winreg.createKey(subkey,"");
  err     = winreg.setValueString(subkey, "PathToExe", fProgram + "$MainExeFile$");

  subkey  = "SOFTWARE\\$CompanyName$\\$ProductName$\\$UserAgent$\\Main";
  err     = winreg.setValueString(subkey, "PathToExe", fProgram + "$MainExeFile$");

  // Register as a windows XP internet browser
  if( IsWinnt() )
  {
    subkey = "Software\\Clients\\StartMenuInternet\\$MainExeFile$";
    winreg.setRootKey(winreg.HKEY_LOCAL_MACHINE);

    winreg.createKey(subkey, "");
    winreg.createKey(subkey + "\\DefaultIcon", "");
    winreg.createKey(subkey + "\\shell", "");
    winreg.createKey(subkey + "\\shell\\open", "");
    winreg.createKey(subkey + "\\shell\\open\\command", "");
    winreg.createKey(subkey + "\\InstallInfo", "");
    winreg.setValueString(subkey, "", "$ProductNameInternal$");

    // path does not need to be quoted per MS doc
    data = fProgram + "$MainExeFile$,0";
    winreg.setValueString(subkey + "\\DefaultIcon", "", data);

    data = "\"" + fProgram + "$MainExeFile$\"";
    winreg.setValueString(subkey + "\\shell\\open\\command", "", data);

    data = "\"" + fProgram + "uninstall\\$UninstallFile$\" /ua \"$UserAgent$\" /hs browser";
    winreg.setValueString(subkey + "\\InstallInfo", "HideIconsCommand", data);

    winreg.setValueNumber(subkey + "\\InstallInfo", "IconsVisible", 1);

    data = "\"" + fProgram + "$MainExeFile$\" -silent -nosplash -setDefaultBrowser ";
    winreg.setValueString(subkey + "\\InstallInfo", "ReinstallCommand", data);

    data = "\"" + fProgram + "uninstall\\$UninstallFile$\" /ua \"$UserAgent$\" /ss browser";
    winreg.setValueString(subkey + "\\InstallInfo", "ShowIconsCommand", data);
  }
}

function updateWinReg()
{
  //Notes:
  // can't use a double backslash before subkey - Windows already puts it in.
  // subkeys have to exist before values can be put in.
  var winreg = getWinRegistry();
  var subkey;  //the name of the subkey you are poking around in
  var err;
  var ikwDefined;

  if(winreg != null) 
  {
    /* This will check to see if the user has restricted access or not.
     * It checks to see if HKEY_LOCALMACHINE\SOFTWARE is writable.  If
     * it is, then access is not restricted.  This is only used to
     * determine which Desktop, Programs, and Start Menu folders
     * are to used: common or per user
     */
    restrictedAccess = false;
    ikwDefined = typeof(winreg.isKeyWritable);
    logComment("winreg.isKeyWritable(): " + ikwDefined);
    if(ikwDefined == "function")
    {
      winreg.setRootKey(winreg.HKEY_LOCAL_MACHINE);
      if(!winreg.isKeyWritable("SOFTWARE"))
        restrictedAccess = true;
    }

    logComment("restrictedAccess value: " + restrictedAccess);
    if(!restrictedAccess)
    {
      winreg.setRootKey(winreg.HKEY_LOCAL_MACHINE);
      registerMainKeys(winreg);

      // set the App Paths key here
      subkey  = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\$MainExeFile$";
      winreg.createKey(subkey,"");
      err     = winreg.setValueString(subkey, "", fProgram + "$MainExeFile$");
      err     = winreg.setValueString(subkey, "Path", fProgram);

      // XPInstall content type mappings. 
      subkey = "SOFTWARE\\Classes\\MIME\\Database\\Content Type\\application/x-xpinstall;app=firefox"
      winreg.createKey(subkey, "");
      winreg.setValueString(subkey, "Extension", ".xpi");
    }

    winreg.setRootKey(winreg.HKEY_CURRENT_USER);
    registerMainKeys(winreg);
  }
}

function upgradeCleanup()
{
  // Remove Chrome directory cruft
  deleteThisFile("Chrome",      "US.jar");
  deleteThisFile("Chrome",      "en-win.jar");
  // Remove chrome and overlay registries, to remove bogus dependencies
  // on any of the above files which may cause the app not to start. 
  // XXXben Erk. This will effectively disable all global extensions...
  //        we need to come up with a way to preserve global extensions 
  //        across app versions...
  deleteThisFile("Chrome",      "chrome.rdf");
  deleteThisFolder("Chrome",    "overlayinfo");

  // Remove defunct components 
  deleteThisFile("Components",  "compreg.dat");
  deleteThisFile("Components",  "xpti.dat");
  deleteThisFile("Components",  "nsBackgroundUpdateService.js");

  // Remove defunct defaults files. 
  deleteThisFile("Program",	    "defaults/pref/all.js");
  deleteThisFile("Program",     "defaults/pref/security-prefs.js");
  deleteThisFile("Program",     "defaults/pref/winpref.js");
  deleteThisFile("Program",     "defaults/pref/xpinstall.js");
  deleteThisFile("Program",     "defaults/pref/bug307259.js");
  deleteThisFolder("Program",   "defaults/profile/US");
  
  // These files are related to app patches and will interfere with the 
  // UA/app version strings if we do not remove them. 
  deleteThisFile("Program",	    "defaults/pref/bug259708.js");
  
  // Remove non-linked xpt files for rev'd interfaces; this prevents a
  // conflict if you had previously installed a zip build in the app directory.
  deleteThisFile("Components",  "autocomplete.xpt");

  // Now clean up Uninstall entries that may be laying around in the
  // registry for older versions of the software that we're overwriting/
  // upgrading...
  var wr = getWinRegistry();
  wr.setRootKey(wr.HKEY_LOCAL_MACHINE);
  var i = 0; 
  const uninstallKey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall";
  do {
    var key = wr.enumKeys(uninstallKey, i++);
    if (!key)
      break;
    key = uninstallKey + "\\" + key;
    
    // For us to remove the entry from the ARP uninstall list, the install 
    // folder paths must *match* and the display version strings must *NOT
    // MATCH* - i.e. we don't want to remove the entry we just created for
    // this version.
    var itemInstallFolder = wr.getValueString(key, "InstallLocation");
    var thisInstallFolder = wr.getValueString("SOFTWARE\\$CompanyName$\\$ProductName$\\$UserAgent$\\Main", 
                                              "Install Directory");
    var itemInstallFolderShortName = File.windowsGetShortName(getFolder("file:///", itemInstallFolder));
    var thisInstallFolderShortName = File.windowsGetShortName(getFolder("file:///", thisInstallFolder));
    
    var itemDisplayVersion = wr.getValueString(key, "DisplayVersion");
    var thisDisplayVersion = "$UserAgent$";

    // It is possible that a user might have installed several products into
    // the same directory that have the same "DisplayVersion" (e.g. "1.0")... 
    // in this case we don't want to trash the Uninstall info for the others
    // so we have to be sure to make sure Comment matches... we use Comment
    // instead of DisplayName since DisplayName varies from version to version
    // as it contains the version number, and this instance of javascript is
    // crippled so as not to contain any useful string parsing.
    var itemComment = wr.getValueString(key, "Comment");
    var thisComment = "$ProductName$";

    if ((itemComment == thisComment || itemComment == "The Browser, Reloaded.") && 
        itemInstallFolderShortName == thisInstallFolderShortName &&
        thisDisplayVersion != itemDisplayVersion && 
        wr.isKeyWritable(key)) {
      wr.deleteKey(key);
      logComment("Removing obsolete uninstall key with upgrade: " + key);
    }
  }
  while (true);
}

function copyFlashXPT()
{
  /*
   * Check if Netscape Navigator (pre 6.0) is installed and if the
   * flash player is installed in Netscape's plugin folder. If it is,
   * try to copy the flashplayer.xpt file into our plugins folder to
   * make ensure that flash is scriptable if we're using it from
   * Netscape's plugins folder.
   */

  var winreg = getWinRegistry();

  winreg.setRootKey(winreg.HKEY_LOCAL_MACHINE);
  var subkey = "Software\\Netscape\\Netscape Navigator";
  var nsver = winreg.getValueString(subkey, "CurrentVersion");

  if (!nsver)
    return;

  subkey += "\\" + nsver + "\\Main";

  var navPluginsDir = winreg.getValueString(subkey, "Plugins Directory");

  if (!navPluginsDir)
    return;

  var navFlashXPT = getFolder("file:///", navPluginsDir + "\\flashplayer.xpt");

  if (!File.exists(navFlashXPT))
    return;

  var target = getFolder("file:///", fProgram + "\\plugins\\flashplayer.xpt");

  // Copy the file flashplayer.xpt from Netscape's plugin directory to
  // Firefox's plugin directory.
  File.copy(navFlashXPT, target);

  logComment("Copied Flash xpt file from '" + navFlashXPT + "' to '" + target +
             "'");
}

function copyQuickTimeXPT()
{
  /*
   * Check if QuickTime is installed and copy
   * nsIQTScriptablePlugin.xpt from its plugins directory into our
   * plugins directory. If we don't do this, QuickTime will load in
   * Firefox, but it won't be scriptable.
   */

  var winreg = getWinRegistry();

  winreg.setRootKey(winreg.HKEY_LOCAL_MACHINE);
  var subkey = "Software\\Apple Computer, Inc.\\QuickTime";
  var qtdir = winreg.getValueString(subkey, "InstallDir");

  if (!qtdir)
    return;

  var qtXPT = getFolder("file:///",
                        qtdir + "\\Plugins\\nsIQTScriptablePlugin.xpt");

  if (!File.exists(qtXPT))
    return;

  var target = getFolder("file:///",
                         fProgram + "\\plugins\\nsIQTScriptablePlugin.xpt");

  // Copy the file nsIQTScriptablePlugin.xpt from the QuickTime
  // installation directory to Firefox's plugin directory.
  File.copy(qtXPT, target);

  logComment("Copied QuickTime xpt file from '" + qtXPT + "' to '" + target +
             "'");
}

// main
var srDest;
var err;
var err2;
var fProgram;
var fWindowsSystem;
var fileComponentRegStr;
var fileComponentReg;
var restrictedAccess;
var fileToRegister;
var args;
var gGreLocal = false;

args = new String(Install.arguments);
logComment("args: " + args);

// If -gGreLocal is passed in, then we need to *not* cleanup GRE files if they
// exist in the browser dir.
// The default is to delete any GRE files because we default GRE will be global.
if(args == "-greLocal")
  gGreLocal = true;

srDest = $SpaceRequired$:bin;
err    = initInstall("$ProductName$", "Firefox", "$Version$"); 
logComment("initInstall: " + err);

fProgram  = getFolder("Program");
fWindowsSystem = getFolder("Win System");
logComment("fProgram: " + fProgram);

if(verifyDiskSpace(fProgram, srDest))
{
  setPackageFolder(fProgram);

  upgradeCleanup();
  err = addDirectory("",
                     "$Version$",
                     "bin",              // dir name in jar to extract 
                     fProgram,           // Where to put this file (Returned from GetFolder) 
                     "",                 // subdir name to create relative to fProgram
                     true);              // Force Flag 
  logComment("addDirectory() of Program returned: " + err);

  // check return value
  if( err == SUCCESS )
  {
    fileToRegister = getFolder(fProgram, "AccessibleMarshal.dll");
    err2           = File.windowsRegisterServer(fileToRegister);
    logComment("windowsRegisterServer() returned: " + err2);
    updateWinReg();  // Finish registering above marshalling dll's

    createShortcuts();

    // we don't want to fail on errors for the above two
    resetError();

    // register chrome
    registerChrome(CONTENT | DELAYED_CHROME, getFolder("Chrome", "browser.jar"), "content/browser/");
    registerChrome(SKIN | DELAYED_CHROME, getFolder("Chrome", "classic.jar"), "skin/classic/browser/");
    registerChrome(CONTENT | DELAYED_CHROME, getFolder("Chrome", "browser.jar"), "content/browser-region/");
    registerChrome(CONTENT | DELAYED_CHROME, getFolder("Chrome", "browser.jar"), "content/browser-platform/");

    registerChrome(CONTENT | DELAYED_CHROME, getFolder("Chrome", "toolkit.jar"), "content/passwordmgr/");
    registerChrome(CONTENT | DELAYED_CHROME, getFolder("Chrome", "toolkit.jar"), "content/mozapps/");
    registerChrome(SKIN | DELAYED_CHROME, getFolder("Chrome", "classic.jar"), "skin/classic/mozapps/");
    
    registerChrome(CONTENT | DELAYED_CHROME, getFolder("Chrome","comm.jar"),"content/autoconfig/");
    registerChrome(CONTENT | DELAYED_CHROME, getFolder("Chrome","comm.jar"),"content/necko/");
    registerChrome(CONTENT | DELAYED_CHROME, getFolder("Chrome","comm.jar"),"content/cookie/");
    registerChrome(CONTENT | DELAYED_CHROME, getFolder("Chrome","comm.jar"),"content/wallet/");
    registerChrome(CONTENT | DELAYED_CHROME, getFolder("Chrome","comm.jar"),"content/xbl-marquee/");

    registerChrome(CONTENT | DELAYED_CHROME, getFolder("Chrome","toolkit.jar"),"content/global/");
    registerChrome(CONTENT | DELAYED_CHROME, getFolder("Chrome","toolkit.jar"),"content/global-region/");
    registerChrome(CONTENT | DELAYED_CHROME, getFolder("Chrome","toolkit.jar"),"content/global-platform/");
    registerChrome(SKIN | DELAYED_CHROME, getFolder("Chrome","classic.jar"),"skin/classic/global/");

    // XXXben Stuff that will become obsolete
    registerChrome(CONTENT | DELAYED_CHROME, getFolder("Chrome","comm.jar"),"content/navigator/");
    registerChrome(CONTENT | DELAYED_CHROME, getFolder("Chrome","comm.jar"),"content/navigator-region/");
    registerChrome(CONTENT | DELAYED_CHROME, getFolder("Chrome","comm.jar"),"content/navigator-platform/");
    registerChrome(SKIN | DELAYED_CHROME, getFolder("Chrome","classic.jar"),"skin/classic/navigator/");

    registerChrome(CONTENT | DELAYED_CHROME, getFolder("Chrome","comm.jar"),"content/communicator/");
    registerChrome(CONTENT | DELAYED_CHROME, getFolder("Chrome","comm.jar"),"content/communicator-region/");
    registerChrome(CONTENT | DELAYED_CHROME, getFolder("Chrome","comm.jar"),"content/communicator-platform/");
    registerChrome(SKIN | DELAYED_CHROME, getFolder("Chrome","classic.jar"),"skin/classic/communicator/");

    // Create the uninstall folder. 
    err = File.dirCreate(getFolder("Program", "uninstall"));
    logComment("dirCreate() of Program/uninstall returned: " + err);

    // We need to register the psm chrome files.
    // We're checking to see if they exist first in case
    // they were not built and packaged up.
    var pki = getFolder("Chrome", "pippki.jar");
    if(File.exists(pki)) 
      registerChrome(CONTENT | DELAYED_CHROME, pki, "content/pippki/");

    var nss = getFolder("Chrome", "pipnss.jar");
    if(File.exists(nss)) 
      registerChrome(CONTENT | DELAYED_CHROME, nss, "content/pipnss/");

    copyFlashXPT();
    copyQuickTimeXPT();
    
    /* Log files that are created after the installer is done, so they can be uninstalled */
    logComment("Installing: "    + fProgram + ".autoreg");
    logComment("Installing: "    + fProgram + "Xpcs Registry.dat");
    logComment("Installing: "    + fProgram + "xpcom.log");
    logComment("Create Folder: " + fProgram + "components");
    logComment("Installing: "    + fProgram + "components\\xpti.dat");
    logComment("Installing: "    + fProgram + "components\\xptitemp.dat");
    logComment("Installing: "    + fProgram + "components\\compreg.dat");
    logComment("Create Folder: " + fProgram + "components\\Netscape");
    logComment("Create Folder: " + fProgram + "components\\Netscape\\MozillaTrunk");
    logComment("Installing: "    + fProgram + "components\\Netscape\\MozillaTrunk\\manifest.ini");
    logComment("Installing: "    + fProgram + "components\\Netscape\\MozillaTrunk\\permdata.box");
    logComment("Installing: "    + fProgram + "components\\Netscape\\MozillaTrunk\\Talkback.ini");
    logComment("Create Folder: " + fProgram + "chrome");
    logComment("Installing: "    + fProgram + "chrome\\installed-chrome.txt");
    logComment("Installing: "    + fProgram + "chrome\\chrome.rdf");
    logComment("Create Folder: " + fProgram + "chrome\\overlayinfo");
    logComment("Create Folder: " + fProgram + "chrome\\overlayinfo\\cookie");
    logComment("Create Folder: " + fProgram + "chrome\\overlayinfo\\cookie\\content");
    logComment("Installing: "    + fProgram + "chrome\\overlayinfo\\cookie\\content\\overlays.rdf");
    logComment("Create Folder: " + fProgram + "chrome\\overlayinfo\\inspector");
    logComment("Create Folder: " + fProgram + "chrome\\overlayinfo\\inspector\\content");
    logComment("Installing: "    + fProgram + "chrome\\overlayinfo\\inspector\\content\\overlays.rdf");
    logComment("Create Folder: " + fProgram + "chrome\\overlayinfo\\communicator");
    logComment("Create Folder: " + fProgram + "chrome\\overlayinfo\\communicator\\content");
    logComment("Installing: "    + fProgram + "chrome\\overlayinfo\\communicator\\content\\overlays.rdf");
    logComment("Create Folder: " + fProgram + "chrome\\overlayinfo\\editor");
    logComment("Create Folder: " + fProgram + "chrome\\overlayinfo\\editor\\content");
    logComment("Installing: "    + fProgram + "chrome\\overlayinfo\\editor\\content\\overlays.rdf");
    logComment("Create Folder: " + fProgram + "chrome\\overlayinfo\\messenger");
    logComment("Create Folder: " + fProgram + "chrome\\overlayinfo\\messenger\\content");
    logComment("Installing: "    + fProgram + "chrome\\overlayinfo\\messenger\\content\\overlays.rdf");
    logComment("Create Folder: " + fProgram + "chrome\\overlayinfo\\navigator");
    logComment("Create Folder: " + fProgram + "chrome\\overlayinfo\\navigator\\content");
    logComment("Installing: "    + fProgram + "chrome\\overlayinfo\\navigator\\content\\overlays.rdf");
    logComment("Create Folder: " + fProgram + "chrome\\overlayinfo\\navigator\\skin");
    logComment("Installing: "    + fProgram + "chrome\\overlayinfo\\navigator\\skin\\stylesheets.rdf");
    logComment("Create Folder: " + fProgram + "uninstall");

    err = getLastError();
    if (err == SUCCESS)
    {
      err = performInstall();
      logComment("performInstall() returned: " + err);
      if (File.exists(getFolder(fProgram, "xpicleanup.dat")))
      {
        logComment("incomplete install, manually launch cleanup utility");
        initInstall("Post-install Cleanup Utility", "Browser/xpicleanup", "$Version$");
        cleanupUtility = getFolder(fProgram, "xpicleanup.exe");
        err = File.execute(cleanupUtility);
        logComment("execute() returned: " + err);
        err = performInstall();
      }
    }
    else
      cancelInstall(err);
  }
  else
    cancelInstall(err);
}
else
  cancelInstall(INSUFFICIENT_DISK_SPACE);


// end main