if (!CopyFile(iniSrcPath, iniDstPath, TRUE)) DWORD e = GetLastError();
int StartIB(/*CString parms, WIDGET *curWidget*/){	char *fgetsrv;	int rv = TRUE;	char	olddir[1024];	componentOrder =0;	rootPath	= GetModulePath();	SetGlobal("Root", rootPath);	configName	= GetGlobal("_NewConfigName");	SetGlobal("CustomizationList", configName); 	configPath  = rootPath + "Configs\\" + configName;	outputPath	= configPath + "\\Output";	cdPath 		= configPath + "\\Output\\Core";	cdshellPath	= configPath + "\\Output\\Shell";	networkPath = configPath + "\\Network";	tempPath 	= configPath + "\\Temp";	iniDstPath	= cdPath + "\\config.ini";	scriptPath	= rootPath + "script.ib";	workspacePath = configPath + "\\Workspace";	xpiDstPath	= cdPath;	// initializing variables for CCK linux build	linuxOption = GetGlobal("lPlatform");	linuxblobPath = GetGlobal("LinuxPath");	templinuxPath = tempPath + "\\templinux\\netscape-installer";	linuxDir = "nscpxpiLinux";	nscpxpilinuxPath = rootPath + linuxDir;	nsinstPath = "\\netscape-installer\\xpi";	nsinstallerDir = "netscape-installer";	xpiDir = "\\xpi";	templinuxDir = "tempLinux";	tarfile = "netscape-i686-pc-linux-gnu-sea.tar.gz";//  AfxMessageBox("set breakpoint",MB_OK);	if (SearchPath(workspacePath, "NSCPXPI", NULL, 0, NULL, NULL))		nscpxpiPath = workspacePath + "\\NSCPXPI";	else		nscpxpiPath = rootPath + "NSCPXPI";	if (linuxOption == "Linux")	{		nscpxpiPath = nscpxpilinuxPath + nsinstPath;		_mkdir(tempPath);		_chdir(tempPath);		_mkdir(templinuxDir);		_chdir(templinuxDir);		_mkdir(nsinstallerDir);		CString tPath = nscpxpiPath;		tPath.Replace(xpiDir,"");		CopyDirectory(tPath, templinuxPath, FALSE);			// get rid of this ugly code when bugzilla bug 105351 is fixed		CopyFile(nscpxpiPath+"\\full.start", 			templinuxPath+"\\xpi\\full.start", FALSE);		CopyFile(nscpxpiPath+"\\full.end", 			templinuxPath+"\\xpi\\full.end", FALSE);		CopyFile(nscpxpiPath+"\\recommended.start", 			templinuxPath+"\\xpi\\recommended.start", FALSE);		CopyFile(nscpxpiPath+"\\recommended.end",			templinuxPath+"\\xpi\\recommended.end", FALSE);	}	iniSrcPath	= nscpxpiPath + "\\config.ini";//Check for disk space before continuing	ULARGE_INTEGER nTotalBytes, nTotalFreeBytes, nTotalAvailable;	GetDiskFreeSpaceEx(NULL,&nTotalAvailable, &nTotalBytes, &nTotalFreeBytes);	// Checking for 26.3MB disk space	if (linuxOption != "Linux")	{		if ((nTotalAvailable.QuadPart) < WDISK_SPACE)		{			DiskSpaceAlert(WDISK_SPACE,(nTotalAvailable.QuadPart));			return FALSE;		}	}	else	{		if ((nTotalAvailable.QuadPart) < LDISK_SPACE)		{			DiskSpaceAlert(LDISK_SPACE,(nTotalAvailable.QuadPart));			return FALSE;		}	}//Check for Disk space over	init_components();//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);	}// Create the HelpMenu.xul in the beginning so that it can be called from the script.ib	CString setHlpRDF = tempPath +"\\helpMenu.rdf";	SetGlobal("HlpRDF",setHlpRDF);	CreateHelpMenu();	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)	{		_mkdir((char *)(LPCTSTR) cdPath);	}	else	{		iniDstPath = outputPath + "\\config.ini";		xpiDstPath = outputPath;	}/////////////////////////////	_mkdir((char *)(LPCTSTR) tempPath);	_mkdir((char *)(LPCTSTR) workspacePath);//	_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				if (!interpret(buffer))				{					rv = FALSE;					break;				}			}		}		fclose(f);	}	// 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 (linuxOption != "Linux")	{	if (cdDir.Compare("1") ==0)	{				CString shellPath = workspacePath + "\\Autorun\\";		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);//		}			}	// Didn't work...	if (linuxOption == "Linux")	{		LinuxInvisible();		AddThirdParty();		CreateLinuxInstaller();	}	else	{		invisible();		AddThirdParty();						ReplaceINIFile();			}	SetCurrentDirectory(olddir);	CString TargetDir = GetGlobal("Root");	CString TargetFile = TargetDir + "wizardmachine.ini";	CString MozBrowser = GetBrowser();//	CreateShortcut(MozBrowser, TargetFile, "HelpLink", TargetDir, FALSE);	EraseDirectory(tempPath);	_chdir(configPath);	_rmdir("Temp");	return TRUE;}