Esempio n. 1
0
static int
IsLFNSupported (char *filename)
{
  int result;

  if (filename && filename[0] && (filename[1] == ':'))
    result = CheckDriveOnLFN (filename[0]);
  else
    result = CheckDriveOnLFN (getdisk () + 'A');

  if (CriticalErrorOccured ())
    return MAYBE;		/* If this caused a reaction, LFN would be supported.
				   Maybe not on the indicated drive though. */
  else
    return result;
}
Esempio n. 2
0
int
WriteFileFromMemory (char *file, char *buffer, unsigned bsize,
		     unsigned long floppysize, int askdisk, int fallthrough,
		     int overwrite)
{
  unsigned long i;
  int criterr = 0, wrhandle;

  if (askdisk)
    {
      puts ("\n");
      NLS_PUTSTRING (1, 21, "Insert TARGET diskette into drive");
      puts ("");
      NLS_PRINTSTRING (1, 9, "Press any key to continue . . .");
      WaitForInput ();
    }

  /* Check disk capacity is the same as that of the original
     diskette. */
  for (;;)
    {
      if (!DiskLargeEnough (file, floppysize) ||
	  ((criterr = CriticalErrorOccured ()) != 0))
	{
	  puts ("");
	  if (criterr)
	    {
	      NLS_PUTSTRING (1, 10, "Disk not ready!");
	    }
	  else
	    NLS_PUTSTRING (1, 12, "Not enough disk space on target drive!");

	  if (fallthrough)
	    return FALSE;

	  puts ("");
	  NLS_PRINTSTRING (1, 23, "Put a diskette with the right capacity in drive");
	  printf (" %c:,\n", GetDiskFromPathName (file));
	  NLS_PUTSTRING (1, 24, "or press CTRL-C to cancel.");
	  WaitForInput ();	/* When the user presses CTRL-C this function does not return */
	}
      else
	break;
    }

  if (access (file, EXISTS) == 0)
    {
      if (overwrite)
	{
	  if (remove (file) == -1)
	    {
	      puts ("");
	      NLS_PUTSTRING (1, 4, "File is write protected!");
	      return FALSE;
	    }
	}
      else
	{
	  puts ("\n");
	  NLS_PUTSTRING (1, 7, "File already exists!");
	  return FALSE;
	}
    }

  wrhandle = open (file, O_WRONLY | O_BINARY | O_CREAT);

  if (wrhandle == -1)
    return FALSE;

  for (i = 0; i < floppysize / bsize; i++)
    {
      if (!ReadMemoryBlock (buffer, bsize) ||
	  (write (wrhandle, buffer, bsize) != bsize))
	{
	  close (wrhandle);
	  if (access (file, EXISTS) == 0)
	    {
	      chmod (file, S_IWRITE);
	      remove (file);
	    }
	  return FALSE;
	}
    }

  close (wrhandle);
  chmod (file, S_IWRITE);
  return TRUE;
}
bool MfxCriticalErrorHandler::NeedToReturnCriticalStatus(mfxBitstream *bs)
{
    bool RetrievingCachedFrames_and_CriticalErrorReportedAtLeastOnce = m_CriticalErrorReportedAtLeastOnce && bs == NULL;
    return CriticalErrorOccured() && !RetrievingCachedFrames_and_CriticalErrorReportedAtLeastOnce;
}