kerneltest/f32test/server/t_dctcbdiskadmin.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>
    74 TRequestStatus aStat1;
    73 TRequestStatus aStat1;
    75 TRequestStatus aStat2;
    74 TRequestStatus aStat2;
    76 TRequestStatus aStat3;
    75 TRequestStatus aStat3;
    77 TRequestStatus aStat4;
    76 TRequestStatus aStat4;
    78 
    77 
       
    78 TVolumeInfo aVolInfo;
       
    79 //	TDriveInfo adriveInfo;
       
    80 
    79 TBuf<40> systestfile;
    81 TBuf<40> systestfile;
    80 TBuf<40> pritestfile;
    82 TBuf<40> pritestfile;
    81 TBuf<40> restestfile;
    83 TBuf<40> restestfile;
    82 TBuf<40> systestfile1;
    84 TBuf<40> systestfile1;
    83 TBuf<40> pritestfile1;
    85 TBuf<40> pritestfile1;
   105 	mkdirname.Zero();
   107 	mkdirname.Zero();
   106 	mkdirname.Append(pritestfalseidname);
   108 	mkdirname.Append(pritestfalseidname);
   107 	mkdirname.Append(KMkDirSub);
   109 	mkdirname.Append(KMkDirSub);
   108 
   110 
   109 	r=TheFs.MkDirAll(mkdirname);	
   111 	r=TheFs.MkDirAll(mkdirname);	
   110 	test_Value(r, r == KErrPermissionDenied);
   112 	test(r==KErrPermissionDenied);
   111 
   113 
   112 	r=TheFs.RmDir(mkdirname);	
   114 	r=TheFs.RmDir(mkdirname);	
   113 	test_Value(r, r == KErrPermissionDenied);
   115 	test(r==KErrPermissionDenied);
   114 
   116 
   115 	r=TheFs.SetSubst(pritestfalseidname,EDriveO);
   117 	r=TheFs.SetSubst(pritestfalseidname,EDriveO);
   116 	test_Value(r, r == KErrPermissionDenied);
   118 	test(r==KErrPermissionDenied);
   117 
   119 
   118 	r=TheFs.RealName(_L("O:\\File.XXX"),realName);
   120 	r=TheFs.RealName(_L("O:\\File.XXX"),realName);
   119 	test_KErrNone(r);
   121 	test(r==KErrNone);
   120 
   122 
   121 	r=TheFs.SetSessionPath(pritestfalseidname);
   123 	r=TheFs.SetSessionPath(pritestfalseidname);
   122 	test_Value(r, r == KErrPermissionDenied);
   124 	test(r==KErrPermissionDenied);
   123 
   125 
   124 	TheFs.NotifyChange(ENotifyAll,aStat2,pritestfalseidname);
   126 	TheFs.NotifyChange(ENotifyAll,aStat2,pritestfalseidname);
   125 	test(aStat2==KErrPermissionDenied);
   127 	test(aStat2==KErrPermissionDenied);
   126 
   128 
   127 
   129 
   133 	
   135 	
   134 	oldName=KOldFile;
   136 	oldName=KOldFile;
   135 	oldName[0]=(TText)gDriveToTest;
   137 	oldName[0]=(TText)gDriveToTest;
   136 
   138 
   137 	r=TheFs.GetShortName(pritestfile, shortfilename);
   139 	r=TheFs.GetShortName(pritestfile, shortfilename);
   138 	test_Value(r, r == KErrPermissionDenied || r==KErrNotSupported);
   140 	test(r==KErrPermissionDenied || r==KErrNotSupported);
   139 
   141 
   140 	r=TheFs.GetLongName(pritestfile1, longfilename);
   142 	r=TheFs.GetLongName(pritestfile1, longfilename);
   141 	test_Value(r, r == KErrPermissionDenied || r==KErrNotSupported);
   143 	test(r==KErrPermissionDenied || r==KErrNotSupported);
   142 
   144 
   143 	r=file1.Create(TheFs,oldName,EFileWrite);
   145 	r=file1.Create(TheFs,oldName,EFileWrite);
   144 	test_Value(r, r == KErrNone || r==KErrAlreadyExists);
   146 	test(r==KErrNone || r==KErrAlreadyExists);
   145 	file1.Close();
   147 	file1.Close();
   146 
   148 
   147 	r=TheFs.Replace(oldName,pritestfile);
   149 	r=TheFs.Replace(oldName,pritestfile);
   148 	test_Value(r, r == KErrPermissionDenied);
   150 	test(r==KErrPermissionDenied);
   149 	
   151 	
   150 	r=TheFs.Rename(pritestfile,pritestfile1);
   152 	r=TheFs.Rename(pritestfile,pritestfile1);
   151 	test_Value(r, r == KErrPermissionDenied);
   153 	test(r==KErrPermissionDenied);
   152 	
   154 	
   153 	r=TheFs.Entry(pritestfile1,entry);
   155 	r=TheFs.Entry(pritestfile1,entry);
   154 	test_Value(r, r == KErrPermissionDenied);
   156 	test(r==KErrPermissionDenied);
   155 
   157 
   156 	r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
   158 	r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
   157 	test_Value(r, r == KErrPermissionDenied);
   159 	test(r==KErrPermissionDenied);
   158 
   160 
   159 	r=TheFs.Delete(pritestfile1);
   161 	r=TheFs.Delete(pritestfile1);
   160 	test_Value(r, r == KErrPermissionDenied);
   162 	test(r==KErrPermissionDenied);
   161 
   163 
   162 	r=TheFs.Delete(oldName);
   164 	r=TheFs.Delete(oldName);
   163 	test_KErrNone(r);
   165 	test(r==KErrNone);
   164 
   166 
   165 	__UHEAP_MARKEND;
   167 	__UHEAP_MARKEND;
   166 	}
   168 	}
   167 LOCAL_C void systemRFsTest()
   169 LOCAL_C void systemRFsTest()
   168 //
   170 //
   176 	
   178 	
   177 	mkdirname.Zero();
   179 	mkdirname.Zero();
   178 	mkdirname.Append(systestname);
   180 	mkdirname.Append(systestname);
   179 	mkdirname.Append(KMkDirSub);
   181 	mkdirname.Append(KMkDirSub);
   180 	r=TheFs.MkDirAll(mkdirname);	
   182 	r=TheFs.MkDirAll(mkdirname);	
   181 	test_KErrNone(r);
   183 	test(r==KErrNone);
   182 
   184 
   183 	TheFs.RmDir(mkdirname);
   185 	TheFs.RmDir(mkdirname);
   184 	test_KErrNone(r);
   186 	test(r==KErrNone);
   185 
   187 
   186 	r=TheFs.SetSubst(systestname,EDriveO);
   188 	r=TheFs.SetSubst(systestname,EDriveO);
   187 	test_KErrNone(r);
   189 	test(r==KErrNone);
   188 	
   190 	
   189 	r=TheFs.RealName(_L("O:\\File.XXX"),realName);
   191 	r=TheFs.RealName(_L("O:\\File.XXX"),realName);
   190 	test_Value(r, r == KErrPermissionDenied);
   192 	test(r==KErrPermissionDenied);
   191 
   193 
   192 	r=TheFs.SetSubst(_L(""),EDriveO); //to unsubst
   194 	r=TheFs.SetSubst(_L(""),EDriveO); //to unsubst
   193 	test_KErrNone(r);
   195 	test(r==KErrNone);
   194 
   196 
   195 	r=TheFs.SetSessionPath(systestname);
   197 	r=TheFs.SetSessionPath(systestname);
   196 	test_Value(r, r == KErrPermissionDenied);
   198 	test(r==KErrPermissionDenied);
   197 	
   199 	
   198 	TheFs.NotifyChange(ENotifyAll,aStat1,systestname);
   200 	TheFs.NotifyChange(ENotifyAll,aStat1,systestname);
   199 	test(aStat1==KErrPermissionDenied);
   201 	test(aStat1==KErrPermissionDenied);
   200 
   202 
   201 	systestfile=KSystemPath;
   203 	systestfile=KSystemPath;
   206 	
   208 	
   207 	oldName=KOldFile;
   209 	oldName=KOldFile;
   208 	oldName[0]=(TText)gDriveToTest;
   210 	oldName[0]=(TText)gDriveToTest;
   209 
   211 
   210 	r=TheFs.GetShortName(systestfile, shortfilename);
   212 	r=TheFs.GetShortName(systestfile, shortfilename);
   211 	test_Value(r, r == KErrPermissionDenied || r==KErrNotSupported);
   213 	test(r==KErrPermissionDenied || r==KErrNotSupported);
   212 
   214 
   213 	r=TheFs.GetLongName(systestfile1, longfilename);
   215 	r=TheFs.GetLongName(systestfile1, longfilename);
   214 	test_Value(r, r == KErrPermissionDenied || r==KErrNotSupported);
   216 	test(r==KErrPermissionDenied || r==KErrNotSupported);
   215 
   217 
   216 	r=file1.Create(TheFs,oldName,EFileWrite);
   218 	r=file1.Create(TheFs,oldName,EFileWrite);
   217 	test_Value(r, r == KErrNone || r==KErrAlreadyExists);
   219 	test(r==KErrNone || r==KErrAlreadyExists);
   218 	file1.Close();
   220 	file1.Close();
   219 
   221 
   220 	r=TheFs.Replace(oldName,systestfile);
   222 	r=TheFs.Replace(oldName,systestfile);
   221 	test_KErrNone(r);
   223 	test(r==KErrNone);
   222 	
   224 	
   223 	r=TheFs.Delete(systestfile1);
   225 	r=TheFs.Delete(systestfile1);
   224 	test_Value(r, r == KErrNone || r==KErrNotFound);
   226 	test(r==KErrNone || r==KErrNotFound);
   225 
   227 
   226 	r=TheFs.Rename(systestfile,systestfile1);
   228 	r=TheFs.Rename(systestfile,systestfile1);
   227 	test_KErrNone(r);
   229 	test(r==KErrNone);
   228 	
   230 	
   229 	r=TheFs.Entry(systestfile1,entry);
   231 	r=TheFs.Entry(systestfile1,entry);
   230 	test_Value(r, r == KErrPermissionDenied);
   232 	test(r==KErrPermissionDenied);
   231 
   233 
   232 	r=TheFs.SetEntry(systestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
   234 	r=TheFs.SetEntry(systestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
   233 	test_KErrNone(r);
   235 	test(r==KErrNone);
   234 
   236 
   235 	r=TheFs.Delete(systestfile1);
   237 	r=TheFs.Delete(systestfile1);
   236 	test_KErrNone(r);
   238 	test(r==KErrNone);
   237 
   239 
   238 	__UHEAP_MARKEND;
   240 	__UHEAP_MARKEND;
   239 	}
   241 	}
   240 
   242 
   241 LOCAL_C void ResourceRFsTest()
   243 LOCAL_C void ResourceRFsTest()
   250 	
   252 	
   251 	mkdirname.Zero();
   253 	mkdirname.Zero();
   252 	mkdirname.Append(restestname);
   254 	mkdirname.Append(restestname);
   253 	mkdirname.Append(KMkDirSub);
   255 	mkdirname.Append(KMkDirSub);
   254 	r=TheFs.MkDirAll(mkdirname);	
   256 	r=TheFs.MkDirAll(mkdirname);	
   255 	test_KErrNone(r);
   257 	test(r==KErrNone);
   256 
   258 
   257 	TheFs.RmDir(mkdirname);
   259 	TheFs.RmDir(mkdirname);
   258 	test_KErrNone(r);
   260 	test(r==KErrNone);
   259 
   261 
   260 	r=TheFs.SetSubst(restestname,EDriveO);
   262 	r=TheFs.SetSubst(restestname,EDriveO);
   261 	test_KErrNone(r);
   263 	test(r==KErrNone);
   262 	
   264 	
   263 	r=TheFs.RealName(_L("O:\\File.XXX"),realName);
   265 	r=TheFs.RealName(_L("O:\\File.XXX"),realName);
   264 	test_KErrNone(r);
   266 	test(r==KErrNone);
   265 
   267 
   266 	r=TheFs.SetSubst(_L(""),EDriveO); //to unsubst
   268 	r=TheFs.SetSubst(_L(""),EDriveO); //to unsubst
   267 	test_KErrNone(r);
   269 	test(r==KErrNone);
   268 
   270 
   269 	r=TheFs.SetSessionPath(restestname);
   271 	r=TheFs.SetSessionPath(restestname);
   270 	test_KErrNone(r);
   272 	test(r==KErrNone);
   271 	
   273 	
   272 	TheFs.NotifyChange(ENotifyAll,aStat4,restestname);
   274 	TheFs.NotifyChange(ENotifyAll,aStat4,restestname);
   273 	test(aStat4==KRequestPending);
   275 	test(aStat4==KRequestPending);
   274 
   276 
   275 	restestfile=KResourcePath;
   277 	restestfile=KResourcePath;
   280 	
   282 	
   281 	oldName=KOldFile;
   283 	oldName=KOldFile;
   282 	oldName[0]=(TText)gDriveToTest;
   284 	oldName[0]=(TText)gDriveToTest;
   283 
   285 
   284 	r=TheFs.GetShortName(restestfile, shortfilename);
   286 	r=TheFs.GetShortName(restestfile, shortfilename);
   285 	test_Value(r, r == KErrNone || r == KErrNotFound || r==KErrNotSupported);
   287 	test(r==KErrNone || KErrNotFound || r==KErrNotSupported);
   286 
   288 
   287 	r=TheFs.GetLongName(restestfile1, longfilename);
   289 	r=TheFs.GetLongName(restestfile1, longfilename);
   288 	test_Value(r, r == KErrNone || r == KErrNotFound || r==KErrNotSupported);
   290 	test(r==KErrNone || KErrNotFound || r==KErrNotSupported);
   289 
   291 
   290 	r=file1.Create(TheFs,oldName,EFileWrite);
   292 	r=file1.Create(TheFs,oldName,EFileWrite);
   291 	test_Value(r, r == KErrNone || r==KErrAlreadyExists);
   293 	test(r==KErrNone || r==KErrAlreadyExists);
   292 	file1.Close();
   294 	file1.Close();
   293 
   295 
   294 	r=TheFs.Replace(oldName,restestfile);
   296 	r=TheFs.Replace(oldName,restestfile);
   295 	test_KErrNone(r);
   297 	test(r==KErrNone);
   296 	
   298 	
   297 	r=TheFs.Delete(restestfile1);
   299 	r=TheFs.Delete(restestfile1);
   298 	test_Value(r, r == KErrNone || r==KErrNotFound);
   300 	test(r==KErrNone || r==KErrNotFound);
   299 
   301 
   300 	r=TheFs.Rename(restestfile,restestfile1);
   302 	r=TheFs.Rename(restestfile,restestfile1);
   301 	test_KErrNone(r);
   303 	test(r==KErrNone);
   302 	
   304 	
   303 	r=TheFs.Entry(restestfile1,entry);
   305 	r=TheFs.Entry(restestfile1,entry);
   304 	test_KErrNone(r);
   306 	test(r==KErrNone);
   305 
   307 
   306 	r=TheFs.SetEntry(restestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
   308 	r=TheFs.SetEntry(restestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
   307 	test_KErrNone(r);
   309 	test(r==KErrNone);
   308 
   310 
   309 	r=TheFs.Delete(restestfile1);
   311 	r=TheFs.Delete(restestfile1);
   310 	test_KErrNone(r);
   312 	test(r==KErrNone);
   311 
   313 
   312 
   314 
   313 	__UHEAP_MARKEND;
   315 	__UHEAP_MARKEND;
   314 	}
   316 	}
   315 
   317 
   327 	mkdirname.Zero();
   329 	mkdirname.Zero();
   328 	mkdirname.Append(pritestname);
   330 	mkdirname.Append(pritestname);
   329 	mkdirname.Append(KMkDirSub);
   331 	mkdirname.Append(KMkDirSub);
   330 
   332 
   331 	r=TheFs.MkDirAll(mkdirname);	
   333 	r=TheFs.MkDirAll(mkdirname);	
   332 	test_Value(r, r == KErrPermissionDenied);
   334 	test(r==KErrPermissionDenied);
   333 
   335 
   334 	r=TheFs.RmDir(mkdirname);	
   336 	r=TheFs.RmDir(mkdirname);	
   335 	test_Value(r, r == KErrPermissionDenied);
   337 	test(r==KErrPermissionDenied);
   336 
   338 
   337 	r=TheFs.SetSubst(pritestname,EDriveO);
   339 	r=TheFs.SetSubst(pritestname,EDriveO);
   338 	test_Value(r, r == KErrPermissionDenied);
   340 	test(r==KErrPermissionDenied);
   339 
   341 
   340 	r=TheFs.RealName(_L("O:\\File.XXX"),realName);
   342 	r=TheFs.RealName(_L("O:\\File.XXX"),realName);
   341 	test_KErrNone(r);
   343 	test(r==KErrNone);
   342 
   344 
   343 	r=TheFs.SetSessionPath(pritestname);
   345 	r=TheFs.SetSessionPath(pritestname);
   344 	test_Value(r, r == KErrPermissionDenied);
   346 	test(r==KErrPermissionDenied);
   345 
   347 
   346 	TheFs.NotifyChange(ENotifyAll,aStat2,pritestname);
   348 	TheFs.NotifyChange(ENotifyAll,aStat2,pritestname);
   347 	test(aStat2==KErrPermissionDenied);
   349 	test(aStat2==KErrPermissionDenied);
   348 
   350 
   349 
   351 
   355 	
   357 	
   356 	oldName=KOldFile;
   358 	oldName=KOldFile;
   357 	oldName[0]=(TText)gDriveToTest;
   359 	oldName[0]=(TText)gDriveToTest;
   358 
   360 
   359 	r=TheFs.GetShortName(pritestfile, shortfilename);
   361 	r=TheFs.GetShortName(pritestfile, shortfilename);
   360 	test_Value(r, r == KErrPermissionDenied || r==KErrNotSupported);
   362 	test(r==KErrPermissionDenied || r==KErrNotSupported);
   361 
   363 
   362 	r=TheFs.GetLongName(pritestfile1, longfilename);
   364 	r=TheFs.GetLongName(pritestfile1, longfilename);
   363 	test_Value(r, r == KErrPermissionDenied || r==KErrNotSupported);
   365 	test(r==KErrPermissionDenied || r==KErrNotSupported);
   364 
   366 
   365 	r=file1.Create(TheFs,oldName,EFileWrite);
   367 	r=file1.Create(TheFs,oldName,EFileWrite);
   366 	test_Value(r, r == KErrNone || r==KErrAlreadyExists);
   368 	test(r==KErrNone || r==KErrAlreadyExists);
   367 	file1.Close();
   369 	file1.Close();
   368 
   370 
   369 	r=TheFs.Replace(oldName,pritestfile);
   371 	r=TheFs.Replace(oldName,pritestfile);
   370 	test_Value(r, r == KErrPermissionDenied);
   372 	test(r==KErrPermissionDenied);
   371 	
   373 	
   372 	r=TheFs.Rename(pritestfile,pritestfile1);
   374 	r=TheFs.Rename(pritestfile,pritestfile1);
   373 	test_Value(r, r == KErrPermissionDenied);
   375 	test(r==KErrPermissionDenied);
   374 	
   376 	
   375 	r=TheFs.Entry(pritestfile1,entry);
   377 	r=TheFs.Entry(pritestfile1,entry);
   376 	test_Value(r, r == KErrPermissionDenied);
   378 	test(r==KErrPermissionDenied);
   377 
   379 
   378 	r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
   380 	r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
   379 	test_Value(r, r == KErrPermissionDenied);
   381 	test(r==KErrPermissionDenied);
   380 
   382 
   381 	r=TheFs.Delete(pritestfile1);
   383 	r=TheFs.Delete(pritestfile1);
   382 	test_Value(r, r == KErrPermissionDenied);
   384 	test(r==KErrPermissionDenied);
   383 
   385 
   384 
   386 
   385 	__UHEAP_MARKEND;
   387 	__UHEAP_MARKEND;
   386 	}
   388 	}
   387 
   389 
   395 
   397 
   396 	mkdirname.Zero();
   398 	mkdirname.Zero();
   397 	mkdirname.Append(theprivatepath);
   399 	mkdirname.Append(theprivatepath);
   398 	mkdirname.Append(KMkDirSub);
   400 	mkdirname.Append(KMkDirSub);
   399 	r=TheFs.MkDirAll(mkdirname);	
   401 	r=TheFs.MkDirAll(mkdirname);	
   400 	test_KErrNone(r);
   402 	test(r==KErrNone);
   401 
   403 
   402 	r=TheFs.RmDir(mkdirname);	
   404 	r=TheFs.RmDir(mkdirname);	
   403 	test_KErrNone(r);
   405 	test(r==KErrNone);
   404 
   406 
   405 	r=TheFs.SetSubst(theprivatepath,EDriveO);	
   407 	r=TheFs.SetSubst(theprivatepath,EDriveO);	
   406 	test_KErrNone(r); 
   408 	test(r==KErrNone); 
   407 
   409 
   408 	r=TheFs.RealName(_L("O:\\File.XXX"),realName);
   410 	r=TheFs.RealName(_L("O:\\File.XXX"),realName);
   409 	test_KErrNone(r);
   411 	test(r==KErrNone);
   410 
   412 
   411 	r=TheFs.SetSubst(_L(""),EDriveO);	 //to unsubst
   413 	r=TheFs.SetSubst(_L(""),EDriveO);	 //to unsubst
   412 	test_KErrNone(r);
   414 	test(r==KErrNone);
   413 
   415 
   414 	r=TheFs.SetSessionPath(theprivatepath);
   416 	r=TheFs.SetSessionPath(theprivatepath);
   415 	test_KErrNone(r);
   417 	test(r==KErrNone);
   416 
   418 
   417 	TheFs.NotifyChange(ENotifyAll,aStat3,theprivatepath);
   419 	TheFs.NotifyChange(ENotifyAll,aStat3,theprivatepath);
   418 	test(aStat3==KRequestPending);
   420 	test(aStat3==KRequestPending);
   419 
   421 
   420 	pritestfile=theprivatepath;
   422 	pritestfile=theprivatepath;
   425 	
   427 	
   426 	oldName=KOldFile;
   428 	oldName=KOldFile;
   427 	oldName[0]=(TText)gDriveToTest;
   429 	oldName[0]=(TText)gDriveToTest;
   428 
   430 
   429 	r=TheFs.GetShortName(pritestfile, shortfilename);
   431 	r=TheFs.GetShortName(pritestfile, shortfilename);
   430 	test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported);
   432 	test(r==KErrNone || r==KErrNotFound || r==KErrNotSupported);
   431 
   433 
   432 	r=TheFs.GetLongName(pritestfile1, longfilename);
   434 	r=TheFs.GetLongName(pritestfile1, longfilename);
   433 	test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported);
   435 	test(r==KErrNone || r==KErrNotFound || r==KErrNotSupported);
   434 
   436 
   435 	r=file1.Create(TheFs,oldName,EFileWrite);
   437 	r=file1.Create(TheFs,oldName,EFileWrite);
   436 	test_Value(r, r == KErrNone || r==KErrAlreadyExists);
   438 	test(r==KErrNone || r==KErrAlreadyExists);
   437 	file1.Close();
   439 	file1.Close();
   438 
   440 
   439 	r=TheFs.Replace(oldName,pritestfile);
   441 	r=TheFs.Replace(oldName,pritestfile);
   440 	test_KErrNone(r);
   442 	test(r==KErrNone);
   441 	
   443 	
   442 	r=TheFs.Rename(pritestfile,pritestfile1);
   444 	r=TheFs.Rename(pritestfile,pritestfile1);
   443 	test_Value(r, r == KErrNone || r==KErrAlreadyExists);
   445 	test(r==KErrNone || r==KErrAlreadyExists);
   444 	
   446 	
   445 	r=TheFs.Entry(pritestfile1,entry);
   447 	r=TheFs.Entry(pritestfile1,entry);
   446 	test_KErrNone(r);
   448 	test(r==KErrNone);
   447 
   449 
   448 	r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
   450 	r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
   449 	test_KErrNone(r);
   451 	test(r==KErrNone);
   450 
   452 
   451 	r=TheFs.Delete(pritestfile1);
   453 	r=TheFs.Delete(pritestfile1);
   452 	test_KErrNone(r);
   454 	test(r==KErrNone);
   453 
   455 
   454 	__UHEAP_MARKEND;
   456 	__UHEAP_MARKEND;
   455 	}
   457 	}
   456 
   458 
   457 
   459 
   461 //
   463 //
   462 	{
   464 	{
   463 	__UHEAP_MARK;
   465 	__UHEAP_MARK;
   464 
   466 
   465 	r=TheFs.SetSessionPath(systestname);
   467 	r=TheFs.SetSessionPath(systestname);
   466 	test_Value(r, r == KErrPermissionDenied);
   468 	test(r==KErrPermissionDenied);
   467 
   469 
   468 	r=file1.Temp(TheFs,systestname,fromTemp,EFileWrite);
   470 	r=file1.Temp(TheFs,systestname,fromTemp,EFileWrite);
   469 	test_KErrNone(r);
   471 	test(r==KErrNone);
   470 	file1.Close();
   472 	file1.Close();
   471 
   473 
   472 	systestfile=KSystemPath;
   474 	systestfile=KSystemPath;
   473 	systestfile[0]=(TText)('A' + gTheDriveNum);
   475 	systestfile[0]=(TText)('A' + gTheDriveNum);
   474 	systestfile1=systestfile;
   476 	systestfile1=systestfile;
   475 	systestfile.Append(KFileSys);
   477 	systestfile.Append(KFileSys);
   476 	systestfile1.Append(KFileSys3);
   478 	systestfile1.Append(KFileSys3);
   477 
   479 
   478 	r=file1.Create(TheFs,systestfile,EFileWrite);
   480 	r=file1.Create(TheFs,systestfile,EFileWrite);
   479 	test_KErrNone(r);
   481 	test(r==KErrNone);
   480 	file1.Close();
   482 	file1.Close();
   481 
   483 
   482 	r=file1.Open(TheFs,systestfile,EFileWrite);
   484 	r=file1.Open(TheFs,systestfile,EFileWrite);
   483 	test_KErrNone(r);
   485 	test(r==KErrNone);
   484 	file1.Close();
   486 	file1.Close();
   485 	
   487 	
   486 	r=file1.Open(TheFs,systestfile,EFileRead);
   488 	r=file1.Open(TheFs,systestfile,EFileRead);
   487 	test_Value(r, r == KErrPermissionDenied);
   489 	test(r==KErrPermissionDenied);
   488 	file1.Close();
   490 	file1.Close();
   489 
   491 
   490 	r=file1.Replace(TheFs,systestfile,EFileWrite);
   492 	r=file1.Replace(TheFs,systestfile,EFileWrite);
   491 	test_KErrNone(r);
   493 	test(r==KErrNone);
   492 	
   494 	
   493 	r=file1.Rename(systestfile1);
   495 	r=file1.Rename(systestfile1);
   494 	test_KErrNone(r);
   496 	test(r==KErrNone);
   495 	file1.Close();
   497 	file1.Close();
   496 
   498 
   497     TFindFile finder(TheFs);
   499     TFindFile finder(TheFs);
   498     CDir* dir = NULL;
   500     CDir* dir = NULL;
   499     r=finder.FindWildByDir(KWildFile, KWildPath, dir);
   501     r=finder.FindWildByDir(KWildFile, KWildPath, dir);
   500 	if (!(r==KErrPermissionDenied))
   502 	if (!(r==KErrPermissionDenied))
   501         test.Printf(_L("T_DCTCBDISKADMIN: test find wildcards r = %d (expected KErrPermissionDenied)\n"), r);
   503         test.Printf(_L("T_DCTCBDISKADMIN: test find wildcards r = %d (expected KErrPermissionDenied)\n"), r);
   502 	test_Value(r, r == KErrPermissionDenied);
   504 	test(r==KErrPermissionDenied);
   503 //	delete dir;
   505 //	delete dir;
   504 
   506 
   505 	r=TheFs.Delete(fromTemp);
   507 	r=TheFs.Delete(fromTemp);
   506 	test_KErrNone(r);
   508 	test(r==KErrNone);
   507 
   509 
   508 	r=TheFs.Delete(systestfile1);
   510 	r=TheFs.Delete(systestfile1);
   509 	test_KErrNone(r);
   511 	test(r==KErrNone);
   510 	
   512 	
   511 
   513 
   512 	__UHEAP_MARKEND;
   514 	__UHEAP_MARKEND;
   513 	}
   515 	}
   514 
   516 
   518 //
   520 //
   519 	{
   521 	{
   520 	__UHEAP_MARK;
   522 	__UHEAP_MARK;
   521 
   523 
   522 	r=TheFs.SetSessionPath(restestname);
   524 	r=TheFs.SetSessionPath(restestname);
   523 	test_KErrNone(r);
   525 	test(r==KErrNone);
   524 
   526 
   525 	r=file1.Temp(TheFs,restestname,fromTemp,EFileWrite);
   527 	r=file1.Temp(TheFs,restestname,fromTemp,EFileWrite);
   526 	test_KErrNone(r);
   528 	test(r==KErrNone);
   527 	file1.Close();
   529 	file1.Close();
   528 
   530 
   529 	r=file1.Create(TheFs,KFileRes,EFileWrite);
   531 	r=file1.Create(TheFs,KFileRes,EFileWrite);
   530 	test_KErrNone(r);
   532 	test(r==KErrNone);
   531 	file1.Close();
   533 	file1.Close();
   532 
   534 
   533 	r=file1.Open(TheFs,KFileRes,EFileWrite|EFileShareExclusive );
   535 	r=file1.Open(TheFs,KFileRes,EFileWrite|EFileShareExclusive );
   534 	test_KErrNone(r);
   536 	test(r==KErrNone);
   535 	
   537 	
   536 	r=file1.Rename(KFileRes3);
   538 	r=file1.Rename(KFileRes3);
   537 	test_KErrNone(r);
   539 	test(r==KErrNone);
   538 	file1.Close();
   540 	file1.Close();
   539 
   541 
   540 	r=file1.Open(TheFs,KFileRes3,EFileShareReadersOrWriters|EFileRead);
   542 	r=file1.Open(TheFs,KFileRes3,EFileShareReadersOrWriters|EFileRead);
   541 	test_KErrNone(r);
   543 	test(r==KErrNone);
   542 	file1.Close();
   544 	file1.Close();
   543 
   545 
   544 	r=file1.Open(TheFs,KFileRes3,EFileShareReadersOrWriters|EFileWrite);
   546 	r=file1.Open(TheFs,KFileRes3,EFileShareReadersOrWriters|EFileWrite);
   545 	test_KErrNone(r);
   547 	test(r==KErrNone);
   546 	file1.Close();
   548 	file1.Close();
   547 
   549 
   548 	r=file1.Open(TheFs,KFileRes3,EFileShareReadersOnly);
   550 	r=file1.Open(TheFs,KFileRes3,EFileShareReadersOnly);
   549 	test_KErrNone(r);
   551 	test(r==KErrNone);
   550 
   552 
   551 	r=file1.ChangeMode(EFileShareExclusive);
   553 	r=file1.ChangeMode(EFileShareExclusive);
   552 	test_KErrNone(r);
   554 	test(r==KErrNone);
   553 	file1.Close();
   555 	file1.Close();
   554 
   556 
   555 	r=file1.Replace(TheFs,KFileRes,EFileWrite);
   557 	r=file1.Replace(TheFs,KFileRes,EFileWrite);
   556 	test_KErrNone(r);
   558 	test(r==KErrNone);
   557 	file1.Close();	
   559 	file1.Close();	
   558 
   560 
   559 	r=TheFs.Delete(KFileRes);
   561 	r=TheFs.Delete(KFileRes);
   560 	test_KErrNone(r);
   562 	test(r==KErrNone);
   561 
   563 
   562 	r=TheFs.Delete(KFileRes3);
   564 	r=TheFs.Delete(KFileRes3);
   563 	test_KErrNone(r);
   565 	test(r==KErrNone);
   564 
   566 
   565 	r=TheFs.Delete(fromTemp);
   567 	r=TheFs.Delete(fromTemp);
   566 	test_KErrNone(r);
   568 	test(r==KErrNone);
   567 
   569 
   568 	__UHEAP_MARKEND;
   570 	__UHEAP_MARKEND;
   569 	}
   571 	}
   570 
   572 
   571 
   573 
   575 //
   577 //
   576 	{
   578 	{
   577 	__UHEAP_MARK;
   579 	__UHEAP_MARK;
   578 
   580 
   579 	r=TheFs.SetSessionPath(pritestfalseidname);
   581 	r=TheFs.SetSessionPath(pritestfalseidname);
   580 	test_Value(r, r == KErrPermissionDenied);
   582 	test(r==KErrPermissionDenied);
   581 
   583 
   582 	// Since can't set the session path to what is required, so use
   584 	// Since can't set the session path to what is required, so use
   583 	// an explicit path
   585 	// an explicit path
   584 	pritestfile=pritestfalseidname;
   586 	pritestfile=pritestfalseidname;
   585 	pritestfile[0]=(TText)('A' + gTheDriveNum);
   587 	pritestfile[0]=(TText)('A' + gTheDriveNum);
   586 	pritestfile.Append(KFilePri);
   588 	pritestfile.Append(KFilePri);
   587 
   589 
   588 	r=file1.Temp(TheFs,pritestfalseidname,fromTemp,EFileWrite);
   590 	r=file1.Temp(TheFs,pritestfalseidname,fromTemp,EFileWrite);
   589 	test_Value(r, r == KErrPermissionDenied);
   591 	test(r==KErrPermissionDenied);
   590 	file1.Close();
   592 	file1.Close();
   591 
   593 
   592 	r=file1.Create(TheFs,pritestfile,EFileWrite);
   594 	r=file1.Create(TheFs,pritestfile,EFileWrite);
   593 	test_Value(r, r == KErrPermissionDenied);
   595 	test(r==KErrPermissionDenied);
   594 	file1.Close();
   596 	file1.Close();
   595 
   597 
   596 	r=file1.Open(TheFs,pritestfile,EFileWrite);
   598 	r=file1.Open(TheFs,pritestfile,EFileWrite);
   597 	test_Value(r, r == KErrPermissionDenied);
   599 	test(r==KErrPermissionDenied);
   598 	file1.Close();
   600 	file1.Close();
   599 	
   601 	
   600 	r=file1.Replace(TheFs,pritestfile,EFileWrite);
   602 	r=file1.Replace(TheFs,pritestfile,EFileWrite);
   601 	test_Value(r, r == KErrPermissionDenied);
   603 	test(r==KErrPermissionDenied);
   602 
   604 
   603 	// Can't perform this operation since file1 has not been created
   605 	// Can't perform this operation since file1 has not been created
   604 /*	r=file1.Rename(KFilePri3);
   606 /*	r=file1.Rename(KFilePri3);
   605 	test_Value(r, r == KErrPermissionDenied);
   607 	test(r==KErrPermissionDenied);
   606 	file1.Close();
   608 	file1.Close();
   607 */
   609 */
   608 	__UHEAP_MARKEND;
   610 	__UHEAP_MARKEND;
   609 	}
   611 	}
   610 
   612 
   616 //
   618 //
   617 	{
   619 	{
   618 	__UHEAP_MARK;
   620 	__UHEAP_MARK;
   619 
   621 
   620 	r=TheFs.SetSessionPath(pritestname);
   622 	r=TheFs.SetSessionPath(pritestname);
   621 	test_Value(r, r == KErrPermissionDenied);
   623 	test(r==KErrPermissionDenied);
   622 
   624 
   623 	r=file1.Temp(TheFs,pritestname,fromTemp,EFileWrite);
   625 	r=file1.Temp(TheFs,pritestname,fromTemp,EFileWrite);
   624 	test_Value(r, r == KErrPermissionDenied);
   626 	test(r==KErrPermissionDenied);
   625 	file1.Close();
   627 	file1.Close();
   626 
   628 
   627 	// Since can't set session path create explicit path
   629 	// Since can't set session path create explicit path
   628 	pritestfile=KPrivatePath;
   630 	pritestfile=KPrivatePath;
   629 	pritestfile[0]=(TText)('A' + gTheDriveNum);
   631 	pritestfile[0]=(TText)('A' + gTheDriveNum);
   630 	pritestfile.Append(KFilePri);
   632 	pritestfile.Append(KFilePri);
   631 
   633 
   632 	r=file1.Create(TheFs,pritestfile,EFileWrite);
   634 	r=file1.Create(TheFs,pritestfile,EFileWrite);
   633 	test_Value(r, r == KErrPermissionDenied);
   635 	test(r==KErrPermissionDenied);
   634 	file1.Close();
   636 	file1.Close();
   635 
   637 
   636 	r=file1.Open(TheFs,pritestfile,EFileWrite);
   638 	r=file1.Open(TheFs,pritestfile,EFileWrite);
   637 	test_Value(r, r == KErrPermissionDenied);
   639 	test(r==KErrPermissionDenied);
   638 	file1.Close();
   640 	file1.Close();
   639 	
   641 	
   640 	r=file1.Open(TheFs,pritestfile,EFileRead);
   642 	r=file1.Open(TheFs,pritestfile,EFileRead);
   641 	test_Value(r, r == KErrPermissionDenied);
   643 	test(r==KErrPermissionDenied);
   642 	file1.Close();
   644 	file1.Close();
   643 	
   645 	
   644 	r=file1.Replace(TheFs,pritestfile,EFileWrite);
   646 	r=file1.Replace(TheFs,pritestfile,EFileWrite);
   645 	test_Value(r, r == KErrPermissionDenied);
   647 	test(r==KErrPermissionDenied);
   646 
   648 
   647 	// Can't rename nor delete since file1 not created
   649 	// Can't rename nor delete since file1 not created
   648 /*
   650 /*
   649 	r=file1.Rename(KFilePri3);
   651 	r=file1.Rename(KFilePri3);
   650 	test_Value(r, r == KErrPermissionDenied);
   652 	test(r==KErrPermissionDenied);
   651 	file1.Close();
   653 	file1.Close();
   652 
   654 
   653 	r=TheFs.Delete(fromTemp);
   655 	r=TheFs.Delete(fromTemp);
   654 	test_KErrNone(r);
   656 	test(r==KErrNone);
   655 */
   657 */
   656 
   658 
   657 	__UHEAP_MARKEND;
   659 	__UHEAP_MARKEND;
   658 	}
   660 	}
   659 
   661 
   665 //
   667 //
   666 	{
   668 	{
   667 	__UHEAP_MARK;
   669 	__UHEAP_MARK;
   668 
   670 
   669 	r=TheFs.SetSessionToPrivate(gTheDriveNum);
   671 	r=TheFs.SetSessionToPrivate(gTheDriveNum);
   670 	test_KErrNone(r);
   672 	test(r==KErrNone);
   671 	
   673 	
   672 	r=file1.Temp(TheFs,theprivatepath,fromTemp,EFileWrite);
   674 	r=file1.Temp(TheFs,theprivatepath,fromTemp,EFileWrite);
   673 	test_KErrNone(r);
   675 	test(r==KErrNone);
   674 	file1.Close();
   676 	file1.Close();
   675 
   677 
   676 	r=file1.Create(TheFs,KFilePri,EFileWrite);
   678 	r=file1.Create(TheFs,KFilePri,EFileWrite);
   677 	test_Value(r, r == KErrNone || r==KErrAlreadyExists);
   679 	test(r==KErrNone || r==KErrAlreadyExists);
   678 	file1.Close();
   680 	file1.Close();
   679 
   681 
   680 	r=file1.Open(TheFs,KFilePri,EFileWrite);
   682 	r=file1.Open(TheFs,KFilePri,EFileWrite);
   681 	test_KErrNone(r);
   683 	test(r==KErrNone);
   682 	file1.Close();
   684 	file1.Close();
   683 	
   685 	
   684 	r=file1.Open(TheFs,KFilePri,EFileRead);
   686 	r=file1.Open(TheFs,KFilePri,EFileRead);
   685 	test_KErrNone(r);
   687 	test(r==KErrNone);
   686 	file1.Close();
   688 	file1.Close();
   687 	
   689 	
   688 	r=file1.Replace(TheFs,KFilePri,EFileWrite);
   690 	r=file1.Replace(TheFs,KFilePri,EFileWrite);
   689 	test_KErrNone(r);
   691 	test(r==KErrNone);
   690 	
   692 	
   691 	r=file1.Rename(KFilePri3);
   693 	r=file1.Rename(KFilePri3);
   692 	test_KErrNone(r);
   694 	test(r==KErrNone);
   693 	file1.Close();
   695 	file1.Close();
   694 
   696 
   695 	r=TheFs.Delete(KFilePri3);
   697 	r=TheFs.Delete(KFilePri3);
   696 	test_KErrNone(r);
   698 	test(r==KErrNone);
   697 
   699 
   698 	r=TheFs.Delete(fromTemp);
   700 	r=TheFs.Delete(fromTemp);
   699 	test_KErrNone(r);
   701 	test(r==KErrNone);
   700 
   702 
   701 	__UHEAP_MARKEND;
   703 	__UHEAP_MARKEND;
   702 	}
   704 	}
   703 
   705 
   704 LOCAL_C void RDirtest()
   706 LOCAL_C void RDirtest()
   712 	//system
   714 	//system
   713 	CDir*	dirEntries;
   715 	CDir*	dirEntries;
   714 	TBuf<30> dirNameBuf(KSystemPath);
   716 	TBuf<30> dirNameBuf(KSystemPath);
   715 	dirNameBuf[0]=(TText)gDriveToTest;
   717 	dirNameBuf[0]=(TText)gDriveToTest;
   716 	r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
   718 	r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
   717 	test_Value(r, r == KErrPermissionDenied);
   719 	test(r==KErrPermissionDenied);
   718 	dir.Close();
   720 	dir.Close();
   719 	r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
   721 	r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
   720 	test_Value(r, r == KErrPermissionDenied);
   722 	test(r==KErrPermissionDenied);
   721 	dirNameBuf.Zero();
   723 	dirNameBuf.Zero();
   722 	delete dirEntries;
   724 	delete dirEntries;
   723 
   725 
   724 	//Private
   726 	//Private
   725 	dirNameBuf=KPrivatePath;
   727 	dirNameBuf=KPrivatePath;
   726 	dirNameBuf[0]=(TText)gDriveToTest;
   728 	dirNameBuf[0]=(TText)gDriveToTest;
   727 	r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
   729 	r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
   728 	test_Value(r, r == KErrPermissionDenied);
   730 	test(r==KErrPermissionDenied);
   729 	dir.Close();
   731 	dir.Close();
   730 	r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
   732 	r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
   731 	test_Value(r, r == KErrPermissionDenied);
   733 	test(r==KErrPermissionDenied);
   732 	dirNameBuf.Zero();
   734 	dirNameBuf.Zero();
   733 	delete dirEntries;
   735 	delete dirEntries;
   734 
   736 
   735 	//Private//<wrong ID>//
   737 	//Private//<wrong ID>//
   736 	dirNameBuf=KPrivateFalseID;
   738 	dirNameBuf=KPrivateFalseID;
   737 	dirNameBuf[0]=(TText)gDriveToTest;
   739 	dirNameBuf[0]=(TText)gDriveToTest;
   738 	r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
   740 	r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
   739 	test_Value(r, r == KErrPermissionDenied);
   741 	test(r==KErrPermissionDenied);
   740 	dir.Close();
   742 	dir.Close();
   741 	r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
   743 	r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
   742 	test_Value(r, r == KErrPermissionDenied);
   744 	test(r==KErrPermissionDenied);
   743 	dirNameBuf.Zero();
   745 	dirNameBuf.Zero();
   744 	delete dirEntries;
   746 	delete dirEntries;
   745 
   747 
   746 	//Private/uid
   748 	//Private/uid
   747 	TheFs.PrivatePath(dirNameBuf);
   749 	TheFs.PrivatePath(dirNameBuf);
   748 	dirNameBuf.Insert(0,_L("?:"));
   750 	dirNameBuf.Insert(0,_L("?:"));
   749 	dirNameBuf[0]=(TText)gDriveToTest;
   751 	dirNameBuf[0]=(TText)gDriveToTest;
   750 	r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
   752 	r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
   751 	test_KErrNone(r);
   753 	test(r==KErrNone);
   752 	dir.Close();
   754 	dir.Close();
   753 	r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
   755 	r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
   754 	test_KErrNone(r);
   756 	test(r==KErrNone);
   755 	dirNameBuf.Zero();
   757 	dirNameBuf.Zero();
   756 	delete dirEntries;
   758 	delete dirEntries;
   757 	//Resource
   759 	//Resource
   758 	
   760 	
   759 	dirNameBuf=KResourcePath;
   761 	dirNameBuf=KResourcePath;
   760 	dirNameBuf[0]=(TText)gDriveToTest;
   762 	dirNameBuf[0]=(TText)gDriveToTest;
   761 	r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
   763 	r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
   762 	test_KErrNone(r);
   764 	test(r==KErrNone);
   763 	r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
   765 	r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
   764 	test_KErrNone(r);
   766 	test(r==KErrNone);
   765 	dir.Close();
   767 	dir.Close();
   766 	delete dirEntries;
   768 	delete dirEntries;
   767 
   769 
   768 	__UHEAP_MARKEND;
   770 	__UHEAP_MARKEND;
   769 	}
   771 	}
   775 //
   777 //
   776 	{
   778 	{
   777 	__UHEAP_MARK;
   779 	__UHEAP_MARK;
   778 
   780 
   779 	r=TheFs.FileSystemName(fsname,gTheDriveNum);
   781 	r=TheFs.FileSystemName(fsname,gTheDriveNum);
   780 	test_KErrNone(r);
   782 	test(r==KErrNone);
   781 	r = DismountFileSystem(TheFs, fsname, gTheDriveNum);
   783 	r = DismountFileSystem(TheFs, fsname, gTheDriveNum);
   782 	test_Value(r, r == KErrNone || r==KErrNotFound);
   784 	test(r==KErrNone || r==KErrNotFound);
   783 //	r=TheFs.RemoveFileSystem(fsname);	//can not test due to bug else where fix exists
   785 //	r=TheFs.RemoveFileSystem(fsname);	//can not test due to bug else where fix exists
   784 //	test_KErrNone(r);
   786 //	test(r==KErrNone);
   785 //	r=TheFs.AddFileSystem(fsname);
   787 //	r=TheFs.AddFileSystem(fsname);
   786 //	test_KErrNone(r);
   788 //	test(r==KErrNone);
   787 	r = MountFileSystem(TheFs, fsname, gTheDriveNum);
   789 	r = MountFileSystem(TheFs, fsname, gTheDriveNum);
   788 	test_KErrNone(r);
   790 	test(r==KErrNone);
   789 	r=TheFs.SetDriveName(gTheDriveNum,KDriveName);
   791 	r=TheFs.SetDriveName(gTheDriveNum,KDriveName);
   790 	test_KErrNone(r);
   792 	test(r==KErrNone);
   791 #ifndef __WINS__
   793 #ifndef __WINS__
   792  	r=TheFs.SetVolumeLabel(KVolLable, gTheDriveNum);
   794  	r=TheFs.SetVolumeLabel(KVolLable, gTheDriveNum);
   793 	test_KErrNone(r);
   795 	test(r==KErrNone);
   794 #endif
   796 #endif
   795 
   797 
   796 	systemRFsTest();
   798 	systemRFsTest();
   797 	ResourceRFsTest();
   799 	ResourceRFsTest();
   798 	privateRFsTest();	
   800 	privateRFsTest();	
   814 	test(aStat2==KErrPermissionDenied);
   816 	test(aStat2==KErrPermissionDenied);
   815 	test(aStat3==KErrNone);
   817 	test(aStat3==KErrNone);
   816 	test(aStat4==KErrNone);
   818 	test(aStat4==KErrNone);
   817 
   819 
   818 	r=TheFs.SetSessionPath(systestname);
   820 	r=TheFs.SetSessionPath(systestname);
   819 	test_Value(r, r == KErrPermissionDenied);
   821 	test(r==KErrPermissionDenied);
   820 	
   822 	
   821 //Test RRawDisk class
   823 //Test RRawDisk class
   822 	r=rawdisk.Open(TheFs,gTheDriveNum);
   824 	r=rawdisk.Open(TheFs,gTheDriveNum);
   823 	test_KErrNone(r);
   825 	test(r==KErrNone);
   824 	rawdisk.Close();
   826 	rawdisk.Close();
   825 
   827 
   826 	RDirtest();
   828 	RDirtest();
   827 
   829 
   828 #ifdef __WINS__
   830 #ifdef __WINS__
   829 	if (User::UpperCase(driveBuf[0]) != 'C')
   831 	if (User::UpperCase(driveBuf[0]) != 'C')
   830 #endif
   832 #endif
   831 		{
   833 		{
   832 		//Test RFormat class
   834 		//Test RFormat class
   833 		r=format.Open(TheFs,driveBuf,EHighDensity,count);
   835 		r=format.Open(TheFs,driveBuf,EHighDensity,count);
   834 		test_KErrNone(r);
   836 		test(r==KErrNone);
   835 
   837 
   836 		while(count)	
   838 		while(count)	
   837 			{
   839 			{
   838 			TInt r=format.Next(count);
   840 			TInt r=format.Next(count);
   839 			test_KErrNone(r);
   841 			test(r==KErrNone);
   840 			}
   842 			}
   841 		format.Close();
   843 		format.Close();
   842 		}
   844 		}
   843 
   845 
   844 	driveBuf[0]=(TText)gDriveToTest;
   846 	driveBuf[0]=(TText)gDriveToTest;
   845 	r=TheFs.ScanDrive(driveBuf);
   847 	r=TheFs.ScanDrive(driveBuf);
   846 	test_Value(r, r == KErrNone || r==KErrNotSupported);
   848 	test(r==KErrNone || r==KErrNotSupported);
   847 	r=TheFs.CheckDisk(driveBuf);
   849 	r=TheFs.CheckDisk(driveBuf);
   848 	test_Value(r, r == KErrNone || r==KErrNotSupported);
   850 	test(r==KErrNone || r==KErrNotSupported);
   849 
   851 
   850 	__UHEAP_MARKEND;
   852 	__UHEAP_MARKEND;
   851 	}
   853 	}
   852 
   854 
   853 LOCAL_C void TestCaps()
   855 LOCAL_C void TestCaps()
   863 	r=RProcess().HasCapability(ECapabilityTCB,ECapabilityDiskAdmin, __PLATSEC_DIAGNOSTIC_STRING(myDiagMsg));
   865 	r=RProcess().HasCapability(ECapabilityTCB,ECapabilityDiskAdmin, __PLATSEC_DIAGNOSTIC_STRING(myDiagMsg));
   864 	test(r);
   866 	test(r);
   865 
   867 
   866 	driveBuf[0]=(TText)gDriveToTest;
   868 	driveBuf[0]=(TText)gDriveToTest;
   867 	r=TheFs.SessionPath(temp);
   869 	r=TheFs.SessionPath(temp);
   868 	test_KErrNone(r);
   870 	test(r==KErrNone);
   869 
   871 
   870 	test.Printf(_L("Session path: %S"),&temp);
   872 	test.Printf(_L("Session path: %S"),&temp);
   871 
   873 
   872 	r=TheFs.CreatePrivatePath(gTheDriveNum);
   874 	r=TheFs.CreatePrivatePath(gTheDriveNum);
   873 	test_Value(r, r == KErrNone || r== KErrAlreadyExists);
   875 	test(r==KErrNone || r== KErrAlreadyExists);
   874 
   876 
   875 	TBuf<18> tempPri;
   877 	TBuf<18> tempPri;
   876 	r=TheFs.PrivatePath(tempPri);
   878 	r=TheFs.PrivatePath(tempPri);
   877 	test_KErrNone(r);
   879 	test(r==KErrNone);
   878 	theprivatepath = _L("?:");
   880 	theprivatepath = _L("?:");
   879 	theprivatepath.Append(tempPri);
   881 	theprivatepath.Append(tempPri);
   880 
   882 
   881 	TestTcbDiskAdmin();
   883 	TestTcbDiskAdmin();
   882 
   884 
   883 	TFileName thesessionpath;
   885 	TFileName thesessionpath;
   884 
   886 
   885 	r=TheFs.SetSessionToPrivate(gTheDriveNum);
   887 	r=TheFs.SetSessionToPrivate(gTheDriveNum);
   886 	test_KErrNone(r);
   888 	test(r==KErrNone);
   887 	r=TheFs.SessionPath(thesessionpath);
   889 	r=TheFs.SessionPath(thesessionpath);
   888 	test_KErrNone(r);
   890 	test(r==KErrNone);
   889 	
   891 	
   890 	test(thesessionpath == theprivatepath);
   892 	test(thesessionpath == theprivatepath);
   891 
   893 
   892 	__UHEAP_MARKEND;
   894 	__UHEAP_MARKEND;
   893 	}
   895 	}
   898 //
   900 //
   899 	{
   901 	{
   900 	test.Next(_L("Delete test directory"));
   902 	test.Next(_L("Delete test directory"));
   901 	CFileMan* fMan=CFileMan::NewL(TheFs);
   903 	CFileMan* fMan=CFileMan::NewL(TheFs);
   902 	TInt r=fMan->RmDir(gSessionPath);
   904 	TInt r=fMan->RmDir(gSessionPath);
   903 	test_Value(r, r == KErrNone || r==KErrPathNotFound);
   905 	test(r==KErrNone || r==KErrPathNotFound);
   904 
   906 
   905 	TBuf<20> delDir;
   907 	TBuf<20> delDir;
   906 	delDir=KResourcePath;
   908 	delDir=KResourcePath;
   907 	delDir[0]=(TText)gDriveToTest;
   909 	delDir[0]=(TText)gDriveToTest;
   908 	r=fMan->RmDir(delDir);
   910 	r=fMan->RmDir(delDir);
   909 	test_Value(r, r == KErrNone || r==KErrPathNotFound);
   911 	test(r==KErrNone || r==KErrPathNotFound);
   910 	delete fMan;
   912 	delete fMan;
   911 
   913 
   912 	delDir=KSystemPath;
   914 	delDir=KSystemPath;
   913 	delDir[0]=(TText)gDriveToTest;
   915 	delDir[0]=(TText)gDriveToTest;
   914 	r=TheFs.RmDir(delDir);
   916 	r=TheFs.RmDir(delDir);
   915 	test_Value(r, r == KErrNone || r==KErrPathNotFound || r==KErrNotFound);
   917 	test(r==KErrNone || r==KErrPathNotFound || r==KErrNotFound);
   916 	}
   918 	}
   917 
   919 
   918 GLDEF_C void CallTestsL(/*TChar aDriveLetter*/)
   920 GLDEF_C void CallTestsL(/*TChar aDriveLetter*/)
   919 //
   921 //
   920 // Do all tests
   922 // Do all tests
   937 	TBuf<30> sesspath;
   939 	TBuf<30> sesspath;
   938 	sesspath=_L("?:\\");
   940 	sesspath=_L("?:\\");
   939 	sesspath[0] = (TText)gDriveToTest;
   941 	sesspath[0] = (TText)gDriveToTest;
   940 
   942 
   941 	TInt r= TheFs.SetSessionPath(sesspath);
   943 	TInt r= TheFs.SetSessionPath(sesspath);
   942 	test_KErrNone(r);
   944 	test(r==KErrNone);
   943 
   945 
   944 	//cleanup from previous run of this test
   946 	//cleanup from previous run of this test
   945 	RProcess tp;
   947 	RProcess tp;
   946 	r=tp.Create(_L("clean_prepdc.exe"),sesspath);
   948 	r=tp.Create(_L("clean_prepdc.exe"),sesspath);
   947 	test_KErrNone(r);
   949 	test(r==KErrNone);
   948 	{
   950 	{
   949 	TRequestStatus ps;
   951 	TRequestStatus ps;
   950 	tp.Logon(ps);
   952 	tp.Logon(ps);
   951 	tp.Resume();
   953 	tp.Resume();
   952 	tp.Close();
   954 	tp.Close();
   956 	//check double mode ie that Defpath still works	
   958 	//check double mode ie that Defpath still works	
   957 	RFs fs1;
   959 	RFs fs1;
   958 	RFs fs2;
   960 	RFs fs2;
   959 	
   961 	
   960 	r=fs1.Connect();
   962 	r=fs1.Connect();
   961 	test_KErrNone(r);
   963 	test(r==KErrNone);
   962 	r=fs1.SessionPath(sesspath);
   964 	r=fs1.SessionPath(sesspath);
   963 	test_KErrNone(r);
   965 	test(r==KErrNone);
   964 	test.Printf(_L("session1 Path=%S"),&sesspath);
   966 	test.Printf(_L("session1 Path=%S"),&sesspath);
   965 
   967 
   966 	TBuf<30> privatepath;
   968 	TBuf<30> privatepath;
   967 	r=fs1.SetSessionToPrivate(gTheDriveNum);
   969 	r=fs1.SetSessionToPrivate(gTheDriveNum);
   968 	test_KErrNone(r);
   970 	test(r==KErrNone);
   969 	r=fs1.PrivatePath(privatepath);
   971 	r=fs1.PrivatePath(privatepath);
   970 	test_KErrNone(r);
   972 	test(r==KErrNone);
   971 	r=privatepath.Compare(KExpectedPrivatePath());
   973 	r=privatepath.Compare(KExpectedPrivatePath());
   972 	test_Value(r, r == 0);
   974 	test(r==0);
   973 	r=fs1.SessionPath(sesspath);
   975 	r=fs1.SessionPath(sesspath);
   974 	test_KErrNone(r);
   976 	test(r==KErrNone);
   975 	r=privatepath.Compare(sesspath.Mid(KPathPosition));
   977 	r=privatepath.Compare(sesspath.Mid(KPathPosition));
   976 	test_Value(r, r == 0);
   978 	test(r==0);
   977 	r=fs1.CreatePrivatePath(gTheDriveNum);
   979 	r=fs1.CreatePrivatePath(gTheDriveNum);
   978 	test_KErrNone(r);
   980 	test(r==KErrNone);
   979 	fs1.Close();
   981 	fs1.Close();
   980 
   982 
   981 	r=fs2.Connect();
   983 	r=fs2.Connect();
   982 	test_KErrNone(r);
   984 	test(r==KErrNone);
   983 	r=fs2.SessionPath(sesspath);
   985 	r=fs2.SessionPath(sesspath);
   984 	test_KErrNone(r);
   986 	test(r==KErrNone);
   985 	test.Printf(_L("session2 Path=%S"),&sesspath);
   987 	test.Printf(_L("session2 Path=%S"),&sesspath);
   986 	fs2.Close();
   988 	fs2.Close();
   987 
   989 
   988 	__UHEAP_MARK;
   990 	__UHEAP_MARK;
   989 	TestCaps();
   991 	TestCaps();