Пример #1
0
/** 
Set the cluster count to a value greater than it should be
The bad cluster count is caluclated as 10000 added to the actual
cluster count value. The bad cluster count is then written to the disk 
in place of the actual cluster count. 

@param aClusterCount The cluster count of the volume
@param aPos The position at which to start writing to the raw disk

@return KErrNone if successful
*/	
TInt CBaseTestFat32Calculate::SetToGreater(TUint32 aClusterCount, TInt aPos)
	{
	TUint32 badClusterCount;
	badClusterCount = aClusterCount+10000;
	TUint8 num[4];
	TInt i;
	TInt r;

	r = TheDisk.Open(iTheFs, CurrentDrive());
	for (i=0; i<4; i++)
		{

		num[i] = 0;
		num[i] = num[i] + badClusterCount;
		badClusterCount = badClusterCount >> 8;
		}

	TUint8 data[1];
	TPtr8 buffer((TUint8*)&data[0],1);
	
	for (i=0; i<4; i++)
		{
		aPos = aPos + 1;
		r=TheDisk.Read(aPos,buffer);
		data[0]=num[i];
		r=TheDisk.Write(aPos,buffer);
		}
	TheDisk.Close();
	return r;
	}
Пример #2
0
/** 
Read the FSInfo sector at the FSI_Free_Count field. 
Following this check that the last known cluster count is less than 
the actual cluster count of the volume. 

Note: This function should be called after files have been written 
to the disk to ensure that clusters have been occupied

@param aPos The position at which to start reading from the raw disk

@return KErrNone if successful
*/	
TInt CBaseTestFat32Calculate::CheckFSInfo(TInt aPos)
	{
	TUint32 fsInfo;

	TUint32 data;
	TPtr8 buffer((TUint8*)&data,4);
	
	TInt r = TheDisk.Open(iTheFs, CurrentDrive());
	r = TheDisk.Read(aPos,buffer);
	
	fsInfo = data; 
	
	TheDisk.Close();
	
	if (fsInfo < iClusterCount)
		{
		_LIT(KFSInfoPass, "FSInfo Correct, iClusterCount = %08x fsInfo = %08x fsInfo = %08x");
		INFO_PRINTF4(KFSInfoPass, iClusterCount, data, fsInfo);
		return KErrNone;
		}
	else
		{
		_LIT(KFSInfoFail, "FSInfo incorrect, iClusterCount = %08x fsInfo = %08x");
		INFO_PRINTF3(KFSInfoFail, iClusterCount, fsInfo);
		return -1;
		}
	}
Пример #3
0
void TMultipleSessionTest::FillUpDisk(RTest& aTest)
//
//	Test that a full disk is ok
//
	{

	aTest.Next(_L("Fill disk to capacity"));
	TInt r=iFs.SetSessionPath(iSessionPath);
	r=iFs.MkDirAll(_L("\\MULTIPLE_SESSION_TEST\\BIGDIRECTORY\\"));
	if	(CurrentDrive(aTest)!=EDriveQ)	//	T_REMFSY may return incorrect result on WINS
		aTest(r==KErrNone || r==KErrAlreadyExists);
	TInt count=0;
	TFileName sessionPath;
	r=iFs.SessionPath(sessionPath);
	test(sessionPath==iSessionPath);
	aTest(r==KErrNone);
	TBuf<128> fileName=_L("\\MULTIPLE_SESSION_TEST\\BIGDIRECTORY\\FILE");
	FOREVER
		{
		TInt r=CreateFileX(fileName,count,iFs, aTest);
		if (r==KErrDiskFull)
			break;
		aTest(r==KErrNone);
		count++;
 #if defined(__WINS__)
		if (count==32 && sessionPath[0]=='C') // Don't fill up disk on NT
			break;
 #endif
		}

	r=iFs.CheckDisk(fileName);
	if (r!=KErrNone && r!=KErrNotSupported)
		{
		aTest.Printf(_L("ERROR:: CheckDisk returned %d\n"),r);
		aTest.Getch();
		}

	while(count--)
		DeleteFileX(fileName,count,iFs,CurrentDrive(aTest),aTest);

	r=iFs.CheckDisk(fileName);
	if (r!=KErrNone && r!=KErrNotSupported)
		{
		aTest.Printf(_L("ERROR:: CheckDisk returned %d\n"),r);
		aTest.Getch();
		}
	}
void TestLeadingE5Handling()
	{
	test.Next(_L("Test Leading \'E5\' byte handling"));
	__UHEAP_MARK;
	
	// logging for failure
	gTCType = ESymbianFATSpecific;
	RBuf failedOnBuf;
	failedOnBuf.CreateL(gLogFailureData.iFuncName);
	gTCId = 0;
	RBuf tcUniquePath;
	tcUniquePath.CreateL(KNone());

	QuickFormat();
	CreateTestDirectory(_L("\\F32-TST\\T_FATCHARSETCONV\\"));

	// Enables codepage dll implementation of LocaleUtils functions for this test only
	TInt r = TheFs.ControlIo(CurrentDrive(), KControlIoEnableFatUtilityFunctions);
	testAndLog(r==KErrNone);
	
	r = UserSvr::ChangeLocale(KTestLocale);
	testAndLog(r==KErrNone);

	r=TheFs.SessionPath(gSessionPath);
	testAndLog(r==KErrNone);

	_LIT(KTestFilePathAndName,		"\\F32-TST\\T_FATCHARSETCONV\\\x88F9.TXT");
	_LIT(KTestFileShortName, 		"\x88F9.TXT");
	
	MakeFile(KTestFilePathAndName);
	TFileName sn;
	r = TheFs.GetShortName(KTestFilePathAndName, sn);
	testAndLog(r==KErrNone);
	r = sn.Compare(KTestFileShortName);
	testAndLog(r==KErrNone);
	
	r=TheFs.Delete(KTestFilePathAndName);
	testAndLog(r==KErrNone);

	// Disables codepage dll implementation of LocaleUtils functions for other base tests
	r = TheFs.ControlIo(CurrentDrive(), KControlIoDisableFatUtilityFunctions);
	testAndLog(r==KErrNone);
	failedOnBuf.Close();
	tcUniquePath.Close();
	__UHEAP_MARKEND;
	}
Пример #5
0
void TMultipleSessionTest::testSetVolume(RTest& aTest)
//
//	Test setting the volume info.
//
	{

	aTest.Next(_L("Test setting the volume label"));
	TInt r=iFs.SetSessionPath(iSessionPath);
	aTest(r==KErrNone);
#if defined(_UNICODE)
	aTest.Printf(_L("Unicode volume label set not implemented ****\n"));
	return;
#else
	TInt driveNum=CurrentDrive(aTest);
	TVolumeInfo v;
	r=iFs.Volume(v,driveNum);
	aTest(r==KErrNone);
	TFileName n=v.iName;
	aTest.Printf(_L("VOL=\"%S\"\n"),&n);

	aTest.Next(_L("Set volume label to nothing"));
	r=iFs.SetVolumeLabel(_L(""),driveNum);
	if (r==KErrGeneral)
		return;
	aTest(r==KErrNone);
	r=iFs.Volume(v,driveNum);
	aTest(r==KErrNone);
	aTest(v.iName==_L(""));
	aTest.Printf(_L("VOL=\"%S\"\n"),&v.iName);

	aTest.Next(_L("Set volume label to ABCDEFGHIJK"));
	r=iFs.SetVolumeLabel(_L("ABCDEFGHIJK"),driveNum);
	aTest(r==KErrNone);
	r=iFs.Volume(v,driveNum);
	aTest(r==KErrNone);
	aTest(v.iName==_L("ABCDEFGHIJK"));
	aTest.Printf(_L("VOL=\"%S\"\n"),&v.iName);

	aTest.Next(_L("Set volume label back to nothing"));
	r=iFs.SetVolumeLabel(_L(""),driveNum);
	aTest(r==KErrNone);
	r=iFs.Volume(v,driveNum);
	aTest(r==KErrNone);
	aTest(v.iName==_L(""));
	aTest.Printf(_L("VOL=\"%S\"\n"),&v.iName);

	aTest.Next(_L("Set volume label to original"));
	r=iFs.SetVolumeLabel(n,driveNum);
	aTest(r==KErrNone);
	r=iFs.Volume(v,driveNum);
	aTest(r==KErrNone);
	aTest(v.iName==n);
	aTest.Printf(_L("VOL=\"%S\"\n"),&v.iName);

#endif
	}
Пример #6
0
void ReadBootSector(TFatBootSector& aBootSector)
	{
    TInt r = ReadBootSector(TheFs, CurrentDrive(), KBootSectorNum<<KDefaultSectorLog2, aBootSector);
    test_KErrNone(r);

    if(!aBootSector.IsValid())
        {
        test.Printf(_L("Wrong bootsector! Dump:\n"));
        aBootSector.PrintDebugInfo();
        test(0);
        }
	}
// ---------------------------------------------------------------------------
// CMMCScBkupReadDataTransferRequestBase::PrepareDataTransferL()
// 
// 
// ---------------------------------------------------------------------------
void CMMCScBkupReadDataTransferRequestBase::PrepareDataTransferL()
    {
    __ASSERT_ALWAYS(iTransferChunkPointer != NULL, User::Invariant());
    const CSBGenericDataType& generic = DataOwner().Owner().Identifier();

    // Prepare the transfer type with a virtual function call...
    CSBGenericTransferType* transferType = PrepareTransferTypeL( generic, CurrentDrive(),
         DataOwner().Version());
    delete iTransferType;
    iTransferType = transferType;

#ifdef __MMCSCBKUPLOGGING_ENABLED__
    TInt lengthOfDataReadyForTransfer = 0;
    if  ( iTransferChunkPointer != NULL )
        {
        lengthOfDataReadyForTransfer = iTransferChunkPointer->Length();
        }

    if ( iTransferType->DerivedTypeL() == EJavaTransferDerivedType )
        {
        HBufC* hash = MMCScBkupSBEUtils::JavaHashFromGenericLC( DataOwner().Owner().Identifier() );
        __LOG5("CMMCScBkupReadDataTransferRequestBase::PrepareDataTransferL() - supplying %d bytes of data for has: %S, drive: %c, iTransferChunkPointer addr: 0x%08x, iTransferChunkPointer length: %d", lengthOfDataReadyForTransfer, hash, 'A' + CurrentDrive(), iTransferChunkPointer->Ptr(), iTransferChunkPointer->Length() );
        CleanupStack::PopAndDestroy( hash );
        }
    else
        {
        const TSecureId sid = DataOwner().SecureId();
        __LOG5("CMMCScBkupReadDataTransferRequestBase::PrepareDataTransferL() - supplying %d bytes of data for sid: 0x%08x, drive: %c, iTransferChunkPointer addr: 0x%08x, iTransferChunkPointer length: %d", lengthOfDataReadyForTransfer, sid.iId, 'A' + CurrentDrive(), iTransferChunkPointer->Ptr(), iTransferChunkPointer->Length() );
        }
#endif

    //
    Driver().DrvSecureBackupClient().SupplyDataL( *iTransferType, iFinishedSupplyingData, iStatus );
    SetActive();
    
    // Reset
    ResetDataTransferCounter();
    iTransferChunkPointer = NULL; // Address is retrieved from global chunk in DoProcessChunkOfDataL
    
    __LOG("CMMCScBkupReadDataTransferRequestBase::PrepareDataTransferL() - data transmitted, waiting for request completion...");

    // When the SBE informs us that it has read the data, we'll need to send it the next 
    // chunk.
    SetState( EProcessData );
    }
Пример #8
0
void TMultipleSessionTest::MakeAndDeleteFiles(RTest& aTest)
//
// Create and delete large files in a randomish order
//
	{

	aTest.Next(_L("Create and delete large files"));
	TInt r=iFs.SetSessionPath(iSessionPath);
	r=iFs.MkDirAll(_L("\\MULTIPLE_SESSION_TEST\\SMALLDIRECTORY\\"));

	if (CurrentDrive(aTest)!=EDriveQ)	//	T_REMFSY may return incorrect result on WINS
		aTest(r==KErrNone || r==KErrAlreadyExists);
	
	TBuf<128> fileName=_L("\\MULTIPLE_SESSION_TEST\\SMALLDIRECTORY\\FILE");
	r=CreateFileX(fileName,0,iFs,aTest);
	aTest(r==KErrNone);
	r=CreateFileX(fileName,1,iFs,aTest);
	aTest(r==KErrNone);
	r=DeleteFileX(fileName,0,iFs,CurrentDrive(aTest),aTest);	
	aTest(r==KErrNone);
	r=CreateFileX(fileName,2,iFs,aTest);
	aTest(r==KErrNone);
	r=CreateFileX(fileName,1,iFs,aTest);
	aTest(r==KErrNone);
	r=CreateFileX(fileName,3,iFs,aTest);
	aTest(r==KErrNone);
	r=DeleteFileX(fileName,1,iFs,CurrentDrive(aTest),aTest);	
	aTest(r==KErrNone);
	r=CreateFileX(fileName,4,iFs,aTest);
	aTest(r==KErrNone);
	r=DeleteFileX(fileName,2,iFs,CurrentDrive(aTest),aTest);	
	aTest(r==KErrNone);
	r=DeleteFileX(fileName,3,iFs,CurrentDrive(aTest),aTest);	
	aTest(r==KErrNone);
	r=DeleteFileX(fileName,4,iFs,CurrentDrive(aTest),aTest);	
	aTest(r==KErrNone);
	r=CreateFileX(fileName,1,iFs,aTest);
	aTest(r==KErrNone);
	r=DeleteFileX(fileName,1,iFs,CurrentDrive(aTest),aTest);	
	aTest(r==KErrNone);

	r=iFs.CheckDisk(fileName);
	if (r!=KErrNone && r!=KErrNotSupported)
		aTest.Printf(_L("ERROR:: CheckDisk returned %d\n"),r);
	}
Пример #9
0
void TSessionTest::testSetVolume()
//
// Test setting the volume info.
//
	{

	test.Start(_L("Test setting the volume label"));

#if defined(_UNICODE)
	test.Printf(_L("Unicode volume label set not implemented ****\n"));
	test.End();
	return;
#else
	TInt driveNum=CurrentDrive();
	TVolumeInfo v;
	TInt r=iFs.Volume(v,driveNum);
	test_KErrNone(r);
	TFileName n=v.iName;
	test.Printf(_L("VOL=\"%S\"\n"),&n);

	test.Next(_L("Set volume label to nothing"));
	r=iFs.SetVolumeLabel(_L(""),driveNum);
#if defined(__WINS__)
	if (r==KErrGeneral || r==KErrAccessDenied || r==KErrNotSupported)
		{
		test.Printf(_L("Error %d: Set volume label not testing on WINS\n"),r);
		test.End();
		return;
		}
#endif
	test_KErrNone(r);
	r=iFs.Volume(v,driveNum);
	test_KErrNone(r);
	test(v.iName==_L(""));
	test.Printf(_L("VOL=\"%S\"\n"),&v.iName);

	test.Next(_L("Set volume label to ABCDEFGHIJK"));
	r=iFs.SetVolumeLabel(_L("ABCDEFGHIJK"),driveNum);
	test_KErrNone(r);
	r=iFs.Volume(v,driveNum);
	test_KErrNone(r);
	test(v.iName==_L("ABCDEFGHIJK"));
	test.Printf(_L("VOL=\"%S\"\n"),&v.iName);

	test.Next(_L("Set volume label back to nothing"));
	r=iFs.SetVolumeLabel(_L(""),driveNum);
	test_KErrNone(r);
	r=iFs.Volume(v,driveNum);
	test_KErrNone(r);
	test(v.iName==_L(""));
	test.Printf(_L("VOL=\"%S\"\n"),&v.iName);

	test.Next(_L("Set volume label to original"));
	r=iFs.SetVolumeLabel(n,driveNum);
	test_KErrNone(r);
	r=iFs.Volume(v,driveNum);
	test_KErrNone(r);
	test(v.iName==n);
	test.Printf(_L("VOL=\"%S\"\n"),&v.iName);

	test.End();
#endif
	}
// ---------------------------------------------------------------------------
// CMMCScBkupReadDataTransferRequestBase::PrepareForNextEntry()
// 
// 
// ---------------------------------------------------------------------------
TBool CMMCScBkupReadDataTransferRequestBase::PrepareForNextEntry()
    {
    TBool anotherEntryAvailable = EFalse;
    
    // Update our starting offset
    iFinishedSupplyingData = EFalse;
    iCurrentOffset = -1;
    //
    if  ( ++iCurrentIndex < iEntries->Count() )
        {
        const TMMCScBkupArchiveVector& currentReadInfo = CurrentReadInfo();
        iCurrentOffset = currentReadInfo.Offset();

        __LOG3("CMMCScBkupReadDataTransferRequestBase::PrepareForNextEntry() - offset: %6d, length: %6d, drive: %c:", currentReadInfo.Offset(), currentReadInfo.Length(), 'A' + CurrentDrive() );

        anotherEntryAvailable = ETrue;
        }
    //
    return anotherEntryAvailable;
    }
Пример #11
0
void ParseCommandArguments(TTestSwitches& aSwitches)
	{
	TBuf<256> cmd;
	User::CommandLine(cmd);
	RDebug::Print(_L("Command Line : %S"), &cmd);
	TChar testDrive = 'C';
		
	InitLogData();
	ClearSwitches(aSwitches);

	TFileName currentFile=RProcess().FileName();
	TLex lex(cmd);
	TPtrC token=lex.NextToken();
	if (token.MatchF(currentFile)==0)
		{
		token.Set(lex.NextToken());
		}
	if (token.Length()==0)
		{
		testDrive = 'C'; // default drives
		gAutoTest = ETrue;
		}
	else if((token[0] >='A' && token[0]<='Z') || (token[0] >='a' && token[0]<='z'))
		{
		testDrive = token[0];
		gAutoTest = ETrue;
		}
	else
		{
		while (!lex.Eos())
			{
			if (token.Length()==0)
				{
				continue;	// ignore trailing whitespace
				}
			if (token==_L("-x") || token==_L("-X"))
				{
				token.Set(lex.NextToken());
				if((token==_L("s")) || (token==_L("S")))
					{
					aSwitches.iExeOnSymbian = ETrue;
					gLogFailureData.iExeOsName = KSymbian;
					}
				else if((token==_L("w")) || (token==_L("W")))
					{
					aSwitches.iExeOnWindows = ETrue;
					gLogFailureData.iExeOsName = KWindows;
					}
				token.Set(lex.NextToken());
				continue;
				}
			if (token==_L("-d") || token==_L("-D"))
				{
				token.Set(lex.NextToken());
				testDrive = token[0];
				token.Set(lex.NextToken());
				continue;
				}
			if (token==_L("-v") || token==_L("-V"))
				{
				token.Set(lex.NextToken());
				if((token==_L("s")) || (token==_L("S")))
					{
					aSwitches.iVerOnSymbian = ETrue;
					gLogFailureData.iVerOsName = KSymbian;
					}
				else if((token==_L("w")) || (token==_L("W")))
					{
					aSwitches.iVerOnWindows = ETrue;
					gLogFailureData.iVerOsName = KWindows;
					}
				token.Set(lex.NextToken());
				continue;
				}
			RDebug::Print(_L("Unknown option %S"), &token);
			Help();
			return;
			}
		}

	CheckIfIOTesting(aSwitches);

	if(gIOTesting)
		{
		gAutoTest = EFalse;
		}
	else
		{
		gAutoTest = ETrue;
		}

	testDrive.UpperCase();
	if (gAutoTest)
		{
#if defined (__WINS__)
		//execution phase
		aSwitches.iExeOnWindows = ETrue;
		aSwitches.iExeDriveChar = testDrive;
		aSwitches.iExeDriveNum = CurrentDrive(aSwitches.iExeDriveChar);
		gLogFailureData.iExeDrive = aSwitches.iExeDriveChar;
		gLogFailureData.iExeOsName = KWindows;
		//verification phase
		aSwitches.iVerOnWindows = ETrue;
		aSwitches.iVerDriveChar = testDrive;
		aSwitches.iVerDriveNum = CurrentDrive(aSwitches.iVerDriveChar);
		gLogFailureData.iVerDrive = aSwitches.iVerDriveChar;
		gLogFailureData.iVerOsName = KWindows;
#else	
		//execution phase
		aSwitches.iExeOnSymbian = ETrue;
		aSwitches.iExeDriveChar = testDrive;
		aSwitches.iExeDriveNum = CurrentDrive(aSwitches.iExeDriveChar);
		gLogFailureData.iExeDrive = aSwitches.iExeDriveChar;
		gLogFailureData.iExeOsName = KSymbian;
		//verification phase	
		aSwitches.iVerOnSymbian = ETrue;
		aSwitches.iVerDriveChar = testDrive;
		aSwitches.iVerDriveNum = CurrentDrive(aSwitches.iVerDriveChar);
		gLogFailureData.iVerDrive = aSwitches.iVerDriveChar;
		gLogFailureData.iVerOsName = KSymbian;
#endif
		}

	if(aSwitches.iExeOnWindows || aSwitches.iExeOnSymbian)
		{
		aSwitches.iExeDriveChar = testDrive;
		aSwitches.iExeDriveNum = CurrentDrive(aSwitches.iExeDriveChar);
		gLogFailureData.iExeDrive = aSwitches.iExeDriveChar;
		}
	if(aSwitches.iVerOnWindows || aSwitches.iVerOnSymbian)
		{
		aSwitches.iVerDriveChar = testDrive;
		aSwitches.iVerDriveNum = CurrentDrive(aSwitches.iVerDriveChar);
		gLogFailureData.iVerDrive = aSwitches.iVerDriveChar;
		}
	}
Пример #12
0
void QuickFormat()
    {
    FormatFatDrive(TheFs, CurrentDrive(), ETrue);
    }
void TestVFATCase1()
	{
	test.Next(_L("Test Without VFAT entry, but DOS entry uses CP932 Japanese file's access"));
	__UHEAP_MARK;
	
	// logging for failure
	gTCType = ESymbianFATSpecific;
	RBuf failedOnBuf;
	failedOnBuf.CreateL(gLogFailureData.iFuncName);
	gTCId = 0;
	RBuf tcUniquePath;
	tcUniquePath.CreateL(KNone());

	QuickFormat();
	CreateTestDirectory(_L("\\F32-TST\\T_FATCHARSETCONV\\"));

	GetBootInfo();

   	RFile file;
  	TFileName fn = _L("\\ABCD");
  	
  	TInt r=file.Create(TheFs,fn,EFileRead);
  	testAndLog(r==KErrNone);
  	file.Close();
  
  	//	Assume this file is the first entry in the root directory
  	r=TheDisk.Open(TheFs,CurrentDrive());
  	testAndLog(r==KErrNone);

    //-- read the 1st dir entry, it should be a DOS entry 
    const TInt posEntry1=gBootSector.RootDirStartSector() << KDefaultSectorLog2; //-- dir entry1 position
      
    TFatDirEntry fatEntry1;
 	TPtr8 ptrEntry1((TUint8*)&fatEntry1,sizeof(TFatDirEntry));
	testAndLog(TheDisk.Read(posEntry1, ptrEntry1)==KErrNone); 
	testAndLog(!fatEntry1.IsVFatEntry());

	// Manually modify the short name into unicode characters
	// 	Unicode: 	0x(798F 5C71 96C5 6CBB)
	//	Shift-JIS: 	0x(959F 8E52 89EB 8EA1)

	TBuf8<8> unicodeSN = _L8("ABCD1234");
	unicodeSN[0] = 0x95;
	unicodeSN[1] = 0x9F;
	unicodeSN[2] = 0x8E;
	unicodeSN[3] = 0x52;
	unicodeSN[4] = 0x89;
	unicodeSN[5] = 0xEB;
	unicodeSN[6] = 0x8E;
	unicodeSN[7] = 0xA1;

	fatEntry1.SetName(unicodeSN);
	testAndLog(TheDisk.Write(posEntry1, ptrEntry1)==KErrNone);
	TheDisk.Close();

  	// The Unicode file name of the file that is created
  	fn = _L("\\ABCD");
  	fn[1] = 0x798F;
  	fn[2] = 0x5C71;
  	fn[3] = 0x96C5;
  	fn[4] = 0x6CBB;
  	
  	// Access the file using its unicode file name without the DLL loaded.
      r = TheFs.ControlIo(CurrentDrive(), KControlIoDisableFatUtilityFunctions);
  	test_KErrNone(r);
  	
  	TEntry entry;
  	TInt err = TheFs.Entry(fn, entry);
  	testAndLog(err==KErrNotFound);
  	
      // Access the file using its unicode file name with the DLL loaded.
      r = TheFs.ControlIo(CurrentDrive(), KControlIoEnableFatUtilityFunctions);  	
	test_KErrNone(r);
 	r = UserSvr::ChangeLocale(KTestLocale);  	
	test_KErrNone(r);
  
  	err = TheFs.Entry(fn, entry);
  	testAndLog(err==KErrNone);
  	
  	//file is no more required,delete it.
  	err = TheFs.Delete(fn);
  	testAndLog(err==KErrNone);
  	
      r = TheFs.ControlIo(CurrentDrive(), KControlIoDisableFatUtilityFunctions);
  	test_KErrNone(r);
  	
 	r=TheFs.SessionPath(gSessionPath);
  	test_KErrNone(r);
	failedOnBuf.Close();
	tcUniquePath.Close();
	__UHEAP_MARKEND;
	}
void TestVFATCase2()
	{
	test.Next(_L("Test With VFAT entry, and DOS entry using CP932 Japanese file's access"));
	__UHEAP_MARK;
	
	// logging for failure
	gTCType = ESymbianFATSpecific;
	RBuf failedOnBuf;
	failedOnBuf.CreateL(gLogFailureData.iFuncName);
	gTCId = 0;
	RBuf tcUniquePath;
	tcUniquePath.CreateL(KNone());

	QuickFormat();
	CreateTestDirectory(_L("\\F32-TST\\T_FATCHARSETCONV\\"));

	TInt r = TheFs.ControlIo(CurrentDrive(), KControlIoEnableFatUtilityFunctions);
	test_KErrNone(r);
		
	r = UserSvr::ChangeLocale(KTestLocale);
	test_KErrNone(r);
	r=TheFs.SetSessionPath(gSessionPath);
	testAndLog(r==KErrNone);
	
	_LIT(KTestNormalFileName, 		"\x65B0\x6587\x4EF6.TXT");	
	_LIT(KTestNormalFileShortName, 	"\x65B0\x6587\x4EF6.TXT");
	
	test.Printf(_L("Create a file with the DLL installed, and get the shortname"));
	r=TheFile.Create(TheFs,KTestNormalFileName,EFileRead|EFileWrite);
	testAndLog(r==KErrNone);
	TFileName sn;
	r = TheFs.GetShortName(KTestNormalFileName, sn);
	testAndLog(r==KErrNone);
	r = sn.Compare(KTestNormalFileShortName);
	testAndLog(r==0);
	TheFile.Close();
	
	test.Printf(_L("Access the file with the DLL installed"));
	r=TheFile.Open(TheFs,KTestNormalFileName,EFileWrite);
	testAndLog(r==KErrNone);
	
	TBuf<50> name;	
	r=TheFile.FullName(name);
	testAndLog(r==KErrNone);
	TheFile.Close();
	
	r=TheFile.Open(TheFs,KTestNormalFileShortName,EFileWrite);
	testAndLog(r==KErrNone);
	TheFile.Close();
	
	r = TheFs.ControlIo(CurrentDrive(), KControlIoDisableFatUtilityFunctions);
	testAndLog(r==KErrNone);
	
	test.Printf(_L("Access the file without the DLL installed"));
	
	r=TheFile.Open(TheFs,KTestNormalFileName,EFileWrite);
	testAndLog(r==KErrNone);

	r=TheFile.FullName(name);
	testAndLog(r==KErrNone);
	TheFile.Close();
	
	r=TheFile.Open(TheFs,KTestNormalFileShortName,EFileWrite);
	testAndLog(r==KErrNone);
	TheFile.Close();
	
	r=TheFs.Delete(KTestNormalFileName);
	failedOnBuf.Close();
	tcUniquePath.Close();
	__UHEAP_MARKEND;
	}
void TestIllegalCharsWithDll()
	{
	test.Next(_L("Test Illegal Character handling with DLL"));			
	__UHEAP_MARK;
	
	// logging for failure
	gTCType = ESymbianFATSpecific;
	RBuf failedOnBuf;
	failedOnBuf.CreateL(gLogFailureData.iFuncName);
	gTCId = 0;
	RBuf tcUniquePath;
	tcUniquePath.CreateL(KNone());

	QuickFormat();
	CreateTestDirectory(_L("\\F32-TST\\T_FATCHARSETCONV\\"));
	
	TInt r = TheFs.ControlIo(CurrentDrive(), KControlIoEnableFatUtilityFunctions);
	testAndLog(r==KErrNone);

	r = UserSvr::ChangeLocale(KTestLocale);
	testAndLog(r==KErrNone);

	_LIT(KTestNormalUnicodeFileName, 				"\x65B0\x6587\x4EF6.TXT");
	_LIT(KTestNormalUnicodeFileNameShortDefualt, 	"\x65B0\x6587\x4EF6.TXT");
	_LIT(KTestFileNameWithIllegalChars, 			"\x222F\x2F3A\x3C3E\x7C00.TXT");
	_LIT(KFileNameWithIllegalCharsShort, 			"___\x7C00.TXT");
	_LIT(KTestFileNameWithWildChars, 				"\x235B\x245C\x255D\x265E.TXT");
	_LIT(KTestFileNameWithWildCharsShort, 			"____.TXT");

	TFileName shn;

	MakeFile(KTestNormalUnicodeFileName);
	r = TheFs.GetShortName(KTestNormalUnicodeFileName, shn);
	testAndLog(r==KErrNone);
	r = shn.Compare(KTestNormalUnicodeFileNameShortDefualt);
	testAndLog(r==0);

	TFileName lgn;
	r = TheFs.GetLongName(KTestNormalUnicodeFileNameShortDefualt, lgn);
	testAndLog(r==KErrNone);
	r = lgn.Compare(KTestNormalUnicodeFileName);
	testAndLog(r==0);

	// Test illegal 8-bit ASCII chars in 16-bit Unicode chars.
	MakeFile(KTestFileNameWithIllegalChars);
	r = TheFs.GetShortName(KTestFileNameWithIllegalChars, shn);
	testAndLog(r==KErrNone);
	r = shn.Compare(KFileNameWithIllegalCharsShort);
	testAndLog(r==0);
	
	// Test wildcards, 8-bit ASCII chars in 16-bit Unicode chars.
	MakeFile(KTestFileNameWithWildChars);
	r = TheFs.GetShortName(KTestFileNameWithWildChars, shn);
	test_KErrNone(r);
	r = shn.Compare(KTestFileNameWithWildCharsShort);
	testAndLog(r==0);
	
	r=TheFs.Delete(KTestFileNameWithIllegalChars);
	testAndLog(r==0);
	r=TheFs.Delete(KTestNormalUnicodeFileName);
	testAndLog(r==0);
	r=TheFs.Delete(KTestFileNameWithWildChars);
	testAndLog(r==0);
	
	r = TheFs.ControlIo(CurrentDrive(), KControlIoDisableFatUtilityFunctions);
	testAndLog(r==KErrNone);
	failedOnBuf.Close();
	tcUniquePath.Close();
	__UHEAP_MARKEND;
	}
// ---------------------------------------------------------------------------
// CMMCScBkupReadDataTransferRequestBase::RunError()
// 
// 
// ---------------------------------------------------------------------------
TInt CMMCScBkupReadDataTransferRequestBase::RunError( TInt aError )
    {
#if defined(__MMCSCBKUPLOGGING_ENABLED__)
    const TSecureId sid = DataOwner().SecureId();
    __LOGFILE3("CMMCScBkupReadDataTransferRequestBase::RunError() - **** - aError: %d, sid: 0x%08x, drive: %c", aError, sid.iId, 'A' + CurrentDrive() );
#endif

    TInt ret = KErrNone;

    if  ( aError == KErrNotFound )
        {
        // KErrNotFound is treated as non-fatal.
        const TBool entryAvailable = PrepareForNextEntry();

        // Try the next entry (if any)
        TState nextState = EProcessData;
        if  ( entryAvailable )
            {
            __LOGFILE("CMMCScBkupReadDataTransferRequestBase::RunError() - **** - another drive available for same DO - trying the next drive...");
            nextState = EProcessData;
            }
        else
            {
            // Done
            __LOGFILE("CMMCScBkupReadDataTransferRequestBase::RunError() - **** - no drives let for same DO...");
            nextState = EFinished;
            }

        SetState( nextState );
        CompleteSelf();
        }
    else
        {
        // Everything else is fatal
        __LOGFILE1( "CMMCScBkupReadDataTransferRequestBase::RunError() - **** - FATAL ERROR (%d)", aError );
        ret = CMMCScBkupTransferRequestBase::RunError( aError );
        }
    //
    return ret;
    }
void CMMCScBkupReadDataTransferRequestBase::DumpTransferDataL( RFs& aFsSession, const TDesC8& aData ) const
    {
    TPtrC subDirectory( KNullDesC );
    //
    switch( ElementType() )
        {
    case EMMCScBkupOwnerDataTypeJavaData:
        subDirectory.Set(KMMCScBkupDataTransferDebuggingPathDataJava);
        break;
    case EMMCScBkupOwnerDataTypeSystemData:
        subDirectory.Set(KMMCScBkupDataTransferDebuggingPathDataSystem);
        break;
    case EMMCScBkupOwnerDataTypePassiveData:
        subDirectory.Set(KMMCScBkupDataTransferDebuggingPathDataPassive);
        break;
    case EMMCScBkupOwnerDataTypeActiveData:
        subDirectory.Set(KMMCScBkupDataTransferDebuggingPathDataActive);
        break;
    default:
        User::Leave( KErrNotSupported );
        break;
        }
    //
    const TSecureId secureId = DataOwner().SecureId();
    _LIT(KMMCScBkupFormatDes, "%S%S");
    TFileName transferDumpFileName;
    const TDesC& path = PathInfo::MemoryCardRootPath();
    transferDumpFileName.Format(KMMCScBkupFormatDes, &path, &KMMCScBkupDataTransferDebuggingPathRoot);
    
    transferDumpFileName.Append( subDirectory );
    transferDumpFileName.Append( KMMCScBkupDataTransferDebuggingPathDataRestore );
    transferDumpFileName.AppendFormat( KMMCScBkupDataTransferDebuggingFileName, secureId.iId, 'a' + CurrentDrive() );
    //
    RFile64 file;
    TInt error = KErrNone;
    TEntry entry;
    if  ( aFsSession.Entry( transferDumpFileName, entry ) == KErrNone )
        {
        // Already exists - append data
        error = file.Open( aFsSession, transferDumpFileName, EFileWrite | EFileStream | EFileShareExclusive );
        }
    else
        {
        entry.iSize = 0;
        error = file.Create( aFsSession, transferDumpFileName, EFileWrite | EFileStream | EFileShareExclusive );
        }
    //
    User::LeaveIfError( error );
    CleanupClosePushL( file );
    error = file.Write( entry.iSize, aData );
    CleanupStack::PopAndDestroy( &file );
    }