Exemplo n.º 1
0
RETVAL PlaceDescriptorInFat(RDWRHandle handle)
{
    struct  BootSectorStruct boot;
    SECTOR  fatstart;
    char    buffer[BYTESPERSECTOR], *p;

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

    fatstart = GetFatStart(handle);
    if (!fatstart) return ERROR;

    if (ReadSectors(handle, 1, fatstart, buffer) == -1)
       return ERROR;

    if (buffer[0] != boot.descriptor)
    {
        ReportFileSysError("Wrong descriptor value in FAT",
                           0,
                           &p,
                           0,
                           FALSE);

       buffer[0] = boot.descriptor;

       if (WriteSectors(handle, 1, fatstart, buffer, WR_FAT) == -1)
          return ERROR;

       if (!BackupFat(handle))
	  return ERROR;
    }

    return SUCCESS;
}
Exemplo n.º 2
0
RETVAL CheckDescriptorInFat(RDWRHandle handle)
{
    struct  BootSectorStruct boot;
    SECTOR  fatstart;
    char    buffer[BYTESPERSECTOR], *p;

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

    fatstart = GetFatStart(handle);
    if (!fatstart) return ERROR;

    if (ReadSectors(handle, 1, fatstart, buffer) == -1) return FALSE;

    if (boot.descriptor == buffer[0])
    {
       return SUCCESS;
    }
    else
    {
        ReportFileSysError("Wrong descriptor value in FAT",
                           0,
                           &p,
                           0,
                           FALSE);
    }

    return FAILED;
}
Exemplo n.º 3
0
static BOOL ValidityChecker(RDWRHandle handle, CLUSTER label,
                            SECTOR datasector, void** structure)
{
   char message[80], *p;
   CLUSTER thisCluster;
   struct Pipe* pipe = *((struct Pipe**) structure);
   
   if (!IsLabelValid(handle, label))
   {
      thisCluster = DataSectorToCluster(handle, datasector);
      if (!thisCluster) return FAIL;          
      
      sprintf(message, "Invalid cluster found at: %lu\n", thisCluster);
      ReportFileSysError(message, 0, &p, 0, FALSE);
      
      pipe->invalidfound = TRUE;
      
      if (pipe->fixit)
      {    
         if (!WriteFatLabel(handle, thisCluster, FAT_LAST_LABEL))
            return FAIL;
      }
   }

   return TRUE;
}
Exemplo n.º 4
0
void ShowFileNameViolation(RDWRHandle handle,
                           char* filename,
                           char* message)
{       
    char* p;        
    UNUSED(handle);
    
    sprintf(MessageBuffer, message, filename);
    ReportFileSysError(MessageBuffer, 0, &p, 0, FALSE);  
}
Exemplo n.º 5
0
void ShowClusterViolation(RDWRHandle handle, CLUSTER cluster, char* message)
{
    char* p;
    
    if (!TraceClusterPathName(handle, cluster, FilePrintBuffer))
       sprintf(FilePrintBuffer, "a file containing cluster %lu", cluster);
                       
    sprintf(MessageBuffer, message, FilePrintBuffer);
    ReportFileSysError(MessageBuffer, 0, &p, 0, FALSE);
}
Exemplo n.º 6
0
void ShowDirectoryViolation(RDWRHandle handle,
                            struct DirectoryPosition* pos,
                            struct DirectoryEntry* entry,    /* Speed up */
                            char* message)
{
    char* p;
    
    if (!TraceFullPathName(handle, pos, FilePrintBuffer))
       ConvertEntryPath(FilePrintBuffer, entry->filename, entry->extension);
                   
    sprintf(MessageBuffer, message, FilePrintBuffer);
    ReportFileSysError(MessageBuffer, 0, &p, 0, FALSE);
}