if (gControls->cfg->redirect.numURLs > 0) { if (DownloadRedirect(vRefNum, dirID, &redirectSpec)) ParseRedirect(&redirectSpec); }
HLock(gControls->cfg->redirect.subpath); if (gControls->cfg->redirect.subpath && *(gControls->cfg->redirect.subpath)) { HUnlock(gControls->cfg->redirect.subpath);   if (DownloadRedirect(vRefNum, dirID, &redirectSpec)) ParseRedirect(&redirectSpec); } else { HUnlock(gControls->cfg->redirect.subpath);   if (gControls->cfg->numSites > 0) { if (gControls->cfg->globalURL) DisposeHandle(gControls->cfg->globalURL); gControls->cfg->globalURL = NewHandleClear(kValueMaxLen);  siteIndex = gControls->opt->siteChoice - 1; HLock(gControls->cfg->globalURL); HLock(gControls->cfg->site[siteIndex].domain); strcpy(*(gControls->cfg->globalURL), *(gControls->cfg->site[siteIndex].domain)); HUnlock(gControls->cfg->globalURL); HUnlock(gControls->cfg->site[siteIndex].domain); } }
pascal void* Install(void* unused){		short			vRefNum, srcVRefNum;	long			dirID, srcDirID, modulesDirID;	OSErr 			err;	FSSpec			idiSpec, coreFileSpec;#if MOZILLA == 0	FSSpec 			redirectSpec;	HRESULT			dlErr;#endif#ifdef MIW_DEBUG	FSSpec			tmpSpec;#endif /* MIW_DEBUG */	SDISTRUCT		sdistruct;	Str255			pIDIfname, pModulesDir;	StringPtr		coreFile = NULL;	THz				ourHZ = NULL;	Boolean 		isDir = false, bCoreExists = false;	GrafPtr			oldPort = NULL;#ifndef MIW_DEBUG	/* get "Temporary Items" folder path */	ERR_CHECK_RET(FindFolder(kOnSystemDisk, kTemporaryFolderType, kCreateFolder, &vRefNum, &dirID), (void*)0);#else	/* for DEBUG builds dump downloaded items in "<currProcessVolume>:Temp NSInstall:" */	vRefNum = gControls->opt->vRefNum;	err = FSMakeFSSpec( vRefNum, 0, kTempFolder, &tmpSpec );	if (err != noErr)	{		err = FSpDirCreate(&tmpSpec, smSystemScript, &dirID);		if (err != noErr)		{			ErrorHandler(err);			return (void*)0;		}	}	else	{		err = FSpGetDirectoryID( &tmpSpec, &dirID, &isDir );		if (!isDir || err!=noErr)		{			ErrorHandler(err);			return (void*)0;		}	}	#endif /* MIW_DEBUG */		err = GetCWD(&srcDirID, &srcVRefNum);	if (err != noErr)	{		ErrorHandler(err);		return (void*)nil;	}		/* get the "Installer Modules" relative subdir */	GetIndString(pModulesDir, rStringList, sInstModules);	isDir = false;  /* reuse */	modulesDirID = 0;	GetDirectoryID(srcVRefNum, srcDirID, pModulesDir, &modulesDirID, &isDir);	srcDirID = modulesDirID;		if (!isDir || !ExistArchives(srcVRefNum, srcDirID))	{			bXPIsExisted = false;		GetIndString(pIDIfname, rStringList, sTempIDIName);			/* preparing to download */		gSDDlg = true;		ourHZ = GetZone();		GetPort(&oldPort);#if MOZILLA == 0		if (gControls->cfg->redirect.numURLs > 0)		{			if (DownloadRedirect(vRefNum, dirID, &redirectSpec))				ParseRedirect(&redirectSpec);		}#endif /* MOZILLA == 0 */		/* generate idi */		if (!GenerateIDIFromOpt(pIDIfname, dirID, vRefNum, &idiSpec))		{			ErrorHandler(err);			return (void*) nil;		}					/* populate SDI struct */		sdistruct.dwStructSize 	= sizeof(SDISTRUCT);		sdistruct.fsIDIFile 	= idiSpec;		sdistruct.dlDirVRefNum 	= srcVRefNum;		sdistruct.dlDirID 		= srcDirID;		sdistruct.hwndOwner    	= NULL;			/* call SDI_NetInstall */#if MOZILLA == 0	#if SDINST_IS_DLL == 1		dlErr = gInstFunc(&sdistruct);#else		dlErr = SDI_NetInstall(&sdistruct);#endif /* SDINST_IS_DLL */		if (dlErr != 0)		{			ErrorHandler(dlErr);			return (void*) nil;		}#endif /* MOZILLA */		SetPort(oldPort);			if (gWPtr)		{			GetPort(&oldPort);			SetPort(gWPtr);			BeginUpdate(gWPtr);			DrawControls(gWPtr);			ShowLogo(true);			UpdateTerminalWin();			EndUpdate(gWPtr);					SetPort(oldPort);		}		SetZone(ourHZ);		gSDDlg = false;			FSpDelete(&idiSpec);	}	else		bCoreExists = true;    /* otherwise core exists in cwd:InstallerModules, different from extraction location */		/* check if coreFile was downloaded */	HLock(gControls->cfg->coreFile);	if (*gControls->cfg->coreFile != NULL)	{		coreFile = CToPascal(*gControls->cfg->coreFile);		if (!coreFile)			return (void*) memFullErr;	}	HUnlock(gControls->cfg->coreFile);			if (coreFile != NULL && *coreFile > 0) /* core file was specified */	{		err = FSMakeFSSpec(srcVRefNum, srcDirID, coreFile, &coreFileSpec);		if (err==noErr) /* core file was downloaded or packaged with installer */		{			InitProgressBar();						/* extract contents of downloaded or packaged core file */						// XXX move this call to the end by 06/18/2000 if the issue is cleared			// XXX IfRemoveOldCore(vRefNum, dirID);						err = ExtractCoreFile(srcVRefNum, srcDirID, vRefNum, dirID);			if (err!=noErr) 			{				ErrorHandler(err);				if (coreFile)					DisposePtr((Ptr)coreFile);				return (void*) nil;			}									/* run all .xpi's through XPInstall */			err = RunAllXPIs(srcVRefNum, srcDirID, vRefNum, dirID);			if (err!=noErr)				ErrorHandler(err);							CleanupExtractedFiles(vRefNum, dirID);		}				if (coreFile)			DisposePtr((Ptr)coreFile);	}		/* launch the downloaded apps who had the LAUNCHAPP attr set */	if (err == noErr)		LaunchApps(srcVRefNum, srcDirID);		/* run apps that were set in RunAppsX sections */	if (err == noErr && gControls->cfg->numRunApps > 0)		RunApps();	 #if MOZILLA == 0	/* cleanup downloaded .xpis */	if (!gControls->opt->saveBits  && !bXPIsExisted)		DeleteXPIs(srcVRefNum, srcDirID);  /* "Installer Modules" folder location is supplied */#endif	/* wind down app */	gDone = true;		return (void*) 0;}