XPI_ERR_CHECK(xpi_initProc( xpiStubDirSpec, tgtDirSpec, xpicbProgress ));
XPI_ERR_CHECK(xpi_initProc( xpiProgDirSpec, tgtDirSpec, xpicbProgress ));
RunAllXPIs(short xpiVRefNum, long xpiDirID, short vRefNum, long dirID){	OSErr 				err = noErr;	FSSpec				tgtDirSpec, xpiStubDirSpec, xpiSpec;	XPI_InitProc		xpi_initProc;	XPI_InstallProc		xpi_installProc;	XPI_ExitProc		xpi_exitProc;	CFragConnectionID	connID;	nsresult 			rv = NS_OK;	StringPtr			pcurrArchive;	int					i, len, compsDone = 0, numXPIs, currXPICount = 0, instChoice = gControls->opt->instChoice-1;	Boolean				isCurrXPI = false, indeterminateFlag = false;	Str255				installingStr;		err = FSMakeFSSpec(vRefNum, dirID, 0, &xpiStubDirSpec); /* temp dir */	err = FSMakeFSSpec(gControls->opt->vRefNum, gControls->opt->dirID, 0, &tgtDirSpec);	/* program dir */		ERR_CHECK_RET(LoadXPIStub(&xpi_initProc, &xpi_installProc, &xpi_exitProc, &connID, xpiStubDirSpec), err);	XPI_ERR_CHECK(xpi_initProc( xpiStubDirSpec, tgtDirSpec, xpicbProgress ));		// init overall xpi indicator	numXPIs = CountSelectedXPIs();	if (gControls->tw->allProgressBar)	{		SetControlMaximum(gControls->tw->allProgressBar, numXPIs*2); // numXPIs * 2 so that prog bar moves more		SetControlData(gControls->tw->allProgressBar, kControlNoPart, kControlProgressBarIndeterminateTag,						sizeof(indeterminateFlag), (Ptr) &indeterminateFlag);		SetControlValue(gControls->tw->allProgressBar, 0);		Draw1Control(gControls->tw->allProgressBar);	}		if (gControls->tw->xpiProgressBar)		ShowControl(gControls->tw->xpiProgressBar);			// enumerate through all .xpi's	// loop through 0 to kMaxComponents	for(i=0; i<kMaxComponents; i++)	{		// general test: if component in setup type		if ( (gControls->cfg->st[instChoice].comp[i] == kInSetupType) &&			 (compsDone < gControls->cfg->st[instChoice].numComps) )		{ 			// if custom and selected, or not custom setup type			// add file to buffer			if ( ((instChoice == gControls->cfg->numSetupTypes-1) && 				  (gControls->cfg->comp[i].selected == true)) ||				 (instChoice < gControls->cfg->numSetupTypes-1) )			{				// if LAUNCHAPP attr wasn't set			 	if (!gControls->cfg->comp[i].launchapp)				{					HLock(gControls->cfg->comp[i].archive);					pcurrArchive = CToPascal(*gControls->cfg->comp[i].archive);					HUnlock(gControls->cfg->comp[i].archive);							isCurrXPI = IsArchiveXPI(pcurrArchive);													err = FSMakeFSSpec(xpiVRefNum, xpiDirID, pcurrArchive, &xpiSpec);					if (err==noErr && isCurrXPI)					{						// update package display name						if (gControls->tw->allProgressMsg)						{							ProgressMsgInit();							GetIndString(installingStr, rStringList, sInstalling);							TEInsert(&installingStr[1], installingStr[0], gControls->tw->allProgressMsg);							HLock(gControls->cfg->comp[i].shortDesc);							len = strlen(*gControls->cfg->comp[i].shortDesc);							TEInsert(*gControls->cfg->comp[i].shortDesc, (len>64?64:len), gControls->tw->allProgressMsg);							HUnlock(gControls->cfg->comp[i].shortDesc);						}												RunXPI(xpiSpec, &xpi_installProc);												// update progess bar						if (gControls->tw->allProgressBar)							SetControlValue(gControls->tw->allProgressBar,											GetControlValue(gControls->tw->allProgressBar)+1);					}					if (pcurrArchive)						DisposePtr((Ptr) pcurrArchive);				}				compsDone++;			}		}		else if (compsDone >= gControls->cfg->st[instChoice].numComps)			break;  	}		xpi_exitProc();		UnloadXPIStub(&connID);	return err;}