First public contribution.
1 // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
19 #include <e32std_private.h>
22 #include <e32def_private.h>
25 GLDEF_D RTest test(_L("t_dctcballfiles"));
26 GLDEF_D TTime gTimeNow;
27 LOCAL_D TInt gTheDriveNum;
29 const TInt KPathPosition = 2;
30 _LIT(KExpectedPrivatePath, "\\Private\\00000001\\");
32 _LIT(KResourcePath, "?:\\Resource\\");
33 _LIT(KSystemPath, "?:\\Sys\\");
34 _LIT(KPrivatePath, "?:\\Private\\");
35 _LIT(KPrivateFalseID, "?:\\Private\\FFFFFFFF\\");
36 _LIT(KDriveName, "Billy");
37 _LIT(KVolLable, "Benny");
38 _LIT(KFileSys, "systemfile.txt");
39 _LIT(KFileSys3, "sysfile.rna");
40 _LIT(KFilePri, "privatefile.txt");
41 _LIT(KFilePri2, "privatefile.tmp");
42 _LIT(KFilePri3, "prifile.rna");
43 _LIT(KFileRes, "resourcefile.txt");
44 _LIT(KFileRes3, "resfile.rna");
45 _LIT(KMkDirSub,"Subdir\\");
46 _LIT(KOldFile,"?:\\Anyold.txt");
47 _LIT(KWildPath, "Z:\\SYS\\");
51 TBuf<4> driveBuf=_L("?:\\");
64 TBuf<40> theprivatepath;
65 TBuf<40> pritestfalseidname;
71 TBuf<40> shortfilename;
72 TBuf<40> longfilename;
74 TRequestStatus aStat1;
75 TRequestStatus aStat2;
76 TRequestStatus aStat3;
77 TRequestStatus aStat4;
80 // TDriveInfo adriveInfo;
85 TBuf<40> systestfile1;
86 TBuf<40> pritestfile1;
87 TBuf<40> restestfile1;
97 LOCAL_C void systemRFsTest()
99 // RFs test on system Directory
102 systestname=KSystemPath;
103 systestname[0]=(TText)('A' + gTheDriveNum);
106 mkdirname.Append(systestname);
107 mkdirname.Append(KMkDirSub);
108 r=TheFs.MkDirAll(mkdirname);
111 TheFs.RmDir(mkdirname);
114 r=TheFs.SetSubst(systestname,EDriveO);
115 test(r==KErrPermissionDenied);
117 r=TheFs.RealName(_L("O:\\File.XXX"),realName);
120 r=TheFs.SetSessionPath(systestname);
123 TheFs.NotifyChange(ENotifyAll,aStat1,systestname);
124 test(aStat1==KRequestPending);
126 systestfile=KSystemPath;
127 systestfile[0]=(TText)('A' + gTheDriveNum);
128 systestfile1=systestfile;
129 systestfile.Append(KFileSys);
130 systestfile1.Append(KFileSys3);
133 oldName[0]=(TText)gDriveToTest;
135 r=TheFs.GetShortName(systestfile, shortfilename);
136 test(r==KErrNotFound || r==KErrNotSupported);
138 r=TheFs.GetLongName(systestfile1, longfilename);
139 test(r==KErrNotFound || r==KErrNotSupported);
141 r=file1.Create(TheFs,oldName,EFileWrite);
142 test(r==KErrNone || r==KErrAlreadyExists);
145 r=TheFs.Replace(oldName,systestfile);
148 r=TheFs.Rename(systestfile,systestfile1);
151 r=TheFs.Entry(systestfile1,entry);
154 r=TheFs.SetEntry(systestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
157 r=TheFs.Delete(systestfile1);
161 LOCAL_C void ResourceRFsTest()
166 restestname=KResourcePath;
167 restestname[0]=(TText)('A' + gTheDriveNum);
170 mkdirname.Append(restestname);
171 mkdirname.Append(KMkDirSub);
172 r=TheFs.MkDirAll(mkdirname);
175 TheFs.RmDir(mkdirname);
178 r=TheFs.SetSubst(restestname,EDriveO);
179 test(r==KErrPermissionDenied);
181 r=TheFs.RealName(_L("O:\\File.XXX"),realName);
184 r=TheFs.SetSessionPath(restestname);
187 TheFs.NotifyChange(ENotifyAll,aStat4,restestname);
188 test(aStat4==KRequestPending);
190 restestfile=KResourcePath;
191 restestfile[0]=(TText)('A' + gTheDriveNum);
192 restestfile1=restestfile;
193 restestfile.Append(KFileRes);
194 restestfile1.Append(KFileRes3);
197 oldName[0]=(TText)gDriveToTest;
199 r=TheFs.GetShortName(restestfile, shortfilename);
200 test(r==KErrNone || KErrNotFound || r==KErrNotSupported);
202 r=TheFs.GetLongName(restestfile1, longfilename);
203 test(r==KErrNone || KErrNotFound || r==KErrNotSupported);
205 r=file1.Create(TheFs,oldName,EFileWrite);
206 test(r==KErrNone || r==KErrAlreadyExists);
209 r=TheFs.Replace(oldName,restestfile);
212 r=TheFs.Rename(restestfile,restestfile1);
215 r=TheFs.Entry(restestfile1,entry);
218 r=TheFs.SetEntry(restestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
221 r=TheFs.Delete(restestfile1);
227 LOCAL_C void privatefalseIDRFsTest()
232 pritestfalseidname=KPrivateFalseID;
233 pritestfalseidname[0]=(TText)('A' + gTheDriveNum);
236 mkdirname.Append(pritestfalseidname);
237 mkdirname.Append(KMkDirSub);
239 r=TheFs.MkDirAll(mkdirname);
242 r=TheFs.RmDir(mkdirname);
245 r=TheFs.SetSubst(pritestfalseidname,EDriveO);
246 test(r==KErrPermissionDenied);
248 r=TheFs.RealName(_L("O:\\File.XXX"),realName);
251 r=TheFs.SetSessionPath(pritestfalseidname);
254 TheFs.NotifyChange(ENotifyAll,aStat2,pritestfalseidname);
255 test(aStat2==KRequestPending);
258 pritestfile=KPrivateFalseID;
259 pritestfile[0]=(TText)('A' + gTheDriveNum);
260 pritestfile1=pritestfile;
261 pritestfile.Append(KFilePri2);
262 pritestfile1.Append(KFilePri3);
265 oldName[0]=(TText)gDriveToTest;
267 r=TheFs.GetShortName(pritestfile, shortfilename);
268 test(r==KErrNone || r==KErrNotFound || r==KErrNotSupported);
270 r=TheFs.GetLongName(pritestfile1, longfilename);
271 test(r==KErrNone || r==KErrNotFound || r==KErrNotSupported);
273 r=file1.Create(TheFs,oldName,EFileWrite);
274 test(r==KErrNone || r==KErrAlreadyExists);
277 r=TheFs.Replace(oldName,pritestfile);
280 r=TheFs.Rename(pritestfile,pritestfile1);
283 r=TheFs.Entry(pritestfile1,entry);
286 r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
289 r=TheFs.Delete(pritestfile1);
295 LOCAL_C void privateRFsTest()
301 pritestname=KPrivatePath;
302 pritestname[0]=(TText)('A' + gTheDriveNum);
305 mkdirname.Append(pritestname);
306 mkdirname.Append(KMkDirSub);
308 r=TheFs.MkDirAll(mkdirname);
311 r=TheFs.RmDir(mkdirname);
314 r=TheFs.SetSubst(pritestname,EDriveO);
315 test(r==KErrPermissionDenied);
317 r=TheFs.RealName(_L("O:\\File.XXX"),realName);
320 r=TheFs.SetSessionPath(pritestname);
323 TheFs.NotifyChange(ENotifyAll,aStat2,pritestname);
324 test(aStat2==KRequestPending);
327 pritestfile=KPrivatePath;
328 pritestfile[0]=(TText)('A' + gTheDriveNum);
329 pritestfile1=pritestfile;
330 pritestfile.Append(KFilePri2);
331 pritestfile1.Append(KFilePri3);
334 oldName[0]=(TText)gDriveToTest;
336 r=TheFs.GetShortName(pritestfile, shortfilename);
337 test(r==KErrNone || r==KErrNotFound || r==KErrNotSupported);
339 r=TheFs.GetLongName(pritestfile1, longfilename);
340 test(r==KErrNone || r==KErrNotFound || r==KErrNotSupported);
342 r=file1.Create(TheFs,oldName,EFileWrite);
343 test(r==KErrNone || r==KErrAlreadyExists);
346 r=TheFs.Replace(oldName,pritestfile);
349 r=TheFs.Rename(pritestfile,pritestfile1);
352 r=TheFs.Entry(pritestfile1,entry);
355 r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
358 r=TheFs.Delete(pritestfile1);
364 LOCAL_C void privateSIDRFstest()
366 theprivatepath[0]=(TText)gDriveToTest;
367 test.Printf(_L("the Private Path = %S"),&theprivatepath);
370 mkdirname.Append(theprivatepath);
371 mkdirname.Append(KMkDirSub);
372 r=TheFs.MkDirAll(mkdirname);
375 r=TheFs.RmDir(mkdirname);
378 r=TheFs.SetSubst(theprivatepath,EDriveO);
379 test(r==KErrPermissionDenied);
381 r=TheFs.RealName(_L("O:\\File.XXX"),realName);
384 r=TheFs.SetSessionPath(theprivatepath);
387 TheFs.NotifyChange(ENotifyAll,aStat3,theprivatepath);
388 test(aStat3==KRequestPending);
390 pritestfile=theprivatepath;
391 pritestfile[0]=(TText)('A' + gTheDriveNum);
392 pritestfile1=pritestfile;
393 pritestfile.Append(KFilePri2);
394 pritestfile1.Append(KFilePri3);
397 oldName[0]=(TText)gDriveToTest;
399 r=TheFs.GetShortName(pritestfile, shortfilename);
400 test(r==KErrNone || r==KErrNotFound || r==KErrNotSupported);
402 r=TheFs.GetLongName(pritestfile1, longfilename);
403 test(r==KErrNone || r==KErrNotFound || r==KErrNotSupported);
405 r=file1.Create(TheFs,oldName,EFileWrite);
406 test(r==KErrNone || r==KErrAlreadyExists);
409 r=TheFs.Replace(oldName,pritestfile);
412 r=TheFs.Rename(pritestfile,pritestfile1);
413 test(r==KErrNone || r==KErrAlreadyExists);
415 r=TheFs.Entry(pritestfile1,entry);
418 r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
421 r=TheFs.Delete(pritestfile1);
426 LOCAL_C void systemRFiletest()
428 //RFile testing with session path set to //system//
432 r=TheFs.SetSessionPath(systestname);
435 r=file1.Temp(TheFs,systestname,fromTemp,EFileWrite);
439 r=file1.Create(TheFs,KFileSys,EFileWrite);
443 r=file1.Open(TheFs,KFileSys,EFileWrite);
447 r=file1.Open(TheFs,KFileSys,EFileRead);
451 r=file1.Replace(TheFs,KFileSys,EFileWrite);
454 r=file1.Rename(KFileSys3);
458 TFindFile finder(TheFs);
460 r=finder.FindWildByDir(KWildFile, KWildPath, dir);
462 test.Printf(_L("T_DCTCBALLFILES: test find wildcards r = %d (expected KErrNone)\n"), r);
467 LOCAL_C void resourceRFiletest()
469 //RFile testing with session path set to //resource//
472 r=TheFs.SetSessionPath(restestname);
475 r=file1.Temp(TheFs,restestname,fromTemp,EFileWrite);
479 r=file1.Create(TheFs,KFileRes,EFileWrite);
483 r=file1.Open(TheFs,KFileRes,EFileWrite|EFileShareExclusive );
486 r=file1.Rename(KFileRes3);
490 r=file1.Open(TheFs,KFileRes3,EFileShareReadersOrWriters|EFileRead);
494 r=file1.Open(TheFs,KFileRes3,EFileShareReadersOrWriters|EFileWrite);
498 r=file1.Open(TheFs,KFileRes3,EFileShareReadersOnly);
501 r=file1.ChangeMode(EFileShareExclusive);
505 r=file1.Replace(TheFs,KFileRes,EFileWrite);
511 LOCAL_C void privateRFiletest()
513 //RFile testing with session path set to //Private//
516 r=TheFs.SetSessionPath(pritestfalseidname);
519 r=file1.Temp(TheFs,pritestfalseidname,fromTemp,EFileWrite);
523 r=file1.Create(TheFs,KFilePri,EFileWrite);
527 r=file1.Open(TheFs,KFilePri,EFileWrite);
531 r=file1.Open(TheFs,KFilePri,EFileRead);
535 r=file1.Replace(TheFs,KFilePri,EFileWrite);
538 r=file1.Rename(KFilePri3);
544 LOCAL_C void privatefalseIDRFiletest()
546 //RFile testing with session path set to //Private//
549 r=TheFs.SetSessionPath(pritestname);
552 r=file1.Temp(TheFs,pritestname,fromTemp,EFileWrite);
556 r=file1.Create(TheFs,KFilePri,EFileWrite);
560 r=file1.Open(TheFs,KFilePri,EFileWrite);
564 r=file1.Open(TheFs,KFilePri,EFileRead);
568 r=file1.Replace(TheFs,KFilePri,EFileWrite);
571 r=file1.Rename(KFilePri3);
577 LOCAL_C void privateSIDRFiletest()
579 //Rfile Testing with session path set to //Private//UID//
582 r=TheFs.SetSessionToPrivate(gTheDriveNum);
585 r=file1.Temp(TheFs,theprivatepath,fromTemp,EFileWrite);
589 r=file1.Create(TheFs,KFilePri,EFileWrite);
593 r=file1.Open(TheFs,KFilePri,EFileWrite);
597 r=file1.Open(TheFs,KFilePri,EFileRead);
601 r=file1.Replace(TheFs,KFilePri,EFileWrite);
604 r=file1.Rename(KFilePri3);
609 LOCAL_C void RDirtest()
617 TBuf<30> dirNameBuf(KSystemPath);
618 dirNameBuf[0]=(TText)gDriveToTest;
619 r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
622 r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
628 dirNameBuf=KPrivatePath;
629 dirNameBuf[0]=(TText)gDriveToTest;
630 r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
633 r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
639 dirNameBuf=KPrivateFalseID;
640 dirNameBuf[0]=(TText)gDriveToTest;
641 r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
644 r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
650 TheFs.PrivatePath(dirNameBuf);
651 dirNameBuf.Insert(0,_L("?:"));
652 dirNameBuf[0]=(TText)gDriveToTest;
653 r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
656 r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
661 dirNameBuf=KResourcePath;
662 dirNameBuf[0]=(TText)gDriveToTest;
663 r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
665 r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
672 LOCAL_C void TestTcbAllfiles()
674 // Test with tcb capabilities
677 r=TheFs.FileSystemName(fsname,gTheDriveNum);
679 r = DismountFileSystem(TheFs, fsname, gTheDriveNum);
680 test(r==KErrPermissionDenied);
681 // r=TheFs.RemoveFileSystem(fsname); //can not test due to bug else where fix exists
682 // test(r==KErrNone);
683 // r=TheFs.AddFileSystem(fsname);
684 // test(r==KErrNone);
685 r = MountFileSystem(TheFs, fsname, gTheDriveNum);
686 test(r==KErrPermissionDenied);
687 test.Printf(_L("r=%d"),r);
688 r=TheFs.SetDriveName(gTheDriveNum,KDriveName);
689 test(r==KErrPermissionDenied);
691 r=TheFs.SetVolumeLabel(KVolLable, gTheDriveNum);
692 test(r==KErrPermissionDenied);
699 privatefalseIDRFsTest();
704 privateSIDRFiletest();
705 privatefalseIDRFiletest();
707 //check notifier return values set in rfs testing
708 User::WaitForRequest(aStat1);
709 User::WaitForRequest(aStat2);
710 User::WaitForRequest(aStat3);
711 User::WaitForRequest(aStat4);
712 test(aStat1==KErrNone);
713 test(aStat2==KErrNone);
714 test(aStat3==KErrNone);
715 test(aStat4==KErrNone);
717 r=TheFs.SetSessionPath(systestname);
720 //Test RRawDisk class
721 r=rawdisk.Open(TheFs,gTheDriveNum);
728 if (User::UpperCase(driveBuf[0]) != 'C')
732 r=format.Open(TheFs,driveBuf,EHighDensity,count);
733 test(r==KErrPermissionDenied);
737 TInt r=format.Next(count);
743 driveBuf[0]=(TText)gDriveToTest;
744 r=TheFs.ScanDrive(driveBuf);
745 RDebug::Print(_L("r=%d"),r);
746 test(r==KErrPermissionDenied);
747 r=TheFs.CheckDisk(driveBuf);
748 test(r==KErrPermissionDenied);
751 LOCAL_C void TestCaps()
753 // test format etc that require certain capabilities
756 #ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
757 const char myDiagMsg[] = "Capability Check Failure";
758 #endif //!__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
759 r=RProcess().HasCapability(ECapabilityTCB, __PLATSEC_DIAGNOSTIC_STRING(myDiagMsg));
761 r=RProcess().HasCapability(ECapabilityAllFiles, __PLATSEC_DIAGNOSTIC_STRING(myDiagMsg));
764 driveBuf[0]=(TText)gDriveToTest;
765 r=TheFs.SessionPath(temp);
768 test.Printf(_L("Session path: %S"),&temp);
770 r=TheFs.CreatePrivatePath(gTheDriveNum);
771 test(r==KErrNone || r== KErrAlreadyExists);
774 r=TheFs.PrivatePath(tempPri);
776 theprivatepath = _L("?:");
777 theprivatepath.Append(tempPri);
781 TFileName thesessionpath;
782 r=TheFs.SetSessionToPrivate(gTheDriveNum);
784 r=TheFs.SessionPath(thesessionpath);
787 test(thesessionpath == theprivatepath);
793 LOCAL_C void ScanDir(const TDesC& aName, CDirScan::TScanDirection aDirection, TInt aError)
795 CDirScan* scanner = NULL;
796 TRAP(r, scanner = CDirScan::NewL(TheFs));
797 test(r == KErrNone && scanner);
799 TRAP(r, scanner->SetScanDataL(aName,KEntryAttDir,ESortByName|EAscending,aDirection));
802 CDir *entryList=NULL;
805 TRAP(r, scanner->NextL(entryList));
810 TInt count=entryList->Count();
814 TEntry data=(*entryList)[count];
815 TBuf<KMaxFileName> path=scanner->AbbreviatedPath();
818 dirName.Append(data.iName);
819 test.Printf(_L(" %S\n"),&dirName);
830 The following test, tests CFileMan and CDirScan API on folders private and sys
831 to confirm that any operation on these folders for any app with incorrect capability
832 returns KErrPermissionDenied. This test step was added as a result of DEF051428
833 ("PlatSec: Incorrect errors returned by f32")
835 LOCAL_C void TestCaging()
837 CFileMan* fMan=CFileMan::NewL(TheFs);
842 // Checking the private path
843 TBuf<30> privatepath;
844 r=TheFs.PrivatePath(privatepath);
845 test.Printf(_L("Private Path is=%S"),&privatepath);
847 r = TheFs.MkDir(_L("\\Caged\\"));
848 test(r==KErrNone || r==KErrAlreadyExists);
850 CDir* entryCount=NULL;
851 r=TheFs.GetDir(_L("\\*.*"),KEntryAttNormal|KEntryAttDir,ESortNone,entryCount);
859 CDir* entryCount2=NULL;
860 r=fMan->Copy(_L("\\sys\\"),_L("\\Caged\\"));
862 r=fMan->Copy(_L("\\*"),_L("\\Caged\\"));
865 r=TheFs.GetDir(_L("\\Caged\\*.*"),KEntryAttNormal|KEntryAttDir,ESortNone,entryCount2);
871 r=fMan->Copy(_L("\\private\\two\\moo"),_L("\\private\\two\\mew"));
872 test(r == KErrPathNotFound);
874 // Create a test file
876 r = testFile.Replace(TheFs, _L("\\capTest"),EFileWrite);
877 test(r==KErrNone || r==KErrAlreadyExists);
882 name.Append(_L("privateFile.tst"));
884 r = privateFile.Replace(TheFs, name,EFileWrite);
885 test(r==KErrNone || r==KErrAlreadyExists);
889 r=fMan->Copy(_L("\\capTest"),_L("\\private\\two\\moo"));
890 test(r == KErrPathNotFound);
891 r=fMan->Copy(_L("\\capTest"),_L("\\sys\\bin\\moo"));
892 test(r == KErrPathNotFound);
893 r=fMan->Copy(_L("\\sys\\bin\\capTest"),_L("\\sys\\bin\\moo"));
894 test(r == KErrPathNotFound);
895 r=fMan->Copy(_L("\\capTest"),_L("\\sys\\capTest"));
896 test(r == KErrNone || r==KErrAlreadyExists);
897 r=fMan->Copy(_L("\\sys\\*"),_L("\\"));
899 r=fMan->Copy(name,_L("\\sys\\"));
903 r=fMan->Attribs(_L("\\private\\two\\moo"),KEntryAttReadOnly,0,TTime(0));
904 test(r == KErrPathNotFound);
905 r=fMan->Attribs(_L("\\private\\moo"),KEntryAttReadOnly,0,TTime(0));
906 test(r == KErrNotFound);
907 r=fMan->Attribs(name,KEntryAttReadOnly,0,TTime(0));
909 r=fMan->Attribs(name,0,KEntryAttReadOnly,TTime(0));
913 r=fMan->Move(_L("\\private\\two\\moo"),_L("\\private\\one\\moo"));
914 test(r == KErrPathNotFound);
915 r=fMan->Move(_L("\\private\\two\\moo.."),_L("\\private\\one\\moo"));
916 test(r == KErrPathNotFound);
917 r=fMan->Move(_L("\\private\\two\\moo"),_L("\\private\\one\\moo.."));
918 test(r == KErrPathNotFound);
919 r=fMan->Move(name,_L("\\privateFile.tst"));
921 r=fMan->Move(_L("\\privateFile.tst"),name);
926 r=fMan->RmDir(_L("\\private\\"));
928 // put it back where it was
929 r = TheFs.MkDirAll(_L("\\private\\00000001\\"));
931 r=fMan->RmDir(_L("\\private\\two\\"));
932 test(r == KErrPathNotFound);
933 r=fMan->RmDir(_L("\\private\\tw?\\"));
934 test(r == KErrBadName);
936 r=fMan->RmDir(_L("\\private\\two\\"));
937 test(r == KErrPathNotFound);
938 r=fMan->RmDir(_L("\\private\\tw?\\"));
939 test(r == KErrBadName);
943 r=fMan->Rename(_L("\\private\\two\\moo"),_L("\\private\\two\\mew"));
944 test(r == KErrPathNotFound);
947 r=fMan->Delete(_L("\\private\\two\\test"));
948 test(r == KErrPathNotFound);
949 r=fMan->Delete(_L("\\private\\moo"));
950 test(r == KErrNotFound);
952 //Something that actually exists in Private
953 r=fMan->Rename(name,_L("\\private\\00000001\\moo"));
954 test(r == KErrNotFound);
955 r=fMan->Rename(_L("\\private\\00000001\\moo"),name);
956 test(r == KErrNotFound);
957 r=fMan->Copy(name,_L("\\private\\00000001\\moo"));
958 test(r == KErrNotFound);
959 r=fMan->Delete(_L("\\private\\00000001\\moo"));
960 test(r == KErrNotFound);
962 // Clean up the test data
963 r=fMan->RmDir(_L("\\Caged\\"));
965 r=fMan->Delete(_L("\\capTest"));
971 ScanDir(_L("\\"), CDirScan::EScanUpTree, KErrNone);
972 ScanDir(_L("\\"), CDirScan::EScanDownTree, KErrNone);
973 ScanDir(_L("\\private\\"), CDirScan::EScanDownTree, KErrNone);
974 ScanDir(_L("\\private\\"), CDirScan::EScanUpTree, KErrNone);
975 ScanDir(_L("\\sys\\"), CDirScan::EScanDownTree, KErrNone);
976 ScanDir(_L("\\sys\\"), CDirScan::EScanUpTree, KErrNone);
979 LOCAL_C void CleanupL()
984 test.Next(_L("Delete test directory"));
985 CFileMan* fMan=CFileMan::NewL(TheFs);
986 TInt r=fMan->RmDir(gSessionPath);
987 test(r==KErrNone || KErrPathNotFound);
991 GLDEF_C void CallTestsL(/*TChar aDriveLetter*/)
996 if( !PlatSec::IsCapabilityEnforced(ECapabilityTCB) ||
997 !PlatSec::IsCapabilityEnforced(ECapabilityAllFiles))
999 test.Printf(_L("Insufficient capabilities enabled - leaving t_dctcballfiles"));
1000 test.Printf(_L("\n")); // Prevent overwrite by next print
1003 TurnAllocFailureOff();
1004 TheFs.CharToDrive(gDriveToTest,gTheDriveNum);
1007 sesspath=_L("?:\\");
1008 sesspath[0] = (TText)gDriveToTest;
1010 TInt r= TheFs.SetSessionPath(sesspath);
1013 //cleanup from previous run of this test
1015 CFileMan* fMan=CFileMan::NewL(TheFs);
1016 delDir=KResourcePath;
1017 delDir[0]=(TText)gDriveToTest;
1018 r=fMan->RmDir(delDir);
1019 test(r==KErrNone || KErrNotFound);
1021 delDir[0]=(TText)gDriveToTest;
1022 r=fMan->RmDir(delDir);
1023 test(r==KErrNone || KErrNotFound);
1024 delDir=KPrivatePath;
1025 delDir[0]=(TText)gDriveToTest;
1026 r=fMan->RmDir(delDir);
1027 test(r==KErrNone || KErrNotFound);
1030 //check double mode ie that Defpath still works
1036 r=fs1.SessionPath(sesspath);
1038 test.Printf(_L("session1 Path=%S"),&sesspath);
1040 TBuf<30> privatepath;
1041 r=fs1.SetSessionToPrivate(gTheDriveNum);
1043 r=fs1.PrivatePath(privatepath);
1045 r=privatepath.Compare(KExpectedPrivatePath());
1047 r=fs1.SessionPath(sesspath);
1049 r=privatepath.Compare(sesspath.Mid(KPathPosition));
1051 r=fs1.CreatePrivatePath(gTheDriveNum);
1057 r=fs2.SessionPath(sesspath);
1059 test.Printf(_L("session2 Path=%S"),&sesspath);
1065 test.Printf(_L("No of files open=%d"), TheFs.ResourceCount());