kerneltest/f32test/server/t_dcnone.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 <e32def.h>
    20 #include <e32def.h>
    93 TRequestStatus aStat1;
    92 TRequestStatus aStat1;
    94 TRequestStatus aStat2;
    93 TRequestStatus aStat2;
    95 TRequestStatus aStat3;
    94 TRequestStatus aStat3;
    96 TRequestStatus aStat4;
    95 TRequestStatus aStat4;
    97 
    96 
       
    97 TVolumeInfo aVolInfo;
       
    98 //	TDriveInfo adriveInfo;
       
    99 
    98 TBuf<40> systestfile;
   100 TBuf<40> systestfile;
    99 TBuf<40> pritestfile;
   101 TBuf<40> pritestfile;
   100 TBuf<40> restestfile;
   102 TBuf<40> restestfile;
   101 TBuf<40> systestfile1;
   103 TBuf<40> systestfile1;
   102 TBuf<40> pritestfile1;
   104 TBuf<40> pritestfile1;
   115 // This test case is brought in by INC054580
   117 // This test case is brought in by INC054580
   116 // (NTT Renaming sys ¨Cfolder on C -drive on H2 allows user to access sys -files)
   118 // (NTT Renaming sys ¨Cfolder on C -drive on H2 allows user to access sys -files)
   117 //
   119 //
   118     {
   120     {
   119     TInt r = TheFs.Rename(_L("\\sys"), _L("\\sysbad"));
   121     TInt r = TheFs.Rename(_L("\\sys"), _L("\\sysbad"));
   120     test_Value(r, r == KErrPermissionDenied);
   122     test(r == KErrPermissionDenied);
   121     r = TheFs.Rename(_L("\\resource"), _L("\\resourcebad"));
   123     r = TheFs.Rename(_L("\\resource"), _L("\\resourcebad"));
   122     test_Value(r, r == KErrPermissionDenied);
   124     test(r == KErrPermissionDenied);
   123     r = TheFs.Rename(_L("\\private"), _L("\\privatebad"));
   125     r = TheFs.Rename(_L("\\private"), _L("\\privatebad"));
   124     test_Value(r, r == KErrPermissionDenied);
   126     test(r == KErrPermissionDenied);
   125     }
   127     }
   126 
   128 
   127 LOCAL_C void systemRFstest()
   129 LOCAL_C void systemRFstest()
   128 //
   130 //
   129 //
   131 //
   134 	
   136 	
   135 	mkdirname.Zero();
   137 	mkdirname.Zero();
   136 	mkdirname.Append(systestname);
   138 	mkdirname.Append(systestname);
   137 	mkdirname.Append(KMkDirSub);
   139 	mkdirname.Append(KMkDirSub);
   138 	r=TheFs.MkDirAll(mkdirname);	
   140 	r=TheFs.MkDirAll(mkdirname);	
   139 	test_Value(r, r == KErrPermissionDenied);
   141 	test(r==KErrPermissionDenied);
   140 
   142 
   141 	r=TheFs.RmDir(mkdirname);	
   143 	r=TheFs.RmDir(mkdirname);	
   142 	test_Value(r, r == KErrPermissionDenied);
   144 	test(r==KErrPermissionDenied);
   143 
   145 
   144 	r=TheFs.SetSubst(systestname,EDriveP);
   146 	r=TheFs.SetSubst(systestname,EDriveP);
   145 	test_Value(r, r == KErrPermissionDenied);
   147 	test(r==KErrPermissionDenied);
   146 	
   148 	
   147 	r=TheFs.SetSessionPath(systestname);
   149 	r=TheFs.SetSessionPath(systestname);
   148 	test_Value(r, r == KErrPermissionDenied);
   150 	test(r==KErrPermissionDenied);
   149 
   151 
   150 	TheFs.NotifyChange(ENotifyAll,aStat1,systestname);
   152 	TheFs.NotifyChange(ENotifyAll,aStat1,systestname);
   151 	test(aStat1==KErrPermissionDenied);
   153 	test(aStat1==KErrPermissionDenied);
   152 
   154 
   153 	systestfile=KSystemPath;
   155 	systestfile=KSystemPath;
   158 	
   160 	
   159 	oldName=KOldFile;
   161 	oldName=KOldFile;
   160 	oldName[0]=(TText)gDriveToTest;
   162 	oldName[0]=(TText)gDriveToTest;
   161 
   163 
   162 	r=TheFs.GetShortName(systestfile, shortfilename);
   164 	r=TheFs.GetShortName(systestfile, shortfilename);
   163 	test_Value(r, r == KErrPermissionDenied);
   165 	test(r==KErrPermissionDenied);
   164 
   166 
   165 	r=TheFs.GetLongName(systestfile1, longfilename);
   167 	r=TheFs.GetLongName(systestfile1, longfilename);
   166 	test_Value(r, r == KErrPermissionDenied);
   168 	test(r==KErrPermissionDenied);
   167 
   169 
   168 	r=file1.Create(TheFs,oldName,EFileWrite);
   170 	r=file1.Create(TheFs,oldName,EFileWrite);
   169 	test_Value(r, r == KErrNone || r==KErrAlreadyExists);
   171 	test(r==KErrNone || r==KErrAlreadyExists);
   170 	file1.Close();
   172 	file1.Close();
   171 
   173 
   172 	r=TheFs.Replace(oldName,systestfile);
   174 	r=TheFs.Replace(oldName,systestfile);
   173 	test_Value(r, r == KErrPermissionDenied);
   175 	test(r==KErrPermissionDenied);
   174 	
   176 	
   175 	r=TheFs.Rename(systestfile,systestfile1);
   177 	r=TheFs.Rename(systestfile,systestfile1);
   176 	test_Value(r, r == KErrPermissionDenied);
   178 	test(r==KErrPermissionDenied);
   177 	
   179 	
   178 	// check that the entry for the system directory itself can be retrieved with no error
   180 	// check that the entry for the system directory itself can be retrieved with no error
   179 	// - with or without a slash
   181 	// - with or without a slash
   180 	TPtrC restrictedDir(systestname.Ptr(), systestname.Length());
   182 	TPtrC restrictedDir(systestname.Ptr(), systestname.Length());
   181 	r=TheFs.Entry(restrictedDir, entry);
   183 	r=TheFs.Entry(restrictedDir, entry);
   182 	test.Printf(_L("RFs::Entry(%S) returned %d"), &restrictedDir, r);
   184 	test.Printf(_L("RFs::Entry(%S) returned %d"), &restrictedDir, r);
   183 	test_KErrNone(r);
   185 	test(r==KErrNone);
   184 	test (entry.iAtt & KEntryAttDir);
   186 	test (entry.iAtt & KEntryAttDir);
   185 
   187 
   186 	TPtrC restrictedDirWithNoBackSlash(restrictedDir.Ptr(), restrictedDir.Length()-1);
   188 	TPtrC restrictedDirWithNoBackSlash(restrictedDir.Ptr(), restrictedDir.Length()-1);
   187 	r=TheFs.Entry(restrictedDirWithNoBackSlash,entry);
   189 	r=TheFs.Entry(restrictedDirWithNoBackSlash,entry);
   188 	test.Printf(_L("RFs::Entry(%S) returned %d"), &restrictedDirWithNoBackSlash, r);
   190 	test.Printf(_L("RFs::Entry(%S) returned %d"), &restrictedDirWithNoBackSlash, r);
   189 	test_KErrNone(r);
   191 	test(r==KErrNone);
   190 
   192 
   191 	r=TheFs.Entry(systestfile1,entry);
   193 	r=TheFs.Entry(systestfile1,entry);
   192 	test_Value(r, r == KErrPermissionDenied);
   194 	test(r==KErrPermissionDenied);
   193 	
   195 	
   194 	r=TheFs.SetEntry(systestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
   196 	r=TheFs.SetEntry(systestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
   195 	test_Value(r, r == KErrPermissionDenied);
   197 	test(r==KErrPermissionDenied);
   196 
   198 
   197 	r=TheFs.Delete(systestfile1);
   199 	r=TheFs.Delete(systestfile1);
   198 	test_Value(r, r == KErrPermissionDenied);
   200 	test(r==KErrPermissionDenied);
   199 
   201 
   200 	}
   202 	}
   201 
   203 
   202 
   204 
   203 LOCAL_C void resourceRFstest()
   205 LOCAL_C void resourceRFstest()
   211 	
   213 	
   212 	mkdirname.Zero();
   214 	mkdirname.Zero();
   213 	mkdirname.Append(restestname);
   215 	mkdirname.Append(restestname);
   214 	mkdirname.Append(KMkDirSub);
   216 	mkdirname.Append(KMkDirSub);
   215 	r=TheFs.MkDirAll(mkdirname);	
   217 	r=TheFs.MkDirAll(mkdirname);	
   216 	test_Value(r, r == KErrPermissionDenied);
   218 	test(r==KErrPermissionDenied);
   217 
   219 
   218 	TheFs.RmDir(mkdirname);
   220 	TheFs.RmDir(mkdirname);
   219 	test_Value(r, r == KErrPermissionDenied);
   221 	test(r==KErrPermissionDenied);
   220 
   222 
   221 	r=TheFs.SetSubst(restestname,EDriveP);
   223 	r=TheFs.SetSubst(restestname,EDriveP);
   222 	test_Value(r, r == KErrPermissionDenied);
   224 	test(r==KErrPermissionDenied);
   223 	
   225 	
   224 	r=TheFs.RealName(_L("P:\\File.XXX"),realName);
   226 	r=TheFs.RealName(_L("P:\\File.XXX"),realName);
   225 	test_KErrNone(r);
   227 	test(r==KErrNone);
   226 
   228 
   227 	r=TheFs.SetSessionPath(restestname);
   229 	r=TheFs.SetSessionPath(restestname);
   228 	test_KErrNone(r);
   230 	test(r==KErrNone);
   229 	
   231 	
   230 	TheFs.NotifyChange(ENotifyAll,aStat4,restestname);
   232 	TheFs.NotifyChange(ENotifyAll,aStat4,restestname);
   231 	test(aStat4==KRequestPending);
   233 	test(aStat4==KRequestPending);
   232 
   234 
   233 
   235 
   239 	
   241 	
   240 	oldName=KOldFile;
   242 	oldName=KOldFile;
   241 	oldName[0]=(TText)gDriveToTest;
   243 	oldName[0]=(TText)gDriveToTest;
   242 
   244 
   243 	r=TheFs.GetShortName(restestfile, shortfilename);
   245 	r=TheFs.GetShortName(restestfile, shortfilename);
   244 //	test_Value(r, r == KErrNone || r == KErrPathNotFound);
   246 	test(r==KErrNone || KErrPathNotFound);
   245 	test(r == KErrNone || KErrPathNotFound);
       
   246 
   247 
   247 	r=TheFs.GetLongName(restestfile1, longfilename);
   248 	r=TheFs.GetLongName(restestfile1, longfilename);
   248 //	test_Value(r, r == KErrNone || r == KErrPathNotFound);
   249 	test(r==KErrNone || KErrPathNotFound);
   249 	test(r == KErrNone || KErrPathNotFound);
       
   250 
   250 
   251 	r=file1.Create(TheFs,oldName,EFileWrite);
   251 	r=file1.Create(TheFs,oldName,EFileWrite);
   252 	test_Value(r, r == KErrNone || r==KErrAlreadyExists);
   252 	test(r==KErrNone || r==KErrAlreadyExists);
   253 	file1.Close();
   253 	file1.Close();
   254 
   254 
   255 	r=TheFs.Replace(oldName,restestfile);
   255 	r=TheFs.Replace(oldName,restestfile);
   256 	test_Value(r, r == KErrPermissionDenied);
   256 	test(r==KErrPermissionDenied);
   257 	
   257 	
   258 	r=TheFs.Rename(restestfile,restestfile1);
   258 	r=TheFs.Rename(restestfile,restestfile1);
   259 	test_Value(r, r == KErrPermissionDenied);
   259 	test(r==KErrPermissionDenied);
   260 	
   260 	
   261 	// check that the entry for the resource directory itself can be retrieved with no error
   261 	// check that the entry for the resource directory itself can be retrieved with no error
   262 	// - with or without a slash
   262 	// - with or without a slash
   263 	TPtrC restrictedDir(restestname.Ptr(), restestname.Length());
   263 	TPtrC restrictedDir(restestname.Ptr(), restestname.Length());
   264 	r=TheFs.Entry(restrictedDir, entry);
   264 	r=TheFs.Entry(restrictedDir, entry);
   265 	test.Printf(_L("RFs::Entry(%S) returned %d"), &restrictedDir, r);
   265 	test.Printf(_L("RFs::Entry(%S) returned %d"), &restrictedDir, r);
   266 	test_KErrNone(r);
   266 	test(r==KErrNone);
   267 	test (entry.iAtt & KEntryAttDir);
   267 	test (entry.iAtt & KEntryAttDir);
   268 
   268 
   269 	TPtrC restrictedDirWithNoBackSlash(restrictedDir.Ptr(), restrictedDir.Length()-1);
   269 	TPtrC restrictedDirWithNoBackSlash(restrictedDir.Ptr(), restrictedDir.Length()-1);
   270 	r=TheFs.Entry(restrictedDirWithNoBackSlash,entry);
   270 	r=TheFs.Entry(restrictedDirWithNoBackSlash,entry);
   271 	test.Printf(_L("RFs::Entry(%S) returned %d"), &restrictedDirWithNoBackSlash, r);
   271 	test.Printf(_L("RFs::Entry(%S) returned %d"), &restrictedDirWithNoBackSlash, r);
   272 	test_KErrNone(r);
   272 	test(r==KErrNone);
   273 
   273 
   274 	r=TheFs.Entry(restestfile1,entry);
   274 	r=TheFs.Entry(restestfile1,entry);
   275 	test_Value(r, r == KErrNone || r==KErrNotFound);
   275 	test(r==KErrNone || r==KErrNotFound);
   276 
   276 
   277 	r=TheFs.SetEntry(restestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
   277 	r=TheFs.SetEntry(restestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
   278 	test_Value(r, r == KErrPermissionDenied);
   278 	test(r==KErrPermissionDenied);
   279 
   279 
   280 	r=TheFs.Delete(restestfile1);
   280 	r=TheFs.Delete(restestfile1);
   281 	test_Value(r, r == KErrPermissionDenied);
   281 	test(r==KErrPermissionDenied);
   282 
   282 
   283 	}
   283 	}
   284 
   284 
   285 
   285 
   286 LOCAL_C void privatefalseIDRFstest()
   286 LOCAL_C void privatefalseIDRFstest()
   294 	mkdirname.Zero();
   294 	mkdirname.Zero();
   295 	mkdirname.Append(pritestfalseidname);
   295 	mkdirname.Append(pritestfalseidname);
   296 	mkdirname.Append(KMkDirSub);
   296 	mkdirname.Append(KMkDirSub);
   297 
   297 
   298 	r=TheFs.MkDirAll(mkdirname);	
   298 	r=TheFs.MkDirAll(mkdirname);	
   299 	test_Value(r, r == KErrPermissionDenied);
   299 	test(r==KErrPermissionDenied);
   300 
   300 
   301 	r=TheFs.RmDir(mkdirname);	
   301 	r=TheFs.RmDir(mkdirname);	
   302 	test_Value(r, r == KErrPermissionDenied);
   302 	test(r==KErrPermissionDenied);
   303 
   303 
   304 	r=TheFs.SetSubst(pritestfalseidname,EDriveP);
   304 	r=TheFs.SetSubst(pritestfalseidname,EDriveP);
   305 	test_Value(r, r == KErrPermissionDenied); 
   305 	test(r==KErrPermissionDenied); 
   306 
   306 
   307 	TheFs.NotifyChange(ENotifyAll,aStat2,pritestfalseidname);
   307 	TheFs.NotifyChange(ENotifyAll,aStat2,pritestfalseidname);
   308 	test(aStat2==KErrPermissionDenied);
   308 	test(aStat2==KErrPermissionDenied);
   309 
   309 
   310 
   310 
   316 	
   316 	
   317 	oldName=KOldFile;
   317 	oldName=KOldFile;
   318 	oldName[0]=(TText)gDriveToTest;
   318 	oldName[0]=(TText)gDriveToTest;
   319 
   319 
   320 	r=TheFs.GetShortName(pritestfile, shortfilename);
   320 	r=TheFs.GetShortName(pritestfile, shortfilename);
   321 	test_Value(r, r == KErrPermissionDenied);
   321 	test(r==KErrPermissionDenied);
   322 
   322 
   323 	r=TheFs.GetLongName(pritestfile1, longfilename);
   323 	r=TheFs.GetLongName(pritestfile1, longfilename);
   324 	test_Value(r, r == KErrPermissionDenied);
   324 	test(r==KErrPermissionDenied);
   325 
   325 
   326 	r=file1.Create(TheFs,oldName,EFileWrite);
   326 	r=file1.Create(TheFs,oldName,EFileWrite);
   327 	test_Value(r, r == KErrNone || r==KErrAlreadyExists);
   327 	test(r==KErrNone || r==KErrAlreadyExists);
   328 	file1.Close();
   328 	file1.Close();
   329 
   329 
   330 	r=TheFs.Replace(oldName,pritestfile);
   330 	r=TheFs.Replace(oldName,pritestfile);
   331 	test_Value(r, r == KErrPermissionDenied);
   331 	test(r==KErrPermissionDenied);
   332 	
   332 	
   333 	r=TheFs.Rename(pritestfile,pritestfile1);
   333 	r=TheFs.Rename(pritestfile,pritestfile1);
   334 	test_Value(r, r == KErrPermissionDenied);
   334 	test(r==KErrPermissionDenied);
   335 	
   335 	
   336 	r=TheFs.Entry(pritestfile1,entry);
   336 	r=TheFs.Entry(pritestfile1,entry);
   337 	test_Value(r, r == KErrPermissionDenied);
   337 	test(r==KErrPermissionDenied);
   338 
   338 
   339 	r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
   339 	r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
   340 	test_Value(r, r == KErrPermissionDenied);
   340 	test(r==KErrPermissionDenied);
   341 
   341 
   342 	r=TheFs.Delete(pritestfile1);
   342 	r=TheFs.Delete(pritestfile1);
   343 	test_Value(r, r == KErrPermissionDenied);
   343 	test(r==KErrPermissionDenied);
   344 
   344 
   345 	}
   345 	}
   346 
   346 
   347 
   347 
   348 
   348 
   357 	mkdirname.Zero();
   357 	mkdirname.Zero();
   358 	mkdirname.Append(pritestname);
   358 	mkdirname.Append(pritestname);
   359 	mkdirname.Append(KMkDirSub);
   359 	mkdirname.Append(KMkDirSub);
   360 
   360 
   361 	r=TheFs.MkDirAll(mkdirname);	
   361 	r=TheFs.MkDirAll(mkdirname);	
   362 	test_Value(r, r == KErrPermissionDenied);
   362 	test(r==KErrPermissionDenied);
   363 
   363 
   364 	r=TheFs.RmDir(mkdirname);	
   364 	r=TheFs.RmDir(mkdirname);	
   365 	test_Value(r, r == KErrPermissionDenied);
   365 	test(r==KErrPermissionDenied);
   366 
   366 
   367 	r=TheFs.SetSubst(pritestname,EDriveP);
   367 	r=TheFs.SetSubst(pritestname,EDriveP);
   368 	test_Value(r, r == KErrPermissionDenied); 
   368 	test(r==KErrPermissionDenied); 
   369 
   369 
   370 	TheFs.NotifyChange(ENotifyAll,aStat2,pritestname);
   370 	TheFs.NotifyChange(ENotifyAll,aStat2,pritestname);
   371 	test(aStat2==KErrPermissionDenied);
   371 	test(aStat2==KErrPermissionDenied);
   372 
   372 
   373 
   373 
   379 	
   379 	
   380 	oldName=KOldFile;
   380 	oldName=KOldFile;
   381 	oldName[0]=(TText)gDriveToTest;
   381 	oldName[0]=(TText)gDriveToTest;
   382 
   382 
   383 	r=TheFs.GetShortName(pritestfile, shortfilename);
   383 	r=TheFs.GetShortName(pritestfile, shortfilename);
   384 	test_Value(r, r == KErrPermissionDenied);
   384 	test(r==KErrPermissionDenied);
   385 
   385 
   386 	r=TheFs.GetLongName(pritestfile1, longfilename);
   386 	r=TheFs.GetLongName(pritestfile1, longfilename);
   387 	test_Value(r, r == KErrPermissionDenied);
   387 	test(r==KErrPermissionDenied);
   388 
   388 
   389 	r=file1.Create(TheFs,oldName,EFileWrite);
   389 	r=file1.Create(TheFs,oldName,EFileWrite);
   390 	test_Value(r, r == KErrNone || r==KErrAlreadyExists);
   390 	test(r==KErrNone || r==KErrAlreadyExists);
   391 	file1.Close();
   391 	file1.Close();
   392 
   392 
   393 	r=TheFs.Replace(oldName,pritestfile);
   393 	r=TheFs.Replace(oldName,pritestfile);
   394 	test_Value(r, r == KErrPermissionDenied);
   394 	test(r==KErrPermissionDenied);
   395 	
   395 	
   396 	r=TheFs.Rename(pritestfile,pritestfile1);
   396 	r=TheFs.Rename(pritestfile,pritestfile1);
   397 	test_Value(r, r == KErrPermissionDenied);
   397 	test(r==KErrPermissionDenied);
   398 	
   398 	
   399 	r=TheFs.Entry(pritestfile1,entry);
   399 	r=TheFs.Entry(pritestfile1,entry);
   400 	test_Value(r, r == KErrPermissionDenied);
   400 	test(r==KErrPermissionDenied);
   401 
   401 
   402 	// check that the entry for the private directory itself can be retrieved with no error
   402 	// check that the entry for the private directory itself can be retrieved with no error
   403 	// - with or without a slash
   403 	// - with or without a slash
   404 	TPtrC restrictedDir(pritestname.Ptr(), pritestname.Length());
   404 	TPtrC restrictedDir(pritestname.Ptr(), pritestname.Length());
   405 	r=TheFs.Entry(restrictedDir, entry);
   405 	r=TheFs.Entry(restrictedDir, entry);
   406 	test.Printf(_L("RFs::Entry(%S) returned %d"), &restrictedDir, r);
   406 	test.Printf(_L("RFs::Entry(%S) returned %d"), &restrictedDir, r);
   407 	test_KErrNone(r);
   407 	test(r==KErrNone);
   408 	test (entry.iAtt & KEntryAttDir);
   408 	test (entry.iAtt & KEntryAttDir);
   409 
   409 
   410 	TPtrC restrictedDirWithNoBackSlash(restrictedDir.Ptr(), restrictedDir.Length()-1);
   410 	TPtrC restrictedDirWithNoBackSlash(restrictedDir.Ptr(), restrictedDir.Length()-1);
   411 	r=TheFs.Entry(restrictedDirWithNoBackSlash,entry);
   411 	r=TheFs.Entry(restrictedDirWithNoBackSlash,entry);
   412 	test.Printf(_L("RFs::Entry(%S) returned %d"), &restrictedDirWithNoBackSlash, r);
   412 	test.Printf(_L("RFs::Entry(%S) returned %d"), &restrictedDirWithNoBackSlash, r);
   413 	test_KErrNone(r);
   413 	test(r==KErrNone);
   414 
   414 
   415 	r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
   415 	r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
   416 	test_Value(r, r == KErrPermissionDenied);
   416 	test(r==KErrPermissionDenied);
   417 
   417 
   418 	r=TheFs.Delete(pritestfile1);
   418 	r=TheFs.Delete(pritestfile1);
   419 	test_Value(r, r == KErrPermissionDenied);
   419 	test(r==KErrPermissionDenied);
   420 
   420 
   421 	}
   421 	}
   422 
   422 
   423 
   423 
   424 LOCAL_C void privateSIDRFstest()
   424 LOCAL_C void privateSIDRFstest()
   431 
   431 
   432 	mkdirname.Zero();
   432 	mkdirname.Zero();
   433 	mkdirname.Append(theprivatepath);
   433 	mkdirname.Append(theprivatepath);
   434 	mkdirname.Append(KMkDirSub);
   434 	mkdirname.Append(KMkDirSub);
   435 	r=TheFs.MkDirAll(mkdirname);	
   435 	r=TheFs.MkDirAll(mkdirname);	
   436 	test_KErrNone(r);
   436 	test(r==KErrNone);
   437 
   437 
   438 	r=TheFs.RmDir(mkdirname);	
   438 	r=TheFs.RmDir(mkdirname);	
   439 	test_KErrNone(r);
   439 	test(r==KErrNone);
   440 
   440 
   441 	r=TheFs.SetSubst(theprivatepath,EDriveP);	
   441 	r=TheFs.SetSubst(theprivatepath,EDriveP);	
   442 	test_Value(r, r == KErrPermissionDenied);
   442 	test(r==KErrPermissionDenied);
   443 
   443 
   444 	r=TheFs.RealName(_L("P:\\File.XXX"),realName);
   444 	r=TheFs.RealName(_L("P:\\File.XXX"),realName);
   445 	test_KErrNone(r);
   445 	test(r==KErrNone);
   446 	
   446 	
   447 	r=TheFs.SetSessionPath(theprivatepath);
   447 	r=TheFs.SetSessionPath(theprivatepath);
   448 	test_KErrNone(r);
   448 	test(r==KErrNone);
   449 
   449 
   450 	TheFs.NotifyChange(ENotifyAll,aStat3,theprivatepath);
   450 	TheFs.NotifyChange(ENotifyAll,aStat3,theprivatepath);
   451 	test(aStat3==KRequestPending);
   451 	test(aStat3==KRequestPending);
   452 
   452 
   453 
   453 
   459 	
   459 	
   460 	oldName=KOldFile;
   460 	oldName=KOldFile;
   461 	oldName[0]=(TText)gDriveToTest;
   461 	oldName[0]=(TText)gDriveToTest;
   462 
   462 
   463 	r=TheFs.GetShortName(pritestfile, shortfilename);
   463 	r=TheFs.GetShortName(pritestfile, shortfilename);
   464 //	test_Value(r, r == KErrNone || r == KErrPathNotFound);
   464 	test(r==KErrNone || KErrPathNotFound);
   465 	test(r == KErrNone || KErrPathNotFound);
       
   466 
   465 
   467 	r=TheFs.GetLongName(pritestfile1, longfilename);
   466 	r=TheFs.GetLongName(pritestfile1, longfilename);
   468 //	test_Value(r, r == KErrNone || r == KErrPathNotFound);
   467 	test(r==KErrNone || KErrPathNotFound);
   469 	test(r == KErrNone || KErrPathNotFound);
       
   470 
   468 
   471 	r=file1.Create(TheFs,oldName,EFileWrite);
   469 	r=file1.Create(TheFs,oldName,EFileWrite);
   472 	test_Value(r, r == KErrNone || r==KErrAlreadyExists);
   470 	test(r==KErrNone || r==KErrAlreadyExists);
   473 	file1.Close();
   471 	file1.Close();
   474 
   472 
   475 	r=TheFs.Replace(oldName,pritestfile);
   473 	r=TheFs.Replace(oldName,pritestfile);
   476 	test_KErrNone(r);
   474 	test(r==KErrNone);
   477 	
   475 	
   478 	r=TheFs.Rename(pritestfile,pritestfile1);
   476 	r=TheFs.Rename(pritestfile,pritestfile1);
   479 	test_Value(r, r == KErrNone || r==KErrAlreadyExists);
   477 	test(r==KErrNone || r==KErrAlreadyExists);
   480 	
   478 	
   481 	r=TheFs.Entry(pritestfile1,entry);
   479 	r=TheFs.Entry(pritestfile1,entry);
   482 	test_KErrNone(r);
   480 	test(r==KErrNone);
   483 
   481 
   484 	//Test Entry with correct SID
   482 	//Test Entry with correct SID
   485 	r=TheFs.Entry(theprivatepath,entry);
   483 	r=TheFs.Entry(theprivatepath,entry);
   486 	test_KErrNone(r);
   484 	test(r==KErrNone);
   487 	
   485 	
   488 	//Test Entry with correct SID and without "//" appended
   486 	//Test Entry with correct SID and without "//" appended
   489 	r=TheFs.Entry(KPrivatePathTest1,entry);
   487 	r=TheFs.Entry(KPrivatePathTest1,entry);
   490 	test_KErrNone(r);
   488 	test(r==KErrNone);
   491 	
   489 	
   492 	//Test Entry with invalid SID, without // appended
   490 	//Test Entry with invalid SID, without // appended
   493 	r=TheFs.Entry(KPrivatePathTest2,entry);
   491 	r=TheFs.Entry(KPrivatePathTest2,entry);
   494 	test_Value(r, r == KErrPermissionDenied);
   492 	test(r==KErrPermissionDenied);
   495 	
   493 	
   496 	//Test Entry with invalid SID
   494 	//Test Entry with invalid SID
   497 	r=TheFs.Entry(KPrivatePathTest3,entry);
   495 	r=TheFs.Entry(KPrivatePathTest3,entry);
   498 	test_Value(r, r == KErrPermissionDenied);
   496 	test(r==KErrPermissionDenied);
   499 
   497 
   500 	r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
   498 	r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
   501 	test_KErrNone(r);
   499 	test(r==KErrNone);
   502 
   500 
   503 	r=TheFs.Delete(pritestfile1);
   501 	r=TheFs.Delete(pritestfile1);
   504 	test_KErrNone(r);
   502 	test(r==KErrNone);
   505 
   503 
   506 	}
   504 	}
   507 
   505 
   508 
   506 
   509 LOCAL_C void systemRFiletest()
   507 LOCAL_C void systemRFiletest()
   510 //
   508 //
   511 //
   509 //
   512 //
   510 //
   513 	{
   511 	{
   514 	r=TheFs.SetSessionPath(systestname);
   512 	r=TheFs.SetSessionPath(systestname);
   515 	test_Value(r, r == KErrPermissionDenied);
   513 	test(r==KErrPermissionDenied);
   516 
   514 
   517 	r=file1.Temp(TheFs,systestname,fromTemp,EFileWrite);
   515 	r=file1.Temp(TheFs,systestname,fromTemp,EFileWrite);
   518 	test_Value(r, r == KErrPermissionDenied);
   516 	test(r==KErrPermissionDenied);
   519 
   517 
   520 
   518 
   521 	TBuf<25> sysfilename;
   519 	TBuf<25> sysfilename;
   522 	sysfilename.Append(systestname);
   520 	sysfilename.Append(systestname);
   523 	sysfilename.Append(KFileSys);
   521 	sysfilename.Append(KFileSys);
   524 
   522 
   525 	r=file1.Create(TheFs,sysfilename,EFileWrite);
   523 	r=file1.Create(TheFs,sysfilename,EFileWrite);
   526 	test_Value(r, r == KErrPermissionDenied);
   524 	test(r==KErrPermissionDenied);
   527 
   525 
   528 	r=file1.Open(TheFs,sysfilename,EFileWrite);
   526 	r=file1.Open(TheFs,sysfilename,EFileWrite);
   529 	test_Value(r, r == KErrPermissionDenied);
   527 	test(r==KErrPermissionDenied);
   530 	
   528 	
   531 	r=file1.Open(TheFs,sysfilename,EFileRead);
   529 	r=file1.Open(TheFs,sysfilename,EFileRead);
   532 	test_Value(r, r == KErrPermissionDenied);
   530 	test(r==KErrPermissionDenied);
   533 	
   531 	
   534 	r=file1.Replace(TheFs,sysfilename,EFileWrite);
   532 	r=file1.Replace(TheFs,sysfilename,EFileWrite);
   535 	test_Value(r, r == KErrPermissionDenied);
   533 	test(r==KErrPermissionDenied);
   536 
   534 
   537 	TFindFile finder(TheFs);
   535 	TFindFile finder(TheFs);
   538 	CDir* dir = NULL;
   536 	CDir* dir = NULL;
   539 	r=finder.FindWildByDir(KWildFile, KWildPath, dir);
   537 	r=finder.FindWildByDir(KWildFile, KWildPath, dir);
   540 	if (!(r==KErrPermissionDenied))
   538 	if (!(r==KErrPermissionDenied))
   541 		test.Printf(_L("T_DCNONE: test find wildcards r = %d (expected KErrPermissionDenied)\n"), r);
   539 		test.Printf(_L("T_DCNONE: test find wildcards r = %d (expected KErrPermissionDenied)\n"), r);
   542 	test_Value(r, r == KErrPermissionDenied);
   540 	test(r==KErrPermissionDenied);
   543 	delete dir;
   541 	delete dir;
   544 	}
   542 	}
   545 
   543 
   546 LOCAL_C void resourceRFiletest()
   544 LOCAL_C void resourceRFiletest()
   547 //
   545 //
   548 //
   546 //
   549 //
   547 //
   550 	{
   548 	{
   551 	r=TheFs.SetSessionPath(restestname);
   549 	r=TheFs.SetSessionPath(restestname);
   552 	test_KErrNone(r);
   550 	test(r==KErrNone);
   553 
   551 
   554 	r=file1.Temp(TheFs,restestname,fromTemp,EFileWrite);
   552 	r=file1.Temp(TheFs,restestname,fromTemp,EFileWrite);
   555 	test_Value(r, r == KErrPermissionDenied);
   553 	test(r==KErrPermissionDenied);
   556 	file1.Close();
   554 	file1.Close();
   557 
   555 
   558 	r=file1.Create(TheFs,KFileRes,EFileWrite);
   556 	r=file1.Create(TheFs,KFileRes,EFileWrite);
   559 	test_Value(r, r == KErrPermissionDenied);
   557 	test(r==KErrPermissionDenied);
   560 	file1.Close();
   558 	file1.Close();
   561 
   559 
   562 	r=file1.Open(TheFs,KFileRes,EFileWrite);
   560 	r=file1.Open(TheFs,KFileRes,EFileWrite);
   563 	test_Value(r, r == KErrPermissionDenied);
   561 	test(r==KErrPermissionDenied);
   564 	file1.Close();
   562 	file1.Close();
   565 
   563 
   566 	r=file1.Open(TheFs,KFileRes,EFileRead|EFileShareReadersOnly);
   564 	r=file1.Open(TheFs,KFileRes,EFileRead|EFileShareReadersOnly);
   567 	test_Value(r, r == KErrNone || r==KErrPathNotFound);
   565 	test(r==KErrNone || r==KErrPathNotFound);
   568 	file1.Close();
   566 	file1.Close();
   569 
   567 
   570 	r=file1.Open(TheFs,KFileRes,EFileShareReadersOrWriters|EFileRead);
   568 	r=file1.Open(TheFs,KFileRes,EFileShareReadersOrWriters|EFileRead);
   571 	test_Value(r, r == KErrNone || r==KErrPathNotFound);
   569 	test(r==KErrNone || r==KErrPathNotFound);
   572 	file1.Close();
   570 	file1.Close();
   573 
   571 
   574 	r=file1.Open(TheFs,KFileRes,EFileShareReadersOrWriters|EFileWrite);
   572 	r=file1.Open(TheFs,KFileRes,EFileShareReadersOrWriters|EFileWrite);
   575 	test_Value(r, r == KErrPermissionDenied);
   573 	test(r==KErrPermissionDenied);
   576 	file1.Close();
   574 	file1.Close();
   577 
   575 
   578 	r=file1.Open(TheFs,KFileRes,EFileShareReadersOnly);
   576 	r=file1.Open(TheFs,KFileRes,EFileShareReadersOnly);
   579 	test_Value(r, r == KErrNone || r==KErrPathNotFound);
   577 	test(r==KErrNone || r==KErrPathNotFound);
   580 
   578 
   581 	r=file1.ChangeMode(EFileShareExclusive);	//this is not illegal though will prevent shared access to resource which is nit my fault but may be desirable to prevent
   579 	r=file1.ChangeMode(EFileShareExclusive);	//this is not illegal though will prevent shared access to resource which is nit my fault but may be desirable to prevent
   582 	test_Value(r, r == KErrNone || r==KErrPathNotFound);
   580 	test(r==KErrNone || r==KErrPathNotFound);
   583 
   581 
   584 	//this operation is prevented as you can not open a file for write access in the resource directory
   582 	//this operation is prevented as you can not open a file for write access in the resource directory
   585 	r=file1.Rename(KFileRes3);
   583 	r=file1.Rename(KFileRes3);
   586 	test_Value(r, r == KErrPermissionDenied || r==KErrAccessDenied);
   584 	test(r==KErrPermissionDenied || r==KErrAccessDenied);
   587 
   585 
   588 	file1.Close();
   586 	file1.Close();
   589 
   587 
   590 	r=file1.Replace(TheFs,KFileRes,EFileWrite);
   588 	r=file1.Replace(TheFs,KFileRes,EFileWrite);
   591 	test_Value(r, r == KErrPermissionDenied);
   589 	test(r==KErrPermissionDenied);
   592 	file1.Close();
   590 	file1.Close();
   593 
   591 
   594 	}
   592 	}
   595 
   593 
   596 
   594 
   599 //
   597 //
   600 //
   598 //
   601 	{
   599 	{
   602 
   600 
   603 	r=TheFs.SetSessionPath(pritestfalseidname);
   601 	r=TheFs.SetSessionPath(pritestfalseidname);
   604 	test_Value(r, r == KErrPermissionDenied);
   602 	test(r==KErrPermissionDenied);
   605 
   603 
   606 	r=file1.Temp(TheFs,pritestfalseidname,fromTemp,EFileWrite);
   604 	r=file1.Temp(TheFs,pritestfalseidname,fromTemp,EFileWrite);
   607 	test_Value(r, r == KErrPermissionDenied);
   605 	test(r==KErrPermissionDenied);
   608 
   606 
   609 	TBuf<25> prifilename;
   607 	TBuf<25> prifilename;
   610 	prifilename.Append(pritestname);
   608 	prifilename.Append(pritestname);
   611 	prifilename.Append(KFileSys);
   609 	prifilename.Append(KFileSys);
   612 
   610 
   613 	r=file1.Create(TheFs,prifilename,EFileWrite);
   611 	r=file1.Create(TheFs,prifilename,EFileWrite);
   614 	test_Value(r, r == KErrPermissionDenied);
   612 	test(r==KErrPermissionDenied);
   615 
   613 
   616 
   614 
   617 	r=file1.Open(TheFs,prifilename,EFileWrite);
   615 	r=file1.Open(TheFs,prifilename,EFileWrite);
   618 	test_Value(r, r == KErrPermissionDenied);
   616 	test(r==KErrPermissionDenied);
   619 
   617 
   620 	r=file1.Open(TheFs,prifilename,EFileRead);
   618 	r=file1.Open(TheFs,prifilename,EFileRead);
   621 	test_Value(r, r == KErrPermissionDenied);
   619 	test(r==KErrPermissionDenied);
   622 
   620 
   623 	
   621 	
   624 	r=file1.Replace(TheFs,prifilename,EFileWrite);
   622 	r=file1.Replace(TheFs,prifilename,EFileWrite);
   625 	test_Value(r, r == KErrPermissionDenied);
   623 	test(r==KErrPermissionDenied);
   626 
   624 
   627 	}
   625 	}
   628 
   626 
   629 
   627 
   630 
   628 
   633 //
   631 //
   634 //
   632 //
   635 	{
   633 	{
   636 
   634 
   637 	r=TheFs.SetSessionPath(pritestname);
   635 	r=TheFs.SetSessionPath(pritestname);
   638 	test_Value(r, r == KErrPermissionDenied);
   636 	test(r==KErrPermissionDenied);
   639 
   637 
   640 	r=file1.Temp(TheFs,pritestname,fromTemp,EFileWrite);
   638 	r=file1.Temp(TheFs,pritestname,fromTemp,EFileWrite);
   641 	test_Value(r, r == KErrPermissionDenied);
   639 	test(r==KErrPermissionDenied);
   642 
   640 
   643 	TBuf<25> prifilename;
   641 	TBuf<25> prifilename;
   644 	prifilename.Append(pritestname);
   642 	prifilename.Append(pritestname);
   645 	prifilename.Append(KFileSys);
   643 	prifilename.Append(KFileSys);
   646 
   644 
   647 	r=file1.Create(TheFs,prifilename,EFileWrite);
   645 	r=file1.Create(TheFs,prifilename,EFileWrite);
   648 	test_Value(r, r == KErrPermissionDenied);
   646 	test(r==KErrPermissionDenied);
   649 
   647 
   650 
   648 
   651 	r=file1.Open(TheFs,prifilename,EFileWrite);
   649 	r=file1.Open(TheFs,prifilename,EFileWrite);
   652 	test_Value(r, r == KErrPermissionDenied);
   650 	test(r==KErrPermissionDenied);
   653 
   651 
   654 	
   652 	
   655 	r=file1.Open(TheFs,prifilename,EFileRead);
   653 	r=file1.Open(TheFs,prifilename,EFileRead);
   656 	test_Value(r, r == KErrPermissionDenied);
   654 	test(r==KErrPermissionDenied);
   657 
   655 
   658 
   656 
   659 	r=file1.Replace(TheFs,prifilename,EFileWrite);
   657 	r=file1.Replace(TheFs,prifilename,EFileWrite);
   660 	test_Value(r, r == KErrPermissionDenied);
   658 	test(r==KErrPermissionDenied);
   661 
   659 
   662 	}
   660 	}
   663 
   661 
   664 LOCAL_C void privateSIDRFiletest()
   662 LOCAL_C void privateSIDRFiletest()
   665 //
   663 //
   666 //
   664 //
   667 //
   665 //
   668 	{
   666 	{
   669 
   667 
   670 	r=TheFs.SetSessionToPrivate(gTheDriveNum);
   668 	r=TheFs.SetSessionToPrivate(gTheDriveNum);
   671 	test_KErrNone(r);
   669 	test(r==KErrNone);
   672 		
   670 		
   673 	r=file1.Temp(TheFs,theprivatepath,fromTemp,EFileWrite);
   671 	r=file1.Temp(TheFs,theprivatepath,fromTemp,EFileWrite);
   674 	test_KErrNone(r);
   672 	test(r==KErrNone);
   675 	file1.Close();
   673 	file1.Close();
   676 	r=file1.Create(TheFs,KFilePri,EFileWrite);
   674 	r=file1.Create(TheFs,KFilePri,EFileWrite);
   677 	test_Value(r, r == KErrNone || r==KErrAlreadyExists);
   675 	test(r==KErrNone || r==KErrAlreadyExists);
   678 	file1.Close();
   676 	file1.Close();
   679 	r=file1.Open(TheFs,KFilePri,EFileWrite);
   677 	r=file1.Open(TheFs,KFilePri,EFileWrite);
   680 	test_KErrNone(r);
   678 	test(r==KErrNone);
   681 	file1.Close();
   679 	file1.Close();
   682 	r=file1.Open(TheFs,KFilePri,EFileRead);
   680 	r=file1.Open(TheFs,KFilePri,EFileRead);
   683 	test_KErrNone(r);
   681 	test(r==KErrNone);
   684 	file1.Close();
   682 	file1.Close();
   685 	r=file1.Replace(TheFs,KFilePri,EFileWrite);
   683 	r=file1.Replace(TheFs,KFilePri,EFileWrite);
   686 	test_KErrNone(r);
   684 	test(r==KErrNone);
   687 	r=file1.Rename(KFilePri3);
   685 	r=file1.Rename(KFilePri3);
   688 	test_Value(r, r == KErrNone || r==KErrAlreadyExists);
   686 	test(r==KErrNone || r==KErrAlreadyExists);
   689 	file1.Close();
   687 	file1.Close();
   690 
   688 
   691 	}
   689 	}
   692 
   690 
   693 
   691 
   699 	//system
   697 	//system
   700 
   698 
   701 	TBuf<30> dirNameBuf(KSystemPath);
   699 	TBuf<30> dirNameBuf(KSystemPath);
   702 	dirNameBuf[0]=(TText)gDriveToTest;
   700 	dirNameBuf[0]=(TText)gDriveToTest;
   703 	r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
   701 	r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
   704 	test_Value(r, r == KErrPermissionDenied);
   702 	test(r==KErrPermissionDenied);
   705 	dir.Close();
   703 	dir.Close();
   706 	r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
   704 	r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
   707 	test_Value(r, r == KErrPermissionDenied);
   705 	test(r==KErrPermissionDenied);
   708 	dirNameBuf.Zero();
   706 	dirNameBuf.Zero();
   709 	delete dirEntries;
   707 	delete dirEntries;
   710 	
   708 	
   711 	dirNameBuf=KPrivateFalseID;
   709 	dirNameBuf=KPrivateFalseID;
   712 	dirNameBuf[0]=(TText)gDriveToTest;
   710 	dirNameBuf[0]=(TText)gDriveToTest;
   713 	r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
   711 	r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
   714 	test_Value(r, r == KErrPermissionDenied);
   712 	test(r==KErrPermissionDenied);
   715 	dir.Close();
   713 	dir.Close();
   716 	r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
   714 	r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
   717 	test_Value(r, r == KErrPermissionDenied);
   715 	test(r==KErrPermissionDenied);
   718 	dirNameBuf.Zero();
   716 	dirNameBuf.Zero();
   719 	delete dirEntries;
   717 	delete dirEntries;
   720 
   718 
   721 	//Private
   719 	//Private
   722 	dirNameBuf=KPrivatePath;
   720 	dirNameBuf=KPrivatePath;
   723 	dirNameBuf[0]=(TText)gDriveToTest;
   721 	dirNameBuf[0]=(TText)gDriveToTest;
   724 	r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
   722 	r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
   725 	test_Value(r, r == KErrPermissionDenied);
   723 	test(r==KErrPermissionDenied);
   726 	dir.Close();
   724 	dir.Close();
   727 	r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
   725 	r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
   728 	test_Value(r, r == KErrPermissionDenied);
   726 	test(r==KErrPermissionDenied);
   729 	dirNameBuf.Zero();
   727 	dirNameBuf.Zero();
   730 	delete dirEntries;
   728 	delete dirEntries;
   731 	//Private/uid
   729 	//Private/uid
   732 	TheFs.PrivatePath(dirNameBuf);
   730 	TheFs.PrivatePath(dirNameBuf);
   733 	dirNameBuf.Insert(0,_L("?:"));
   731 	dirNameBuf.Insert(0,_L("?:"));
   734 	dirNameBuf[0]=(TText)gDriveToTest;
   732 	dirNameBuf[0]=(TText)gDriveToTest;
   735 	r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
   733 	r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
   736 	test_KErrNone(r);
   734 	test(r==KErrNone);
   737 	dir.Close();
   735 	dir.Close();
   738 	r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
   736 	r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
   739 	test_KErrNone(r);
   737 	test(r==KErrNone);
   740 	dirNameBuf.Zero();
   738 	dirNameBuf.Zero();
   741 	delete dirEntries;
   739 	delete dirEntries;
   742 	//Resource
   740 	//Resource
   743 	dirNameBuf=KResourcePath;
   741 	dirNameBuf=KResourcePath;
   744 	dirNameBuf[0]=(TText)gDriveToTest;
   742 	dirNameBuf[0]=(TText)gDriveToTest;
   745 	r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
   743 	r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
   746 	test_KErrNone(r);
   744 	test(r==KErrNone);
   747 	r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
   745 	r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
   748 	test_KErrNone(r);
   746 	test(r==KErrNone);
   749 	dir.Close();
   747 	dir.Close();
   750 	delete dirEntries;
   748 	delete dirEntries;
   751 	}
   749 	}
   752 
   750 
   753 
   751 
   755 //
   753 //
   756 //	test APIs with no capabilities
   754 //	test APIs with no capabilities
   757 //
   755 //
   758 	{
   756 	{
   759 	r=TheFs.FileSystemName(fsname,gTheDriveNum);
   757 	r=TheFs.FileSystemName(fsname,gTheDriveNum);
   760 	test_KErrNone(r);
   758 	test(r==KErrNone);
   761 	r = DismountFileSystem(TheFs, fsname, gTheDriveNum);
   759 	r = DismountFileSystem(TheFs, fsname, gTheDriveNum);
   762 	test_Value(r, r == KErrPermissionDenied);
   760 	test(r==KErrPermissionDenied);
   763 //	r=TheFs.RemoveFileSystem(fsname);	//can not test due to bug elsewhere fix exists
   761 //	r=TheFs.RemoveFileSystem(fsname);	//can not test due to bug elsewhere fix exists
   764 //	test_Value(r, r == KErrPermissionDenied);
   762 //	test(r==KErrPermissionDenied);
   765 //	r=TheFs.AddFileSystem(fsname);
   763 //	r=TheFs.AddFileSystem(fsname);
   766 //	test_Value(r, r == KErrPermissionDenied);
   764 //	test(r==KErrPermissionDenied);
   767 	r = MountFileSystem(TheFs, fsname, gTheDriveNum);
   765 	r = MountFileSystem(TheFs, fsname, gTheDriveNum);
   768 	test_Value(r, r == KErrPermissionDenied);
   766 	test(r==KErrPermissionDenied);
   769 	r=TheFs.SetDriveName(gTheDriveNum,KDriveName);
   767 	r=TheFs.SetDriveName(gTheDriveNum,KDriveName);
   770 	test_Value(r, r == KErrPermissionDenied);
   768 	test(r==KErrPermissionDenied);
   771 //	r=TheFs.SetVolumeLabel(KVolLable, gTheDriveNum);	//broken on wins C:
   769 //	r=TheFs.SetVolumeLabel(KVolLable, gTheDriveNum);	//broken on wins C:
   772 //	test_Value(r, r == KErrPermissionDenied);
   770 //	test(r==KErrPermissionDenied);
   773 
   771 
   774 	systemRFstest();
   772 	systemRFstest();
   775 	resourceRFstest();
   773 	resourceRFstest();
   776 	privateRFstest();
   774 	privateRFstest();
   777 	privateSIDRFstest();
   775 	privateSIDRFstest();
   792 	test(aStat1==KErrPermissionDenied);
   790 	test(aStat1==KErrPermissionDenied);
   793 	test(aStat2==KErrPermissionDenied);
   791 	test(aStat2==KErrPermissionDenied);
   794 	test(aStat3==KErrNone);
   792 	test(aStat3==KErrNone);
   795 	
   793 	
   796 	r=TheFs.SetSessionPath(systestname);
   794 	r=TheFs.SetSessionPath(systestname);
   797 	test_Value(r, r == KErrPermissionDenied);
   795 	test(r==KErrPermissionDenied);
   798 	
   796 	
   799 	
   797 	
   800 //Test RRawDisk class
   798 //Test RRawDisk class
   801 	r=rawdisk.Open(TheFs,gTheDriveNum);
   799 	r=rawdisk.Open(TheFs,gTheDriveNum);
   802 	test_Value(r, r == KErrPermissionDenied);
   800 	test(r==KErrPermissionDenied);
   803 //	rawdisk.Close();
   801 //	rawdisk.Close();
   804 
   802 
   805 	r=format.Open(TheFs,driveBuf,EHighDensity,count);
   803 	r=format.Open(TheFs,driveBuf,EHighDensity,count);
   806 	test_Value(r, r == KErrPermissionDenied);
   804 	test(r==KErrPermissionDenied);
   807 
   805 
   808 	RDirtest();
   806 	RDirtest();
   809 
   807 
   810 	driveBuf[0]=(TText)gDriveToTest;
   808 	driveBuf[0]=(TText)gDriveToTest;
   811 	r=TheFs.ScanDrive(driveBuf);
   809 	r=TheFs.ScanDrive(driveBuf);
   812 	test_Value(r, r == KErrPermissionDenied);
   810 	test(r==KErrPermissionDenied);
   813 	r=TheFs.CheckDisk(driveBuf);
   811 	r=TheFs.CheckDisk(driveBuf);
   814 	test_Value(r, r == KErrPermissionDenied);
   812 	test(r==KErrPermissionDenied);
   815 	}
   813 	}
   816 
   814 
   817 LOCAL_C void TestCaps()
   815 LOCAL_C void TestCaps()
   818 //
   816 //
   819 //	test format etc that require certain capabilities
   817 //	test format etc that require certain capabilities
   831 	r=RProcess().HasCapability(ECapability_None, __PLATSEC_DIAGNOSTIC_STRING(myDiagMsg));
   829 	r=RProcess().HasCapability(ECapability_None, __PLATSEC_DIAGNOSTIC_STRING(myDiagMsg));
   832 	test(r);
   830 	test(r);
   833 
   831 
   834 	driveBuf[0]=(TText)gDriveToTest;
   832 	driveBuf[0]=(TText)gDriveToTest;
   835 	r=TheFs.SessionPath(temp);
   833 	r=TheFs.SessionPath(temp);
   836 	test_KErrNone(r);
   834 	test(r==KErrNone);
   837 
   835 
   838 	r=TheFs.CreatePrivatePath(gTheDriveNum);
   836 	r=TheFs.CreatePrivatePath(gTheDriveNum);
   839 	test_Value(r, r == KErrNone || r== KErrAlreadyExists);
   837 	test(r==KErrNone || r== KErrAlreadyExists);
   840 
   838 
   841 	TBuf<18> tempPri;
   839 	TBuf<18> tempPri;
   842 	r=TheFs.PrivatePath(tempPri);
   840 	r=TheFs.PrivatePath(tempPri);
   843 	test_KErrNone(r);
   841 	test(r==KErrNone);
   844 	theprivatepath = _L("?:");
   842 	theprivatepath = _L("?:");
   845 	theprivatepath.Append(tempPri);
   843 	theprivatepath.Append(tempPri);
   846 
   844 
   847 	TestNoCaps();
   845 	TestNoCaps();
   848 
   846 
   849 	TFileName thesessionpath;
   847 	TFileName thesessionpath;
   850 	r=TheFs.SetSessionToPrivate(gTheDriveNum);
   848 	r=TheFs.SetSessionToPrivate(gTheDriveNum);
   851 	test_KErrNone(r);
   849 	test(r==KErrNone);
   852 	r=TheFs.SessionPath(thesessionpath);
   850 	r=TheFs.SessionPath(thesessionpath);
   853 	test_KErrNone(r);
   851 	test(r==KErrNone);
   854 	
   852 	
   855 	test(thesessionpath == theprivatepath);
   853 	test(thesessionpath == theprivatepath);
   856 
   854 
   857 	}
   855 	}
   858 
   856 
   862 // Create system and private directories for scan with and without DC
   860 // Create system and private directories for scan with and without DC
   863 //
   861 //
   864 	{
   862 	{
   865 	TInt r;
   863 	TInt r;
   866 	r = TheFs.MkDir(_L("\\normal\\"));
   864 	r = TheFs.MkDir(_L("\\normal\\"));
   867 	test_Value(r, r == KErrNone || r == KErrAlreadyExists);
   865 	test(r == KErrNone || r == KErrAlreadyExists);
   868 	r = TheFs.MkDir(_L("\\normal\\one\\"));
   866 	r = TheFs.MkDir(_L("\\normal\\one\\"));
   869 	test_Value(r, r == KErrNone || r == KErrAlreadyExists);
   867 	test(r == KErrNone || r == KErrAlreadyExists);
   870 	r = TheFs.MkDir(_L("\\normal\\two\\"));
   868 	r = TheFs.MkDir(_L("\\normal\\two\\"));
   871 	test_Value(r, r == KErrNone || r == KErrAlreadyExists);
   869 	test(r == KErrNone || r == KErrAlreadyExists);
   872 	r = TheFs.MkDir(_L("\\sys\\"));
   870 	r = TheFs.MkDir(_L("\\sys\\"));
   873 	test_Value(r, r == KErrPermissionDenied);
   871 	test(r == KErrPermissionDenied);
   874 	r = TheFs.MkDir(_L("\\sys\\one\\"));
   872 	r = TheFs.MkDir(_L("\\sys\\one\\"));
   875 	test_Value(r, r == KErrPermissionDenied);
   873 	test(r == KErrPermissionDenied);
   876 	r = TheFs.MkDir(_L("\\sys\\two\\"));
   874 	r = TheFs.MkDir(_L("\\sys\\two\\"));
   877 	test_Value(r, r == KErrPermissionDenied);
   875 	test(r == KErrPermissionDenied);
   878 	r = TheFs.MkDir(_L("\\private\\"));
   876 	r = TheFs.MkDir(_L("\\private\\"));
   879 	test_Value(r, r == KErrPermissionDenied);
   877 	test(r == KErrPermissionDenied);
   880 	r = TheFs.MkDir(_L("\\private\\one\\"));
   878 	r = TheFs.MkDir(_L("\\private\\one\\"));
   881 	test_Value(r, r == KErrPermissionDenied);
   879 	test(r == KErrPermissionDenied);
   882 	r = TheFs.MkDir(_L("\\private\\two\\"));
   880 	r = TheFs.MkDir(_L("\\private\\two\\"));
   883 	test_Value(r, r == KErrPermissionDenied);
   881 	test(r == KErrPermissionDenied);
   884 	r = TheFs.MkDir(_L("\\ZZZZZZ\\"));
   882 	r = TheFs.MkDir(_L("\\ZZZZZZ\\"));
   885 	test_Value(r, r == KErrNone || r == KErrAlreadyExists);
   883 	test(r == KErrNone || r == KErrAlreadyExists);
   886 	}
   884 	}
   887 
   885 
   888 TFileName dirName;
   886 TFileName dirName;
   889 
   887 
   890 LOCAL_C void ScanDir(const TDesC& aName, CDirScan::TScanDirection aDirection, TInt aError)
   888 LOCAL_C void ScanDir(const TDesC& aName, CDirScan::TScanDirection aDirection, TInt aError)
   891 	{
   889 	{
   892 	CDirScan* scanner = NULL;
   890 	CDirScan* scanner = NULL;
   893 	TRAP(r, scanner = CDirScan::NewL(TheFs));
   891 	TRAP(r, scanner = CDirScan::NewL(TheFs));
   894 	test_Value(r, r == KErrNone && scanner);
   892 	test(r == KErrNone && scanner);
   895 
   893 
   896 	TRAP(r, scanner->SetScanDataL(aName,KEntryAttDir,ESortByName|EAscending,aDirection));
   894 	TRAP(r, scanner->SetScanDataL(aName,KEntryAttDir,ESortByName|EAscending,aDirection));
   897 	test_KErrNone(r);
   895 	test(r == KErrNone);
   898 	
   896 	
   899 	CDir *entryList=NULL;
   897 	CDir *entryList=NULL;
   900 	for (;;)
   898 	for (;;)
   901 		{
   899 		{
   902 		TRAP(r, scanner->NextL(entryList));
   900 		TRAP(r, scanner->NextL(entryList));
   903 		test_Value(r, r == aError);
   901 		test(r == aError);
   904 		if (entryList==NULL)
   902 		if (entryList==NULL)
   905 			break;
   903 			break;
   906 		TInt count=entryList->Count();
   904 		TInt count=entryList->Count();
   907 		while (count--)
   905 		while (count--)
   908 			{
   906 			{
   937 		TBuf<30> privatepath;
   935 		TBuf<30> privatepath;
   938 		r=TheFs.PrivatePath(privatepath);
   936 		r=TheFs.PrivatePath(privatepath);
   939 		test.Printf(_L("Private Path is=%S"),&privatepath);
   937 		test.Printf(_L("Private Path is=%S"),&privatepath);
   940 		
   938 		
   941 		r = TheFs.MkDir(_L("\\Caged\\"));
   939 		r = TheFs.MkDir(_L("\\Caged\\"));
   942 		test_Value(r, r == KErrNone || r==KErrAlreadyExists);
   940 		test(r==KErrNone || r==KErrAlreadyExists);
   943 		
   941 		
   944 		CDir* entryCount=NULL;
   942 		CDir* entryCount=NULL;
   945 		r=TheFs.GetDir(_L("\\*.*"),KEntryAttNormal,ESortNone,entryCount);
   943 		r=TheFs.GetDir(_L("\\*.*"),KEntryAttNormal,ESortNone,entryCount);
   946 		test_KErrNone(r);
   944 		test(r==KErrNone);
   947 		TInt rootCount= entryCount->Count();
   945 		TInt rootCount= entryCount->Count();
   948 		
   946 		
   949 		delete entryCount;
   947 		delete entryCount;
   950 		entryCount=NULL;
   948 		entryCount=NULL;
   951 
   949 
   952 
   950 
   953 		//Testing Copy
   951 		//Testing Copy
   954 		CDir* entryCount2=NULL;
   952 		CDir* entryCount2=NULL;
   955 		r=fMan->Copy(_L("\\sys\\"),_L("\\Caged\\"));
   953 		r=fMan->Copy(_L("\\sys\\"),_L("\\Caged\\"));
   956 		test_Value(r, r == KErrPermissionDenied);
   954 		test(r == KErrPermissionDenied);
   957 		r=fMan->Copy(_L("\\*"),_L("\\Caged\\"));
   955 		r=fMan->Copy(_L("\\*"),_L("\\Caged\\"));
   958 		test_KErrNone(r);
   956 		test(r == KErrNone);
   959 		
   957 		
   960 		r=TheFs.GetDir(_L("\\Caged\\*.*"),KEntryAttNormal,ESortNone,entryCount2);
   958 		r=TheFs.GetDir(_L("\\Caged\\*.*"),KEntryAttNormal,ESortNone,entryCount2);
   961 		test_KErrNone(r);
   959 		test(r==KErrNone);
   962 		TInt cagedCount= entryCount2->Count();
   960 		TInt cagedCount= entryCount2->Count();
   963 		
   961 		
   964 		test(cagedCount==rootCount);
   962 		test(cagedCount==rootCount);
   965 		
   963 		
   966 		delete entryCount2;
   964 		delete entryCount2;
   967 		entryCount2=NULL;
   965 		entryCount2=NULL;
   968 		
   966 		
   969 		// Check if both copied sys and private are empty (no information is exposed)
   967 		// Check if both copied sys and private are empty (no information is exposed)
   970 		CDir* entryCount3=NULL;
   968 		CDir* entryCount3=NULL;
   971 		r=TheFs.GetDir(_L("\\Caged\\private\\*.*"),KEntryAttNormal|KEntryAttDir,ESortNone,entryCount3);
   969 		r=TheFs.GetDir(_L("\\Caged\\private\\*.*"),KEntryAttNormal|KEntryAttDir,ESortNone,entryCount3);
   972 		test_Value(r, r == KErrPathNotFound);
   970 		test(r==KErrPathNotFound);
   973 		delete entryCount3;
   971 		delete entryCount3;
   974 		entryCount3=NULL;
   972 		entryCount3=NULL;
   975 		
   973 		
   976 		CDir* entryCount4=NULL;
   974 		CDir* entryCount4=NULL;
   977 		r=TheFs.GetDir(_L("\\Caged\\sys\\*.*"),KEntryAttNormal|KEntryAttDir,ESortNone,entryCount4);
   975 		r=TheFs.GetDir(_L("\\Caged\\sys\\*.*"),KEntryAttNormal|KEntryAttDir,ESortNone,entryCount4);
   978 		test_Value(r, r == KErrPathNotFound);
   976 		test(r==KErrPathNotFound);
   979 		delete entryCount4;
   977 		delete entryCount4;
   980 		entryCount4=NULL;
   978 		entryCount4=NULL;
   981 
   979 
   982 	
   980 	
   983 		r=fMan->Copy(_L("\\private\\two\\moo"),_L("\\private\\two\\mew")); 
   981 		r=fMan->Copy(_L("\\private\\two\\moo"),_L("\\private\\two\\mew")); 
   984 		test_Value(r, r == KErrPermissionDenied);
   982 		test(r == KErrPermissionDenied);
   985 	
   983 	
   986 		// Create a test file
   984 		// Create a test file
   987 		RFile testFile;
   985 		RFile testFile;
   988 		r = testFile.Replace(TheFs, _L("\\capTest"),EFileWrite);
   986 		r = testFile.Replace(TheFs, _L("\\capTest"),EFileWrite);
   989 		test_Value(r, r == KErrNone || r==KErrAlreadyExists);
   987 		test(r==KErrNone || r==KErrAlreadyExists);
   990 		testFile.Close();
   988 		testFile.Close();
   991 		
   989 		
   992 		TFileName name;
   990 		TFileName name;
   993 		name = privatepath;
   991 		name = privatepath;
   994 		name.Append(_L("privateFile.tst"));
   992 		name.Append(_L("privateFile.tst"));
   995 		RFile privateFile;
   993 		RFile privateFile;
   996 		r = privateFile.Replace(TheFs, name,EFileWrite);
   994 		r = privateFile.Replace(TheFs, name,EFileWrite);
   997 		test_Value(r, r == KErrNone || r==KErrAlreadyExists);
   995 		test(r==KErrNone || r==KErrAlreadyExists);
   998 		privateFile.Close();
   996 		privateFile.Close();
   999 
   997 
  1000 	
   998 	
  1001 		r=fMan->Copy(_L("\\capTest"),_L("\\private\\two\\moo")); 
   999 		r=fMan->Copy(_L("\\capTest"),_L("\\private\\two\\moo")); 
  1002 		test_Value(r, r == KErrPermissionDenied);
  1000 		test(r == KErrPermissionDenied);
  1003 		r=fMan->Copy(_L("\\capTest"),_L("\\sys\\bin\\moo")); 
  1001 		r=fMan->Copy(_L("\\capTest"),_L("\\sys\\bin\\moo")); 
  1004 		test_Value(r, r == KErrPermissionDenied);
  1002 		test(r == KErrPermissionDenied);
  1005 		r=fMan->Copy(_L("\\sys\\bin\\capTest"),_L("\\sys\\bin\\moo"));
  1003 		r=fMan->Copy(_L("\\sys\\bin\\capTest"),_L("\\sys\\bin\\moo"));
  1006 		test_Value(r, r == KErrPermissionDenied);
  1004 		test(r == KErrPermissionDenied);
  1007 		r=fMan->Copy(_L("\\sys\\*"),_L("\\"));
  1005 		r=fMan->Copy(_L("\\sys\\*"),_L("\\"));
  1008 		test_Value(r, r == KErrPermissionDenied);
  1006 		test (r==KErrPermissionDenied);
  1009 		r=fMan->Copy(name,_L("\\sys\\"));
  1007 		r=fMan->Copy(name,_L("\\sys\\"));
  1010 		test_Value(r, r == KErrPermissionDenied);
  1008 		test(r==KErrPermissionDenied);
  1011 
  1009 
  1012 		// Testing Move
  1010 		// Testing Move
  1013 		r=fMan->Move(_L("\\private\\two\\moo"),_L("\\private\\one\\moo"));
  1011 		r=fMan->Move(_L("\\private\\two\\moo"),_L("\\private\\one\\moo"));
  1014 		test_Value(r, r == KErrPermissionDenied);
  1012 		test(r == KErrPermissionDenied);
  1015 		r=fMan->Move(_L("\\private\\two\\moo.."),_L("\\private\\one\\moo"));
  1013 		r=fMan->Move(_L("\\private\\two\\moo.."),_L("\\private\\one\\moo"));
  1016 		test_Value(r, r == KErrPermissionDenied);
  1014 		test(r == KErrPermissionDenied);
  1017 		r=fMan->Move(_L("\\private\\two\\moo"),_L("\\private\\one\\moo.."));
  1015 		r=fMan->Move(_L("\\private\\two\\moo"),_L("\\private\\one\\moo.."));
  1018 		test_Value(r, r == KErrPermissionDenied);
  1016 		test(r == KErrPermissionDenied);
  1019 		r=fMan->Move(name,_L("\\privateFile.tst"));
  1017 		r=fMan->Move(name,_L("\\privateFile.tst"));
  1020 		test_KErrNone(r);
  1018 		test(r == KErrNone);
  1021 		r=fMan->Move(_L("\\privateFile.tst"),name);
  1019 		r=fMan->Move(_L("\\privateFile.tst"),name);
  1022 		test_KErrNone(r);
  1020 		test(r == KErrNone);
  1023 		r=fMan->Move(_L("\\capTest"),_L("\\private\\two\\moo")); 
  1021 		r=fMan->Move(_L("\\capTest"),_L("\\private\\two\\moo")); 
  1024 		test_Value(r, r == KErrPermissionDenied);
  1022 		test(r == KErrPermissionDenied);
  1025 		r=fMan->Move(_L("\\capTest"),_L("\\sys\\bin\\moo")); 
  1023 		r=fMan->Move(_L("\\capTest"),_L("\\sys\\bin\\moo")); 
  1026 		test_Value(r, r == KErrPermissionDenied);
  1024 		test(r == KErrPermissionDenied);
  1027 		r=fMan->Move(_L("\\sys\\bin\\capTest"),_L("\\sys\\bin\\moo"));
  1025 		r=fMan->Move(_L("\\sys\\bin\\capTest"),_L("\\sys\\bin\\moo"));
  1028 		test_Value(r, r == KErrPermissionDenied);
  1026 		test(r == KErrPermissionDenied);
  1029 		r=fMan->Move(_L("\\sys\\*"),_L("\\"));
  1027 		r=fMan->Move(_L("\\sys\\*"),_L("\\"));
  1030 		test_Value(r, r == KErrPermissionDenied);
  1028 		test (r==KErrPermissionDenied);
  1031 		r=fMan->Move(name,_L("\\sys\\"));
  1029 		r=fMan->Move(name,_L("\\sys\\"));
  1032 		test_Value(r, r == KErrPermissionDenied);
  1030 		test(r==KErrPermissionDenied);
  1033 
  1031 
  1034 
  1032 
  1035 		// Testing Attribs
  1033 		// Testing Attribs
  1036 		r=fMan->Attribs(_L("\\private\\two\\moo"),KEntryAttReadOnly,0,TTime(0)); 
  1034 		r=fMan->Attribs(_L("\\private\\two\\moo"),KEntryAttReadOnly,0,TTime(0)); 
  1037 		test_Value(r, r == KErrPermissionDenied);
  1035 		test(r == KErrPermissionDenied);
  1038 		r=fMan->Attribs(_L("\\private\\moo"),KEntryAttReadOnly,0,TTime(0)); 
  1036 		r=fMan->Attribs(_L("\\private\\moo"),KEntryAttReadOnly,0,TTime(0)); 
  1039 		test_Value(r, r == KErrPermissionDenied);
  1037 		test(r == KErrPermissionDenied);
  1040 		r=fMan->Attribs(name,KEntryAttReadOnly,0,TTime(0));
  1038 		r=fMan->Attribs(name,KEntryAttReadOnly,0,TTime(0));
  1041 		test_KErrNone(r);
  1039 		test(r == KErrNone);
  1042 		r=fMan->Attribs(name,0,KEntryAttReadOnly,TTime(0));
  1040 		r=fMan->Attribs(name,0,KEntryAttReadOnly,TTime(0));
  1043 		test_KErrNone(r);
  1041 		test(r == KErrNone);
  1044 
  1042 
  1045 
  1043 
  1046 		// Testing RmDir
  1044 		// Testing RmDir
  1047 		r=fMan->RmDir(_L("\\private\\"));
  1045 		r=fMan->RmDir(_L("\\private\\"));
  1048 		test_Value(r, r == KErrPermissionDenied);
  1046 		test(r == KErrPermissionDenied);
  1049 		r=fMan->RmDir(_L("\\private\\two\\"));
  1047 		r=fMan->RmDir(_L("\\private\\two\\"));
  1050 		test_Value(r, r == KErrPermissionDenied);
  1048 		test(r == KErrPermissionDenied);
  1051 		r=fMan->RmDir(_L("\\private\\tw?\\"));
  1049 		r=fMan->RmDir(_L("\\private\\tw?\\"));
  1052 		test_Value(r, r == KErrPermissionDenied);
  1050 		test(r == KErrPermissionDenied);
  1053 		r=fMan->RmDir(_L("\\sys\\"));
  1051 		r=fMan->RmDir(_L("\\sys\\"));
  1054 		test_Value(r, r == KErrPermissionDenied);
  1052 		test(r == KErrPermissionDenied);
  1055 		
  1053 		
  1056 		
  1054 		
  1057 		// Testing Rename
  1055 		// Testing Rename
  1058 		r=fMan->Rename(_L("\\private\\two\\moo"),_L("\\private\\two\\mew")); 
  1056 		r=fMan->Rename(_L("\\private\\two\\moo"),_L("\\private\\two\\mew")); 
  1059 		test_Value(r, r == KErrPermissionDenied);
  1057 		test(r == KErrPermissionDenied);
  1060 		
  1058 		
  1061 		// Testing Delete
  1059 		// Testing Delete
  1062 		r=fMan->Delete(_L("\\private\\two\\test")); 
  1060 		r=fMan->Delete(_L("\\private\\two\\test")); 
  1063 		test_Value(r, r == KErrPermissionDenied);
  1061 		test(r == KErrPermissionDenied);
  1064 		r=fMan->Delete(_L("\\private\\moo")); 
  1062 		r=fMan->Delete(_L("\\private\\moo")); 
  1065 		test_Value(r, r == KErrPermissionDenied);
  1063 		test(r == KErrPermissionDenied);
  1066 		r=fMan->Delete(_L("\\sys\\moo")); 
  1064 		r=fMan->Delete(_L("\\sys\\moo")); 
  1067 		test_Value(r, r == KErrPermissionDenied);
  1065 		test(r == KErrPermissionDenied);
  1068 		
  1066 		
  1069 
  1067 
  1070 		//Something that actually exists in Private
  1068 		//Something that actually exists in Private
  1071 		r=fMan->Rename(name,_L("\\private\\00000001\\moo")); 
  1069 		r=fMan->Rename(name,_L("\\private\\00000001\\moo")); 
  1072 		test_KErrNone(r);
  1070 		test(r == KErrNone);
  1073 		r=fMan->Rename(_L("\\private\\00000001\\moo"),name); 
  1071 		r=fMan->Rename(_L("\\private\\00000001\\moo"),name); 
  1074 		test_KErrNone(r);
  1072 		test(r == KErrNone);
  1075 		r=fMan->Copy(name,_L("\\private\\00000001\\moo")); 
  1073 		r=fMan->Copy(name,_L("\\private\\00000001\\moo")); 
  1076 		test_KErrNone(r);
  1074 		test(r == KErrNone);
  1077 		r=fMan->Delete(_L("\\private\\00000001\\moo")); 
  1075 		r=fMan->Delete(_L("\\private\\00000001\\moo")); 
  1078 		test_KErrNone(r);
  1076 		test(r == KErrNone);
  1079 
  1077 
  1080 		// Clean up the test data
  1078 		// Clean up the test data
  1081 		r=fMan->RmDir(_L("\\Caged\\")); 
  1079 		r=fMan->RmDir(_L("\\Caged\\")); 
  1082 		test_KErrNone(r);
  1080 		test(r == KErrNone);
  1083 		r=fMan->Delete(_L("\\capTest")); 
  1081 		r=fMan->Delete(_L("\\capTest")); 
  1084 		test_KErrNone(r);
  1082 		test(r == KErrNone);
  1085 		r=fMan->Delete(name); 
  1083 		r=fMan->Delete(name); 
  1086 		test_KErrNone(r);
  1084 		test(r == KErrNone);
  1087 		delete(fMan);
  1085 		delete(fMan);
  1088 		}
  1086 		}
  1089 	
  1087 	
  1090 	// CDirScan tests
  1088 	// CDirScan tests
  1091 	ScanDir(_L("\\"), CDirScan::EScanUpTree, KErrNone);
  1089 	ScanDir(_L("\\"), CDirScan::EScanUpTree, KErrNone);
  1101 // permitted in this case).
  1099 // permitted in this case).
  1102 //
  1100 //
  1103 	{
  1101 	{
  1104 	TInt r;
  1102 	TInt r;
  1105 	r = TheFs.RmDir(_L("\\normal\\one\\"));
  1103 	r = TheFs.RmDir(_L("\\normal\\one\\"));
  1106 	test_KErrNone(r);
  1104 	test(r == KErrNone);
  1107 	r = TheFs.RmDir(_L("\\normal\\two\\"));
  1105 	r = TheFs.RmDir(_L("\\normal\\two\\"));
  1108 	test_KErrNone(r);
  1106 	test(r == KErrNone);
  1109 	r = TheFs.RmDir(_L("\\normal\\"));
  1107 	r = TheFs.RmDir(_L("\\normal\\"));
  1110 	test_KErrNone(r);
  1108 	test(r == KErrNone);
  1111 	r = TheFs.RmDir(_L("\\sys\\one\\"));
  1109 	r = TheFs.RmDir(_L("\\sys\\one\\"));
  1112 	test_Value(r, r == KErrPermissionDenied);
  1110 	test(r == KErrPermissionDenied);
  1113 	r = TheFs.RmDir(_L("\\sys\\two\\"));
  1111 	r = TheFs.RmDir(_L("\\sys\\two\\"));
  1114 	test_Value(r, r == KErrPermissionDenied);
  1112 	test(r == KErrPermissionDenied);
  1115 	r = TheFs.RmDir(_L("\\sys\\"));
  1113 	r = TheFs.RmDir(_L("\\sys\\"));
  1116 	test_Value(r, r == KErrPermissionDenied);
  1114 	test(r == KErrPermissionDenied);
  1117 	r = TheFs.RmDir(_L("\\private\\one\\"));
  1115 	r = TheFs.RmDir(_L("\\private\\one\\"));
  1118 	test_Value(r, r == KErrPermissionDenied);
  1116 	test(r == KErrPermissionDenied);
  1119 	r = TheFs.RmDir(_L("\\private\\two\\"));
  1117 	r = TheFs.RmDir(_L("\\private\\two\\"));
  1120 	test_Value(r, r == KErrPermissionDenied);
  1118 	test(r == KErrPermissionDenied);
  1121 	r = TheFs.RmDir(_L("\\private\\"));
  1119 	r = TheFs.RmDir(_L("\\private\\"));
  1122 	test_Value(r, r == KErrPermissionDenied);
  1120 	test(r == KErrPermissionDenied);
  1123 	r = TheFs.RmDir(_L("\\ZZZZZZ\\"));
  1121 	r = TheFs.RmDir(_L("\\ZZZZZZ\\"));
  1124 	test_KErrNone(r);
  1122 	test(r == KErrNone);
  1125 	}
  1123 	}
  1126 
  1124 
  1127 TFileName gDirList[100];
  1125 TFileName gDirList[100];
  1128 TInt      gDirNum = 0;
  1126 TInt      gDirNum = 0;
  1129 
  1127 
  1135 //
  1133 //
  1136 	{
  1134 	{
  1137 	CDirScan* scanner = NULL;
  1135 	CDirScan* scanner = NULL;
  1138 	TInt r;
  1136 	TInt r;
  1139 	TRAP(r, scanner = CDirScan::NewL(TheFs));
  1137 	TRAP(r, scanner = CDirScan::NewL(TheFs));
  1140 	test_Value(r, r == KErrNone && scanner);
  1138 	test(r == KErrNone && scanner);
  1141 	TParse dirName;
  1139 	TParse dirName;
  1142 	TheFs.Parse(_L("\\"),dirName);
  1140 	TheFs.Parse(_L("\\"),dirName);
  1143 	TRAP(r, scanner->SetScanDataL(dirName.FullName(),KEntryAttDir,ESortByName|EAscending));
  1141 	TRAP(r, scanner->SetScanDataL(dirName.FullName(),KEntryAttDir,ESortByName|EAscending));
  1144 	test_KErrNone(r);
  1142 	test(r == KErrNone);
  1145 	CDir *entryList;
  1143 	CDir *entryList;
  1146 	test.Printf(_L("------ ALL DIRECTORIES ------\n"));
  1144 	test.Printf(_L("------ ALL DIRECTORIES ------\n"));
  1147 	for (;;)
  1145 	for (;;)
  1148 		{
  1146 		{
  1149 		scanner->NextL(entryList);
  1147 		scanner->NextL(entryList);
  1176 	ListDirs();
  1174 	ListDirs();
  1177 
  1175 
  1178 	CDirScan* scanner = NULL;
  1176 	CDirScan* scanner = NULL;
  1179 	TInt r;
  1177 	TInt r;
  1180 	TRAP(r, scanner = CDirScan::NewL(TheFs));
  1178 	TRAP(r, scanner = CDirScan::NewL(TheFs));
  1181 	test_Value(r, r == KErrNone && scanner);
  1179 	test(r == KErrNone && scanner);
  1182 	TParse dirName;
  1180 	TParse dirName;
  1183 	TheFs.Parse(_L("\\"),dirName);
  1181 	TheFs.Parse(_L("\\"),dirName);
  1184 	TRAP(r, scanner->SetScanDataL(dirName.FullName(),KEntryAttDir,ESortByName|EAscending));
  1182 	TRAP(r, scanner->SetScanDataL(dirName.FullName(),KEntryAttDir,ESortByName|EAscending));
  1185 	test_KErrNone(r);
  1183 	test(r == KErrNone);
  1186 	CDir *entryList = NULL;
  1184 	CDir *entryList = NULL;
  1187 	TInt  num = 0;
  1185 	TInt  num = 0;
  1188 	test.Printf(_L("------ ACCESSIBLE DIRECTORIES ------\n"));
  1186 	test.Printf(_L("------ ACCESSIBLE DIRECTORIES ------\n"));
  1189 	for (;;)
  1187 	for (;;)
  1190 		{
  1188 		{
  1215 		delete entryList;
  1213 		delete entryList;
  1216 		entryList=NULL;
  1214 		entryList=NULL;
  1217 		}
  1215 		}
  1218 	delete scanner;
  1216 	delete scanner;
  1219 	CleanDirs();
  1217 	CleanDirs();
  1220 	test_KErrNone(r);
  1218 	test(r == KErrNone);
  1221 	if (num < gDirNum)
  1219 	if (num < gDirNum)
  1222 		{
  1220 		{
  1223 		test.Printf(_L("Directory not as expected (%d found < %d expected\n"), num, gDirNum);
  1221 		test.Printf(_L("Directory not as expected (%d found < %d expected\n"), num, gDirNum);
  1224 		test(0);
  1222 		test(0);
  1225 		}
  1223 		}
  1246 //
  1244 //
  1247 	{
  1245 	{
  1248 	test.Next(_L("Delete test directory"));
  1246 	test.Next(_L("Delete test directory"));
  1249 	CFileMan* fMan=CFileMan::NewL(TheFs);
  1247 	CFileMan* fMan=CFileMan::NewL(TheFs);
  1250 	TInt r=fMan->RmDir(gSessionPath);
  1248 	TInt r=fMan->RmDir(gSessionPath);
  1251 	test_KErrNone(r);
  1249 	test(r==KErrNone);
  1252 	delete fMan;
  1250 	delete fMan;
  1253 	}
  1251 	}
  1254 
  1252 
  1255 GLDEF_C void CallTestsL(/*TChar aDriveLetter*/)
  1253 GLDEF_C void CallTestsL(/*TChar aDriveLetter*/)
  1256 //
  1254 //
  1271 	TBuf<30> sesspath;
  1269 	TBuf<30> sesspath;
  1272 	sesspath=_L("?:\\");
  1270 	sesspath=_L("?:\\");
  1273 	sesspath[0] = (TText)gDriveToTest;
  1271 	sesspath[0] = (TText)gDriveToTest;
  1274 
  1272 
  1275 	TInt r= TheFs.SetSessionPath(sesspath);
  1273 	TInt r= TheFs.SetSessionPath(sesspath);
  1276 	test_KErrNone(r);
  1274 	test(r==KErrNone);
  1277 
  1275 
  1278 	TBuf<2> cmd;
  1276 	TBuf<2> cmd;
  1279 	cmd.SetLength(1);
  1277 	cmd.SetLength(1);
  1280 	cmd[0] = (TText)gDriveToTest;
  1278 	cmd[0] = (TText)gDriveToTest;
  1281 	RProcess tp;
  1279 	RProcess tp;
  1282 	r=tp.Create(_L("clean_prepdc.exe"),sesspath);
  1280 	r=tp.Create(_L("clean_prepdc.exe"),sesspath);
  1283 	test_KErrNone(r);
  1281 	test(r==KErrNone);
  1284 	{
  1282 	{
  1285 	TRequestStatus ps;
  1283 	TRequestStatus ps;
  1286 	tp.Logon(ps);
  1284 	tp.Logon(ps);
  1287 	tp.Resume();
  1285 	tp.Resume();
  1288 	tp.Close();
  1286 	tp.Close();
  1292 	//check double mode ie that Defpath still works	
  1290 	//check double mode ie that Defpath still works	
  1293 	RFs fs1;
  1291 	RFs fs1;
  1294 	RFs fs2;
  1292 	RFs fs2;
  1295 	
  1293 	
  1296 	r=fs1.Connect();
  1294 	r=fs1.Connect();
  1297 	test_KErrNone(r);
  1295 	test(r==KErrNone);
  1298 	r=fs1.SessionPath(sesspath);
  1296 	r=fs1.SessionPath(sesspath);
  1299 	test_KErrNone(r);
  1297 	test(r==KErrNone);
  1300 	test.Printf(_L("session1 Path=%S"),&sesspath);
  1298 	test.Printf(_L("session1 Path=%S"),&sesspath);
  1301 
  1299 
  1302 	TBuf<30> privatepath;
  1300 	TBuf<30> privatepath;
  1303 	r=fs1.SetSessionToPrivate(gTheDriveNum);
  1301 	r=fs1.SetSessionToPrivate(gTheDriveNum);
  1304 	test_KErrNone(r);
  1302 	test(r==KErrNone);
  1305 	r=fs1.PrivatePath(privatepath);
  1303 	r=fs1.PrivatePath(privatepath);
  1306 	test_KErrNone(r);
  1304 	test(r==KErrNone);
  1307 	r=privatepath.Compare(KExpectedPrivatePath());
  1305 	r=privatepath.Compare(KExpectedPrivatePath());
  1308 	test_Value(r, r == 0);
  1306 	test(r==0);
  1309 	r=fs1.SessionPath(sesspath);
  1307 	r=fs1.SessionPath(sesspath);
  1310 	test_KErrNone(r);
  1308 	test(r==KErrNone);
  1311 	r=privatepath.Compare(sesspath.Mid(KPathPosition));
  1309 	r=privatepath.Compare(sesspath.Mid(KPathPosition));
  1312 	test_Value(r, r == 0);
  1310 	test(r==0);
  1313 	r=fs1.CreatePrivatePath(gTheDriveNum);
  1311 	r=fs1.CreatePrivatePath(gTheDriveNum);
  1314 	test_KErrNone(r);
  1312 	test(r==KErrNone);
  1315 	fs1.Close();
  1313 	fs1.Close();
  1316 
  1314 
  1317 	r=fs2.Connect();
  1315 	r=fs2.Connect();
  1318 	test_KErrNone(r);
  1316 	test(r==KErrNone);
  1319 	r=fs2.SessionPath(sesspath);
  1317 	r=fs2.SessionPath(sesspath);
  1320 	test_KErrNone(r);
  1318 	test(r==KErrNone);
  1321 	test.Printf(_L("session2 Path=%S"),&sesspath);
  1319 	test.Printf(_L("session2 Path=%S"),&sesspath);
  1322 	fs2.Close();
  1320 	fs2.Close();
  1323 
  1321 
  1324 	TestCaps();
  1322 	TestCaps();
  1325 	TestCaging();
  1323 	TestCaging();