kerneltest/f32test/server/t_dctcb.cpp
branchRCL_3
changeset 44 3e88ff8f41d5
parent 43 c1f20ce4abcf
equal deleted inserted replaced
43:c1f20ce4abcf 44:3e88ff8f41d5
    11 // Contributors:
    11 // Contributors:
    12 //
    12 //
    13 // Description:
    13 // Description:
    14 //
    14 //
    15 
    15 
    16 #define __E32TEST_EXTENSION__
       
    17 #include <f32file.h>
    16 #include <f32file.h>
    18 #include <e32test.h>
    17 #include <e32test.h>
    19 #include <e32std.h>
    18 #include <e32std.h>
    20 #include <e32std_private.h>
    19 #include <e32std_private.h>
    21 #include <e32svr.h>
    20 #include <e32svr.h>
    86 TRequestStatus aStat1;
    85 TRequestStatus aStat1;
    87 TRequestStatus aStat2;
    86 TRequestStatus aStat2;
    88 TRequestStatus aStat3;
    87 TRequestStatus aStat3;
    89 TRequestStatus aStat4;
    88 TRequestStatus aStat4;
    90 
    89 
       
    90 TVolumeInfo aVolInfo;
       
    91 
    91 TBuf<40> systestfile;
    92 TBuf<40> systestfile;
    92 TBuf<40> pritestfile;
    93 TBuf<40> pritestfile;
    93 TBuf<40> restestfile;
    94 TBuf<40> restestfile;
    94 TBuf<40> systestfile1;
    95 TBuf<40> systestfile1;
    95 TBuf<40> pritestfile1;
    96 TBuf<40> pritestfile1;
   108 // This test case is brought in by INC054580
   109 // This test case is brought in by INC054580
   109 // (NTT Renaming sys ¨Cfolder on C -drive on H2 allows user to access sys -files)
   110 // (NTT Renaming sys ¨Cfolder on C -drive on H2 allows user to access sys -files)
   110 //
   111 //
   111     {
   112     {
   112     TInt r = TheFs.Rename(_L("\\sys"), _L("\\sysbad"));
   113     TInt r = TheFs.Rename(_L("\\sys"), _L("\\sysbad"));
   113     test_KErrNone(r);
   114     test(r == KErrNone);
   114     r = TheFs.Rename(_L("\\resource"), _L("\\resourcebad"));
   115     r = TheFs.Rename(_L("\\resource"), _L("\\resourcebad"));
   115     test_KErrNone(r);
   116     test(r == KErrNone);
   116     r = TheFs.Rename(_L("\\sysbad"), _L("\\sys"));
   117     r = TheFs.Rename(_L("\\sysbad"), _L("\\sys"));
   117     test_KErrNone(r);
   118     test(r == KErrNone);
   118     r = TheFs.Rename(_L("\\resourcebad"), _L("\\resource"));
   119     r = TheFs.Rename(_L("\\resourcebad"), _L("\\resource"));
   119     test_KErrNone(r);
   120     test(r == KErrNone);
   120     r = TheFs.Rename(_L("\\private"), _L("\\privatebad"));
   121     r = TheFs.Rename(_L("\\private"), _L("\\privatebad"));
   121     test_Value(r, r == KErrPermissionDenied);
   122     test(r == KErrPermissionDenied);
   122     }
   123     }
   123 
   124 
   124 LOCAL_C void systemRFsTest()
   125 LOCAL_C void systemRFsTest()
   125 //
   126 //
   126 //	RFs test on system Directory
   127 //	RFs test on system Directory
   132 	
   133 	
   133 	mkdirname.Zero();
   134 	mkdirname.Zero();
   134 	mkdirname.Append(systestname);
   135 	mkdirname.Append(systestname);
   135 	mkdirname.Append(KMkDirSub);
   136 	mkdirname.Append(KMkDirSub);
   136 	r=TheFs.MkDirAll(mkdirname);	
   137 	r=TheFs.MkDirAll(mkdirname);	
   137 	test_KErrNone(r);
   138 	test(r==KErrNone);
   138 
   139 
   139 	TheFs.RmDir(mkdirname);
   140 	TheFs.RmDir(mkdirname);
   140 	test_KErrNone(r);
   141 	test(r==KErrNone);
   141 
   142 
   142 	r=TheFs.SetSubst(systestname,EDriveO);
   143 	r=TheFs.SetSubst(systestname,EDriveO);
   143 	test_Value(r, r == KErrPermissionDenied);
   144 	test(r==KErrPermissionDenied);
   144 	
   145 	
   145 	r=TheFs.RealName(_L("O:\\File.XXX"),realName);
   146 	r=TheFs.RealName(_L("O:\\File.XXX"),realName);
   146 	test_KErrNone(r);
   147 	test(r==KErrNone);
   147 
   148 
   148 	r=TheFs.SetSessionPath(systestname);
   149 	r=TheFs.SetSessionPath(systestname);
   149 	test_Value(r, r == KErrPermissionDenied);
   150 	test(r==KErrPermissionDenied);
   150 	
   151 	
   151 	TheFs.NotifyChange(ENotifyAll,aStat1,systestname);
   152 	TheFs.NotifyChange(ENotifyAll,aStat1,systestname);
   152 	test(aStat1==KErrPermissionDenied);
   153 	test(aStat1==KErrPermissionDenied);
   153 
   154 
   154 	systestfile=KSystemPath;
   155 	systestfile=KSystemPath;
   159 	
   160 	
   160 	oldName=KOldFile;
   161 	oldName=KOldFile;
   161 	oldName[0]=(TText)gDriveToTest;
   162 	oldName[0]=(TText)gDriveToTest;
   162 
   163 
   163 	r=TheFs.GetShortName(systestfile, shortfilename);
   164 	r=TheFs.GetShortName(systestfile, shortfilename);
   164 	test_Value(r, r == KErrPermissionDenied || r==KErrNotSupported);
   165 	test(r==KErrPermissionDenied || r==KErrNotSupported);
   165 
   166 
   166 	r=TheFs.GetLongName(systestfile1, longfilename);
   167 	r=TheFs.GetLongName(systestfile1, longfilename);
   167 	test_Value(r, r == KErrPermissionDenied || r==KErrNotSupported);
   168 	test(r==KErrPermissionDenied || r==KErrNotSupported);
   168 
   169 
   169 	r=file1.Create(TheFs,oldName,EFileWrite);
   170 	r=file1.Create(TheFs,oldName,EFileWrite);
   170 	test_Value(r, r == KErrNone || r==KErrAlreadyExists);
   171 	test(r==KErrNone || r==KErrAlreadyExists);
   171 	file1.Close();
   172 	file1.Close();
   172 
   173 
   173 	r=TheFs.Replace(oldName,systestfile);
   174 	r=TheFs.Replace(oldName,systestfile);
   174 	test_KErrNone(r);
   175 	test(r==KErrNone);
   175 	
   176 	
   176 	r=TheFs.Delete(systestfile1);
   177 	r=TheFs.Delete(systestfile1);
   177 	test_Value(r, r == KErrNone || r==KErrNotFound);
   178 	test(r==KErrNone || r==KErrNotFound);
   178 
   179 
   179 	r=TheFs.Rename(systestfile,systestfile1);
   180 	r=TheFs.Rename(systestfile,systestfile1);
   180 	test_KErrNone(r);
   181 	test(r==KErrNone);
   181 	
   182 	
   182 	r=TheFs.Entry(systestfile1,entry);
   183 	r=TheFs.Entry(systestfile1,entry);
   183 	test_Value(r, r == KErrPermissionDenied);
   184 	test(r==KErrPermissionDenied);
   184 
   185 
   185 	r=TheFs.SetEntry(systestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
   186 	r=TheFs.SetEntry(systestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
   186 	test_KErrNone(r);
   187 	test(r==KErrNone);
   187 
   188 
   188 	r=TheFs.Delete(systestfile1);
   189 	r=TheFs.Delete(systestfile1);
   189 	test_KErrNone(r);
   190 	test(r==KErrNone);
   190 
   191 
   191 	__UHEAP_MARKEND;
   192 	__UHEAP_MARKEND;
   192 
   193 
   193 	}
   194 	}
   194 
   195 
   204 	
   205 	
   205 	mkdirname.Zero();
   206 	mkdirname.Zero();
   206 	mkdirname.Append(restestname);
   207 	mkdirname.Append(restestname);
   207 	mkdirname.Append(KMkDirSub);
   208 	mkdirname.Append(KMkDirSub);
   208 	r=TheFs.MkDirAll(mkdirname);	
   209 	r=TheFs.MkDirAll(mkdirname);	
   209 	test_KErrNone(r);
   210 	test(r==KErrNone);
   210 
   211 
   211 	TheFs.RmDir(mkdirname);
   212 	TheFs.RmDir(mkdirname);
   212 	test_KErrNone(r);
   213 	test(r==KErrNone);
   213 
   214 
   214 	r=TheFs.SetSubst(restestname,EDriveO);
   215 	r=TheFs.SetSubst(restestname,EDriveO);
   215 	test_Value(r, r == KErrPermissionDenied || r==KErrGeneral);
   216 	test(r==KErrPermissionDenied || r==KErrGeneral);
   216 	
   217 	
   217 	r=TheFs.RealName(_L("O:\\File.XXX"),realName);
   218 	r=TheFs.RealName(_L("O:\\File.XXX"),realName);
   218 	test_KErrNone(r);
   219 	test(r==KErrNone);
   219 
   220 
   220 	r=TheFs.SetSessionPath(restestname);
   221 	r=TheFs.SetSessionPath(restestname);
   221 	test_KErrNone(r);
   222 	test(r==KErrNone);
   222 	
   223 	
   223 	TheFs.NotifyChange(ENotifyAll,aStat4,restestname);
   224 	TheFs.NotifyChange(ENotifyAll,aStat4,restestname);
   224 	test(aStat4==KRequestPending);
   225 	test(aStat4==KRequestPending);
   225 
   226 
   226 	restestfile=KResourcePath;
   227 	restestfile=KResourcePath;
   231 	
   232 	
   232 	oldName=KOldFile;
   233 	oldName=KOldFile;
   233 	oldName[0]=(TText)gDriveToTest;
   234 	oldName[0]=(TText)gDriveToTest;
   234 
   235 
   235 	r=TheFs.GetShortName(restestfile, shortfilename);
   236 	r=TheFs.GetShortName(restestfile, shortfilename);
   236 //	test_Value(r, r == KErrNone || r == KErrNotFound || r==KErrNotSupported);
   237 	test(r==KErrNone || KErrNotFound || r==KErrNotSupported);
   237 	test(r == KErrNone || KErrNotFound || r==KErrNotSupported);
       
   238 
   238 
   239 	r=TheFs.GetLongName(restestfile1, longfilename);
   239 	r=TheFs.GetLongName(restestfile1, longfilename);
   240 //	test_Value(r, r == KErrNone || r == KErrNotFound || r==KErrNotSupported);
   240 	test(r==KErrNone || KErrNotFound || r==KErrNotSupported);
   241 	test(r == KErrNone || KErrNotFound || r==KErrNotSupported);
       
   242 
   241 
   243 	r=file1.Create(TheFs,oldName,EFileWrite);
   242 	r=file1.Create(TheFs,oldName,EFileWrite);
   244 	test_Value(r, r == KErrNone || r==KErrAlreadyExists);
   243 	test(r==KErrNone || r==KErrAlreadyExists);
   245 	file1.Close();
   244 	file1.Close();
   246 
   245 
   247 	r=TheFs.Replace(oldName,restestfile);
   246 	r=TheFs.Replace(oldName,restestfile);
   248 	test_KErrNone(r);
   247 	test(r==KErrNone);
   249 	
   248 	
   250 	r=TheFs.Rename(restestfile,restestfile1);
   249 	r=TheFs.Rename(restestfile,restestfile1);
   251 	test_KErrNone(r);
   250 	test(r==KErrNone);
   252 	
   251 	
   253 	r=TheFs.Entry(restestfile1,entry);
   252 	r=TheFs.Entry(restestfile1,entry);
   254 	test_KErrNone(r);
   253 	test(r==KErrNone);
   255 
   254 
   256 	r=TheFs.SetEntry(restestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
   255 	r=TheFs.SetEntry(restestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
   257 	test_KErrNone(r);
   256 	test(r==KErrNone);
   258 
   257 
   259 	r=TheFs.Delete(restestfile1);
   258 	r=TheFs.Delete(restestfile1);
   260 	test_KErrNone(r);
   259 	test(r==KErrNone);
   261 
   260 
   262 	__UHEAP_MARK;
   261 	__UHEAP_MARK;
   263 
   262 
   264 	}
   263 	}
   265 
   264 
   277 	mkdirname.Zero();
   276 	mkdirname.Zero();
   278 	mkdirname.Append(pritestfalseidname);
   277 	mkdirname.Append(pritestfalseidname);
   279 	mkdirname.Append(KMkDirSub);
   278 	mkdirname.Append(KMkDirSub);
   280 
   279 
   281 	r=TheFs.MkDirAll(mkdirname);	
   280 	r=TheFs.MkDirAll(mkdirname);	
   282 	test_Value(r, r == KErrPermissionDenied);
   281 	test(r==KErrPermissionDenied);
   283 
   282 
   284 	r=TheFs.RmDir(mkdirname);	
   283 	r=TheFs.RmDir(mkdirname);	
   285 	test_Value(r, r == KErrPermissionDenied);
   284 	test(r==KErrPermissionDenied);
   286 
   285 
   287 	r=TheFs.SetSubst(pritestfalseidname,EDriveO);
   286 	r=TheFs.SetSubst(pritestfalseidname,EDriveO);
   288 	test_Value(r, r == KErrPermissionDenied);
   287 	test(r==KErrPermissionDenied);
   289 
   288 
   290 	r=TheFs.RealName(_L("O:\\File.XXX"),realName);
   289 	r=TheFs.RealName(_L("O:\\File.XXX"),realName);
   291 	test_KErrNone(r);
   290 	test(r==KErrNone);
   292 
   291 
   293 	r=TheFs.SetSessionPath(pritestfalseidname);
   292 	r=TheFs.SetSessionPath(pritestfalseidname);
   294 	test_Value(r, r == KErrPermissionDenied);
   293 	test(r==KErrPermissionDenied);
   295 
   294 
   296 	TheFs.NotifyChange(ENotifyAll,aStat2,pritestfalseidname);
   295 	TheFs.NotifyChange(ENotifyAll,aStat2,pritestfalseidname);
   297 	test_Value(r, r == KErrPermissionDenied);
   296 	test(r==KErrPermissionDenied);
   298 
   297 
   299 
   298 
   300 	pritestfile=KPrivateFalseID;
   299 	pritestfile=KPrivateFalseID;
   301 	pritestfile[0]=(TText)('A' + gTheDriveNum);
   300 	pritestfile[0]=(TText)('A' + gTheDriveNum);
   302 	pritestfile1=pritestfile;
   301 	pritestfile1=pritestfile;
   305 	
   304 	
   306 	oldName=KOldFile;
   305 	oldName=KOldFile;
   307 	oldName[0]=(TText)gDriveToTest;
   306 	oldName[0]=(TText)gDriveToTest;
   308 
   307 
   309 	r=TheFs.GetShortName(pritestfile, shortfilename);
   308 	r=TheFs.GetShortName(pritestfile, shortfilename);
   310 	test_Value(r, r == KErrPermissionDenied || r==KErrNotSupported);
   309 	test(r==KErrPermissionDenied || r==KErrNotSupported);
   311 
   310 
   312 	r=TheFs.GetLongName(pritestfile1, longfilename);
   311 	r=TheFs.GetLongName(pritestfile1, longfilename);
   313 	test_Value(r, r == KErrPermissionDenied || r==KErrNotSupported);
   312 	test(r==KErrPermissionDenied || r==KErrNotSupported);
   314 
   313 
   315 	r=file1.Create(TheFs,oldName,EFileWrite);
   314 	r=file1.Create(TheFs,oldName,EFileWrite);
   316 	test_Value(r, r == KErrNone || r==KErrAlreadyExists);
   315 	test(r==KErrNone || r==KErrAlreadyExists);
   317 	file1.Close();
   316 	file1.Close();
   318 
   317 
   319 	r=TheFs.Replace(oldName,pritestfile);
   318 	r=TheFs.Replace(oldName,pritestfile);
   320 	test_Value(r, r == KErrPermissionDenied);
   319 	test(r==KErrPermissionDenied);
   321 	
   320 	
   322 	r=TheFs.Rename(pritestfile,pritestfile1);
   321 	r=TheFs.Rename(pritestfile,pritestfile1);
   323 	test_Value(r, r == KErrPermissionDenied);
   322 	test(r==KErrPermissionDenied);
   324 	
   323 	
   325 	r=TheFs.Entry(pritestfile1,entry);
   324 	r=TheFs.Entry(pritestfile1,entry);
   326 	test_Value(r, r == KErrPermissionDenied);
   325 	test(r==KErrPermissionDenied);
   327 
   326 
   328 	r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
   327 	r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
   329 	test_Value(r, r == KErrPermissionDenied);
   328 	test(r==KErrPermissionDenied);
   330 
   329 
   331 	r=TheFs.Delete(pritestfile1);
   330 	r=TheFs.Delete(pritestfile1);
   332 	test_Value(r, r == KErrPermissionDenied);
   331 	test(r==KErrPermissionDenied);
   333 
   332 
   334 	__UHEAP_MARKEND;
   333 	__UHEAP_MARKEND;
   335 	}
   334 	}
   336 
   335 
   337 
   336 
   349 	mkdirname.Zero();
   348 	mkdirname.Zero();
   350 	mkdirname.Append(pritestname);
   349 	mkdirname.Append(pritestname);
   351 	mkdirname.Append(KMkDirSub);
   350 	mkdirname.Append(KMkDirSub);
   352 
   351 
   353 	r=TheFs.MkDirAll(mkdirname);	
   352 	r=TheFs.MkDirAll(mkdirname);	
   354 	test_Value(r, r == KErrPermissionDenied);
   353 	test(r==KErrPermissionDenied);
   355 
   354 
   356 	r=TheFs.RmDir(mkdirname);	
   355 	r=TheFs.RmDir(mkdirname);	
   357 	test_Value(r, r == KErrPermissionDenied);
   356 	test(r==KErrPermissionDenied);
   358 
   357 
   359 	r=TheFs.SetSubst(pritestname,EDriveO);
   358 	r=TheFs.SetSubst(pritestname,EDriveO);
   360 	test_Value(r, r == KErrPermissionDenied);
   359 	test(r==KErrPermissionDenied);
   361 
   360 
   362 	r=TheFs.RealName(_L("O:\\File.XXX"),realName);
   361 	r=TheFs.RealName(_L("O:\\File.XXX"),realName);
   363 	test_KErrNone(r);
   362 	test(r==KErrNone);
   364 
   363 
   365 	r=TheFs.SetSessionPath(pritestname);
   364 	r=TheFs.SetSessionPath(pritestname);
   366 	test_Value(r, r == KErrPermissionDenied);
   365 	test(r==KErrPermissionDenied);
   367 
   366 
   368 	TheFs.NotifyChange(ENotifyAll,aStat2,pritestname);
   367 	TheFs.NotifyChange(ENotifyAll,aStat2,pritestname);
   369 	test_Value(r, r == KErrPermissionDenied);
   368 	test(r==KErrPermissionDenied);
   370 
   369 
   371 
   370 
   372 	pritestfile=KPrivatePath;
   371 	pritestfile=KPrivatePath;
   373 	pritestfile[0]=(TText)('A' + gTheDriveNum);
   372 	pritestfile[0]=(TText)('A' + gTheDriveNum);
   374 	pritestfile1=pritestfile;
   373 	pritestfile1=pritestfile;
   377 	
   376 	
   378 	oldName=KOldFile;
   377 	oldName=KOldFile;
   379 	oldName[0]=(TText)gDriveToTest;
   378 	oldName[0]=(TText)gDriveToTest;
   380 
   379 
   381 	r=TheFs.GetShortName(pritestfile, shortfilename);
   380 	r=TheFs.GetShortName(pritestfile, shortfilename);
   382 	test_Value(r, r == KErrPermissionDenied || r==KErrNotSupported);
   381 	test(r==KErrPermissionDenied || r==KErrNotSupported);
   383 
   382 
   384 	r=TheFs.GetLongName(pritestfile1, longfilename);
   383 	r=TheFs.GetLongName(pritestfile1, longfilename);
   385 	test_Value(r, r == KErrPermissionDenied || r==KErrNotSupported);
   384 	test(r==KErrPermissionDenied || r==KErrNotSupported);
   386 
   385 
   387 	r=file1.Create(TheFs,oldName,EFileWrite);
   386 	r=file1.Create(TheFs,oldName,EFileWrite);
   388 	test_Value(r, r == KErrNone || r==KErrAlreadyExists);
   387 	test(r==KErrNone || r==KErrAlreadyExists);
   389 	file1.Close();
   388 	file1.Close();
   390 
   389 
   391 	r=TheFs.Replace(oldName,pritestfile);
   390 	r=TheFs.Replace(oldName,pritestfile);
   392 	test_Value(r, r == KErrPermissionDenied);
   391 	test(r==KErrPermissionDenied);
   393 	
   392 	
   394 	r=TheFs.Rename(pritestfile,pritestfile1);
   393 	r=TheFs.Rename(pritestfile,pritestfile1);
   395 	test_Value(r, r == KErrPermissionDenied);
   394 	test(r==KErrPermissionDenied);
   396 	
   395 	
   397 	r=TheFs.Entry(pritestfile1,entry);
   396 	r=TheFs.Entry(pritestfile1,entry);
   398 	test_Value(r, r == KErrPermissionDenied);
   397 	test(r==KErrPermissionDenied);
   399 
   398 
   400 	r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
   399 	r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
   401 	test_Value(r, r == KErrPermissionDenied);
   400 	test(r==KErrPermissionDenied);
   402 
   401 
   403 	r=TheFs.Delete(pritestfile1);
   402 	r=TheFs.Delete(pritestfile1);
   404 	test_Value(r, r == KErrPermissionDenied);
   403 	test(r==KErrPermissionDenied);
   405 
   404 
   406 	__UHEAP_MARKEND;
   405 	__UHEAP_MARKEND;
   407 	}
   406 	}
   408 
   407 
   409 
   408 
   416 
   415 
   417 	mkdirname.Zero();
   416 	mkdirname.Zero();
   418 	mkdirname.Append(theprivatepath);
   417 	mkdirname.Append(theprivatepath);
   419 	mkdirname.Append(KMkDirSub);
   418 	mkdirname.Append(KMkDirSub);
   420 	r=TheFs.MkDirAll(mkdirname);	
   419 	r=TheFs.MkDirAll(mkdirname);	
   421 	test_KErrNone(r);
   420 	test(r==KErrNone);
   422 
   421 
   423 	r=TheFs.RmDir(mkdirname);	
   422 	r=TheFs.RmDir(mkdirname);	
   424 	test_KErrNone(r);
   423 	test(r==KErrNone);
   425 
   424 
   426 	r=TheFs.SetSubst(theprivatepath,EDriveO);	
   425 	r=TheFs.SetSubst(theprivatepath,EDriveO);	
   427 	test_Value(r, r == KErrPermissionDenied || r==KErrGeneral); // Drive may already be substituted
   426 	test(r==KErrPermissionDenied || r==KErrGeneral); // Drive may already be substituted
   428 
   427 
   429 	r=TheFs.RealName(_L("O:\\File.XXX"),realName);
   428 	r=TheFs.RealName(_L("O:\\File.XXX"),realName);
   430 	test_KErrNone(r);
   429 	test(r==KErrNone);
   431 
   430 
   432 	r=TheFs.SetSessionPath(theprivatepath);
   431 	r=TheFs.SetSessionPath(theprivatepath);
   433 	test_KErrNone(r);
   432 	test(r==KErrNone);
   434 
   433 
   435 	TheFs.NotifyChange(ENotifyAll,aStat3,theprivatepath);
   434 	TheFs.NotifyChange(ENotifyAll,aStat3,theprivatepath);
   436 	test(aStat3==KRequestPending);
   435 	test(aStat3==KRequestPending);
   437 
   436 
   438 	pritestfile=theprivatepath;
   437 	pritestfile=theprivatepath;
   443 	
   442 	
   444 	oldName=KOldFile;
   443 	oldName=KOldFile;
   445 	oldName[0]=(TText)gDriveToTest;
   444 	oldName[0]=(TText)gDriveToTest;
   446 
   445 
   447 	r=TheFs.GetShortName(pritestfile, shortfilename);
   446 	r=TheFs.GetShortName(pritestfile, shortfilename);
   448 	test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported);
   447 	test(r==KErrNone || r==KErrNotFound || r==KErrNotSupported);
   449 
   448 
   450 	r=TheFs.GetLongName(pritestfile1, longfilename);
   449 	r=TheFs.GetLongName(pritestfile1, longfilename);
   451 	test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported);
   450 	test(r==KErrNone || r==KErrNotFound || r==KErrNotSupported);
   452 
   451 
   453 	r=file1.Create(TheFs,oldName,EFileWrite);
   452 	r=file1.Create(TheFs,oldName,EFileWrite);
   454 	test_Value(r, r == KErrNone || r==KErrAlreadyExists);
   453 	test(r==KErrNone || r==KErrAlreadyExists);
   455 	file1.Close();
   454 	file1.Close();
   456 
   455 
   457 	r=TheFs.Replace(oldName,pritestfile);
   456 	r=TheFs.Replace(oldName,pritestfile);
   458 	test_KErrNone(r);
   457 	test(r==KErrNone);
   459 	
   458 	
   460 	r=TheFs.Rename(pritestfile,pritestfile1);
   459 	r=TheFs.Rename(pritestfile,pritestfile1);
   461 	test_Value(r, r == KErrNone || r==KErrAlreadyExists);
   460 	test(r==KErrNone || r==KErrAlreadyExists);
   462 	
   461 	
   463 	r=TheFs.Entry(pritestfile1,entry);
   462 	r=TheFs.Entry(pritestfile1,entry);
   464 	test_KErrNone(r);
   463 	test(r==KErrNone);
   465 
   464 
   466 	r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
   465 	r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
   467 	test_KErrNone(r);
   466 	test(r==KErrNone);
   468 
   467 
   469 	r=TheFs.Delete(pritestfile1);
   468 	r=TheFs.Delete(pritestfile1);
   470 	test_KErrNone(r);
   469 	test(r==KErrNone);
   471 
   470 
   472 	__UHEAP_MARKEND;
   471 	__UHEAP_MARKEND;
   473 	}
   472 	}
   474 
   473 
   475 
   474 
   479 //
   478 //
   480 	{
   479 	{
   481 	__UHEAP_MARK;
   480 	__UHEAP_MARK;
   482 
   481 
   483 	r=TheFs.SetSessionPath(systestname);
   482 	r=TheFs.SetSessionPath(systestname);
   484 	test_Value(r, r == KErrPermissionDenied);
   483 	test(r==KErrPermissionDenied);
   485 
   484 
   486 	r=file1.Temp(TheFs,systestname,fromTemp,EFileWrite);
   485 	r=file1.Temp(TheFs,systestname,fromTemp,EFileWrite);
   487 	test_KErrNone(r);
   486 	test(r==KErrNone);
   488 	file1.Close();
   487 	file1.Close();
   489 
   488 
   490 	TBuf<25> sysfilename;
   489 	TBuf<25> sysfilename;
   491 	sysfilename.Append(systestname);
   490 	sysfilename.Append(systestname);
   492 	sysfilename.Append(KFileSys);
   491 	sysfilename.Append(KFileSys);
   493 
   492 
   494 	r=file1.Create(TheFs,sysfilename,EFileWrite);
   493 	r=file1.Create(TheFs,sysfilename,EFileWrite);
   495 	test_KErrNone(r);
   494 	test(r==KErrNone);
   496 	file1.Close();
   495 	file1.Close();
   497 
   496 
   498 	r=file1.Open(TheFs,sysfilename,EFileWrite);
   497 	r=file1.Open(TheFs,sysfilename,EFileWrite);
   499 	test_KErrNone(r);
   498 	test(r==KErrNone);
   500 	file1.Close();
   499 	file1.Close();
   501 	
   500 	
   502 	r=file1.Open(TheFs,sysfilename,EFileRead);
   501 	r=file1.Open(TheFs,sysfilename,EFileRead);
   503 	test_Value(r, r == KErrPermissionDenied);
   502 	test(r==KErrPermissionDenied);
   504 	file1.Close();
   503 	file1.Close();
   505 	
   504 	
   506 	r=file1.Replace(TheFs,sysfilename,EFileWrite);
   505 	r=file1.Replace(TheFs,sysfilename,EFileWrite);
   507 	test_KErrNone(r);
   506 	test(r==KErrNone);
   508 
   507 
   509 	TBuf<25> sysfilename2;
   508 	TBuf<25> sysfilename2;
   510 	sysfilename2.Append(systestname);
   509 	sysfilename2.Append(systestname);
   511 	sysfilename2.Append(KFileSys3);
   510 	sysfilename2.Append(KFileSys3);
   512 		
   511 		
   513 	r=file1.Rename(sysfilename2);
   512 	r=file1.Rename(sysfilename2);
   514 	test_KErrNone(r);
   513 	test(r==KErrNone);
   515 	file1.Close();
   514 	file1.Close();
   516 
   515 
   517     TFindFile finder(TheFs);
   516     TFindFile finder(TheFs);
   518     CDir* dir = NULL;
   517     CDir* dir = NULL;
   519     r=finder.FindWildByDir(KWildFile, KWildPath, dir);
   518     r=finder.FindWildByDir(KWildFile, KWildPath, dir);
   520 	if (!(r==KErrPermissionDenied))
   519 	if (!(r==KErrPermissionDenied))
   521         test.Printf(_L("T_DCTCB: test find wildcards r = %d (expected KErrPermissionDenied)\n"), r);
   520         test.Printf(_L("T_DCTCB: test find wildcards r = %d (expected KErrPermissionDenied)\n"), r);
   522 	test_Value(r, r == KErrPermissionDenied);
   521 	test(r==KErrPermissionDenied);
   523 	delete dir;
   522 	delete dir;
   524 
   523 
   525 	__UHEAP_MARKEND;
   524 	__UHEAP_MARKEND;
   526 	}
   525 	}
   527 
   526 
   531 //
   530 //
   532 	{
   531 	{
   533 	__UHEAP_MARK;
   532 	__UHEAP_MARK;
   534 
   533 
   535 	r=TheFs.SetSessionPath(restestname);
   534 	r=TheFs.SetSessionPath(restestname);
   536 	test_KErrNone(r);
   535 	test(r==KErrNone);
   537 
   536 
   538 	r=file1.Temp(TheFs,restestname,fromTemp,EFileWrite);
   537 	r=file1.Temp(TheFs,restestname,fromTemp,EFileWrite);
   539 	test_KErrNone(r);
   538 	test(r==KErrNone);
   540 	file1.Close();
   539 	file1.Close();
   541 
   540 
   542 	r=file1.Create(TheFs,KFileRes,EFileWrite);
   541 	r=file1.Create(TheFs,KFileRes,EFileWrite);
   543 	test_KErrNone(r);
   542 	test(r==KErrNone);
   544 	file1.Close();
   543 	file1.Close();
   545 
   544 
   546 	r=file1.Open(TheFs,KFileRes,EFileWrite|EFileShareExclusive );
   545 	r=file1.Open(TheFs,KFileRes,EFileWrite|EFileShareExclusive );
   547 	test_KErrNone(r);
   546 	test(r==KErrNone);
   548 	
   547 	
   549 	r=file1.Rename(KFileRes3);
   548 	r=file1.Rename(KFileRes3);
   550 	test_KErrNone(r);
   549 	test(r==KErrNone);
   551 	file1.Close();
   550 	file1.Close();
   552 
   551 
   553 	r=file1.Open(TheFs,KFileRes3,EFileShareReadersOrWriters|EFileRead);
   552 	r=file1.Open(TheFs,KFileRes3,EFileShareReadersOrWriters|EFileRead);
   554 	test_KErrNone(r);
   553 	test(r==KErrNone);
   555 	file1.Close();
   554 	file1.Close();
   556 
   555 
   557 	r=file1.Open(TheFs,KFileRes3,EFileShareReadersOrWriters|EFileWrite);
   556 	r=file1.Open(TheFs,KFileRes3,EFileShareReadersOrWriters|EFileWrite);
   558 	test_KErrNone(r);
   557 	test(r==KErrNone);
   559 	file1.Close();
   558 	file1.Close();
   560 
   559 
   561 	r=file1.Open(TheFs,KFileRes3,EFileShareReadersOnly);
   560 	r=file1.Open(TheFs,KFileRes3,EFileShareReadersOnly);
   562 	test_KErrNone(r);
   561 	test(r==KErrNone);
   563 
   562 
   564 	r=file1.ChangeMode(EFileShareExclusive);
   563 	r=file1.ChangeMode(EFileShareExclusive);
   565 	test_KErrNone(r);
   564 	test(r==KErrNone);
   566 	file1.Close();
   565 	file1.Close();
   567 
   566 
   568 	r=file1.Replace(TheFs,KFileRes,EFileWrite);
   567 	r=file1.Replace(TheFs,KFileRes,EFileWrite);
   569 	test_KErrNone(r);
   568 	test(r==KErrNone);
   570 	file1.Close();	
   569 	file1.Close();	
   571 	
   570 	
   572 	__UHEAP_MARKEND;
   571 	__UHEAP_MARKEND;
   573 
   572 
   574 	}
   573 	}
   580 //
   579 //
   581 	{
   580 	{
   582 	__UHEAP_MARK;
   581 	__UHEAP_MARK;
   583 
   582 
   584 	r=TheFs.SetSessionPath(pritestfalseidname);
   583 	r=TheFs.SetSessionPath(pritestfalseidname);
   585 	test_Value(r, r == KErrPermissionDenied);
   584 	test(r==KErrPermissionDenied);
   586 
   585 
   587 	r=file1.Temp(TheFs,pritestfalseidname,fromTemp,EFileWrite);
   586 	r=file1.Temp(TheFs,pritestfalseidname,fromTemp,EFileWrite);
   588 	test_Value(r, r == KErrPermissionDenied);
   587 	test(r==KErrPermissionDenied);
   589 	file1.Close();
   588 	file1.Close();
   590 
   589 
   591 	// Since can't set session path create explicit path
   590 	// Since can't set session path create explicit path
   592 	pritestfile=KPrivateFalseID;
   591 	pritestfile=KPrivateFalseID;
   593 	pritestfile[0]=(TText)('A' + gTheDriveNum);
   592 	pritestfile[0]=(TText)('A' + gTheDriveNum);
   594 	pritestfile.Append(KFilePri);
   593 	pritestfile.Append(KFilePri);
   595 
   594 
   596 	r=file1.Create(TheFs,pritestfile,EFileWrite);
   595 	r=file1.Create(TheFs,pritestfile,EFileWrite);
   597 	test_Value(r, r == KErrPermissionDenied);
   596 	test(r==KErrPermissionDenied);
   598 	file1.Close();
   597 	file1.Close();
   599 
   598 
   600 	r=file1.Open(TheFs,pritestfile,EFileWrite);
   599 	r=file1.Open(TheFs,pritestfile,EFileWrite);
   601 	test_Value(r, r == KErrPermissionDenied);
   600 	test(r==KErrPermissionDenied);
   602 	file1.Close();
   601 	file1.Close();
   603 	
   602 	
   604 	r=file1.Open(TheFs,pritestfile,EFileRead);
   603 	r=file1.Open(TheFs,pritestfile,EFileRead);
   605 	test_Value(r, r == KErrPermissionDenied);
   604 	test(r==KErrPermissionDenied);
   606 	file1.Close();
   605 	file1.Close();
   607 		
   606 		
   608 	r=file1.Replace(TheFs,pritestfile,EFileWrite);
   607 	r=file1.Replace(TheFs,pritestfile,EFileWrite);
   609 	test_Value(r, r == KErrPermissionDenied);
   608 	test(r==KErrPermissionDenied);
   610 
   609 
   611 	// File does not exist so can't rename it	
   610 	// File does not exist so can't rename it	
   612 /*	r=file1.Rename(KFilePri3);
   611 /*	r=file1.Rename(KFilePri3);
   613 	test_Value(r, r == KErrAlreadyExists || r==KErrNone);
   612 	test(r==KErrAlreadyExists || r==KErrNone);
   614 	file1.Close();
   613 	file1.Close();
   615 */	__UHEAP_MARKEND;
   614 */	__UHEAP_MARKEND;
   616 	}
   615 	}
   617 
   616 
   618 
   617 
   622 //
   621 //
   623 	{
   622 	{
   624 	__UHEAP_MARK;
   623 	__UHEAP_MARK;
   625 
   624 
   626 	r=TheFs.SetSessionPath(pritestname);
   625 	r=TheFs.SetSessionPath(pritestname);
   627 	test_Value(r, r == KErrPermissionDenied);
   626 	test(r==KErrPermissionDenied);
   628 
   627 
   629 	r=file1.Temp(TheFs,pritestname,fromTemp,EFileWrite);
   628 	r=file1.Temp(TheFs,pritestname,fromTemp,EFileWrite);
   630 	test_Value(r, r == KErrPermissionDenied);
   629 	test(r==KErrPermissionDenied);
   631 	file1.Close();
   630 	file1.Close();
   632 
   631 
   633 	// Since can't set session path create explicit path
   632 	// Since can't set session path create explicit path
   634 	pritestfile=KPrivatePath;
   633 	pritestfile=KPrivatePath;
   635 	pritestfile[0]=(TText)('A' + gTheDriveNum);
   634 	pritestfile[0]=(TText)('A' + gTheDriveNum);
   636 	pritestfile.Append(KFilePri);
   635 	pritestfile.Append(KFilePri);
   637 
   636 
   638 	r=file1.Create(TheFs,pritestfile,EFileWrite);
   637 	r=file1.Create(TheFs,pritestfile,EFileWrite);
   639 	test_Value(r, r == KErrPermissionDenied);
   638 	test(r==KErrPermissionDenied);
   640 	file1.Close();
   639 	file1.Close();
   641 
   640 
   642 	r=file1.Open(TheFs,pritestfile,EFileWrite);
   641 	r=file1.Open(TheFs,pritestfile,EFileWrite);
   643 	test_Value(r, r == KErrPermissionDenied);
   642 	test(r==KErrPermissionDenied);
   644 	file1.Close();
   643 	file1.Close();
   645 	
   644 	
   646 	r=file1.Open(TheFs,pritestfile,EFileRead);
   645 	r=file1.Open(TheFs,pritestfile,EFileRead);
   647 	test_Value(r, r == KErrPermissionDenied);
   646 	test(r==KErrPermissionDenied);
   648 	file1.Close();
   647 	file1.Close();
   649 	
   648 	
   650 	r=file1.Replace(TheFs,pritestfile,EFileWrite);
   649 	r=file1.Replace(TheFs,pritestfile,EFileWrite);
   651 	test_Value(r, r == KErrPermissionDenied);
   650 	test(r==KErrPermissionDenied);
   652 
   651 
   653 	// File does not exist so can't be renamed	
   652 	// File does not exist so can't be renamed	
   654 /*	r=file1.Rename(KFilePri3);
   653 /*	r=file1.Rename(KFilePri3);
   655 	test_KErrNone(r);
   654 	test(r==KErrNone);
   656 	file1.Close();
   655 	file1.Close();
   657 */
   656 */
   658 	__UHEAP_MARKEND;
   657 	__UHEAP_MARKEND;
   659 	}
   658 	}
   660 
   659 
   664 //Rfile Testing with session path set to //Private//UID//
   663 //Rfile Testing with session path set to //Private//UID//
   665 //
   664 //
   666 	{
   665 	{
   667 	__UHEAP_MARK;
   666 	__UHEAP_MARK;
   668 	r=TheFs.SetSessionToPrivate(gTheDriveNum);
   667 	r=TheFs.SetSessionToPrivate(gTheDriveNum);
   669 	test_KErrNone(r);
   668 	test(r==KErrNone);
   670 	
   669 	
   671 	r=file1.Temp(TheFs,theprivatepath,fromTemp,EFileWrite);
   670 	r=file1.Temp(TheFs,theprivatepath,fromTemp,EFileWrite);
   672 	test_KErrNone(r);
   671 	test(r==KErrNone);
   673 	file1.Close();
   672 	file1.Close();
   674 
   673 
   675 	r=file1.Create(TheFs,KFilePri,EFileWrite);
   674 	r=file1.Create(TheFs,KFilePri,EFileWrite);
   676 	test_KErrNone(r);
   675 	test(r==KErrNone);
   677 	file1.Close();
   676 	file1.Close();
   678 
   677 
   679 	r=file1.Open(TheFs,KFilePri,EFileWrite);
   678 	r=file1.Open(TheFs,KFilePri,EFileWrite);
   680 	test_KErrNone(r);
   679 	test(r==KErrNone);
   681 	file1.Close();
   680 	file1.Close();
   682 	
   681 	
   683 	r=file1.Open(TheFs,KFilePri,EFileRead);
   682 	r=file1.Open(TheFs,KFilePri,EFileRead);
   684 	test_KErrNone(r);
   683 	test(r==KErrNone);
   685 	file1.Close();
   684 	file1.Close();
   686 	
   685 	
   687 	r=file1.Replace(TheFs,KFilePri,EFileWrite);
   686 	r=file1.Replace(TheFs,KFilePri,EFileWrite);
   688 	test_KErrNone(r);
   687 	test(r==KErrNone);
   689 	
   688 	
   690 	r=file1.Rename(KFilePri3);
   689 	r=file1.Rename(KFilePri3);
   691 	test_KErrNone(r);
   690 	test(r==KErrNone);
   692 	file1.Close();
   691 	file1.Close();
   693 	__UHEAP_MARKEND;
   692 	__UHEAP_MARKEND;
   694 	}
   693 	}
   695 
   694 
   696 LOCAL_C void RDirtest()
   695 LOCAL_C void RDirtest()
   703 	//system
   702 	//system
   704 	CDir*	dirEntries;
   703 	CDir*	dirEntries;
   705 	TBuf<30> dirNameBuf(KSystemPath);
   704 	TBuf<30> dirNameBuf(KSystemPath);
   706 	dirNameBuf[0]=(TText)gDriveToTest;
   705 	dirNameBuf[0]=(TText)gDriveToTest;
   707 	r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
   706 	r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
   708 	test_Value(r, r == KErrPermissionDenied);
   707 	test(r==KErrPermissionDenied);
   709 	dir.Close();
   708 	dir.Close();
   710 	r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
   709 	r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
   711 	test_Value(r, r == KErrPermissionDenied);
   710 	test(r==KErrPermissionDenied);
   712 	dirNameBuf.Zero();
   711 	dirNameBuf.Zero();
   713 	delete dirEntries;
   712 	delete dirEntries;
   714 
   713 
   715 	//Private
   714 	//Private
   716 	dirNameBuf=KPrivatePath;
   715 	dirNameBuf=KPrivatePath;
   717 	dirNameBuf[0]=(TText)gDriveToTest;
   716 	dirNameBuf[0]=(TText)gDriveToTest;
   718 	r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
   717 	r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
   719 	test_Value(r, r == KErrPermissionDenied);
   718 	test(r==KErrPermissionDenied);
   720 	dir.Close();
   719 	dir.Close();
   721 	r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
   720 	r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
   722 	test_Value(r, r == KErrPermissionDenied);
   721 	test(r==KErrPermissionDenied);
   723 	dirNameBuf.Zero();
   722 	dirNameBuf.Zero();
   724 	delete dirEntries;
   723 	delete dirEntries;
   725 
   724 
   726 	//Private//falseID
   725 	//Private//falseID
   727 	dirNameBuf=KPrivateFalseID;
   726 	dirNameBuf=KPrivateFalseID;
   728 	dirNameBuf[0]=(TText)gDriveToTest;
   727 	dirNameBuf[0]=(TText)gDriveToTest;
   729 	r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
   728 	r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
   730 	test_Value(r, r == KErrPermissionDenied);
   729 	test(r==KErrPermissionDenied);
   731 	dir.Close();
   730 	dir.Close();
   732 	r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
   731 	r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
   733 	test_Value(r, r == KErrPermissionDenied);
   732 	test(r==KErrPermissionDenied);
   734 	dirNameBuf.Zero();
   733 	dirNameBuf.Zero();
   735 	delete dirEntries;
   734 	delete dirEntries;
   736 
   735 
   737 	//Private/uid
   736 	//Private/uid
   738 	TheFs.PrivatePath(dirNameBuf);
   737 	TheFs.PrivatePath(dirNameBuf);
   739 	dirNameBuf.Insert(0,_L("?:"));
   738 	dirNameBuf.Insert(0,_L("?:"));
   740 	dirNameBuf[0]=(TText)gDriveToTest;
   739 	dirNameBuf[0]=(TText)gDriveToTest;
   741 	r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
   740 	r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
   742 	test_KErrNone(r);
   741 	test(r==KErrNone);
   743 	dir.Close();
   742 	dir.Close();
   744 	r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
   743 	r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
   745 	test_KErrNone(r);
   744 	test(r==KErrNone);
   746 	dirNameBuf.Zero();
   745 	dirNameBuf.Zero();
   747 	delete dirEntries;
   746 	delete dirEntries;
   748 	//Resource
   747 	//Resource
   749 	dirNameBuf=KResourcePath;
   748 	dirNameBuf=KResourcePath;
   750 	dirNameBuf[0]=(TText)gDriveToTest;
   749 	dirNameBuf[0]=(TText)gDriveToTest;
   751 	r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
   750 	r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
   752 	test_KErrNone(r);
   751 	test(r==KErrNone);
   753 	r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
   752 	r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
   754 	test_KErrNone(r);
   753 	test(r==KErrNone);
   755 	dir.Close();
   754 	dir.Close();
   756 	delete dirEntries;
   755 	delete dirEntries;
   757 	__UHEAP_MARKEND;
   756 	__UHEAP_MARKEND;
   758 	}
   757 	}
   759 
   758 
   763 //	Test with tcb capabilities
   762 //	Test with tcb capabilities
   764 //
   763 //
   765 	{
   764 	{
   766 	__UHEAP_MARK;
   765 	__UHEAP_MARK;
   767 	r=TheFs.FileSystemName(fsname,gTheDriveNum);
   766 	r=TheFs.FileSystemName(fsname,gTheDriveNum);
   768 	test_KErrNone(r);	
   767 	test(r==KErrNone);	
   769 	r = DismountFileSystem(TheFs, fsname, gTheDriveNum);
   768 	r = DismountFileSystem(TheFs, fsname, gTheDriveNum);
   770 	test_Value(r, r == KErrPermissionDenied);
   769 	test(r==KErrPermissionDenied);
   771 	r = MountFileSystem(TheFs, fsname, gTheDriveNum);
   770 	r = MountFileSystem(TheFs, fsname, gTheDriveNum);
   772 	test_Value(r, r == KErrPermissionDenied);
   771 	test(r==KErrPermissionDenied);
   773 	r=TheFs.SetDriveName(gTheDriveNum,KDriveName);
   772 	r=TheFs.SetDriveName(gTheDriveNum,KDriveName);
   774 	test_Value(r, r == KErrPermissionDenied);
   773 	test(r==KErrPermissionDenied);
   775 #ifndef __WINS__
   774 #ifndef __WINS__
   776  	r=TheFs.SetVolumeLabel(KVolLable, gTheDriveNum);
   775  	r=TheFs.SetVolumeLabel(KVolLable, gTheDriveNum);
   777 	test_Value(r, r == KErrPermissionDenied);
   776 	test(r==KErrPermissionDenied);
   778 #endif
   777 #endif
   779 
   778 
   780 	systemRFsTest();
   779 	systemRFsTest();
   781 	ResourceRFsTest();
   780 	ResourceRFsTest();
   782 	privateRFsTest();	
   781 	privateRFsTest();	
   799 	test(aStat2==KErrPermissionDenied);
   798 	test(aStat2==KErrPermissionDenied);
   800 	test(aStat3==KErrNone);
   799 	test(aStat3==KErrNone);
   801 	test(aStat4==KErrNone);
   800 	test(aStat4==KErrNone);
   802 
   801 
   803 	r=TheFs.SetSessionPath(systestname);
   802 	r=TheFs.SetSessionPath(systestname);
   804 	test_Value(r, r == KErrPermissionDenied);
   803 	test(r==KErrPermissionDenied);
   805 	
   804 	
   806 //Test RRawDisk class
   805 //Test RRawDisk class
   807 	r=rawdisk.Open(TheFs,gTheDriveNum);
   806 	r=rawdisk.Open(TheFs,gTheDriveNum);
   808 	test_KErrNone(r);
   807 	test(r==KErrNone);
   809     rawdisk.Close();
   808     rawdisk.Close();
   810 
   809 
   811 	RDirtest();
   810 	RDirtest();
   812 
   811 
   813 #ifdef __WINS__
   812 #ifdef __WINS__
   814 	if (User::UpperCase(driveBuf[0]) != 'C')
   813 	if (User::UpperCase(driveBuf[0]) != 'C')
   815 #endif
   814 #endif
   816 		{
   815 		{
   817 		//Test RFormat class
   816 		//Test RFormat class
   818 		r=format.Open(TheFs,driveBuf,EHighDensity,count);
   817 		r=format.Open(TheFs,driveBuf,EHighDensity,count);
   819 		test_Value(r, r == KErrPermissionDenied);
   818 		test(r==KErrPermissionDenied);
   820 
   819 
   821 		while(count)	
   820 		while(count)	
   822 			{
   821 			{
   823 			TInt r=format.Next(count);
   822 			TInt r=format.Next(count);
   824 			test_KErrNone(r);
   823 			test(r==KErrNone);
   825 			}
   824 			}
   826 		format.Close();
   825 		format.Close();
   827 		}
   826 		}
   828 
   827 
   829 	driveBuf[0]=(TText)gDriveToTest;
   828 	driveBuf[0]=(TText)gDriveToTest;
   830 	r=TheFs.ScanDrive(driveBuf);
   829 	r=TheFs.ScanDrive(driveBuf);
   831 	test_Value(r, (r == KErrPermissionDenied)||(r==KErrNotSupported));
   830 	test((r==KErrPermissionDenied)||(r==KErrNotSupported));
   832 	r=TheFs.CheckDisk(driveBuf);
   831 	r=TheFs.CheckDisk(driveBuf);
   833 	test_Value(r, (r == KErrPermissionDenied)||(r==KErrNotSupported));
   832 	test((r==KErrPermissionDenied)||(r==KErrNotSupported));
   834 	__UHEAP_MARKEND;
   833 	__UHEAP_MARKEND;
   835 	}
   834 	}
   836 
   835 
   837 LOCAL_C void TestCaps()
   836 LOCAL_C void TestCaps()
   838 //
   837 //
   846 	r=RProcess().HasCapability(ECapabilityTCB, __PLATSEC_DIAGNOSTIC_STRING(myDiagMsg));
   845 	r=RProcess().HasCapability(ECapabilityTCB, __PLATSEC_DIAGNOSTIC_STRING(myDiagMsg));
   847 	test(r);
   846 	test(r);
   848 
   847 
   849 	driveBuf[0]=(TText)gDriveToTest;
   848 	driveBuf[0]=(TText)gDriveToTest;
   850 	r=TheFs.SessionPath(temp);
   849 	r=TheFs.SessionPath(temp);
   851 	test_KErrNone(r);
   850 	test(r==KErrNone);
   852 	test.Printf(_L("Session path: %S"),&temp);
   851 	test.Printf(_L("Session path: %S"),&temp);
   853 	r=TheFs.CreatePrivatePath(gTheDriveNum);
   852 	r=TheFs.CreatePrivatePath(gTheDriveNum);
   854 	test_Value(r, r == KErrNone || r== KErrAlreadyExists);
   853 	test(r==KErrNone || r== KErrAlreadyExists);
   855 
   854 
   856 	TBuf<18> tempPri;
   855 	TBuf<18> tempPri;
   857 	r=TheFs.PrivatePath(tempPri);
   856 	r=TheFs.PrivatePath(tempPri);
   858 	test_KErrNone(r);
   857 	test(r==KErrNone);
   859 	theprivatepath = _L("?:");
   858 	theprivatepath = _L("?:");
   860 	theprivatepath.Append(tempPri);
   859 	theprivatepath.Append(tempPri);
   861 
   860 
   862 	TestTcbCaps();
   861 	TestTcbCaps();
   863 
   862 
   864 	TFileName thesessionpath;
   863 	TFileName thesessionpath;
   865 	r=TheFs.SetSessionToPrivate(gTheDriveNum);
   864 	r=TheFs.SetSessionToPrivate(gTheDriveNum);
   866 	test_KErrNone(r);
   865 	test(r==KErrNone);
   867 	r=TheFs.SessionPath(thesessionpath);
   866 	r=TheFs.SessionPath(thesessionpath);
   868 	test_KErrNone(r);
   867 	test(r==KErrNone);
   869 	test(thesessionpath == theprivatepath);
   868 	test(thesessionpath == theprivatepath);
   870 	__UHEAP_MARKEND;
   869 	__UHEAP_MARKEND;
   871 	}
   870 	}
   872 
   871 
   873 
   872 
   875 
   874 
   876 LOCAL_C void ScanDir(const TDesC& aName, CDirScan::TScanDirection aDirection, TInt aError)
   875 LOCAL_C void ScanDir(const TDesC& aName, CDirScan::TScanDirection aDirection, TInt aError)
   877 	{
   876 	{
   878 	CDirScan* scanner = NULL;
   877 	CDirScan* scanner = NULL;
   879 	TRAP(r, scanner = CDirScan::NewL(TheFs));
   878 	TRAP(r, scanner = CDirScan::NewL(TheFs));
   880 	test_Value(r, r == KErrNone && scanner);
   879 	test(r == KErrNone && scanner);
   881 
   880 
   882 	TRAP(r, scanner->SetScanDataL(aName,KEntryAttDir,ESortByName|EAscending,aDirection));
   881 	TRAP(r, scanner->SetScanDataL(aName,KEntryAttDir,ESortByName|EAscending,aDirection));
   883 	test_KErrNone(r);
   882 	test(r == KErrNone);
   884 	
   883 	
   885 	CDir *entryList=NULL;
   884 	CDir *entryList=NULL;
   886 	for (;;)
   885 	for (;;)
   887 		{
   886 		{
   888 		TRAP(r, scanner->NextL(entryList));
   887 		TRAP(r, scanner->NextL(entryList));
   889 		test_Value(r, r == aError);
   888 		test(r == aError);
   890 		if (entryList==NULL)
   889 		if (entryList==NULL)
   891 			break;
   890 			break;
   892 		TInt count=entryList->Count();
   891 		TInt count=entryList->Count();
   893 		while (count--)
   892 		while (count--)
   894 			{
   893 			{
   923 		TBuf<30> privatepath;
   922 		TBuf<30> privatepath;
   924 		r=TheFs.PrivatePath(privatepath);
   923 		r=TheFs.PrivatePath(privatepath);
   925 		test.Printf(_L("Private Path is=%S"),&privatepath);
   924 		test.Printf(_L("Private Path is=%S"),&privatepath);
   926 		
   925 		
   927 		r = TheFs.MkDir(_L("\\Caged\\"));
   926 		r = TheFs.MkDir(_L("\\Caged\\"));
   928 		test_Value(r, r == KErrNone || r==KErrAlreadyExists);
   927 		test(r==KErrNone || r==KErrAlreadyExists);
   929 		
   928 		
   930 		CDir* entryCount=NULL;
   929 		CDir* entryCount=NULL;
   931 		r=TheFs.GetDir(_L("\\*.*"),KEntryAttNormal,ESortNone,entryCount);
   930 		r=TheFs.GetDir(_L("\\*.*"),KEntryAttNormal,ESortNone,entryCount);
   932 		test_KErrNone(r);
   931 		test(r==KErrNone);
   933 		TInt rootCount= entryCount->Count();
   932 		TInt rootCount= entryCount->Count();
   934 		
   933 		
   935 		delete entryCount;
   934 		delete entryCount;
   936 		entryCount=NULL;
   935 		entryCount=NULL;
   937 
   936 
   938 
   937 
   939 		//Testing Copy
   938 		//Testing Copy
   940 		CDir* entryCount2=NULL;
   939 		CDir* entryCount2=NULL;
   941 		r=fMan->Copy(_L("\\sys\\"),_L("\\Caged\\"));
   940 		r=fMan->Copy(_L("\\sys\\"),_L("\\Caged\\"));
   942 		test_Value(r, r == KErrPermissionDenied);
   941 		test(r == KErrPermissionDenied);
   943 		r=fMan->Copy(_L("\\*"),_L("\\Caged\\"));
   942 		r=fMan->Copy(_L("\\*"),_L("\\Caged\\"));
   944 		test_KErrNone(r);
   943 		test(r == KErrNone);
   945 		
   944 		
   946 		r=TheFs.GetDir(_L("\\Caged\\*.*"),KEntryAttNormal,ESortNone,entryCount2);
   945 		r=TheFs.GetDir(_L("\\Caged\\*.*"),KEntryAttNormal,ESortNone,entryCount2);
   947 		test_KErrNone(r);
   946 		test(r==KErrNone);
   948 		TInt cagedCount= entryCount2->Count();
   947 		TInt cagedCount= entryCount2->Count();
   949 		
   948 		
   950 		test(cagedCount==rootCount);
   949 		test(cagedCount==rootCount);
   951 		
   950 		
   952 		delete entryCount2;
   951 		delete entryCount2;
   953 		entryCount2=NULL;
   952 		entryCount2=NULL;
   954 	
   953 	
   955 		r=fMan->Copy(_L("\\private\\two\\moo"),_L("\\private\\two\\mew")); 
   954 		r=fMan->Copy(_L("\\private\\two\\moo"),_L("\\private\\two\\mew")); 
   956 		test_Value(r, r == KErrPermissionDenied);
   955 		test(r == KErrPermissionDenied);
   957 	
   956 	
   958 		// Create a test file
   957 		// Create a test file
   959 		RFile testFile;
   958 		RFile testFile;
   960 		r = testFile.Replace(TheFs, _L("\\capTest"),EFileWrite);
   959 		r = testFile.Replace(TheFs, _L("\\capTest"),EFileWrite);
   961 		test_Value(r, r == KErrNone || r==KErrAlreadyExists);
   960 		test(r==KErrNone || r==KErrAlreadyExists);
   962 		testFile.Close();
   961 		testFile.Close();
   963 		
   962 		
   964 		TFileName name;
   963 		TFileName name;
   965 		name = privatepath;
   964 		name = privatepath;
   966 		name.Append(_L("privateFile.tst"));
   965 		name.Append(_L("privateFile.tst"));
   967 		RFile privateFile;
   966 		RFile privateFile;
   968 		r = privateFile.Replace(TheFs, name,EFileWrite);
   967 		r = privateFile.Replace(TheFs, name,EFileWrite);
   969 		test_Value(r, r == KErrNone || r==KErrAlreadyExists);
   968 		test(r==KErrNone || r==KErrAlreadyExists);
   970 		privateFile.Close();
   969 		privateFile.Close();
   971 
   970 
   972 	
   971 	
   973 		r=fMan->Copy(_L("\\capTest"),_L("\\private\\two\\moo")); 
   972 		r=fMan->Copy(_L("\\capTest"),_L("\\private\\two\\moo")); 
   974 		test_Value(r, r == KErrPermissionDenied);
   973 		test(r == KErrPermissionDenied);
   975 		r=fMan->Copy(_L("\\capTest"),_L("\\sys\\bin\\moo")); 
   974 		r=fMan->Copy(_L("\\capTest"),_L("\\sys\\bin\\moo")); 
   976 		test_Value(r, r == KErrPathNotFound); 
   975 		test(r == KErrPathNotFound); 
   977 		r=fMan->Copy(_L("\\sys\\bin\\capTest"),_L("\\sys\\bin\\moo")); 
   976 		r=fMan->Copy(_L("\\sys\\bin\\capTest"),_L("\\sys\\bin\\moo")); 
   978 		test_Value(r, r == KErrPermissionDenied);
   977 		test(r == KErrPermissionDenied);
   979 		r=fMan->Copy(_L("\\capTest"),_L("\\sys\\capTest")); 
   978 		r=fMan->Copy(_L("\\capTest"),_L("\\sys\\capTest")); 
   980 		test_Value(r, r == KErrNone || r==KErrAlreadyExists); 
   979 		test(r == KErrNone || r==KErrAlreadyExists); 
   981 		r=fMan->Copy(_L("\\sys\\*"),_L("\\"));
   980 		r=fMan->Copy(_L("\\sys\\*"),_L("\\"));
   982 		test_Value(r, r == KErrPermissionDenied);
   981 		test (r==KErrPermissionDenied);
   983 		r=fMan->Copy(name,_L("\\sys\\"));
   982 		r=fMan->Copy(name,_L("\\sys\\"));
   984 		test_KErrNone(r);
   983 		test(r==KErrNone);
   985 
   984 
   986 		// Testing Move
   985 		// Testing Move
   987 		r=fMan->Move(_L("\\private\\two\\moo"),_L("\\private\\one\\moo"));
   986 		r=fMan->Move(_L("\\private\\two\\moo"),_L("\\private\\one\\moo"));
   988 		test_Value(r, r == KErrPermissionDenied);
   987 		test(r == KErrPermissionDenied);
   989 		r=fMan->Move(_L("\\private\\two\\moo.."),_L("\\private\\one\\moo"));
   988 		r=fMan->Move(_L("\\private\\two\\moo.."),_L("\\private\\one\\moo"));
   990 		test_Value(r, r == KErrPermissionDenied);
   989 		test(r == KErrPermissionDenied);
   991 		r=fMan->Move(_L("\\private\\two\\moo"),_L("\\private\\one\\moo.."));
   990 		r=fMan->Move(_L("\\private\\two\\moo"),_L("\\private\\one\\moo.."));
   992 		test_Value(r, r == KErrPermissionDenied);
   991 		test(r == KErrPermissionDenied);
   993 		r=fMan->Move(name,_L("\\privateFile.tst"));
   992 		r=fMan->Move(name,_L("\\privateFile.tst"));
   994 		test_KErrNone(r);
   993 		test(r == KErrNone);
   995 		r=fMan->Move(_L("\\privateFile.tst"),name);
   994 		r=fMan->Move(_L("\\privateFile.tst"),name);
   996 		test_KErrNone(r);
   995 		test(r == KErrNone);
   997 
   996 
   998 
   997 
   999 		// Testing Attribs
   998 		// Testing Attribs
  1000 		r=fMan->Attribs(_L("\\private\\two\\moo"),KEntryAttReadOnly,0,TTime(0)); 
   999 		r=fMan->Attribs(_L("\\private\\two\\moo"),KEntryAttReadOnly,0,TTime(0)); 
  1001 		test_Value(r, r == KErrPermissionDenied);
  1000 		test(r == KErrPermissionDenied);
  1002 		r=fMan->Attribs(_L("\\private\\moo"),KEntryAttReadOnly,0,TTime(0)); 
  1001 		r=fMan->Attribs(_L("\\private\\moo"),KEntryAttReadOnly,0,TTime(0)); 
  1003 		test_Value(r, r == KErrPermissionDenied);
  1002 		test(r == KErrPermissionDenied);
  1004 		r=fMan->Attribs(name,KEntryAttReadOnly,0,TTime(0));
  1003 		r=fMan->Attribs(name,KEntryAttReadOnly,0,TTime(0));
  1005 		test_KErrNone(r);
  1004 		test(r == KErrNone);
  1006 		r=fMan->Attribs(name,0,KEntryAttReadOnly,TTime(0));
  1005 		r=fMan->Attribs(name,0,KEntryAttReadOnly,TTime(0));
  1007 		test_KErrNone(r);
  1006 		test(r == KErrNone);
  1008 
  1007 
  1009 		// Testing Move
  1008 		// Testing Move
  1010 		r=fMan->Move(_L("\\private\\two\\moo"),_L("\\private\\one\\moo"));
  1009 		r=fMan->Move(_L("\\private\\two\\moo"),_L("\\private\\one\\moo"));
  1011 		test_Value(r, r == KErrPermissionDenied);
  1010 		test(r == KErrPermissionDenied);
  1012 		r=fMan->Move(_L("\\private\\two\\moo.."),_L("\\private\\one\\moo"));
  1011 		r=fMan->Move(_L("\\private\\two\\moo.."),_L("\\private\\one\\moo"));
  1013 		test_Value(r, r == KErrPermissionDenied);
  1012 		test(r == KErrPermissionDenied);
  1014 		r=fMan->Move(_L("\\private\\two\\moo"),_L("\\private\\one\\moo.."));
  1013 		r=fMan->Move(_L("\\private\\two\\moo"),_L("\\private\\one\\moo.."));
  1015 		test_Value(r, r == KErrPermissionDenied);
  1014 		test(r == KErrPermissionDenied);
  1016 		r=fMan->Move(name,_L("\\privateFile.tst"));
  1015 		r=fMan->Move(name,_L("\\privateFile.tst"));
  1017 		test_KErrNone(r);
  1016 		test(r == KErrNone);
  1018 		r=fMan->Move(_L("\\privateFile.tst"),name);
  1017 		r=fMan->Move(_L("\\privateFile.tst"),name);
  1019 		test_KErrNone(r);
  1018 		test(r == KErrNone);
  1020 
  1019 
  1021 
  1020 
  1022 		// Testing RmDir
  1021 		// Testing RmDir
  1023 		r=fMan->RmDir(_L("\\private\\"));
  1022 		r=fMan->RmDir(_L("\\private\\"));
  1024 		test_Value(r, r == KErrPermissionDenied);
  1023 		test(r == KErrPermissionDenied);
  1025 		r=fMan->RmDir(_L("\\private\\two\\"));
  1024 		r=fMan->RmDir(_L("\\private\\two\\"));
  1026 		test_Value(r, r == KErrPermissionDenied);
  1025 		test(r == KErrPermissionDenied);
  1027 		r=fMan->RmDir(_L("\\private\\tw?\\"));
  1026 		r=fMan->RmDir(_L("\\private\\tw?\\"));
  1028 		test_Value(r, r == KErrPermissionDenied);
  1027 		test(r == KErrPermissionDenied);
  1029 		r=fMan->RmDir(_L("\\sys\\"));
  1028 		r=fMan->RmDir(_L("\\sys\\"));
  1030 		test_Value(r, r == KErrPermissionDenied);
  1029 		test(r == KErrPermissionDenied);
  1031 		
  1030 		
  1032 		
  1031 		
  1033 		// Testing Rename
  1032 		// Testing Rename
  1034 		r=fMan->Rename(_L("\\private\\two\\moo"),_L("\\private\\two\\mew")); 
  1033 		r=fMan->Rename(_L("\\private\\two\\moo"),_L("\\private\\two\\mew")); 
  1035 		test_Value(r, r == KErrPermissionDenied);
  1034 		test(r == KErrPermissionDenied);
  1036 		
  1035 		
  1037 		// Testing Delete
  1036 		// Testing Delete
  1038 		r=fMan->Delete(_L("\\private\\two\\test")); 
  1037 		r=fMan->Delete(_L("\\private\\two\\test")); 
  1039 		test_Value(r, r == KErrPermissionDenied);
  1038 		test(r == KErrPermissionDenied);
  1040 		r=fMan->Delete(_L("\\private\\moo")); 
  1039 		r=fMan->Delete(_L("\\private\\moo")); 
  1041 		test_Value(r, r == KErrPermissionDenied);
  1040 		test(r == KErrPermissionDenied);
  1042 		r=fMan->Delete(_L("\\sys\\")); 
  1041 		r=fMan->Delete(_L("\\sys\\")); 
  1043 		test_Value(r, r == KErrPermissionDenied);
  1042 		test(r == KErrPermissionDenied);
  1044 
  1043 
  1045 		//Something that actually exists in Private
  1044 		//Something that actually exists in Private
  1046 		r=fMan->Rename(name,_L("\\private\\00000001\\moo")); 
  1045 		r=fMan->Rename(name,_L("\\private\\00000001\\moo")); 
  1047 		test_KErrNone(r);
  1046 		test(r == KErrNone);
  1048 		r=fMan->Rename(_L("\\private\\00000001\\moo"),name); 
  1047 		r=fMan->Rename(_L("\\private\\00000001\\moo"),name); 
  1049 		test_KErrNone(r);
  1048 		test(r == KErrNone);
  1050 		r=fMan->Copy(name,_L("\\private\\00000001\\moo")); 
  1049 		r=fMan->Copy(name,_L("\\private\\00000001\\moo")); 
  1051 		test_KErrNone(r);
  1050 		test(r == KErrNone);
  1052 		r=fMan->Delete(_L("\\private\\00000001\\moo")); 
  1051 		r=fMan->Delete(_L("\\private\\00000001\\moo")); 
  1053 		test_KErrNone(r);
  1052 		test(r == KErrNone);
  1054 
  1053 
  1055 		// Clean up the test data
  1054 		// Clean up the test data
  1056 		r=fMan->RmDir(_L("\\Caged\\")); 
  1055 		r=fMan->RmDir(_L("\\Caged\\")); 
  1057 		test_KErrNone(r);
  1056 		test(r == KErrNone);
  1058 		r=fMan->Delete(_L("\\capTest")); 
  1057 		r=fMan->Delete(_L("\\capTest")); 
  1059 		test_KErrNone(r);
  1058 		test(r == KErrNone);
  1060 		r=fMan->Delete(name); 
  1059 		r=fMan->Delete(name); 
  1061 		test_KErrNone(r);
  1060 		test(r == KErrNone);
  1062 		delete(fMan);
  1061 		delete(fMan);
  1063 		}
  1062 		}
  1064 	
  1063 	
  1065 	// CDirScan tests
  1064 	// CDirScan tests
  1066 	ScanDir(_L("\\"), CDirScan::EScanUpTree, KErrNone);
  1065 	ScanDir(_L("\\"), CDirScan::EScanUpTree, KErrNone);
  1087 				if(!(info.iDriveAtt & (KDriveAttRom|KDriveAttRedirected|KDriveAttSubsted|KDriveAttRemovable)))
  1086 				if(!(info.iDriveAtt & (KDriveAttRom|KDriveAttRedirected|KDriveAttSubsted|KDriveAttRemovable)))
  1088 					{
  1087 					{
  1089 					test.Printf(_L("Setting %c:"), 'A'+i);
  1088 					test.Printf(_L("Setting %c:"), 'A'+i);
  1090 					TInt ret = TheFs.SetSystemDrive((TDriveNumber)i);
  1089 					TInt ret = TheFs.SetSystemDrive((TDriveNumber)i);
  1091 					test.Printf(_L("%d\n"), ret);
  1090 					test.Printf(_L("%d\n"), ret);
  1092 					test_Value(ret, ret == KErrNone || ret == KErrAlreadyExists);
  1091 					test(ret == KErrNone || ret == KErrAlreadyExists);
  1093 					if(ret == KErrNone)
  1092 					if(ret == KErrNone)
  1094 						{
  1093 						{
  1095 						drive = (TDriveNumber)i;
  1094 						drive = (TDriveNumber)i;
  1096 						test.Printf(_L("Re-setting %c:"), 'A'+i);
  1095 						test.Printf(_L("Re-setting %c:"), 'A'+i);
  1097 						ret = TheFs.SetSystemDrive(drive);
  1096 						ret = TheFs.SetSystemDrive(drive);
  1098 						test.Printf(_L("%d\n"), ret);
  1097 						test.Printf(_L("%d\n"), ret);
  1099 						test_Value(ret, ret == KErrAlreadyExists);
  1098 						test(ret == KErrAlreadyExists);
  1100 						}
  1099 						}
  1101 					}
  1100 					}
  1102 				}
  1101 				}
  1103 			}
  1102 			}
  1104 		}
  1103 		}
  1113 //
  1112 //
  1114 	{
  1113 	{
  1115 	test.Next(_L("Delete test directory"));
  1114 	test.Next(_L("Delete test directory"));
  1116 	CFileMan* fMan=CFileMan::NewL(TheFs);
  1115 	CFileMan* fMan=CFileMan::NewL(TheFs);
  1117 	TInt r=fMan->RmDir(gSessionPath);
  1116 	TInt r=fMan->RmDir(gSessionPath);
  1118 //	test_Value(r, r == KErrNone || r == KErrPathNotFound);
  1117 	test(r==KErrNone || KErrPathNotFound);
  1119 	test(r == KErrNone || KErrPathNotFound);
       
  1120 	delete fMan;
  1118 	delete fMan;
  1121 	}
  1119 	}
  1122 
  1120 
  1123 GLDEF_C void CallTestsL(/*TChar aDriveLetter*/)
  1121 GLDEF_C void CallTestsL(/*TChar aDriveLetter*/)
  1124 //
  1122 //
  1138 	TBuf<30> sesspath;
  1136 	TBuf<30> sesspath;
  1139 	sesspath=_L("?:\\");
  1137 	sesspath=_L("?:\\");
  1140 	sesspath[0] = (TText)gDriveToTest;
  1138 	sesspath[0] = (TText)gDriveToTest;
  1141 
  1139 
  1142 	TInt r= TheFs.SetSessionPath(sesspath);
  1140 	TInt r= TheFs.SetSessionPath(sesspath);
  1143 	test_KErrNone(r);
  1141 	test(r==KErrNone);
  1144 
  1142 
  1145 	//cleanup from previous run of this test
  1143 	//cleanup from previous run of this test
  1146 	TBuf<20> delDir;
  1144 	TBuf<20> delDir;
  1147 	CFileMan* fMan=CFileMan::NewL(TheFs);
  1145 	CFileMan* fMan=CFileMan::NewL(TheFs);
  1148 	delDir=KResourcePath;
  1146 	delDir=KResourcePath;
  1149 	delDir[0]=(TText)gDriveToTest;
  1147 	delDir[0]=(TText)gDriveToTest;
  1150 	r=fMan->RmDir(delDir);
  1148 	r=fMan->RmDir(delDir);
  1151 //	test_Value(r, r == KErrNone || r == KErrNotFound);
  1149 	test(r==KErrNone || KErrNotFound);
  1152 	test(r == KErrNone || KErrNotFound);
       
  1153 	delDir=KSystemPath;
  1150 	delDir=KSystemPath;
  1154 	delDir[0]=(TText)gDriveToTest;
  1151 	delDir[0]=(TText)gDriveToTest;
  1155 	r=fMan->RmDir(delDir);
  1152 	r=fMan->RmDir(delDir);
  1156 //	test_Value(r, r == KErrNone || r == KErrNotFound);
  1153 	test(r==KErrNone || KErrNotFound);
  1157 	test(r == KErrNone || KErrNotFound);
       
  1158 	delDir=KPrivatePath;
  1154 	delDir=KPrivatePath;
  1159 	delDir[0]=(TText)gDriveToTest;
  1155 	delDir[0]=(TText)gDriveToTest;
  1160 	r=fMan->RmDir(delDir);
  1156 	r=fMan->RmDir(delDir);
  1161 //	test_Value(r, r == KErrNone || r == KErrNotFound);
  1157 	test(r==KErrNone || KErrNotFound);
  1162 	test(r == KErrNone || KErrNotFound);
       
  1163 	delete fMan;
  1158 	delete fMan;
  1164 
  1159 
  1165 	//check double mode ie that Defpath still works	
  1160 	//check double mode ie that Defpath still works	
  1166 	RFs fs1;
  1161 	RFs fs1;
  1167 	RFs fs2;
  1162 	RFs fs2;
  1168 	
  1163 	
  1169 	r=fs1.Connect();
  1164 	r=fs1.Connect();
  1170 	test_KErrNone(r);
  1165 	test(r==KErrNone);
  1171 	r=fs1.SessionPath(sesspath);
  1166 	r=fs1.SessionPath(sesspath);
  1172 	test_KErrNone(r);
  1167 	test(r==KErrNone);
  1173 	test.Printf(_L("session1 Path=%S"),&sesspath);
  1168 	test.Printf(_L("session1 Path=%S"),&sesspath);
  1174 
  1169 
  1175 	TBuf<30> privatepath;
  1170 	TBuf<30> privatepath;
  1176 	r=fs1.SetSessionToPrivate(gTheDriveNum);
  1171 	r=fs1.SetSessionToPrivate(gTheDriveNum);
  1177 	test_KErrNone(r);
  1172 	test(r==KErrNone);
  1178 	r=fs1.PrivatePath(privatepath);
  1173 	r=fs1.PrivatePath(privatepath);
  1179 	test_KErrNone(r);
  1174 	test(r==KErrNone);
  1180 	r=privatepath.Compare(KExpectedPrivatePath());
  1175 	r=privatepath.Compare(KExpectedPrivatePath());
  1181 	test_Value(r, r == 0);
  1176 	test(r==0);
  1182 	r=fs1.SessionPath(sesspath);
  1177 	r=fs1.SessionPath(sesspath);
  1183 	test_KErrNone(r);
  1178 	test(r==KErrNone);
  1184 	r=privatepath.Compare(sesspath.Mid(KPathPosition));
  1179 	r=privatepath.Compare(sesspath.Mid(KPathPosition));
  1185 	test_Value(r, r == 0);
  1180 	test(r==0);
  1186 	r=fs1.CreatePrivatePath(gTheDriveNum);
  1181 	r=fs1.CreatePrivatePath(gTheDriveNum);
  1187 	test_KErrNone(r);
  1182 	test(r==KErrNone);
  1188 	fs1.Close();
  1183 	fs1.Close();
  1189 
  1184 
  1190 	r=fs2.Connect();
  1185 	r=fs2.Connect();
  1191 	test_KErrNone(r);
  1186 	test(r==KErrNone);
  1192 	r=fs2.SessionPath(sesspath);
  1187 	r=fs2.SessionPath(sesspath);
  1193 	test_KErrNone(r);
  1188 	test(r==KErrNone);
  1194 	test.Printf(_L("session2 Path=%S"),&sesspath);
  1189 	test.Printf(_L("session2 Path=%S"),&sesspath);
  1195 	fs2.Close();
  1190 	fs2.Close();
  1196 
  1191 
  1197 	TestCaps();
  1192 	TestCaps();
  1198 	TestCaging();
  1193 	TestCaging();