WritePrivateProfileString("Redirect", "Status", "Disabled", configiniPath); WritePrivateProfileString("Site Selector", NULL, "", configiniPath); WritePrivateProfileString("Site Selector", "Identifier0", "Site0", configiniPath); WritePrivateProfileString("Site Selector", "Description0", "Default", configiniPath);
int StartIB(/*CString parms, WIDGET *curWidget*/){	char *fgetsrv;	int rv = TRUE;	char	olddir[1024];	CString curVersion, localePath,	strLang, strRegion, strREGION;	componentOrder = 0;	rootPath = GetModulePath();	SetGlobal("Root", rootPath);	configName = GetGlobal("_NewConfigName");	SetGlobal("CustomizationList", configName); 	curVersion      = GetGlobal("Version");	curPlatform     = GetGlobal("lPlatform");	platformPath    = rootPath+"Version\\"+curVersion+"\\"+curPlatform;	curLanguage     = GetLocaleCode(GetGlobal("Language"));	localePath      = rootPath+"Version\\"+curVersion+"\\"+curPlatform+"\\"+curLanguage;	configPath      = rootPath + "Configs\\" + configName;	outputPath      = configPath + "\\Output";	cdPath          = configPath + "\\Output\\Core";	cdshellPath     = configPath + "\\Output\\Shell";	remoteAdminFile = outputPath + "\\autoconfig.jsc";	networkPath     = configPath + "\\Network";	tempPath        = configPath + "\\Temp";	iniDstPath      = cdPath + "\\config.ini";	scriptPath      = rootPath + "script_" + curPlatform + ".ib";	workspacePath   = configPath + "\\Workspace";	shellPath       = workspacePath + "\\Autorun\\";	xpiDstPath      = cdPath;	// variables for language-region information	strLang        = curLanguage.Left(2);	strRegion      = curLanguage.Right(2);	strREGION      = strRegion;	strREGION.MakeUpper();	SetGlobal("%lang%", strLang);	SetGlobal("%region%", strRegion);	SetGlobal("%REGION%", strREGION);	// initializing variables for CCK linux build	templinuxPath    = tempPath + "\\templinux\\netscape-installer";	xpiDir           = "\\xpi";	templinuxDir     = "tempLinux";	targzfile        = "netscape-i686-pc-linux-gnu-sea.tar.gz";	templinuxDirPath = tempPath + "\\" + templinuxDir;//  AfxMessageBox("set breakpoint",MB_OK);	// delete contents of output directory before creating customized installer	EraseDirectory(outputPath);	if (SearchPath(workspacePath, "NSCPXPI", NULL, 0, NULL, NULL))		nscpxpiPath = workspacePath + "\\NSCPXPI";	else		nscpxpiPath = localePath + "\\Nscpxpi";	if (curPlatform == "Linux")	{		// Create directories for temporarily storing customized files		_mkdir(tempPath);		_chdir(tempPath);		_mkdir(templinuxDir);		_mkdir(templinuxPath);		_mkdir(templinuxPath + xpiDir);	}	iniSrcPath	= nscpxpiPath + "\\config.ini";	init_components();//Check for disk space before continuing	ULARGE_INTEGER nTotalBytes, nTotalFreeBytes, nTotalAvailable;	GetDiskFreeSpaceEx(NULL,&nTotalAvailable, &nTotalBytes, &nTotalFreeBytes);	if (curPlatform == "Windows")	{		ULONGLONG reqdWinDiskSpace = ComputeReqdWinDiskSpace();		if ((nTotalAvailable.QuadPart) < reqdWinDiskSpace)		{			DiskSpaceAlert(reqdWinDiskSpace, (nTotalAvailable.QuadPart));			return FALSE;		}	}	else if (curPlatform == "Linux")	{		if ((nTotalAvailable.QuadPart) < LDISK_SPACE)		{			DiskSpaceAlert(LDISK_SPACE,(nTotalAvailable.QuadPart));			return FALSE;		}	}	else if (curPlatform == "Mac OS")	{		ULONGLONG reqdMacDiskSpace = ComputeReqdMacDiskSpace();		if ((nTotalAvailable.QuadPart) < reqdMacDiskSpace)		{			DiskSpaceAlert(reqdMacDiskSpace, (nTotalAvailable.QuadPart));			return FALSE;		}	}//Check for Disk space over	//checking for the autorun CD shell - inorder to create a Core dir or not	CString cdDir= GetGlobal("CD image");	CString networkDir = GetGlobal("Network");	CString ftpLocation = GetGlobal("FTPLocation");//checking to see if the AnimatedLogoURL has a http:// appended in front of it //if not then we have to append it;//Check to see if the User Agent string exists and if so then prefix with -CK//(-CK can be replaced with a string UserAgentPrefix global.)	CString userAgentPrefix = GetGlobal("UserAgentPrefix");	if (userAgentPrefix.IsEmpty())		userAgentPrefix = "CK-";	CString userAgent = GetGlobal("OrganizationName");    if (userAgent)    {        CString templeft = userAgent.Left(3);        if ((templeft.CompareNoCase(userAgentPrefix)) != 0)            userAgent = userAgentPrefix + userAgent;    }    SetGlobal("OrganizationName",userAgent);// check to see if the bmp for rshell background is bigger than 302KB;	HANDLE hFile;	DWORD dwFileSize;	CString Rshellbmp = GetGlobal("ShellBgBitmap");	hFile = CreateFile ((LPCTSTR)Rshellbmp,GENERIC_READ,FILE_SHARE_READ,NULL,							OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,(HANDLE)NULL);	dwFileSize = GetFileSize (hFile, NULL);	int returnValue;	if (dwFileSize < 300000)		returnValue = AfxMessageBox("You have chosen a background BitMap that is too small for the customized RShell-If you want to proceed anyway choose Cancel or click on Retry and go back and make your changes",MB_RETRYCANCEL);	if (returnValue == IDRETRY)		return FALSE;//end of filesize check;// Check to see if the animatedlogourl has the http before it or not- else the browser// looks only in the chrome directory.	CString animLogoUrl = GetGlobal("AnimatedLogoURL");	CString leftvalue = animLogoUrl.Left(7);	CString httpvalue = "http://";	if (leftvalue.CompareNoCase("http://") != 0)	{		httpvalue = httpvalue + animLogoUrl;		SetGlobal("AnimatedLogoURL",httpvalue);	}		CString HelpUrl = GetGlobal("HelpMenuCommandURL");	leftvalue = HelpUrl.Left(7);	httpvalue = "http://";	if (leftvalue.CompareNoCase("http://") != 0)	{		httpvalue = httpvalue + HelpUrl;		SetGlobal("HelpMenuCommandURL",httpvalue);	}	CString setIspRDF = tempPath +"\\mailaccount.rdf";	SetGlobal("IspRDF",setIspRDF);	CreateIspMenu();	CString setnewsRDF = tempPath +"\\newsaccount.rdf";	SetGlobal("NewsRDF",setnewsRDF);	CreateNewsMenu();	// Determine which proxy configuration is chosen	CString proxyConfigoption = GetGlobal("radioGroup2");	if (proxyConfigoption == "3")		SetGlobal("ProxyConfig","2");	else if (proxyConfigoption == "2")		SetGlobal("ProxyConfig","1");	else		SetGlobal("ProxyConfig","0");	// Determine which SOCKS version is chosen	CString socksVer = GetGlobal("socksv");	if (socksVer == "SOCKS v4")		SetGlobal("SocksVersion","4");	else		SetGlobal("SocksVersion","5");	if ((cdDir.Compare("1")==0) && (curPlatform.Compare("Windows")==0))	{		_mkdir((char *)(LPCTSTR) cdPath);	}	else	{		iniDstPath = outputPath + "\\config.ini";		xpiDstPath = outputPath;	}/////////////////////////////	_mkdir((char *)(LPCTSTR) tempPath);	_mkdir((char *)(LPCTSTR) workspacePath);	// Copying config.ini file to the output directory	if (!CopyFile(iniSrcPath, iniDstPath, TRUE))		DWORD e = GetLastError();//	_mkdir((char *)(LPCTSTR) cdshellPath);	GetCurrentDirectory(sizeof(olddir), olddir);	if(SetCurrentDirectory((char *)(LPCTSTR) tempPath) == FALSE)	{		AfxMessageBox("Windows System Error:Unable to change directory",MB_OK);		return TRUE;	}//PostBeta - We have to inform the user that he has not set any value//and that it will default.Returning TRUE so that it doesnt stay in the last//screen forever.  	// Read in script file and interpret commands from it	FILE *f = fopen(scriptPath, "r");	if (!f)		rv = FALSE;	else	{		int done = FALSE;		while (!done)		{			fgetsrv = fgets(buffer, sizeof(buffer), f);			done = feof(f);			if (!done)			{				if (!fgetsrv || ferror(f))				{					rv = FALSE;					break;				}				buffer[strlen(buffer)] = '\0';  // Eliminate the trailing newline				CString strTempBuffer = buffer;				strcpy(buffer, SubstituteValues(strTempBuffer));				if (!interpret(buffer))				{					rv = FALSE;					break;				}			}		}		fclose(f);	}  // Copy the .cfg, if it exists, to the output directory in case the user  // wants to save it or look at it or something.  if (!gstrCFGPrefFile.IsEmpty())  {    int ipos = gstrCFGPrefFile.ReverseFind('/');    if (ipos >= 0)    {      CString baseFilename = gstrCFGPrefFile.Right(gstrCFGPrefFile.GetLength() - (ipos + 1));       CopyFile(tempPath+"\\bin\\"+baseFilename, outputPath+"\\"+baseFilename, FALSE);  // FALSE to overwrite    }  }	// Put all the extracted files back into their new XPI homes	ReplaceJARFiles();	ReplaceXPIFiles();	// Copy remaining default installer files into config	// preserving any existing files that we created already	// in previous steps	/* -- Need to be more selective than this	CopyDir(nscpxpiPath, cdPath, NULL, FALSE);	*/	for (int i=0; i<numComponents; i++)	{		if (Components[i].selected)			CopyFile(nscpxpiPath + "\\" + Components[i].archive, 					 xpiDstPath + "\\" + Components[i].archive, TRUE);	}	if (curPlatform == "Windows")	{		if (cdDir.Compare("1") ==0)		{			CopyDir(shellPath, outputPath, NULL, TRUE);			CreateRshell ();			WritePrivateProfileString("Message Stream", "Status", "Disabled", iniDstPath);		}		else		{			FILE *infout;			CString infFile = outputPath + "\\autorun.inf";			infout = fopen(infFile, "w");			if (!infout)				exit( 3 );			fprintf(infout,"[autorun]\nopen = setup.exe");		}		CString component;		CString configiniPath = xpiDstPath +"\\config.ini";		if (ftpLocation.Compare("ftp://") !=0)		{//			Change the ftp section to accomodate changes from PR3 to RTM//			for (int i=0; i<numComponents; i++)//			{//				if (Components[i].selected)//					CopyFile(nscpxpiPath + "\\" + Components[i].archive, //						networkPath + "\\" + Components[i].archive, TRUE);			WritePrivateProfileString("General", "url", ftpLocation, configiniPath);			WritePrivateProfileString("Redirect", "Status", "Disabled", configiniPath);			WritePrivateProfileString("Site Selector", NULL, "", configiniPath);			WritePrivateProfileString("Site Selector", "Identifier0", "Site0", configiniPath);			WritePrivateProfileString("Site Selector", "Description0", "Default", configiniPath);			WritePrivateProfileString("Site Selector", "Domain0", ftpLocation, configiniPath);			// HTTP support for network installer 			CString httpstr = ftpLocation.Left(7);			if (httpstr.Compare("http://") == 0)				WritePrivateProfileString("Dialog Advanced Settings",				"Use Protocol", "HTTP", configiniPath);			else				WritePrivateProfileString("Dialog Advanced Settings",				"Use Protocol", "FTP", configiniPath);//			}		}				invisible();		AddThirdParty();		ReplaceINIFile();	}	else if (curPlatform == "Linux")	{		LinuxInvisible();		AddThirdParty();		CreateLinuxInstaller();	}	else if (curPlatform == "Mac OS")	{		CreateMacZipFile();	}	SetCurrentDirectory(olddir);	CString TargetDir = GetGlobal("Root");	CString TargetFile = TargetDir + "wizardmachine.ini";	CString MozBrowser = GetBrowser();//	CreateShortcut(MozBrowser, TargetFile, "HelpLink", TargetDir, FALSE);	SetCurrentDirectory(configPath);	EraseDirectory(tempPath);	RemoveDirectory(tempPath);	return TRUE;}