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.
14 // f32test\server\t_dcdiskadmin.cpp
21 #include <e32std_private.h>
25 GLDEF_D RTest test(_L("T_DCDiskadmin"));
26 GLDEF_D TTime gTimeNow;
27 LOCAL_D TInt gTheDriveNum;
29 const TInt KPathPosition = 2;
30 _LIT(KExpectedPrivatePath, "\\Private\\00000001\\");
31 _LIT(KResourcePath, "?:\\Resource\\");
32 _LIT(KSystemPath, "?:\\Sys\\");
33 _LIT(KPrivatePath, "?:\\Private\\");
34 _LIT(KPrivateFalseID, "?:\\Private\\FFFFFFFF\\");
35 _LIT(KDriveName, "Billy");
36 _LIT(KVolLable, "Benny");
37 _LIT(KFileSys, "systemfile.txt");
38 _LIT(KFileSys3, "sysfile.rna");
39 _LIT(KFilePri, "privatefile.txt");
40 _LIT(KFilePri2, "privatefile.tmp");
41 _LIT(KFilePri3, "prifile.rna");
42 _LIT(KFileRes, "resourcefile.txt");
43 _LIT(KFileRes3, "resfile.rna");
44 _LIT(KMkDirSub,"Subdir\\");
45 _LIT(KOldFile,"?:\\Anyold.txt");
46 _LIT(KWildPath, "Z:\\SYS\\");
51 TBuf<4> driveBuf=_L("?:\\");
64 TBuf<40> theprivatepath;
65 TBuf<40> pritestfalseidname;
69 TBuf<40> shortfilename;
70 TBuf<40> longfilename;
73 TRequestStatus aStat1;
74 TRequestStatus aStat2;
75 TRequestStatus aStat3;
76 TRequestStatus aStat4;
79 // TDriveInfo adriveInfo;
84 TBuf<40> systestfile1;
85 TBuf<40> pritestfile1;
86 TBuf<40> restestfile1;
97 LOCAL_C void systemRFstest()
104 systestname=KSystemPath;
105 systestname[0]=(TText)('A' + gTheDriveNum);
108 mkdirname.Append(systestname);
109 mkdirname.Append(KMkDirSub);
110 r=TheFs.MkDirAll(mkdirname);
111 test(r==KErrPermissionDenied);
113 r=TheFs.RmDir(mkdirname);
114 test(r==KErrPermissionDenied);
116 r=TheFs.SetSubst(systestname,EDriveS);
117 test(r==KErrPermissionDenied);
119 r=TheFs.SetSessionPath(systestname);
120 test(r==KErrPermissionDenied);
122 TheFs.NotifyChange(ENotifyAll,aStat1,systestname);
123 test(aStat1==KErrPermissionDenied);
125 systestfile=KSystemPath;
126 systestfile[0]=(TText)('A' + gTheDriveNum);
127 systestfile1=systestfile;
128 systestfile.Append(KFileSys);
129 systestfile1.Append(KFileSys3);
132 oldName[0]=(TText)gDriveToTest;
134 r=TheFs.GetShortName(systestfile, shortfilename);
135 test(r==KErrPermissionDenied);
137 r=TheFs.GetLongName(systestfile1, longfilename);
138 test(r==KErrPermissionDenied);
140 r=file1.Create(TheFs,oldName,EFileWrite);
141 test(r==KErrNone || r==KErrAlreadyExists);
144 r=TheFs.Replace(oldName,systestfile);
145 test(r==KErrPermissionDenied);
147 r=TheFs.Rename(systestfile,systestfile1);
148 test(r==KErrPermissionDenied);
150 r=TheFs.Entry(systestfile1,entry);
151 test(r==KErrPermissionDenied);
153 r=TheFs.SetEntry(systestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
154 test(r==KErrPermissionDenied);
156 r=TheFs.Delete(systestfile1);
157 test(r==KErrPermissionDenied);
160 // DEF141257: Security Issue in File Server
161 // Test that we can't access the system drive by preceding it with a dot character
162 _LIT(KSystemPathDot, "?:\\.Sys\\");
164 // try creating a file in "\.SYS"...
165 TBuf<40> SysTestFileDot;
166 SysTestFileDot=KSystemPathDot;
167 SysTestFileDot[0]=(TText)('A' + gTheDriveNum);
168 SysTestFileDot.Append(KFileSys);
170 r = file.Replace(TheFs, SysTestFileDot, EFileWrite);
171 test(r==KErrPathNotFound);
173 // try creating a subst drive for "\.SYS"...
174 TBuf<40> SysTestNameDot;
175 SysTestNameDot=KSystemPathDot;
176 SysTestNameDot[0]=(TText)('A' + gTheDriveNum);
177 r=TheFs.SetSubst(SysTestNameDot,EDriveA);
180 // try creating a file using substituted drive...
181 TBuf<40> SubstTestFile = _L("A:\\");
182 SubstTestFile.Append(KFileSys);
184 r = file.Replace(TheFs, SubstTestFile, EFileWrite);
185 test(r==KErrPathNotFound);
187 r = TheFs.SetSubst(_L(""),EDriveA);
192 // try listing files in "\.SYS"
193 _LIT(KWildPathDot, "Z:\\.SYS\\");
194 TFindFile finder(TheFs);
196 r=finder.FindWildByDir(KWildFile, KWildPathDot, dir);
197 test(r==KErrNotFound);
200 // Deliberately create a directory called "\.SYS"
201 // and verify shortname is NOT the same as "SYS"
203 mkdirname.Append(KSystemPathDot);
204 mkdirname[0]=(TText)('A' + gTheDriveNum);
205 r=TheFs.MkDirAll(mkdirname);
208 r=TheFs.GetShortName(mkdirname, shortfilename);
209 test(r==KErrNone || r==KErrNotSupported); // short names not supported on LFFS
210 // r = shortfilename.Compare(_L("SYS~1"));
211 // test(r==KErrNone);
212 r = shortfilename.Compare(_L("SYS"));
215 r = TheFs.RmDir(mkdirname);
218 // Deliberately create a directory called "\..SYS"
219 // and verify shortname is NOT the same as "SYS"
220 _LIT(KSystemPathDotDot, "?:\\..Sys\\");
222 mkdirname.Append(KSystemPathDotDot);
223 mkdirname[0]=(TText)('A' + gTheDriveNum);
224 r=TheFs.MkDirAll(mkdirname);
227 r=TheFs.GetShortName(mkdirname, shortfilename);
228 test(r==KErrNone || r==KErrNotSupported); // short names not supported on LFFS
229 // r = shortfilename.Compare(_L("_.SYS"));
230 // test(r==KErrNone);
231 r = shortfilename.Compare(_L("SYS"));
234 r = TheFs.RmDir(mkdirname);
239 LOCAL_C void resourceRFstest()
245 restestname=KResourcePath;
246 restestname[0]=(TText)('A' + gTheDriveNum);
249 mkdirname.Append(restestname);
250 mkdirname.Append(KMkDirSub);
251 r=TheFs.MkDirAll(mkdirname);
252 test(r==KErrPermissionDenied);
254 TheFs.RmDir(mkdirname);
255 test(r==KErrPermissionDenied);
257 // Change due to defect DEF099546 fix
258 // TCB capability is required for following operation.
259 r=TheFs.SetSubst(restestname,EDriveS);
261 test(r==KErrPermissionDenied);
263 // SetSubst will fail.
264 //r=TheFs.RealName(_L("S:\\File.XXX"),realName);
267 //r=TheFs.SetSubst(_L(""),EDriveS);
270 r=TheFs.SetSessionPath(restestname);
273 TheFs.NotifyChange(ENotifyAll,aStat4,restestname);
274 test(aStat4==KRequestPending);
277 restestfile=KResourcePath;
278 restestfile[0]=(TText)('A' + gTheDriveNum);
279 restestfile1=restestfile;
280 restestfile.Append(KFileRes);
281 restestfile1.Append(KFileRes3);
284 oldName[0]=(TText)gDriveToTest;
286 r=TheFs.GetShortName(restestfile, shortfilename);
287 test(r==KErrNone || KErrPathNotFound);
289 r=TheFs.GetLongName(restestfile1, longfilename);
290 test(r==KErrNone || KErrPathNotFound);
292 r=file1.Create(TheFs,oldName,EFileWrite);
293 test(r==KErrNone || r==KErrAlreadyExists);
296 r=TheFs.Replace(oldName,restestfile);
297 test(r==KErrPermissionDenied);
299 r=TheFs.Rename(restestfile,restestfile1);
300 test(r==KErrPermissionDenied);
302 r=TheFs.Entry(restestfile1,entry);
303 test(r==KErrNone || KErrPathNotFound);
305 r=TheFs.SetEntry(restestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
306 test(r==KErrPermissionDenied);
308 r=TheFs.Delete(restestfile1);
309 test(r==KErrPermissionDenied);
313 LOCAL_C void privateFalseIDRFstest()
318 pritestfalseidname=KPrivateFalseID;
319 pritestfalseidname[0]=(TText)('A' + gTheDriveNum);
322 mkdirname.Append(pritestfalseidname);
323 mkdirname.Append(KMkDirSub);
325 r=TheFs.MkDirAll(mkdirname);
326 test(r==KErrPermissionDenied);
328 r=TheFs.RmDir(mkdirname);
329 test(r==KErrPermissionDenied);
331 r=TheFs.SetSubst(pritestfalseidname,EDriveS);
332 test(r==KErrPermissionDenied);
334 r=TheFs.SetSessionPath(pritestfalseidname);
335 test(r==KErrPermissionDenied);
337 TheFs.NotifyChange(ENotifyAll,aStat2,pritestfalseidname);
338 test(aStat2==KErrPermissionDenied);
340 pritestfile=KPrivateFalseID;
341 pritestfile[0]=(TText)('A' + gTheDriveNum);
342 pritestfile1=pritestfile;
343 pritestfile.Append(KFilePri2);
344 pritestfile1.Append(KFilePri3);
347 oldName[0]=(TText)gDriveToTest;
349 r=TheFs.GetShortName(pritestfile, shortfilename);
350 test(r==KErrPermissionDenied);
352 r=TheFs.GetLongName(pritestfile1, longfilename);
353 test(r==KErrPermissionDenied);
355 r=file1.Create(TheFs,oldName,EFileWrite);
356 test(r==KErrNone || r==KErrAlreadyExists);
359 r=TheFs.Replace(oldName,pritestfile);
360 test(r==KErrPermissionDenied);
362 r=TheFs.Rename(pritestfile,pritestfile1);
363 test(r==KErrPermissionDenied);
365 r=TheFs.Entry(pritestfile1,entry);
366 test(r==KErrPermissionDenied);
368 r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
369 test(r==KErrPermissionDenied);
371 r=TheFs.Delete(pritestfile1);
372 test(r==KErrPermissionDenied);
378 LOCAL_C void privateRFstest()
384 pritestname=KPrivatePath;
385 pritestname[0]=(TText)('A' + gTheDriveNum);
388 mkdirname.Append(pritestname);
389 mkdirname.Append(KMkDirSub);
391 r=TheFs.MkDirAll(mkdirname);
392 test(r==KErrPermissionDenied);
394 r=TheFs.RmDir(mkdirname);
395 test(r==KErrPermissionDenied);
397 r=TheFs.SetSubst(pritestname,EDriveS);
398 test(r==KErrPermissionDenied);
400 r=TheFs.SetSessionPath(pritestname);
401 test(r==KErrPermissionDenied);
403 TheFs.NotifyChange(ENotifyAll,aStat2,pritestname);
404 test(aStat2==KErrPermissionDenied);
406 pritestfile=KPrivatePath;
407 pritestfile[0]=(TText)('A' + gTheDriveNum);
408 pritestfile1=pritestfile;
409 pritestfile.Append(KFilePri2);
410 pritestfile1.Append(KFilePri3);
413 oldName[0]=(TText)gDriveToTest;
415 r=TheFs.GetShortName(pritestfile, shortfilename);
416 test(r==KErrPermissionDenied);
418 r=TheFs.GetLongName(pritestfile1, longfilename);
419 test(r==KErrPermissionDenied);
421 r=file1.Create(TheFs,oldName,EFileWrite);
422 test(r==KErrNone || r==KErrAlreadyExists);
425 r=TheFs.Replace(oldName,pritestfile);
426 test(r==KErrPermissionDenied);
428 r=TheFs.Rename(pritestfile,pritestfile1);
429 test(r==KErrPermissionDenied);
431 r=TheFs.Entry(pritestfile1,entry);
432 test(r==KErrPermissionDenied);
434 r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
435 test(r==KErrPermissionDenied);
437 r=TheFs.Delete(pritestfile1);
438 test(r==KErrPermissionDenied);
443 LOCAL_C void privateSIDRFstest()
449 theprivatepath[0]=(TText)gDriveToTest;
450 test.Printf(_L("the Private Path = %S"),&theprivatepath);
453 mkdirname.Append(theprivatepath);
454 mkdirname.Append(KMkDirSub);
455 r=TheFs.MkDirAll(mkdirname);
458 r=TheFs.RmDir(mkdirname);
461 r=TheFs.SetSubst(theprivatepath,EDriveS);
464 r=TheFs.RealName(_L("S:\\File.XXX"),realName);
467 r=TheFs.SetSubst(_L(""),EDriveS);
470 r=TheFs.SetSessionPath(theprivatepath);
473 TheFs.NotifyChange(ENotifyAll,aStat3,theprivatepath);
474 test(aStat3==KRequestPending);
476 pritestfile=theprivatepath;
477 pritestfile[0]=(TText)('A' + gTheDriveNum);
478 pritestfile1=pritestfile;
479 pritestfile.Append(KFilePri2);
480 pritestfile1.Append(KFilePri3);
483 oldName[0]=(TText)gDriveToTest;
485 r=TheFs.GetShortName(pritestfile, shortfilename);
486 test(r==KErrNone || KErrPathNotFound);
488 r=TheFs.GetLongName(pritestfile1, longfilename);
489 test(r==KErrNone || KErrPathNotFound);
491 r=file1.Create(TheFs,oldName,EFileWrite);
492 test(r==KErrNone || r==KErrAlreadyExists);
495 r=TheFs.Replace(oldName,pritestfile);
498 r=TheFs.Rename(pritestfile,pritestfile1);
499 test(r==KErrNone || r==KErrAlreadyExists);
501 r=TheFs.Entry(pritestfile1,entry);
504 r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
507 r=TheFs.Delete(pritestfile1);
511 LOCAL_C void systemRFiletest()
516 //RFile testing with session path set to //system//
518 r=TheFs.SetSessionPath(systestname);
519 test(r==KErrPermissionDenied);
521 r=file1.Temp(TheFs,systestname,fromTemp,EFileWrite);
522 test(r==KErrPermissionDenied);
524 TBuf<25> sysfilename;
525 sysfilename.Append(systestname);
526 sysfilename.Append(KFileSys);
527 r=file1.Create(TheFs,sysfilename,EFileWrite);
528 test(r==KErrPermissionDenied);
530 r=file1.Open(TheFs,sysfilename,EFileWrite);
531 test(r==KErrPermissionDenied);
533 r=file1.Open(TheFs,sysfilename,EFileRead);
534 test(r==KErrPermissionDenied);
536 r=file1.Replace(TheFs,sysfilename,EFileWrite);
537 test(r==KErrPermissionDenied);
539 TFindFile finder(TheFs);
541 r=finder.FindWildByDir(KWildFile, KWildPath, dir);
542 if (!(r==KErrPermissionDenied))
543 test.Printf(_L("T_DCDISKADMIN: test find wildcards r = %d (expected KErrPermissionDenied)\n"), r);
544 test(r==KErrPermissionDenied);
548 LOCAL_C void resourceRFiletest()
553 //RFile testing with session path set to //resource//
554 r=TheFs.SetSessionPath(restestname);
557 r=file1.Temp(TheFs,restestname,fromTemp,EFileWrite);
558 test(r==KErrPermissionDenied);
561 r=file1.Create(TheFs,KFileRes,EFileWrite);
562 test(r==KErrPermissionDenied);
565 r=file1.Open(TheFs,KFileRes,EFileWrite);
566 test(r==KErrPermissionDenied);
569 r=file1.Open(TheFs,KFileRes,EFileRead|EFileShareReadersOnly);
570 test(r==KErrNone || r==KErrPathNotFound);
573 r=file1.Open(TheFs,KFileRes,EFileShareReadersOrWriters|EFileRead);
574 test(r==KErrNone || r==KErrPathNotFound);
577 r=file1.Open(TheFs,KFileRes,EFileShareReadersOrWriters|EFileWrite);
578 test(r==KErrPermissionDenied);
581 r=file1.Open(TheFs,KFileRes,EFileShareReadersOnly);
584 r=file1.ChangeMode(EFileShareExclusive);
587 //this operation is prevented as you can not open a file for write access in the resource directory
588 r=file1.Rename(KFileRes3);
589 test(r==KErrPermissionDenied || r==KErrAccessDenied);
592 r=file1.Replace(TheFs,KFileRes,EFileWrite);
593 test(r==KErrPermissionDenied);
599 LOCAL_C void privatefalseIDRFiletest()
601 //RFile testing with session path set to //Private//falseID
604 r=TheFs.SetSessionPath(pritestfalseidname);
605 test(r==KErrPermissionDenied);
607 r=file1.Temp(TheFs,pritestfalseidname,fromTemp,EFileWrite);
608 test(r==KErrPermissionDenied);
610 TBuf<25> prifilename;
611 prifilename.Append(pritestname);
612 prifilename.Append(KFileSys);
614 r=file1.Create(TheFs,prifilename,EFileWrite);
615 test(r==KErrPermissionDenied);
617 r=file1.Open(TheFs,prifilename,EFileWrite);
618 test(r==KErrPermissionDenied);
620 r=file1.Open(TheFs,prifilename,EFileRead);
621 test(r==KErrPermissionDenied);
623 r=file1.Replace(TheFs,prifilename,EFileWrite);
624 test(r==KErrPermissionDenied);
628 LOCAL_C void privateRFiletest()
630 //RFile testing with session path set to //Private//
633 r=TheFs.SetSessionPath(pritestname);
634 test(r==KErrPermissionDenied);
636 r=file1.Temp(TheFs,pritestname,fromTemp,EFileWrite);
637 test(r==KErrPermissionDenied);
639 TBuf<25> prifilename;
640 prifilename.Append(pritestname);
641 prifilename.Append(KFileSys);
643 r=file1.Create(TheFs,prifilename,EFileWrite);
644 test(r==KErrPermissionDenied);
646 r=file1.Open(TheFs,prifilename,EFileWrite);
647 test(r==KErrPermissionDenied);
649 r=file1.Open(TheFs,prifilename,EFileRead);
650 test(r==KErrPermissionDenied);
652 r=file1.Replace(TheFs,prifilename,EFileWrite);
653 test(r==KErrPermissionDenied);
657 LOCAL_C void privateSIDRFiletest()
659 //Rfile Testing with session path set to //Private//UID//
662 r=TheFs.SetSessionToPrivate(gTheDriveNum);
665 r=file1.Temp(TheFs,theprivatepath,fromTemp,EFileWrite);
669 r=file1.Create(TheFs,KFilePri,EFileWrite);
670 test(r==KErrNone || r==KErrAlreadyExists);
673 r=file1.Open(TheFs,KFilePri,EFileWrite);
677 r=file1.Open(TheFs,KFilePri,EFileRead);
681 r=file1.Replace(TheFs,KFilePri,EFileWrite);
684 r=file1.Rename(KFilePri3);
685 test(r==KErrNone || r==KErrAlreadyExists);
690 LOCAL_C void RDirtest()
697 dirNameBuf = KSystemPath;
698 dirNameBuf[0]=(TText)gDriveToTest;
699 r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
700 test(r==KErrPermissionDenied);
702 r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
703 test(r==KErrPermissionDenied);
707 dirNameBuf=KPrivateFalseID;
708 dirNameBuf[0]=(TText)gDriveToTest;
709 r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
710 test(r==KErrPermissionDenied);
712 r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
713 test(r==KErrPermissionDenied);
717 dirNameBuf=KPrivatePath;
718 dirNameBuf[0]=(TText)gDriveToTest;
719 r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
720 test(r==KErrPermissionDenied);
722 r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
723 test(r==KErrPermissionDenied);
727 TheFs.PrivatePath(dirNameBuf);
728 dirNameBuf.Insert(0,_L("?:"));
729 dirNameBuf[0]=(TText)gDriveToTest;
730 r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
733 r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
738 dirNameBuf=KResourcePath;
739 dirNameBuf[0]=(TText)gDriveToTest;
740 r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
741 test(r==KErrNone || r==KErrPathNotFound || r==KErrNotFound);
742 r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
743 test(r==KErrNone || r==KErrPathNotFound || r==KErrNotFound);
749 LOCAL_C void DiskAdminTest()
751 // test diskadministration capabilitiy
754 r=TheFs.FileSystemName(fsname,gTheDriveNum);
756 r = DismountFileSystem(TheFs, fsname, gTheDriveNum);
758 // r=TheFs.RemoveFileSystem(fsname); //can not test due to bug else where fix exists
759 // test(r==KErrPermissionDenied);
760 // r=TheFs.AddFileSystem(fsname);
761 // test(r==KErrPermissionDenied);
762 r = MountFileSystem(TheFs, fsname, gTheDriveNum);
764 r=TheFs.SetDriveName(gTheDriveNum,KDriveName);
766 r=TheFs.SetVolumeLabel(KVolLable, gTheDriveNum);
767 test(r==KErrNone || r==KErrNotSupported);
773 privateFalseIDRFstest();
778 privateSIDRFiletest();
779 privatefalseIDRFiletest();
781 //disk changes to sys and pri paths should have completed these
782 test(aStat4 == KRequestPending);
783 TheFs.NotifyChangeCancel(aStat4);
784 test(aStat4==KErrCancel);
786 User::WaitForRequest(aStat3);
787 test(aStat1==KErrPermissionDenied);
788 test(aStat2==KErrPermissionDenied);
789 test(aStat3==KErrNone);
791 r=TheFs.SetSessionPath(systestname);
792 test(r==KErrPermissionDenied);
794 //Test RRawDisk class
795 r=rawdisk.Open(TheFs,gTheDriveNum);
796 test(r==KErrPermissionDenied);
802 if (User::UpperCase(driveBuf[0]) != 'C')
806 r=format.Open(TheFs,driveBuf,EHighDensity,count);
811 TInt r=format.Next(count);
817 driveBuf[0]=(TText)gDriveToTest;
818 r=TheFs.ScanDrive(driveBuf);
819 test(r==KErrNone || r==KErrNotSupported);
820 r=TheFs.CheckDisk(driveBuf);
821 test(r==KErrNone || r==KErrNotSupported);
826 LOCAL_C void TestCaps()
828 // test format etc that require certain capabilities
831 driveBuf[0]=(TText)gDriveToTest;
832 r=TheFs.SessionPath(temp);
835 test.Printf(_L("Session path: %S"),&temp);
837 r=TheFs.CreatePrivatePath(gTheDriveNum);
838 test(r==KErrNone || r== KErrAlreadyExists);
841 r=TheFs.PrivatePath(tempPri);
843 theprivatepath = _L("?:");
844 theprivatepath.Append(tempPri);
848 TFileName thesessionpath;
850 r=TheFs.SetSessionToPrivate(gTheDriveNum);
852 r=TheFs.SessionPath(thesessionpath);
855 test(thesessionpath == theprivatepath);
859 LOCAL_C void CleanupL()
864 test.Next(_L("Delete test directory"));
865 CFileMan* fMan=CFileMan::NewL(TheFs);
866 TInt r=fMan->RmDir(gSessionPath);
867 test(r==KErrNone || KErrPathNotFound);
871 GLDEF_C void CallTestsL(/*TChar aDriveLetter*/)
876 if( !PlatSec::IsCapabilityEnforced(ECapabilityDiskAdmin))
878 test.Printf(_L("Capability ECapabilityDiskAdmin not enabled - leaving t_dcdiskadmin"));
879 test.Printf(_L("\n")); // Prevent overwrite by next print
883 TurnAllocFailureOff();
884 TheFs.CharToDrive(gDriveToTest,gTheDriveNum);
888 sesspath[0] = (TText)gDriveToTest;
890 TInt r= TheFs.SetSessionPath(sesspath);
893 //cleanup from previous run of this test
896 cmd[0] = (TText)gDriveToTest;
898 r=tp.Create(_L("clean_prepdc.exe"),sesspath);
905 User::WaitForRequest(ps);
908 //check double mode ie that Defpath still works
914 r=fs1.SessionPath(sesspath);
916 test.Printf(_L("session1 Path=%S"),&sesspath);
918 TBuf<30> privatepath;
919 r=fs1.SetSessionToPrivate(gTheDriveNum);
921 r=fs1.PrivatePath(privatepath);
923 r=privatepath.Compare(KExpectedPrivatePath());
925 r=fs1.SessionPath(sesspath);
927 r=privatepath.Compare(sesspath.Mid(KPathPosition));
929 r=fs1.CreatePrivatePath(gTheDriveNum);
935 r=fs2.SessionPath(sesspath);
937 test.Printf(_L("session2 Path=%S"),&sesspath);
942 test.Printf(_L("No of files open=%d"), TheFs.ResourceCount());