os/kernelhwsrv/kerneltest/f32test/server/t_dctcballfiles.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/kerneltest/f32test/server/t_dctcballfiles.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,1068 @@
     1.4 +// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of the License "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +#include <f32file.h>
    1.20 +#include <e32test.h>
    1.21 +#include <e32std.h>
    1.22 +#include <e32std_private.h>
    1.23 +#include <e32svr.h>
    1.24 +#include <e32def.h>
    1.25 +#include <e32def_private.h>
    1.26 +#include "t_server.h"
    1.27 +
    1.28 +GLDEF_D RTest test(_L("t_dctcballfiles"));
    1.29 +GLDEF_D TTime gTimeNow;
    1.30 +LOCAL_D TInt gTheDriveNum;
    1.31 +
    1.32 +const TInt KPathPosition = 2;
    1.33 +_LIT(KExpectedPrivatePath, "\\Private\\00000001\\");
    1.34 +
    1.35 +_LIT(KResourcePath, "?:\\Resource\\");
    1.36 +_LIT(KSystemPath,	"?:\\Sys\\");
    1.37 +_LIT(KPrivatePath,	"?:\\Private\\");
    1.38 +_LIT(KPrivateFalseID,	"?:\\Private\\FFFFFFFF\\");
    1.39 +_LIT(KDriveName,	"Billy");
    1.40 +_LIT(KVolLable,		"Benny");
    1.41 +_LIT(KFileSys,	"systemfile.txt");
    1.42 +_LIT(KFileSys3, "sysfile.rna");
    1.43 +_LIT(KFilePri,	"privatefile.txt");
    1.44 +_LIT(KFilePri2,	"privatefile.tmp");
    1.45 +_LIT(KFilePri3,	"prifile.rna");
    1.46 +_LIT(KFileRes,	"resourcefile.txt");
    1.47 +_LIT(KFileRes3,	"resfile.rna");
    1.48 +_LIT(KMkDirSub,"Subdir\\");
    1.49 +_LIT(KOldFile,"?:\\Anyold.txt");
    1.50 +_LIT(KWildPath, "Z:\\SYS\\");
    1.51 +_LIT(KWildFile, "*");
    1.52 +
    1.53 +TCapability TheCaps;
    1.54 +TBuf<4> driveBuf=_L("?:\\");
    1.55 +RFormat format;
    1.56 +TInt count;
    1.57 +RRawDisk rawdisk;
    1.58 +RFile file1;
    1.59 +RFile file2;
    1.60 +RDir	dir;
    1.61 +
    1.62 +TInt r;
    1.63 +TBuf<40> fsname;
    1.64 +TBuf<40> systestname;
    1.65 +TBuf<40> pritestname;
    1.66 +TBuf<40> restestname;
    1.67 +TBuf<40> theprivatepath;
    1.68 +TBuf<40> pritestfalseidname;
    1.69 +TBuf<40> mkdirname;
    1.70 +TFileName fromTemp;
    1.71 +
    1.72 +TBuf<25> sysfilename;
    1.73 +TBuf<30> realName;
    1.74 +TBuf<40> shortfilename;
    1.75 +TBuf<40> longfilename;
    1.76 +
    1.77 +TRequestStatus aStat1;
    1.78 +TRequestStatus aStat2;
    1.79 +TRequestStatus aStat3;
    1.80 +TRequestStatus aStat4;
    1.81 +
    1.82 +TVolumeInfo aVolInfo;
    1.83 +//	TDriveInfo adriveInfo;
    1.84 +
    1.85 +TBuf<40> systestfile;
    1.86 +TBuf<40> pritestfile;
    1.87 +TBuf<40> restestfile;
    1.88 +TBuf<40> systestfile1;
    1.89 +TBuf<40> pritestfile1;
    1.90 +TBuf<40> restestfile1;
    1.91 +
    1.92 +TTime testtime;
    1.93 +TBuf<20> oldName;
    1.94 +
    1.95 +TBuf<25> temp;
    1.96 +
    1.97 +TEntry entry;
    1.98 +
    1.99 +
   1.100 +LOCAL_C void systemRFsTest()
   1.101 +//
   1.102 +//	RFs test on system Directory
   1.103 +//
   1.104 +	{
   1.105 +	systestname=KSystemPath;
   1.106 +	systestname[0]=(TText)('A' + gTheDriveNum);
   1.107 +	
   1.108 +	mkdirname.Zero();
   1.109 +	mkdirname.Append(systestname);
   1.110 +	mkdirname.Append(KMkDirSub);
   1.111 +	r=TheFs.MkDirAll(mkdirname);	
   1.112 +	test(r==KErrNone);
   1.113 +
   1.114 +	TheFs.RmDir(mkdirname);
   1.115 +	test(r==KErrNone);
   1.116 +
   1.117 +	r=TheFs.SetSubst(systestname,EDriveO);
   1.118 +	test(r==KErrPermissionDenied);
   1.119 +	
   1.120 +	r=TheFs.RealName(_L("O:\\File.XXX"),realName);
   1.121 +	test(r==KErrNone);
   1.122 +
   1.123 +	r=TheFs.SetSessionPath(systestname);
   1.124 +	test(r==KErrNone);
   1.125 +	
   1.126 +	TheFs.NotifyChange(ENotifyAll,aStat1,systestname);
   1.127 +	test(aStat1==KRequestPending);
   1.128 +
   1.129 +	systestfile=KSystemPath;
   1.130 +	systestfile[0]=(TText)('A' + gTheDriveNum);
   1.131 +	systestfile1=systestfile;
   1.132 +	systestfile.Append(KFileSys);
   1.133 +	systestfile1.Append(KFileSys3);
   1.134 +	
   1.135 +	oldName=KOldFile;
   1.136 +	oldName[0]=(TText)gDriveToTest;
   1.137 +
   1.138 +	r=TheFs.GetShortName(systestfile, shortfilename);
   1.139 +	test(r==KErrNotFound || r==KErrNotSupported);
   1.140 +
   1.141 +	r=TheFs.GetLongName(systestfile1, longfilename);
   1.142 +	test(r==KErrNotFound || r==KErrNotSupported);
   1.143 +
   1.144 +	r=file1.Create(TheFs,oldName,EFileWrite);
   1.145 +	test(r==KErrNone || r==KErrAlreadyExists);
   1.146 +	file1.Close();
   1.147 +
   1.148 +	r=TheFs.Replace(oldName,systestfile);
   1.149 +	test(r==KErrNone);
   1.150 +	
   1.151 +	r=TheFs.Rename(systestfile,systestfile1);
   1.152 +	test(r==KErrNone);
   1.153 +	
   1.154 +	r=TheFs.Entry(systestfile1,entry);
   1.155 +	test(r==KErrNone);
   1.156 +
   1.157 +	r=TheFs.SetEntry(systestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
   1.158 +	test(r==KErrNone);
   1.159 +
   1.160 +	r=TheFs.Delete(systestfile1);
   1.161 +	test(r==KErrNone);
   1.162 +	}
   1.163 +
   1.164 +LOCAL_C void ResourceRFsTest()
   1.165 +//
   1.166 +//
   1.167 +//
   1.168 +	{
   1.169 +	restestname=KResourcePath;
   1.170 +	restestname[0]=(TText)('A' + gTheDriveNum);
   1.171 +	
   1.172 +	mkdirname.Zero();
   1.173 +	mkdirname.Append(restestname);
   1.174 +	mkdirname.Append(KMkDirSub);
   1.175 +	r=TheFs.MkDirAll(mkdirname);	
   1.176 +	test(r==KErrNone);
   1.177 +
   1.178 +	TheFs.RmDir(mkdirname);
   1.179 +	test(r==KErrNone);
   1.180 +
   1.181 +	r=TheFs.SetSubst(restestname,EDriveO);
   1.182 +	test(r==KErrPermissionDenied);
   1.183 +	
   1.184 +	r=TheFs.RealName(_L("O:\\File.XXX"),realName);
   1.185 +	test(r==KErrNone);
   1.186 +
   1.187 +	r=TheFs.SetSessionPath(restestname);
   1.188 +	test(r==KErrNone);
   1.189 +	
   1.190 +	TheFs.NotifyChange(ENotifyAll,aStat4,restestname);
   1.191 +	test(aStat4==KRequestPending);
   1.192 +
   1.193 +	restestfile=KResourcePath;
   1.194 +	restestfile[0]=(TText)('A' + gTheDriveNum);
   1.195 +	restestfile1=restestfile;
   1.196 +	restestfile.Append(KFileRes);
   1.197 +	restestfile1.Append(KFileRes3);
   1.198 +	
   1.199 +	oldName=KOldFile;
   1.200 +	oldName[0]=(TText)gDriveToTest;
   1.201 +
   1.202 +	r=TheFs.GetShortName(restestfile, shortfilename);
   1.203 +	test(r==KErrNone || KErrNotFound || r==KErrNotSupported);
   1.204 +
   1.205 +	r=TheFs.GetLongName(restestfile1, longfilename);
   1.206 +	test(r==KErrNone || KErrNotFound || r==KErrNotSupported);
   1.207 +
   1.208 +	r=file1.Create(TheFs,oldName,EFileWrite);
   1.209 +	test(r==KErrNone || r==KErrAlreadyExists);
   1.210 +	file1.Close();
   1.211 +
   1.212 +	r=TheFs.Replace(oldName,restestfile);
   1.213 +	test(r==KErrNone);
   1.214 +	
   1.215 +	r=TheFs.Rename(restestfile,restestfile1);
   1.216 +	test(r==KErrNone);
   1.217 +	
   1.218 +	r=TheFs.Entry(restestfile1,entry);
   1.219 +	test(r==KErrNone);
   1.220 +
   1.221 +	r=TheFs.SetEntry(restestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
   1.222 +	test(r==KErrNone);
   1.223 +
   1.224 +	r=TheFs.Delete(restestfile1);
   1.225 +	test(r==KErrNone);
   1.226 +
   1.227 +	}
   1.228 +
   1.229 +
   1.230 +LOCAL_C void privatefalseIDRFsTest()
   1.231 +//
   1.232 +//
   1.233 +//
   1.234 +	{
   1.235 +	pritestfalseidname=KPrivateFalseID;
   1.236 +	pritestfalseidname[0]=(TText)('A' + gTheDriveNum);
   1.237 +	
   1.238 +	mkdirname.Zero();
   1.239 +	mkdirname.Append(pritestfalseidname);
   1.240 +	mkdirname.Append(KMkDirSub);
   1.241 +
   1.242 +	r=TheFs.MkDirAll(mkdirname);	
   1.243 +	test(r==KErrNone);
   1.244 +
   1.245 +	r=TheFs.RmDir(mkdirname);	
   1.246 +	test(r==KErrNone);
   1.247 +
   1.248 +	r=TheFs.SetSubst(pritestfalseidname,EDriveO);
   1.249 +	test(r==KErrPermissionDenied);
   1.250 +
   1.251 +	r=TheFs.RealName(_L("O:\\File.XXX"),realName);
   1.252 +	test(r==KErrNone);
   1.253 +
   1.254 +	r=TheFs.SetSessionPath(pritestfalseidname);
   1.255 +	test(r==KErrNone);
   1.256 +
   1.257 +	TheFs.NotifyChange(ENotifyAll,aStat2,pritestfalseidname);
   1.258 +	test(aStat2==KRequestPending);
   1.259 +
   1.260 +
   1.261 +	pritestfile=KPrivateFalseID;
   1.262 +	pritestfile[0]=(TText)('A' + gTheDriveNum);
   1.263 +	pritestfile1=pritestfile;
   1.264 +	pritestfile.Append(KFilePri2);
   1.265 +	pritestfile1.Append(KFilePri3);
   1.266 +	
   1.267 +	oldName=KOldFile;
   1.268 +	oldName[0]=(TText)gDriveToTest;
   1.269 +
   1.270 +	r=TheFs.GetShortName(pritestfile, shortfilename);
   1.271 +	test(r==KErrNone || r==KErrNotFound || r==KErrNotSupported);
   1.272 +
   1.273 +	r=TheFs.GetLongName(pritestfile1, longfilename);
   1.274 +	test(r==KErrNone || r==KErrNotFound || r==KErrNotSupported);
   1.275 +
   1.276 +	r=file1.Create(TheFs,oldName,EFileWrite);
   1.277 +	test(r==KErrNone || r==KErrAlreadyExists);
   1.278 +	file1.Close();
   1.279 +
   1.280 +	r=TheFs.Replace(oldName,pritestfile);
   1.281 +	test(r==KErrNone);
   1.282 +	
   1.283 +	r=TheFs.Rename(pritestfile,pritestfile1);
   1.284 +	test(r==KErrNone);
   1.285 +	
   1.286 +	r=TheFs.Entry(pritestfile1,entry);
   1.287 +	test(r==KErrNone);
   1.288 +
   1.289 +	r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
   1.290 +	test(r==KErrNone);
   1.291 +
   1.292 +	r=TheFs.Delete(pritestfile1);
   1.293 +	test(r==KErrNone);
   1.294 +
   1.295 +	}
   1.296 +
   1.297 +
   1.298 +LOCAL_C void privateRFsTest()
   1.299 +//
   1.300 +//
   1.301 +//
   1.302 +	{
   1.303 +	//private
   1.304 +	pritestname=KPrivatePath;
   1.305 +	pritestname[0]=(TText)('A' + gTheDriveNum);
   1.306 +	
   1.307 +	mkdirname.Zero();
   1.308 +	mkdirname.Append(pritestname);
   1.309 +	mkdirname.Append(KMkDirSub);
   1.310 +
   1.311 +	r=TheFs.MkDirAll(mkdirname);	
   1.312 +	test(r==KErrNone);
   1.313 +
   1.314 +	r=TheFs.RmDir(mkdirname);	
   1.315 +	test(r==KErrNone);
   1.316 +
   1.317 +	r=TheFs.SetSubst(pritestname,EDriveO);
   1.318 +	test(r==KErrPermissionDenied);
   1.319 +
   1.320 +	r=TheFs.RealName(_L("O:\\File.XXX"),realName);
   1.321 +	test(r==KErrNone);
   1.322 +
   1.323 +	r=TheFs.SetSessionPath(pritestname);
   1.324 +	test(r==KErrNone);
   1.325 +
   1.326 +	TheFs.NotifyChange(ENotifyAll,aStat2,pritestname);
   1.327 +	test(aStat2==KRequestPending);
   1.328 +
   1.329 +
   1.330 +	pritestfile=KPrivatePath;
   1.331 +	pritestfile[0]=(TText)('A' + gTheDriveNum);
   1.332 +	pritestfile1=pritestfile;
   1.333 +	pritestfile.Append(KFilePri2);
   1.334 +	pritestfile1.Append(KFilePri3);
   1.335 +	
   1.336 +	oldName=KOldFile;
   1.337 +	oldName[0]=(TText)gDriveToTest;
   1.338 +
   1.339 +	r=TheFs.GetShortName(pritestfile, shortfilename);
   1.340 +	test(r==KErrNone || r==KErrNotFound || r==KErrNotSupported);
   1.341 +
   1.342 +	r=TheFs.GetLongName(pritestfile1, longfilename);
   1.343 +	test(r==KErrNone || r==KErrNotFound || r==KErrNotSupported);
   1.344 +
   1.345 +	r=file1.Create(TheFs,oldName,EFileWrite);
   1.346 +	test(r==KErrNone || r==KErrAlreadyExists);
   1.347 +	file1.Close();
   1.348 +
   1.349 +	r=TheFs.Replace(oldName,pritestfile);
   1.350 +	test(r==KErrNone);
   1.351 +	
   1.352 +	r=TheFs.Rename(pritestfile,pritestfile1);
   1.353 +	test(r==KErrNone);
   1.354 +	
   1.355 +	r=TheFs.Entry(pritestfile1,entry);
   1.356 +	test(r==KErrNone);
   1.357 +
   1.358 +	r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
   1.359 +	test(r==KErrNone);
   1.360 +
   1.361 +	r=TheFs.Delete(pritestfile1);
   1.362 +	test(r==KErrNone);
   1.363 +
   1.364 +	}
   1.365 +
   1.366 +
   1.367 +LOCAL_C void privateSIDRFstest()
   1.368 +	{
   1.369 +	theprivatepath[0]=(TText)gDriveToTest;	
   1.370 +	test.Printf(_L("the Private Path = %S"),&theprivatepath);
   1.371 +
   1.372 +	mkdirname.Zero();
   1.373 +	mkdirname.Append(theprivatepath);
   1.374 +	mkdirname.Append(KMkDirSub);
   1.375 +	r=TheFs.MkDirAll(mkdirname);	
   1.376 +	test(r==KErrNone);
   1.377 +
   1.378 +	r=TheFs.RmDir(mkdirname);	
   1.379 +	test(r==KErrNone);
   1.380 +
   1.381 +	r=TheFs.SetSubst(theprivatepath,EDriveO);	
   1.382 +	test(r==KErrPermissionDenied);
   1.383 +
   1.384 +	r=TheFs.RealName(_L("O:\\File.XXX"),realName);
   1.385 +	test(r==KErrNone);
   1.386 +
   1.387 +	r=TheFs.SetSessionPath(theprivatepath);
   1.388 +	test(r==KErrNone);
   1.389 +
   1.390 +	TheFs.NotifyChange(ENotifyAll,aStat3,theprivatepath);
   1.391 +	test(aStat3==KRequestPending);
   1.392 +
   1.393 +	pritestfile=theprivatepath;
   1.394 +	pritestfile[0]=(TText)('A' + gTheDriveNum);
   1.395 +	pritestfile1=pritestfile;
   1.396 +	pritestfile.Append(KFilePri2);
   1.397 +	pritestfile1.Append(KFilePri3);
   1.398 +	
   1.399 +	oldName=KOldFile;
   1.400 +	oldName[0]=(TText)gDriveToTest;
   1.401 +
   1.402 +	r=TheFs.GetShortName(pritestfile, shortfilename);
   1.403 +	test(r==KErrNone || r==KErrNotFound || r==KErrNotSupported);
   1.404 +
   1.405 +	r=TheFs.GetLongName(pritestfile1, longfilename);
   1.406 +	test(r==KErrNone || r==KErrNotFound || r==KErrNotSupported);
   1.407 +
   1.408 +	r=file1.Create(TheFs,oldName,EFileWrite);
   1.409 +	test(r==KErrNone || r==KErrAlreadyExists);
   1.410 +	file1.Close();
   1.411 +
   1.412 +	r=TheFs.Replace(oldName,pritestfile);
   1.413 +	test(r==KErrNone);
   1.414 +	
   1.415 +	r=TheFs.Rename(pritestfile,pritestfile1);
   1.416 +	test(r==KErrNone || r==KErrAlreadyExists);
   1.417 +	
   1.418 +	r=TheFs.Entry(pritestfile1,entry);
   1.419 +	test(r==KErrNone);
   1.420 +
   1.421 +	r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
   1.422 +	test(r==KErrNone);
   1.423 +
   1.424 +	r=TheFs.Delete(pritestfile1);
   1.425 +	test(r==KErrNone);
   1.426 +	}
   1.427 +
   1.428 +
   1.429 +LOCAL_C void systemRFiletest()
   1.430 +//
   1.431 +//RFile testing with session path set to //system//
   1.432 +//
   1.433 +	{
   1.434 +
   1.435 +	r=TheFs.SetSessionPath(systestname);
   1.436 +	test(r==KErrNone);
   1.437 +
   1.438 +	r=file1.Temp(TheFs,systestname,fromTemp,EFileWrite);
   1.439 +	test(r==KErrNone);
   1.440 +	file1.Close();
   1.441 +
   1.442 +	r=file1.Create(TheFs,KFileSys,EFileWrite);
   1.443 +	test(r==KErrNone);
   1.444 +	file1.Close();
   1.445 +
   1.446 +	r=file1.Open(TheFs,KFileSys,EFileWrite);
   1.447 +	test(r==KErrNone);
   1.448 +	file1.Close();
   1.449 +	
   1.450 +	r=file1.Open(TheFs,KFileSys,EFileRead);
   1.451 +	test(r==KErrNone);
   1.452 +	file1.Close();
   1.453 +
   1.454 +	r=file1.Replace(TheFs,KFileSys,EFileWrite);
   1.455 +	test(r==KErrNone);
   1.456 +	
   1.457 +	r=file1.Rename(KFileSys3);
   1.458 +	test(r==KErrNone);
   1.459 +	file1.Close();
   1.460 +
   1.461 +    TFindFile finder(TheFs);
   1.462 +    CDir* dir = NULL;
   1.463 +    r=finder.FindWildByDir(KWildFile, KWildPath, dir);
   1.464 +	if (!(r==KErrNone))
   1.465 +        test.Printf(_L("T_DCTCBALLFILES: test find wildcards r = %d (expected KErrNone)\n"), r);
   1.466 +	test(r==KErrNone);
   1.467 +	delete dir;
   1.468 +	}
   1.469 +
   1.470 +LOCAL_C void resourceRFiletest()
   1.471 +//
   1.472 +//RFile testing with session path set to //resource//
   1.473 +//
   1.474 +	{
   1.475 +	r=TheFs.SetSessionPath(restestname);
   1.476 +	test(r==KErrNone);
   1.477 +
   1.478 +	r=file1.Temp(TheFs,restestname,fromTemp,EFileWrite);
   1.479 +	test(r==KErrNone);
   1.480 +	file1.Close();
   1.481 +
   1.482 +	r=file1.Create(TheFs,KFileRes,EFileWrite);
   1.483 +	test(r==KErrNone);
   1.484 +	file1.Close();
   1.485 +
   1.486 +	r=file1.Open(TheFs,KFileRes,EFileWrite|EFileShareExclusive );
   1.487 +	test(r==KErrNone);
   1.488 +	
   1.489 +	r=file1.Rename(KFileRes3);
   1.490 +	test(r==KErrNone);
   1.491 +	file1.Close();
   1.492 +
   1.493 +	r=file1.Open(TheFs,KFileRes3,EFileShareReadersOrWriters|EFileRead);
   1.494 +	test(r==KErrNone);
   1.495 +	file1.Close();
   1.496 +
   1.497 +	r=file1.Open(TheFs,KFileRes3,EFileShareReadersOrWriters|EFileWrite);
   1.498 +	test(r==KErrNone);
   1.499 +	file1.Close();
   1.500 +
   1.501 +	r=file1.Open(TheFs,KFileRes3,EFileShareReadersOnly);
   1.502 +	test(r==KErrNone);
   1.503 +
   1.504 +	r=file1.ChangeMode(EFileShareExclusive);
   1.505 +	test(r==KErrNone);
   1.506 +	file1.Close();
   1.507 +
   1.508 +	r=file1.Replace(TheFs,KFileRes,EFileWrite);
   1.509 +	test(r==KErrNone);
   1.510 +	file1.Close();	
   1.511 +	}
   1.512 +
   1.513 +
   1.514 +LOCAL_C void privateRFiletest()
   1.515 +//
   1.516 +//RFile testing with session path set to //Private//
   1.517 +//
   1.518 +	{
   1.519 +	r=TheFs.SetSessionPath(pritestfalseidname);
   1.520 +	test(r==KErrNone);
   1.521 +
   1.522 +	r=file1.Temp(TheFs,pritestfalseidname,fromTemp,EFileWrite);
   1.523 +	test(r==KErrNone);
   1.524 +	file1.Close();
   1.525 +
   1.526 +	r=file1.Create(TheFs,KFilePri,EFileWrite);
   1.527 +	test(r==KErrNone);
   1.528 +	file1.Close();
   1.529 +
   1.530 +	r=file1.Open(TheFs,KFilePri,EFileWrite);
   1.531 +	test(r==KErrNone);
   1.532 +	file1.Close();
   1.533 +	
   1.534 +	r=file1.Open(TheFs,KFilePri,EFileRead);
   1.535 +	test(r==KErrNone);
   1.536 +	file1.Close();
   1.537 +	
   1.538 +	r=file1.Replace(TheFs,KFilePri,EFileWrite);
   1.539 +	test(r==KErrNone);
   1.540 +	
   1.541 +	r=file1.Rename(KFilePri3);
   1.542 +	test(r==KErrNone);
   1.543 +	file1.Close();
   1.544 +	}
   1.545 +
   1.546 +
   1.547 +LOCAL_C void privatefalseIDRFiletest()
   1.548 +//
   1.549 +//RFile testing with session path set to //Private//
   1.550 +//
   1.551 +	{
   1.552 +	r=TheFs.SetSessionPath(pritestname);
   1.553 +	test(r==KErrNone);
   1.554 +
   1.555 +	r=file1.Temp(TheFs,pritestname,fromTemp,EFileWrite);
   1.556 +	test(r==KErrNone);
   1.557 +	file1.Close();
   1.558 +
   1.559 +	r=file1.Create(TheFs,KFilePri,EFileWrite);
   1.560 +	test(r==KErrNone);
   1.561 +	file1.Close();
   1.562 +
   1.563 +	r=file1.Open(TheFs,KFilePri,EFileWrite);
   1.564 +	test(r==KErrNone);
   1.565 +	file1.Close();
   1.566 +	
   1.567 +	r=file1.Open(TheFs,KFilePri,EFileRead);
   1.568 +	test(r==KErrNone);
   1.569 +	file1.Close();
   1.570 +	
   1.571 +	r=file1.Replace(TheFs,KFilePri,EFileWrite);
   1.572 +	test(r==KErrNone);
   1.573 +	
   1.574 +	r=file1.Rename(KFilePri3);
   1.575 +	test(r==KErrNone);
   1.576 +	file1.Close();
   1.577 +	}
   1.578 +
   1.579 +
   1.580 +LOCAL_C void privateSIDRFiletest()
   1.581 +//
   1.582 +//Rfile Testing with session path set to //Private//UID//
   1.583 +//
   1.584 +	{
   1.585 +	r=TheFs.SetSessionToPrivate(gTheDriveNum);
   1.586 +	test(r==KErrNone);
   1.587 +	
   1.588 +	r=file1.Temp(TheFs,theprivatepath,fromTemp,EFileWrite);
   1.589 +	test(r==KErrNone);
   1.590 +	file1.Close();
   1.591 +
   1.592 +	r=file1.Create(TheFs,KFilePri,EFileWrite);
   1.593 +	test(r==KErrNone);
   1.594 +	file1.Close();
   1.595 +
   1.596 +	r=file1.Open(TheFs,KFilePri,EFileWrite);
   1.597 +	test(r==KErrNone);
   1.598 +	file1.Close();
   1.599 +	
   1.600 +	r=file1.Open(TheFs,KFilePri,EFileRead);
   1.601 +	test(r==KErrNone);
   1.602 +	file1.Close();
   1.603 +	
   1.604 +	r=file1.Replace(TheFs,KFilePri,EFileWrite);
   1.605 +	test(r==KErrNone);
   1.606 +	
   1.607 +	r=file1.Rename(KFilePri3);
   1.608 +	test(r==KErrNone);
   1.609 +	file1.Close();
   1.610 +	}
   1.611 +
   1.612 +LOCAL_C void RDirtest()
   1.613 +//
   1.614 +//
   1.615 +//
   1.616 +	{
   1.617 +
   1.618 +	//system
   1.619 +	CDir*	dirEntries;
   1.620 +	TBuf<30> dirNameBuf(KSystemPath);
   1.621 +	dirNameBuf[0]=(TText)gDriveToTest;
   1.622 +	r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
   1.623 +	test(r==KErrNone);
   1.624 +	dir.Close();
   1.625 +	r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
   1.626 +	test(r==KErrNone);
   1.627 +	dirNameBuf.Zero();
   1.628 +	delete dirEntries;
   1.629 +
   1.630 +	//Private
   1.631 +	dirNameBuf=KPrivatePath;
   1.632 +	dirNameBuf[0]=(TText)gDriveToTest;
   1.633 +	r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
   1.634 +	test(r==KErrNone);
   1.635 +	dir.Close();
   1.636 +	r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
   1.637 +	test(r==KErrNone);
   1.638 +	dirNameBuf.Zero();
   1.639 +	delete dirEntries;
   1.640 +
   1.641 +	//Private//false ID
   1.642 +	dirNameBuf=KPrivateFalseID;
   1.643 +	dirNameBuf[0]=(TText)gDriveToTest;
   1.644 +	r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
   1.645 +	test(r==KErrNone);
   1.646 +	dir.Close();
   1.647 +	r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
   1.648 +	test(r==KErrNone);
   1.649 +	dirNameBuf.Zero();
   1.650 +	delete dirEntries;
   1.651 +
   1.652 +	//Private/uid
   1.653 +	TheFs.PrivatePath(dirNameBuf);
   1.654 +	dirNameBuf.Insert(0,_L("?:"));
   1.655 +	dirNameBuf[0]=(TText)gDriveToTest;
   1.656 +	r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
   1.657 +	test(r==KErrNone);
   1.658 +	dir.Close();
   1.659 +	r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
   1.660 +	test(r==KErrNone);
   1.661 +	dirNameBuf.Zero();
   1.662 +	delete dirEntries;
   1.663 +	//Resource
   1.664 +	dirNameBuf=KResourcePath;
   1.665 +	dirNameBuf[0]=(TText)gDriveToTest;
   1.666 +	r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
   1.667 +	test(r==KErrNone);
   1.668 +	r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
   1.669 +	test(r==KErrNone);
   1.670 +	dir.Close();
   1.671 +	delete dirEntries;
   1.672 +	}
   1.673 +
   1.674 +
   1.675 +LOCAL_C void TestTcbAllfiles()
   1.676 +//
   1.677 +//	Test with tcb capabilities
   1.678 +//
   1.679 +	{
   1.680 +	r=TheFs.FileSystemName(fsname,gTheDriveNum);
   1.681 +	test(r==KErrNone);
   1.682 +	r = DismountFileSystem(TheFs, fsname, gTheDriveNum);
   1.683 +	test(r==KErrPermissionDenied);
   1.684 +//	r=TheFs.RemoveFileSystem(fsname);	//can not test due to bug else where fix exists
   1.685 +//	test(r==KErrNone);
   1.686 +//	r=TheFs.AddFileSystem(fsname);
   1.687 +//	test(r==KErrNone);
   1.688 +	r = MountFileSystem(TheFs, fsname, gTheDriveNum);
   1.689 +	test(r==KErrPermissionDenied);
   1.690 +	test.Printf(_L("r=%d"),r);
   1.691 +	r=TheFs.SetDriveName(gTheDriveNum,KDriveName);
   1.692 +	test(r==KErrPermissionDenied);
   1.693 +#ifndef __WINS__
   1.694 + 	r=TheFs.SetVolumeLabel(KVolLable, gTheDriveNum);
   1.695 +	test(r==KErrPermissionDenied);
   1.696 +#endif
   1.697 +
   1.698 +	systemRFsTest();
   1.699 +	ResourceRFsTest();
   1.700 +	privateRFsTest();	
   1.701 +	privateSIDRFstest();
   1.702 +	privatefalseIDRFsTest();
   1.703 +
   1.704 +	systemRFiletest();
   1.705 +	resourceRFiletest();
   1.706 +	privateRFiletest();
   1.707 +	privateSIDRFiletest();
   1.708 +	privatefalseIDRFiletest();
   1.709 +
   1.710 +	//check notifier return values set in rfs testing
   1.711 +	User::WaitForRequest(aStat1);
   1.712 +	User::WaitForRequest(aStat2);
   1.713 +	User::WaitForRequest(aStat3);
   1.714 +	User::WaitForRequest(aStat4);
   1.715 +	test(aStat1==KErrNone);
   1.716 +	test(aStat2==KErrNone);
   1.717 +	test(aStat3==KErrNone);
   1.718 +	test(aStat4==KErrNone);
   1.719 +
   1.720 +	r=TheFs.SetSessionPath(systestname);
   1.721 +	test(r==KErrNone);
   1.722 +	
   1.723 +//Test RRawDisk class
   1.724 +	r=rawdisk.Open(TheFs,gTheDriveNum);
   1.725 +	test(r==KErrNone);
   1.726 +	rawdisk.Close();
   1.727 +
   1.728 +	RDirtest();
   1.729 +
   1.730 +#ifdef __WINS__
   1.731 +	if (User::UpperCase(driveBuf[0]) != 'C')
   1.732 +#endif
   1.733 +		{
   1.734 +		//Test RFormat class
   1.735 +		r=format.Open(TheFs,driveBuf,EHighDensity,count);
   1.736 +		test(r==KErrPermissionDenied);
   1.737 +
   1.738 +		while(count)	
   1.739 +			{
   1.740 +			TInt r=format.Next(count);
   1.741 +			test(r==KErrNone);
   1.742 +			}
   1.743 +		format.Close();
   1.744 +		}
   1.745 +
   1.746 +	driveBuf[0]=(TText)gDriveToTest;
   1.747 +	r=TheFs.ScanDrive(driveBuf);
   1.748 +	RDebug::Print(_L("r=%d"),r);
   1.749 +	test(r==KErrPermissionDenied);
   1.750 +	r=TheFs.CheckDisk(driveBuf);
   1.751 +	test(r==KErrPermissionDenied);
   1.752 +	}
   1.753 +
   1.754 +LOCAL_C void TestCaps()
   1.755 +//
   1.756 +//	test format etc that require certain capabilities
   1.757 +//
   1.758 +	{
   1.759 +#ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
   1.760 +	const char myDiagMsg[] = "Capability Check Failure";
   1.761 +#endif //!__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
   1.762 +	r=RProcess().HasCapability(ECapabilityTCB, __PLATSEC_DIAGNOSTIC_STRING(myDiagMsg));
   1.763 +	test(r);
   1.764 +	r=RProcess().HasCapability(ECapabilityAllFiles, __PLATSEC_DIAGNOSTIC_STRING(myDiagMsg));
   1.765 +	test(r);
   1.766 +	
   1.767 +	driveBuf[0]=(TText)gDriveToTest;
   1.768 +	r=TheFs.SessionPath(temp);
   1.769 +	test(r==KErrNone);
   1.770 +
   1.771 +	test.Printf(_L("Session path: %S"),&temp);
   1.772 +
   1.773 +	r=TheFs.CreatePrivatePath(gTheDriveNum);
   1.774 +	test(r==KErrNone || r== KErrAlreadyExists);
   1.775 +
   1.776 +	TBuf<18> tempPri;
   1.777 +	r=TheFs.PrivatePath(tempPri);
   1.778 +	test(r==KErrNone);
   1.779 +	theprivatepath = _L("?:");
   1.780 +	theprivatepath.Append(tempPri);
   1.781 +
   1.782 +	TestTcbAllfiles();
   1.783 +	
   1.784 +	TFileName thesessionpath;
   1.785 +	r=TheFs.SetSessionToPrivate(gTheDriveNum);
   1.786 +	test(r==KErrNone);
   1.787 +	r=TheFs.SessionPath(thesessionpath);
   1.788 +	test(r==KErrNone);
   1.789 +
   1.790 +	test(thesessionpath == theprivatepath);
   1.791 +	}
   1.792 +
   1.793 +
   1.794 +TFileName dirName;
   1.795 +
   1.796 +LOCAL_C void ScanDir(const TDesC& aName, CDirScan::TScanDirection aDirection, TInt aError)
   1.797 +	{
   1.798 +	CDirScan* scanner = NULL;
   1.799 +	TRAP(r, scanner = CDirScan::NewL(TheFs));
   1.800 +	test(r == KErrNone && scanner);
   1.801 +
   1.802 +	TRAP(r, scanner->SetScanDataL(aName,KEntryAttDir,ESortByName|EAscending,aDirection));
   1.803 +	test(r == KErrNone);
   1.804 +
   1.805 +	CDir *entryList=NULL;
   1.806 +	for (;;)
   1.807 +		{
   1.808 +		TRAP(r, scanner->NextL(entryList));
   1.809 +		test(r == aError);
   1.810 +		if (entryList==NULL)
   1.811 +			break;
   1.812 +
   1.813 +        TInt count=entryList->Count();
   1.814 +
   1.815 +        while (count--)
   1.816 +			{
   1.817 +			TEntry data=(*entryList)[count];
   1.818 +			TBuf<KMaxFileName> path=scanner->AbbreviatedPath();
   1.819 +			
   1.820 +			dirName = path;
   1.821 +			dirName.Append(data.iName);
   1.822 +			test.Printf(_L("    %S\n"),&dirName);
   1.823 +			
   1.824 +			}
   1.825 +		delete entryList;
   1.826 +		entryList=NULL;
   1.827 +		}
   1.828 +	delete scanner;
   1.829 +
   1.830 +	}
   1.831 +
   1.832 +/**
   1.833 +The following test, tests CFileMan and CDirScan API on folders private and sys
   1.834 +to confirm that any operation on these folders for any app with incorrect capability
   1.835 +returns KErrPermissionDenied. This test step was added as a result of DEF051428
   1.836 +("PlatSec: Incorrect errors returned by f32")
   1.837 +*/
   1.838 +LOCAL_C void TestCaging()
   1.839 +	{
   1.840 +	CFileMan* fMan=CFileMan::NewL(TheFs);
   1.841 +	TInt r;
   1.842 +	if(fMan!=NULL)
   1.843 +		{		
   1.844 +		
   1.845 +		// Checking the private path
   1.846 +		TBuf<30> privatepath;
   1.847 +		r=TheFs.PrivatePath(privatepath);
   1.848 +		test.Printf(_L("Private Path is=%S"),&privatepath);
   1.849 +		
   1.850 +		r = TheFs.MkDir(_L("\\Caged\\"));
   1.851 +		test(r==KErrNone || r==KErrAlreadyExists);
   1.852 +		
   1.853 +		CDir* entryCount=NULL;
   1.854 +		r=TheFs.GetDir(_L("\\*.*"),KEntryAttNormal|KEntryAttDir,ESortNone,entryCount);
   1.855 +		test(r==KErrNone);
   1.856 +		
   1.857 +		delete entryCount;
   1.858 +		entryCount=NULL;
   1.859 +
   1.860 +
   1.861 +		//Testing Copy
   1.862 +		CDir* entryCount2=NULL;
   1.863 +		r=fMan->Copy(_L("\\sys\\"),_L("\\Caged\\"));
   1.864 +		test(r == KErrNone);
   1.865 +		r=fMan->Copy(_L("\\*"),_L("\\Caged\\"));
   1.866 +		test(r == KErrNone);
   1.867 +		
   1.868 +		r=TheFs.GetDir(_L("\\Caged\\*.*"),KEntryAttNormal|KEntryAttDir,ESortNone,entryCount2);
   1.869 +		test(r==KErrNone);
   1.870 +		
   1.871 +		delete entryCount2;
   1.872 +		entryCount2=NULL;
   1.873 +	
   1.874 +		r=fMan->Copy(_L("\\private\\two\\moo"),_L("\\private\\two\\mew")); 
   1.875 +		test(r == KErrPathNotFound);
   1.876 +	
   1.877 +		// Create a test file
   1.878 +		RFile testFile;
   1.879 +		r = testFile.Replace(TheFs, _L("\\capTest"),EFileWrite);
   1.880 +		test(r==KErrNone || r==KErrAlreadyExists);
   1.881 +		testFile.Close();
   1.882 +		
   1.883 +		TFileName name;
   1.884 +		name = privatepath;
   1.885 +		name.Append(_L("privateFile.tst"));
   1.886 +		RFile privateFile;
   1.887 +		r = privateFile.Replace(TheFs, name,EFileWrite);
   1.888 +		test(r==KErrNone || r==KErrAlreadyExists);
   1.889 +		privateFile.Close();
   1.890 +
   1.891 +	
   1.892 +		r=fMan->Copy(_L("\\capTest"),_L("\\private\\two\\moo")); 
   1.893 +		test(r == KErrPathNotFound);
   1.894 +		r=fMan->Copy(_L("\\capTest"),_L("\\sys\\bin\\moo")); 
   1.895 +		test(r == KErrPathNotFound); 
   1.896 +		r=fMan->Copy(_L("\\sys\\bin\\capTest"),_L("\\sys\\bin\\moo")); 
   1.897 +		test(r == KErrPathNotFound);
   1.898 +		r=fMan->Copy(_L("\\capTest"),_L("\\sys\\capTest")); 
   1.899 +		test(r == KErrNone || r==KErrAlreadyExists); 
   1.900 +		r=fMan->Copy(_L("\\sys\\*"),_L("\\"));
   1.901 +		test (r==KErrNone);
   1.902 +		r=fMan->Copy(name,_L("\\sys\\"));
   1.903 +		test(r==KErrNone);
   1.904 +
   1.905 +		// Testing Attribs
   1.906 +		r=fMan->Attribs(_L("\\private\\two\\moo"),KEntryAttReadOnly,0,TTime(0)); 
   1.907 +		test(r == KErrPathNotFound);
   1.908 +		r=fMan->Attribs(_L("\\private\\moo"),KEntryAttReadOnly,0,TTime(0)); 
   1.909 +		test(r == KErrNotFound);
   1.910 +		r=fMan->Attribs(name,KEntryAttReadOnly,0,TTime(0));
   1.911 +		test(r == KErrNone);
   1.912 +		r=fMan->Attribs(name,0,KEntryAttReadOnly,TTime(0));
   1.913 +		test(r == KErrNone);
   1.914 +
   1.915 +		// Testing Move
   1.916 +		r=fMan->Move(_L("\\private\\two\\moo"),_L("\\private\\one\\moo"));
   1.917 +		test(r == KErrPathNotFound);
   1.918 +		r=fMan->Move(_L("\\private\\two\\moo.."),_L("\\private\\one\\moo"));
   1.919 +		test(r == KErrPathNotFound);
   1.920 +		r=fMan->Move(_L("\\private\\two\\moo"),_L("\\private\\one\\moo.."));
   1.921 +		test(r == KErrPathNotFound);
   1.922 +		r=fMan->Move(name,_L("\\privateFile.tst"));
   1.923 +		test(r == KErrNone);
   1.924 +		r=fMan->Move(_L("\\privateFile.tst"),name);
   1.925 +		test(r == KErrNone);
   1.926 +
   1.927 +
   1.928 +		// Testing RmDir
   1.929 +		r=fMan->RmDir(_L("\\private\\"));
   1.930 +		test(r == KErrNone);
   1.931 +		// put it back where it was
   1.932 +		r = TheFs.MkDirAll(_L("\\private\\00000001\\"));
   1.933 +		test(r == KErrNone);
   1.934 +		r=fMan->RmDir(_L("\\private\\two\\"));
   1.935 +		test(r == KErrPathNotFound);
   1.936 +		r=fMan->RmDir(_L("\\private\\tw?\\"));
   1.937 +		test(r == KErrBadName);
   1.938 +
   1.939 +		r=fMan->RmDir(_L("\\private\\two\\"));
   1.940 +		test(r == KErrPathNotFound);
   1.941 +		r=fMan->RmDir(_L("\\private\\tw?\\"));
   1.942 +		test(r == KErrBadName);
   1.943 +		
   1.944 +		
   1.945 +		// Testing Rename
   1.946 +		r=fMan->Rename(_L("\\private\\two\\moo"),_L("\\private\\two\\mew")); 
   1.947 +		test(r == KErrPathNotFound);
   1.948 +		
   1.949 +		// Testing Delete
   1.950 +		r=fMan->Delete(_L("\\private\\two\\test")); 
   1.951 +		test(r == KErrPathNotFound);
   1.952 +		r=fMan->Delete(_L("\\private\\moo")); 
   1.953 +		test(r == KErrNotFound);
   1.954 +		
   1.955 +		//Something that actually exists in Private
   1.956 +		r=fMan->Rename(name,_L("\\private\\00000001\\moo")); 
   1.957 +		test(r == KErrNotFound);
   1.958 +		r=fMan->Rename(_L("\\private\\00000001\\moo"),name); 
   1.959 +		test(r == KErrNotFound);
   1.960 +		r=fMan->Copy(name,_L("\\private\\00000001\\moo")); 
   1.961 +		test(r == KErrNotFound);
   1.962 +		r=fMan->Delete(_L("\\private\\00000001\\moo")); 
   1.963 +		test(r == KErrNotFound);
   1.964 +
   1.965 +		// Clean up the test data
   1.966 +		r=fMan->RmDir(_L("\\Caged\\")); 
   1.967 +		test(r == KErrNone);
   1.968 +		r=fMan->Delete(_L("\\capTest")); 
   1.969 +		test(r == KErrNone);
   1.970 +		delete(fMan);
   1.971 +		}
   1.972 +	
   1.973 +	// CDirScan tests
   1.974 +	ScanDir(_L("\\"), CDirScan::EScanUpTree, KErrNone);
   1.975 +	ScanDir(_L("\\"), CDirScan::EScanDownTree, KErrNone);
   1.976 +	ScanDir(_L("\\private\\"), CDirScan::EScanDownTree, KErrNone);
   1.977 +	ScanDir(_L("\\private\\"), CDirScan::EScanUpTree, KErrNone);
   1.978 +	ScanDir(_L("\\sys\\"), CDirScan::EScanDownTree, KErrNone);
   1.979 +	ScanDir(_L("\\sys\\"), CDirScan::EScanUpTree, KErrNone);
   1.980 +	}
   1.981 +
   1.982 +LOCAL_C void CleanupL()
   1.983 +//
   1.984 +// Clean up tests
   1.985 +//
   1.986 +	{
   1.987 +	test.Next(_L("Delete test directory"));
   1.988 +	CFileMan* fMan=CFileMan::NewL(TheFs);
   1.989 +	TInt r=fMan->RmDir(gSessionPath);
   1.990 +	test(r==KErrNone || KErrPathNotFound);
   1.991 +	delete fMan;
   1.992 +	}
   1.993 +
   1.994 +GLDEF_C void CallTestsL(/*TChar aDriveLetter*/)
   1.995 +//
   1.996 +// Do all tests
   1.997 +//
   1.998 +	{
   1.999 +	if( !PlatSec::IsCapabilityEnforced(ECapabilityTCB) || 
  1.1000 +		!PlatSec::IsCapabilityEnforced(ECapabilityAllFiles))
  1.1001 +		{
  1.1002 +		test.Printf(_L("Insufficient capabilities enabled - leaving t_dctcballfiles"));
  1.1003 +		test.Printf(_L("\n")); // Prevent overwrite by next print
  1.1004 +		return;
  1.1005 +		}
  1.1006 +	TurnAllocFailureOff();
  1.1007 +	TheFs.CharToDrive(gDriveToTest,gTheDriveNum);
  1.1008 +	
  1.1009 +	TBuf<30> sesspath;
  1.1010 +	sesspath=_L("?:\\");
  1.1011 +	sesspath[0] = (TText)gDriveToTest;
  1.1012 +
  1.1013 +	TInt r= TheFs.SetSessionPath(sesspath);
  1.1014 +	test(r==KErrNone);
  1.1015 +
  1.1016 +	//cleanup from previous run of this test
  1.1017 +	TBuf<20> delDir;
  1.1018 +	CFileMan* fMan=CFileMan::NewL(TheFs);
  1.1019 +	delDir=KResourcePath;
  1.1020 +	delDir[0]=(TText)gDriveToTest;
  1.1021 +	r=fMan->RmDir(delDir);
  1.1022 +	test(r==KErrNone || KErrNotFound);
  1.1023 +	delDir=KSystemPath;
  1.1024 +	delDir[0]=(TText)gDriveToTest;
  1.1025 +	r=fMan->RmDir(delDir);
  1.1026 +	test(r==KErrNone || KErrNotFound);
  1.1027 +	delDir=KPrivatePath;
  1.1028 +	delDir[0]=(TText)gDriveToTest;
  1.1029 +	r=fMan->RmDir(delDir);
  1.1030 +	test(r==KErrNone || KErrNotFound);
  1.1031 +	delete fMan;
  1.1032 +
  1.1033 +	//check double mode ie that Defpath still works	
  1.1034 +	RFs fs1;
  1.1035 +	RFs fs2;
  1.1036 +	
  1.1037 +	r=fs1.Connect();
  1.1038 +	test(r==KErrNone);
  1.1039 +	r=fs1.SessionPath(sesspath);
  1.1040 +	test(r==KErrNone);
  1.1041 +	test.Printf(_L("session1 Path=%S"),&sesspath);
  1.1042 +
  1.1043 +	TBuf<30> privatepath;
  1.1044 +	r=fs1.SetSessionToPrivate(gTheDriveNum);
  1.1045 +	test(r==KErrNone);
  1.1046 +	r=fs1.PrivatePath(privatepath);
  1.1047 +	test(r==KErrNone);
  1.1048 +	r=privatepath.Compare(KExpectedPrivatePath());
  1.1049 +	test(r==0);
  1.1050 +	r=fs1.SessionPath(sesspath);
  1.1051 +	test(r==KErrNone);
  1.1052 +	r=privatepath.Compare(sesspath.Mid(KPathPosition));
  1.1053 +	test(r==0);
  1.1054 +	r=fs1.CreatePrivatePath(gTheDriveNum);
  1.1055 +	test(r==KErrNone);
  1.1056 +	fs1.Close();
  1.1057 +
  1.1058 +	r=fs2.Connect();
  1.1059 +	test(r==KErrNone);
  1.1060 +	r=fs2.SessionPath(sesspath);
  1.1061 +	test(r==KErrNone);
  1.1062 +	test.Printf(_L("session2 Path=%S"),&sesspath);
  1.1063 +	fs2.Close();
  1.1064 +
  1.1065 +	TestCaps();
  1.1066 +	TestCaging();
  1.1067 +
  1.1068 +	test.Printf(_L("No of files open=%d"), TheFs.ResourceCount());
  1.1069 +
  1.1070 +	CleanupL();
  1.1071 +	}