Ejemplo n.º 1
0
RETVAL CorrectFSString(RDWRHandle handle)
{
    char* correct;
    struct BootSectorStruct bootsect;

    switch (CheckFSString(handle))
    {
       case SUCCESS:
            break;
            
       case FAILED:
            correct = GetCorrectFSString(handle);
            if (!correct) return ERROR;

            if (!ReadBootSector(handle, &bootsect))
               return ERROR;

            correct = GetCorrectFSString(handle);

            WriteBPBFileSystemString(&bootsect, correct);

            if (!WriteBootSector(handle, &bootsect))
               return ERROR;
            break;
            
       case FAIL:
            return ERROR;
    }

    return SUCCESS;
}
Ejemplo n.º 2
0
void CFat16FileSystem::Execute(Long64 aPartitionSize,EntryList aNodeList,ofstream& aOutPutStream,
							   ConfigurableFatAttributes* aConfigurableFatAttributes)
{
	CDirRegion* dirRegionPtr = NULL;
	try
	{
		CreateBootSector(aPartitionSize,aConfigurableFatAttributes);
		ComputeTotalClusters(aPartitionSize);
		WriteBootSector(aOutPutStream);
		dirRegionPtr = new CDirRegion(aNodeList,this);
		dirRegionPtr->Execute();
		iClustersPerEntry = dirRegionPtr->GetClustersPerEntryMap();
		CreateFatTable(aOutPutStream);
		dirRegionPtr ->WriteClustersIntoFile(aOutPutStream);
		delete dirRegionPtr ;
	}
	catch(ErrorHandler &aError)
	{
		delete dirRegionPtr;
		//Re throw the same error message
		throw ErrorHandler(aError.iMessageIndex,(char*)aError.iSubMessage.c_str(),(char*)aError.iFileName.c_str(),aError.iLineNumber);
	}
	/**
	Irrespective of successful or unsuccessful data drive image generation ROFSBUILD
	may try to generate images for successive ".oby" file input.
	During this course unhandled exceptions may cause leaving some memory on heap 
	unused. so the unhandled exceptions handling is used to free the memory allocated 
	on heap. 
	*/
	catch(...)
	{
		delete dirRegionPtr;
		throw ErrorHandler(UNKNOWNERROR,__FILE__,__LINE__);
	}
}