kerneltest/f32test/server/t_dcdiskadmin.cpp
branchRCL_3
changeset 256 c1f20ce4abcf
parent 0 a41df078684a
child 257 3e88ff8f41d5
equal deleted inserted replaced
249:a179b74831c9 256:c1f20ce4abcf
    13 // Description:
    13 // Description:
    14 // f32test\server\t_dcdiskadmin.cpp
    14 // f32test\server\t_dcdiskadmin.cpp
    15 // 
    15 // 
    16 //
    16 //
    17 
    17 
       
    18 #define __E32TEST_EXTENSION__
    18 #include <f32file.h>
    19 #include <f32file.h>
    19 #include <e32test.h>
    20 #include <e32test.h>
    20 #include <e32std.h>
    21 #include <e32std.h>
    21 #include <e32std_private.h>
    22 #include <e32std_private.h>
    22 #include <e32svr.h>
    23 #include <e32svr.h>
    73 TRequestStatus aStat1;
    74 TRequestStatus aStat1;
    74 TRequestStatus aStat2;
    75 TRequestStatus aStat2;
    75 TRequestStatus aStat3;
    76 TRequestStatus aStat3;
    76 TRequestStatus aStat4;
    77 TRequestStatus aStat4;
    77 
    78 
    78 TVolumeInfo aVolInfo;
       
    79 //	TDriveInfo adriveInfo;
       
    80 
       
    81 TBuf<40> systestfile;
    79 TBuf<40> systestfile;
    82 TBuf<40> pritestfile;
    80 TBuf<40> pritestfile;
    83 TBuf<40> restestfile;
    81 TBuf<40> restestfile;
    84 TBuf<40> systestfile1;
    82 TBuf<40> systestfile1;
    85 TBuf<40> pritestfile1;
    83 TBuf<40> pritestfile1;
   106 
   104 
   107 	mkdirname.Zero();
   105 	mkdirname.Zero();
   108 	mkdirname.Append(systestname);
   106 	mkdirname.Append(systestname);
   109 	mkdirname.Append(KMkDirSub);
   107 	mkdirname.Append(KMkDirSub);
   110 	r=TheFs.MkDirAll(mkdirname);	
   108 	r=TheFs.MkDirAll(mkdirname);	
   111 	test(r==KErrPermissionDenied);
   109 	test_Value(r, r == KErrPermissionDenied);
   112 
   110 
   113 	r=TheFs.RmDir(mkdirname);	
   111 	r=TheFs.RmDir(mkdirname);	
   114 	test(r==KErrPermissionDenied);
   112 	test_Value(r, r == KErrPermissionDenied);
   115 
   113 
   116 	r=TheFs.SetSubst(systestname,EDriveS);
   114 	r=TheFs.SetSubst(systestname,EDriveS);
   117 	test(r==KErrPermissionDenied);
   115 	test_Value(r, r == KErrPermissionDenied);
   118 	
   116 	
   119 	r=TheFs.SetSessionPath(systestname);
   117 	r=TheFs.SetSessionPath(systestname);
   120 	test(r==KErrPermissionDenied);
   118 	test_Value(r, r == KErrPermissionDenied);
   121 
   119 
   122 	TheFs.NotifyChange(ENotifyAll,aStat1,systestname);
   120 	TheFs.NotifyChange(ENotifyAll,aStat1,systestname);
   123 	test(aStat1==KErrPermissionDenied);
   121 	test(aStat1==KErrPermissionDenied);
   124 
   122 
   125 	systestfile=KSystemPath;
   123 	systestfile=KSystemPath;
   130 	
   128 	
   131 	oldName=KOldFile;
   129 	oldName=KOldFile;
   132 	oldName[0]=(TText)gDriveToTest;
   130 	oldName[0]=(TText)gDriveToTest;
   133 
   131 
   134 	r=TheFs.GetShortName(systestfile, shortfilename);
   132 	r=TheFs.GetShortName(systestfile, shortfilename);
   135 	test(r==KErrPermissionDenied);
   133 	test_Value(r, r == KErrPermissionDenied);
   136 
   134 
   137 	r=TheFs.GetLongName(systestfile1, longfilename);
   135 	r=TheFs.GetLongName(systestfile1, longfilename);
   138 	test(r==KErrPermissionDenied);
   136 	test_Value(r, r == KErrPermissionDenied);
   139 
   137 
   140 	r=file1.Create(TheFs,oldName,EFileWrite);
   138 	r=file1.Create(TheFs,oldName,EFileWrite);
   141 	test(r==KErrNone || r==KErrAlreadyExists);
   139 	test_Value(r, r == KErrNone || r==KErrAlreadyExists);
   142 	file1.Close();
   140 	file1.Close();
   143 
   141 
   144 	r=TheFs.Replace(oldName,systestfile);
   142 	r=TheFs.Replace(oldName,systestfile);
   145 	test(r==KErrPermissionDenied);
   143 	test_Value(r, r == KErrPermissionDenied);
   146 	
   144 	
   147 	r=TheFs.Rename(systestfile,systestfile1);
   145 	r=TheFs.Rename(systestfile,systestfile1);
   148 	test(r==KErrPermissionDenied);
   146 	test_Value(r, r == KErrPermissionDenied);
   149 	
   147 	
   150 	r=TheFs.Entry(systestfile1,entry);
   148 	r=TheFs.Entry(systestfile1,entry);
   151 	test(r==KErrPermissionDenied);
   149 	test_Value(r, r == KErrPermissionDenied);
   152 
   150 
   153 	r=TheFs.SetEntry(systestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
   151 	r=TheFs.SetEntry(systestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
   154 	test(r==KErrPermissionDenied);
   152 	test_Value(r, r == KErrPermissionDenied);
   155 
   153 
   156 	r=TheFs.Delete(systestfile1);
   154 	r=TheFs.Delete(systestfile1);
   157 	test(r==KErrPermissionDenied);
   155 	test_Value(r, r == KErrPermissionDenied);
   158 
   156 
   159 
   157 
   160 	// DEF141257: Security Issue in File Server 
   158 	// DEF141257: Security Issue in File Server 
   161 	// Test that we can't access the system drive by preceding it with a dot character
   159 	// Test that we can't access the system drive by preceding it with a dot character
   162 	_LIT(KSystemPathDot, "?:\\.Sys\\");
   160 	_LIT(KSystemPathDot, "?:\\.Sys\\");
   166 	SysTestFileDot=KSystemPathDot;
   164 	SysTestFileDot=KSystemPathDot;
   167 	SysTestFileDot[0]=(TText)('A' + gTheDriveNum);
   165 	SysTestFileDot[0]=(TText)('A' + gTheDriveNum);
   168 	SysTestFileDot.Append(KFileSys);
   166 	SysTestFileDot.Append(KFileSys);
   169 	RFile file;
   167 	RFile file;
   170 	r = file.Replace(TheFs, SysTestFileDot, EFileWrite);
   168 	r = file.Replace(TheFs, SysTestFileDot, EFileWrite);
   171 	test(r==KErrPathNotFound);
   169 	test_Value(r, r == KErrPathNotFound);
   172 
   170 
   173 	// try creating a subst drive for "\.SYS"...
   171 	// try creating a subst drive for "\.SYS"...
   174 	TBuf<40> SysTestNameDot;
   172 	TBuf<40> SysTestNameDot;
   175 	SysTestNameDot=KSystemPathDot;
   173 	SysTestNameDot=KSystemPathDot;
   176 	SysTestNameDot[0]=(TText)('A' + gTheDriveNum);
   174 	SysTestNameDot[0]=(TText)('A' + gTheDriveNum);
   177 	r=TheFs.SetSubst(SysTestNameDot,EDriveA);
   175 	r=TheFs.SetSubst(SysTestNameDot,EDriveA);
   178 	test(r==KErrNone);
   176 	test_KErrNone(r);
   179 
   177 
   180 	// try creating a file using substituted drive...
   178 	// try creating a file using substituted drive...
   181 	TBuf<40> SubstTestFile = _L("A:\\");
   179 	TBuf<40> SubstTestFile = _L("A:\\");
   182 	SubstTestFile.Append(KFileSys);
   180 	SubstTestFile.Append(KFileSys);
   183 
   181 
   184 	r = file.Replace(TheFs, SubstTestFile, EFileWrite);
   182 	r = file.Replace(TheFs, SubstTestFile, EFileWrite);
   185 	test(r==KErrPathNotFound);
   183 	test_Value(r, r == KErrPathNotFound);
   186 
   184 
   187 	r = TheFs.SetSubst(_L(""),EDriveA);
   185 	r = TheFs.SetSubst(_L(""),EDriveA);
   188 	test(r==KErrNone);
   186 	test_KErrNone(r);
   189 
   187 
   190 
   188 
   191 
   189 
   192 	// try listing files in "\.SYS"
   190 	// try listing files in "\.SYS"
   193 	_LIT(KWildPathDot, "Z:\\.SYS\\");
   191 	_LIT(KWildPathDot, "Z:\\.SYS\\");
   194 	TFindFile finder(TheFs);
   192 	TFindFile finder(TheFs);
   195 	CDir* dir = NULL;
   193 	CDir* dir = NULL;
   196 	r=finder.FindWildByDir(KWildFile, KWildPathDot, dir);
   194 	r=finder.FindWildByDir(KWildFile, KWildPathDot, dir);
   197 	test(r==KErrNotFound);
   195 	test_Value(r, r == KErrNotFound);
   198 	delete dir;
   196 	delete dir;
   199 
   197 
   200 	// Deliberately create a directory called "\.SYS"
   198 	// Deliberately create a directory called "\.SYS"
   201 	// and verify shortname is NOT the same as "SYS"
   199 	// and verify shortname is NOT the same as "SYS"
   202 	mkdirname.Zero();
   200 	mkdirname.Zero();
   203 	mkdirname.Append(KSystemPathDot);
   201 	mkdirname.Append(KSystemPathDot);
   204 	mkdirname[0]=(TText)('A' + gTheDriveNum);
   202 	mkdirname[0]=(TText)('A' + gTheDriveNum);
   205 	r=TheFs.MkDirAll(mkdirname);	
   203 	r=TheFs.MkDirAll(mkdirname);	
   206 	test(r==KErrNone);
   204 	test_KErrNone(r);
   207 
   205 
   208 	r=TheFs.GetShortName(mkdirname, shortfilename);
   206 	r=TheFs.GetShortName(mkdirname, shortfilename);
   209 	test(r==KErrNone || r==KErrNotSupported);	// short names not supported on LFFS
   207 	test_Value(r, r == KErrNone || r==KErrNotSupported);	// short names not supported on LFFS
   210 //	r = shortfilename.Compare(_L("SYS~1"));
   208 //	r = shortfilename.Compare(_L("SYS~1"));
   211 //	test(r==KErrNone);
   209 //	test_KErrNone(r);
   212 	r = shortfilename.Compare(_L("SYS"));
   210 	r = shortfilename.Compare(_L("SYS"));
   213 	test (r != 0);
   211 	test (r != 0);
   214 
   212 
   215 	r = TheFs.RmDir(mkdirname);
   213 	r = TheFs.RmDir(mkdirname);
   216 	test(r==KErrNone);
   214 	test_KErrNone(r);
   217 
   215 
   218 	// Deliberately create a directory called "\..SYS"
   216 	// Deliberately create a directory called "\..SYS"
   219 	// and verify shortname is NOT the same as "SYS"
   217 	// and verify shortname is NOT the same as "SYS"
   220 	_LIT(KSystemPathDotDot, "?:\\..Sys\\");
   218 	_LIT(KSystemPathDotDot, "?:\\..Sys\\");
   221 	mkdirname.Zero();
   219 	mkdirname.Zero();
   222 	mkdirname.Append(KSystemPathDotDot);
   220 	mkdirname.Append(KSystemPathDotDot);
   223 	mkdirname[0]=(TText)('A' + gTheDriveNum);
   221 	mkdirname[0]=(TText)('A' + gTheDriveNum);
   224 	r=TheFs.MkDirAll(mkdirname);	
   222 	r=TheFs.MkDirAll(mkdirname);	
   225 	test(r==KErrNone);
   223 	test_KErrNone(r);
   226 
   224 
   227 	r=TheFs.GetShortName(mkdirname, shortfilename);
   225 	r=TheFs.GetShortName(mkdirname, shortfilename);
   228 	test(r==KErrNone || r==KErrNotSupported);	// short names not supported on LFFS
   226 	test_Value(r, r == KErrNone || r==KErrNotSupported);	// short names not supported on LFFS
   229 //	r = shortfilename.Compare(_L("_.SYS"));
   227 //	r = shortfilename.Compare(_L("_.SYS"));
   230 //	test(r==KErrNone);
   228 //	test_KErrNone(r);
   231 	r = shortfilename.Compare(_L("SYS"));
   229 	r = shortfilename.Compare(_L("SYS"));
   232 	test (r != 0);
   230 	test (r != 0);
   233 
   231 
   234 	r = TheFs.RmDir(mkdirname);
   232 	r = TheFs.RmDir(mkdirname);
   235 	test(r==KErrNone);
   233 	test_KErrNone(r);
   236 	}
   234 	}
   237 
   235 
   238 
   236 
   239 LOCAL_C void resourceRFstest()
   237 LOCAL_C void resourceRFstest()
   240 //
   238 //
   247 	
   245 	
   248 	mkdirname.Zero();
   246 	mkdirname.Zero();
   249 	mkdirname.Append(restestname);
   247 	mkdirname.Append(restestname);
   250 	mkdirname.Append(KMkDirSub);
   248 	mkdirname.Append(KMkDirSub);
   251 	r=TheFs.MkDirAll(mkdirname);	
   249 	r=TheFs.MkDirAll(mkdirname);	
   252 	test(r==KErrPermissionDenied);
   250 	test_Value(r, r == KErrPermissionDenied);
   253 
   251 
   254 	TheFs.RmDir(mkdirname);
   252 	TheFs.RmDir(mkdirname);
   255 	test(r==KErrPermissionDenied);
   253 	test_Value(r, r == KErrPermissionDenied);
   256 	
   254 	
   257 	// Change due to defect DEF099546 fix
   255 	// Change due to defect DEF099546 fix
   258 	// TCB capability is required for following operation.
   256 	// TCB capability is required for following operation.
   259 	r=TheFs.SetSubst(restestname,EDriveS);
   257 	r=TheFs.SetSubst(restestname,EDriveS);
   260 	//test(r==KErrNone);
   258 	//test_KErrNone(r);
   261 	test(r==KErrPermissionDenied);
   259 	test_Value(r, r == KErrPermissionDenied);
   262 	
   260 	
   263 	// SetSubst will fail.
   261 	// SetSubst will fail.
   264 	//r=TheFs.RealName(_L("S:\\File.XXX"),realName);
   262 	//r=TheFs.RealName(_L("S:\\File.XXX"),realName);
   265 	//test(r==KErrNone);
   263 	//test_KErrNone(r);
   266 
   264 
   267 	//r=TheFs.SetSubst(_L(""),EDriveS); 
   265 	//r=TheFs.SetSubst(_L(""),EDriveS); 
   268 	//test(r==KErrNone);
   266 	//test_KErrNone(r);
   269 
   267 
   270 	r=TheFs.SetSessionPath(restestname);
   268 	r=TheFs.SetSessionPath(restestname);
   271 	test(r==KErrNone);
   269 	test_KErrNone(r);
   272 	
   270 	
   273 	TheFs.NotifyChange(ENotifyAll,aStat4,restestname);
   271 	TheFs.NotifyChange(ENotifyAll,aStat4,restestname);
   274 	test(aStat4==KRequestPending);
   272 	test(aStat4==KRequestPending);
   275 
   273 
   276 
   274 
   282 	
   280 	
   283 	oldName=KOldFile;
   281 	oldName=KOldFile;
   284 	oldName[0]=(TText)gDriveToTest;
   282 	oldName[0]=(TText)gDriveToTest;
   285 
   283 
   286 	r=TheFs.GetShortName(restestfile, shortfilename);
   284 	r=TheFs.GetShortName(restestfile, shortfilename);
   287 	test(r==KErrNone || KErrPathNotFound);
   285 	test(r == KErrNone || KErrPathNotFound);
       
   286 //	test_Value(r, r == KErrNone || r == KErrPathNotFound);
   288 
   287 
   289 	r=TheFs.GetLongName(restestfile1, longfilename);
   288 	r=TheFs.GetLongName(restestfile1, longfilename);
   290 	test(r==KErrNone || KErrPathNotFound);
   289 	test(r == KErrNone || KErrPathNotFound);
       
   290 //	test_Value(r, r == KErrNone || r == KErrPathNotFound);
   291 
   291 
   292 	r=file1.Create(TheFs,oldName,EFileWrite);
   292 	r=file1.Create(TheFs,oldName,EFileWrite);
   293 	test(r==KErrNone || r==KErrAlreadyExists);
   293 	test_Value(r, r == KErrNone || r==KErrAlreadyExists);
   294 	file1.Close();
   294 	file1.Close();
   295 
   295 
   296 	r=TheFs.Replace(oldName,restestfile);
   296 	r=TheFs.Replace(oldName,restestfile);
   297 	test(r==KErrPermissionDenied);
   297 	test_Value(r, r == KErrPermissionDenied);
   298 	
   298 	
   299 	r=TheFs.Rename(restestfile,restestfile1);
   299 	r=TheFs.Rename(restestfile,restestfile1);
   300 	test(r==KErrPermissionDenied);
   300 	test_Value(r, r == KErrPermissionDenied);
   301 	
   301 	
   302 	r=TheFs.Entry(restestfile1,entry);
   302 	r=TheFs.Entry(restestfile1,entry);
   303 	test(r==KErrNone || KErrPathNotFound);
   303 	test(r == KErrNone || KErrPathNotFound);
       
   304 //	test_Value(r, r == KErrNone || r == KErrPathNotFound);
   304 
   305 
   305 	r=TheFs.SetEntry(restestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
   306 	r=TheFs.SetEntry(restestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
   306 	test(r==KErrPermissionDenied);
   307 	test_Value(r, r == KErrPermissionDenied);
   307 
   308 
   308 	r=TheFs.Delete(restestfile1);
   309 	r=TheFs.Delete(restestfile1);
   309 	test(r==KErrPermissionDenied);
   310 	test_Value(r, r == KErrPermissionDenied);
   310 	}
   311 	}
   311 
   312 
   312 
   313 
   313 LOCAL_C void privateFalseIDRFstest()
   314 LOCAL_C void privateFalseIDRFstest()
   314 //
   315 //
   321 	mkdirname.Zero();
   322 	mkdirname.Zero();
   322 	mkdirname.Append(pritestfalseidname);
   323 	mkdirname.Append(pritestfalseidname);
   323 	mkdirname.Append(KMkDirSub);
   324 	mkdirname.Append(KMkDirSub);
   324 
   325 
   325 	r=TheFs.MkDirAll(mkdirname);	
   326 	r=TheFs.MkDirAll(mkdirname);	
   326 	test(r==KErrPermissionDenied);
   327 	test_Value(r, r == KErrPermissionDenied);
   327 
   328 
   328 	r=TheFs.RmDir(mkdirname);	
   329 	r=TheFs.RmDir(mkdirname);	
   329 	test(r==KErrPermissionDenied);
   330 	test_Value(r, r == KErrPermissionDenied);
   330 
   331 
   331 	r=TheFs.SetSubst(pritestfalseidname,EDriveS);
   332 	r=TheFs.SetSubst(pritestfalseidname,EDriveS);
   332 	test(r==KErrPermissionDenied); 
   333 	test_Value(r, r == KErrPermissionDenied); 
   333 	
   334 	
   334 	r=TheFs.SetSessionPath(pritestfalseidname);
   335 	r=TheFs.SetSessionPath(pritestfalseidname);
   335 	test(r==KErrPermissionDenied);
   336 	test_Value(r, r == KErrPermissionDenied);
   336 
   337 
   337 	TheFs.NotifyChange(ENotifyAll,aStat2,pritestfalseidname);
   338 	TheFs.NotifyChange(ENotifyAll,aStat2,pritestfalseidname);
   338 	test(aStat2==KErrPermissionDenied);
   339 	test(aStat2==KErrPermissionDenied);
   339 
   340 
   340 	pritestfile=KPrivateFalseID;
   341 	pritestfile=KPrivateFalseID;
   345 	
   346 	
   346 	oldName=KOldFile;
   347 	oldName=KOldFile;
   347 	oldName[0]=(TText)gDriveToTest;
   348 	oldName[0]=(TText)gDriveToTest;
   348 
   349 
   349 	r=TheFs.GetShortName(pritestfile, shortfilename);
   350 	r=TheFs.GetShortName(pritestfile, shortfilename);
   350 	test(r==KErrPermissionDenied);
   351 	test_Value(r, r == KErrPermissionDenied);
   351 
   352 
   352 	r=TheFs.GetLongName(pritestfile1, longfilename);
   353 	r=TheFs.GetLongName(pritestfile1, longfilename);
   353 	test(r==KErrPermissionDenied);
   354 	test_Value(r, r == KErrPermissionDenied);
   354 
   355 
   355 	r=file1.Create(TheFs,oldName,EFileWrite);
   356 	r=file1.Create(TheFs,oldName,EFileWrite);
   356 	test(r==KErrNone || r==KErrAlreadyExists);
   357 	test_Value(r, r == KErrNone || r==KErrAlreadyExists);
   357 	file1.Close();
   358 	file1.Close();
   358 
   359 
   359 	r=TheFs.Replace(oldName,pritestfile);
   360 	r=TheFs.Replace(oldName,pritestfile);
   360 	test(r==KErrPermissionDenied);
   361 	test_Value(r, r == KErrPermissionDenied);
   361 	
   362 	
   362 	r=TheFs.Rename(pritestfile,pritestfile1);
   363 	r=TheFs.Rename(pritestfile,pritestfile1);
   363 	test(r==KErrPermissionDenied);
   364 	test_Value(r, r == KErrPermissionDenied);
   364 	
   365 	
   365 	r=TheFs.Entry(pritestfile1,entry);
   366 	r=TheFs.Entry(pritestfile1,entry);
   366 	test(r==KErrPermissionDenied);
   367 	test_Value(r, r == KErrPermissionDenied);
   367 
   368 
   368 	r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
   369 	r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
   369 	test(r==KErrPermissionDenied);
   370 	test_Value(r, r == KErrPermissionDenied);
   370 
   371 
   371 	r=TheFs.Delete(pritestfile1);
   372 	r=TheFs.Delete(pritestfile1);
   372 	test(r==KErrPermissionDenied);
   373 	test_Value(r, r == KErrPermissionDenied);
   373 
   374 
   374 	}
   375 	}
   375 
   376 
   376 
   377 
   377 
   378 
   387 	mkdirname.Zero();
   388 	mkdirname.Zero();
   388 	mkdirname.Append(pritestname);
   389 	mkdirname.Append(pritestname);
   389 	mkdirname.Append(KMkDirSub);
   390 	mkdirname.Append(KMkDirSub);
   390 
   391 
   391 	r=TheFs.MkDirAll(mkdirname);	
   392 	r=TheFs.MkDirAll(mkdirname);	
   392 	test(r==KErrPermissionDenied);
   393 	test_Value(r, r == KErrPermissionDenied);
   393 
   394 
   394 	r=TheFs.RmDir(mkdirname);	
   395 	r=TheFs.RmDir(mkdirname);	
   395 	test(r==KErrPermissionDenied);
   396 	test_Value(r, r == KErrPermissionDenied);
   396 
   397 
   397 	r=TheFs.SetSubst(pritestname,EDriveS);
   398 	r=TheFs.SetSubst(pritestname,EDriveS);
   398 	test(r==KErrPermissionDenied); 
   399 	test_Value(r, r == KErrPermissionDenied); 
   399 	
   400 	
   400 	r=TheFs.SetSessionPath(pritestname);
   401 	r=TheFs.SetSessionPath(pritestname);
   401 	test(r==KErrPermissionDenied);
   402 	test_Value(r, r == KErrPermissionDenied);
   402 
   403 
   403 	TheFs.NotifyChange(ENotifyAll,aStat2,pritestname);
   404 	TheFs.NotifyChange(ENotifyAll,aStat2,pritestname);
   404 	test(aStat2==KErrPermissionDenied);
   405 	test(aStat2==KErrPermissionDenied);
   405 
   406 
   406 	pritestfile=KPrivatePath;
   407 	pritestfile=KPrivatePath;
   411 	
   412 	
   412 	oldName=KOldFile;
   413 	oldName=KOldFile;
   413 	oldName[0]=(TText)gDriveToTest;
   414 	oldName[0]=(TText)gDriveToTest;
   414 
   415 
   415 	r=TheFs.GetShortName(pritestfile, shortfilename);
   416 	r=TheFs.GetShortName(pritestfile, shortfilename);
   416 	test(r==KErrPermissionDenied);
   417 	test_Value(r, r == KErrPermissionDenied);
   417 
   418 
   418 	r=TheFs.GetLongName(pritestfile1, longfilename);
   419 	r=TheFs.GetLongName(pritestfile1, longfilename);
   419 	test(r==KErrPermissionDenied);
   420 	test_Value(r, r == KErrPermissionDenied);
   420 
   421 
   421 	r=file1.Create(TheFs,oldName,EFileWrite);
   422 	r=file1.Create(TheFs,oldName,EFileWrite);
   422 	test(r==KErrNone || r==KErrAlreadyExists);
   423 	test_Value(r, r == KErrNone || r==KErrAlreadyExists);
   423 	file1.Close();
   424 	file1.Close();
   424 
   425 
   425 	r=TheFs.Replace(oldName,pritestfile);
   426 	r=TheFs.Replace(oldName,pritestfile);
   426 	test(r==KErrPermissionDenied);
   427 	test_Value(r, r == KErrPermissionDenied);
   427 	
   428 	
   428 	r=TheFs.Rename(pritestfile,pritestfile1);
   429 	r=TheFs.Rename(pritestfile,pritestfile1);
   429 	test(r==KErrPermissionDenied);
   430 	test_Value(r, r == KErrPermissionDenied);
   430 	
   431 	
   431 	r=TheFs.Entry(pritestfile1,entry);
   432 	r=TheFs.Entry(pritestfile1,entry);
   432 	test(r==KErrPermissionDenied);
   433 	test_Value(r, r == KErrPermissionDenied);
   433 
   434 
   434 	r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
   435 	r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
   435 	test(r==KErrPermissionDenied);
   436 	test_Value(r, r == KErrPermissionDenied);
   436 
   437 
   437 	r=TheFs.Delete(pritestfile1);
   438 	r=TheFs.Delete(pritestfile1);
   438 	test(r==KErrPermissionDenied);
   439 	test_Value(r, r == KErrPermissionDenied);
   439 
   440 
   440 	}
   441 	}
   441 
   442 
   442 
   443 
   443 LOCAL_C void privateSIDRFstest()
   444 LOCAL_C void privateSIDRFstest()
   451 
   452 
   452 	mkdirname.Zero();
   453 	mkdirname.Zero();
   453 	mkdirname.Append(theprivatepath);
   454 	mkdirname.Append(theprivatepath);
   454 	mkdirname.Append(KMkDirSub);
   455 	mkdirname.Append(KMkDirSub);
   455 	r=TheFs.MkDirAll(mkdirname);	
   456 	r=TheFs.MkDirAll(mkdirname);	
   456 	test(r==KErrNone);
   457 	test_KErrNone(r);
   457 
   458 
   458 	r=TheFs.RmDir(mkdirname);	
   459 	r=TheFs.RmDir(mkdirname);	
   459 	test(r==KErrNone);
   460 	test_KErrNone(r);
   460 
   461 
   461 	r=TheFs.SetSubst(theprivatepath,EDriveS);	
   462 	r=TheFs.SetSubst(theprivatepath,EDriveS);	
   462 	test(r==KErrNone);
   463 	test_KErrNone(r);
   463 
   464 
   464 	r=TheFs.RealName(_L("S:\\File.XXX"),realName);
   465 	r=TheFs.RealName(_L("S:\\File.XXX"),realName);
   465 	test(r==KErrNone);
   466 	test_KErrNone(r);
   466 
   467 
   467 	r=TheFs.SetSubst(_L(""),EDriveS);	
   468 	r=TheFs.SetSubst(_L(""),EDriveS);	
   468 	test(r==KErrNone);
   469 	test_KErrNone(r);
   469 	
   470 	
   470 	r=TheFs.SetSessionPath(theprivatepath);
   471 	r=TheFs.SetSessionPath(theprivatepath);
   471 	test(r==KErrNone);
   472 	test_KErrNone(r);
   472 
   473 
   473 	TheFs.NotifyChange(ENotifyAll,aStat3,theprivatepath);
   474 	TheFs.NotifyChange(ENotifyAll,aStat3,theprivatepath);
   474 	test(aStat3==KRequestPending);
   475 	test(aStat3==KRequestPending);
   475 
   476 
   476 		pritestfile=theprivatepath;
   477 		pritestfile=theprivatepath;
   481 	
   482 	
   482 	oldName=KOldFile;
   483 	oldName=KOldFile;
   483 	oldName[0]=(TText)gDriveToTest;
   484 	oldName[0]=(TText)gDriveToTest;
   484 
   485 
   485 	r=TheFs.GetShortName(pritestfile, shortfilename);
   486 	r=TheFs.GetShortName(pritestfile, shortfilename);
   486 	test(r==KErrNone || KErrPathNotFound);
   487 	test(r == KErrNone || KErrPathNotFound);
       
   488 //	test_Value(r, r == KErrNone || r == KErrPathNotFound);
   487 
   489 
   488 	r=TheFs.GetLongName(pritestfile1, longfilename);
   490 	r=TheFs.GetLongName(pritestfile1, longfilename);
   489 	test(r==KErrNone || KErrPathNotFound);
   491 	test(r == KErrNone || KErrPathNotFound);
       
   492 //	test_Value(r, r == KErrNone || r == KErrPathNotFound);
   490 
   493 
   491 	r=file1.Create(TheFs,oldName,EFileWrite);
   494 	r=file1.Create(TheFs,oldName,EFileWrite);
   492 	test(r==KErrNone || r==KErrAlreadyExists);
   495 	test_Value(r, r == KErrNone || r==KErrAlreadyExists);
   493 	file1.Close();
   496 	file1.Close();
   494 
   497 
   495 	r=TheFs.Replace(oldName,pritestfile);
   498 	r=TheFs.Replace(oldName,pritestfile);
   496 	test(r==KErrNone);
   499 	test_KErrNone(r);
   497 	
   500 	
   498 	r=TheFs.Rename(pritestfile,pritestfile1);
   501 	r=TheFs.Rename(pritestfile,pritestfile1);
   499 	test(r==KErrNone || r==KErrAlreadyExists);
   502 	test_Value(r, r == KErrNone || r==KErrAlreadyExists);
   500 	
   503 	
   501 	r=TheFs.Entry(pritestfile1,entry);
   504 	r=TheFs.Entry(pritestfile1,entry);
   502 	test(r==KErrNone);
   505 	test_KErrNone(r);
   503 
   506 
   504 	r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
   507 	r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
   505 	test(r==KErrNone);
   508 	test_KErrNone(r);
   506 
   509 
   507 	r=TheFs.Delete(pritestfile1);
   510 	r=TheFs.Delete(pritestfile1);
   508 	test(r==KErrNone);
   511 	test_KErrNone(r);
   509 	}
   512 	}
   510 
   513 
   511 LOCAL_C void systemRFiletest()
   514 LOCAL_C void systemRFiletest()
   512 //
   515 //
   513 //
   516 //
   514 //
   517 //
   515 	{
   518 	{
   516 //RFile testing with session path set to //system//
   519 //RFile testing with session path set to //system//
   517 
   520 
   518 	r=TheFs.SetSessionPath(systestname);
   521 	r=TheFs.SetSessionPath(systestname);
   519 	test(r==KErrPermissionDenied);
   522 	test_Value(r, r == KErrPermissionDenied);
   520 
   523 
   521 	r=file1.Temp(TheFs,systestname,fromTemp,EFileWrite);
   524 	r=file1.Temp(TheFs,systestname,fromTemp,EFileWrite);
   522 	test(r==KErrPermissionDenied);
   525 	test_Value(r, r == KErrPermissionDenied);
   523 
   526 
   524 	TBuf<25> sysfilename;
   527 	TBuf<25> sysfilename;
   525 	sysfilename.Append(systestname);
   528 	sysfilename.Append(systestname);
   526 	sysfilename.Append(KFileSys);
   529 	sysfilename.Append(KFileSys);
   527 	r=file1.Create(TheFs,sysfilename,EFileWrite);
   530 	r=file1.Create(TheFs,sysfilename,EFileWrite);
   528 	test(r==KErrPermissionDenied);
   531 	test_Value(r, r == KErrPermissionDenied);
   529 
   532 
   530 	r=file1.Open(TheFs,sysfilename,EFileWrite);
   533 	r=file1.Open(TheFs,sysfilename,EFileWrite);
   531 	test(r==KErrPermissionDenied);
   534 	test_Value(r, r == KErrPermissionDenied);
   532 
   535 
   533 	r=file1.Open(TheFs,sysfilename,EFileRead);
   536 	r=file1.Open(TheFs,sysfilename,EFileRead);
   534 	test(r==KErrPermissionDenied);
   537 	test_Value(r, r == KErrPermissionDenied);
   535 
   538 
   536 	r=file1.Replace(TheFs,sysfilename,EFileWrite);
   539 	r=file1.Replace(TheFs,sysfilename,EFileWrite);
   537 	test(r==KErrPermissionDenied);
   540 	test_Value(r, r == KErrPermissionDenied);
   538 
   541 
   539     TFindFile finder(TheFs);
   542     TFindFile finder(TheFs);
   540     CDir* dir = NULL;
   543     CDir* dir = NULL;
   541     r=finder.FindWildByDir(KWildFile, KWildPath, dir);
   544     r=finder.FindWildByDir(KWildFile, KWildPath, dir);
   542 	if (!(r==KErrPermissionDenied))
   545 	if (!(r==KErrPermissionDenied))
   543         test.Printf(_L("T_DCDISKADMIN: test find wildcards r = %d (expected KErrPermissionDenied)\n"), r);
   546         test.Printf(_L("T_DCDISKADMIN: test find wildcards r = %d (expected KErrPermissionDenied)\n"), r);
   544 	test(r==KErrPermissionDenied);
   547 	test_Value(r, r == KErrPermissionDenied);
   545 	delete dir;
   548 	delete dir;
   546 	}
   549 	}
   547 
   550 
   548 LOCAL_C void resourceRFiletest()
   551 LOCAL_C void resourceRFiletest()
   549 //
   552 //
   550 //
   553 //
   551 //
   554 //
   552 	{
   555 	{
   553 //RFile testing with session path set to //resource//
   556 //RFile testing with session path set to //resource//
   554 	r=TheFs.SetSessionPath(restestname);
   557 	r=TheFs.SetSessionPath(restestname);
   555 	test(r==KErrNone);
   558 	test_KErrNone(r);
   556 
   559 
   557 	r=file1.Temp(TheFs,restestname,fromTemp,EFileWrite);
   560 	r=file1.Temp(TheFs,restestname,fromTemp,EFileWrite);
   558 	test(r==KErrPermissionDenied);
   561 	test_Value(r, r == KErrPermissionDenied);
   559 	file1.Close();
   562 	file1.Close();
   560 
   563 
   561 	r=file1.Create(TheFs,KFileRes,EFileWrite);
   564 	r=file1.Create(TheFs,KFileRes,EFileWrite);
   562 	test(r==KErrPermissionDenied);
   565 	test_Value(r, r == KErrPermissionDenied);
   563 	file1.Close();
   566 	file1.Close();
   564 
   567 
   565 	r=file1.Open(TheFs,KFileRes,EFileWrite);
   568 	r=file1.Open(TheFs,KFileRes,EFileWrite);
   566 	test(r==KErrPermissionDenied);
   569 	test_Value(r, r == KErrPermissionDenied);
   567 	file1.Close();
   570 	file1.Close();
   568 
   571 
   569 	r=file1.Open(TheFs,KFileRes,EFileRead|EFileShareReadersOnly);
   572 	r=file1.Open(TheFs,KFileRes,EFileRead|EFileShareReadersOnly);
   570 	test(r==KErrNone || r==KErrPathNotFound);
   573 	test_Value(r, r == KErrNone || r==KErrPathNotFound);
   571 	file1.Close();
   574 	file1.Close();
   572 
   575 
   573 	r=file1.Open(TheFs,KFileRes,EFileShareReadersOrWriters|EFileRead);
   576 	r=file1.Open(TheFs,KFileRes,EFileShareReadersOrWriters|EFileRead);
   574 	test(r==KErrNone || r==KErrPathNotFound);
   577 	test_Value(r, r == KErrNone || r==KErrPathNotFound);
   575 	file1.Close();
   578 	file1.Close();
   576 
   579 
   577 	r=file1.Open(TheFs,KFileRes,EFileShareReadersOrWriters|EFileWrite);
   580 	r=file1.Open(TheFs,KFileRes,EFileShareReadersOrWriters|EFileWrite);
   578 	test(r==KErrPermissionDenied);
   581 	test_Value(r, r == KErrPermissionDenied);
   579 	file1.Close();
   582 	file1.Close();
   580 
   583 
   581 	r=file1.Open(TheFs,KFileRes,EFileShareReadersOnly);
   584 	r=file1.Open(TheFs,KFileRes,EFileShareReadersOnly);
   582 	test(r==KErrNone);
   585 	test_KErrNone(r);
   583 
   586 
   584 	r=file1.ChangeMode(EFileShareExclusive);	
   587 	r=file1.ChangeMode(EFileShareExclusive);	
   585 	test(r==KErrNone);
   588 	test_KErrNone(r);
   586 
   589 
   587 	//this operation is prevented as you can not open a file for write access in the resource directory
   590 	//this operation is prevented as you can not open a file for write access in the resource directory
   588 	r=file1.Rename(KFileRes3);
   591 	r=file1.Rename(KFileRes3);
   589 	test(r==KErrPermissionDenied || r==KErrAccessDenied);
   592 	test_Value(r, r == KErrPermissionDenied || r==KErrAccessDenied);
   590 	file1.Close();
   593 	file1.Close();
   591 
   594 
   592 	r=file1.Replace(TheFs,KFileRes,EFileWrite);
   595 	r=file1.Replace(TheFs,KFileRes,EFileWrite);
   593 	test(r==KErrPermissionDenied);
   596 	test_Value(r, r == KErrPermissionDenied);
   594 	file1.Close();
   597 	file1.Close();
   595 
   598 
   596 	}
   599 	}
   597 
   600 
   598 
   601 
   600 //
   603 //
   601 //RFile testing with session path set to //Private//falseID
   604 //RFile testing with session path set to //Private//falseID
   602 //
   605 //
   603 	{
   606 	{
   604 	r=TheFs.SetSessionPath(pritestfalseidname);
   607 	r=TheFs.SetSessionPath(pritestfalseidname);
   605 	test(r==KErrPermissionDenied);
   608 	test_Value(r, r == KErrPermissionDenied);
   606 
   609 
   607 	r=file1.Temp(TheFs,pritestfalseidname,fromTemp,EFileWrite);
   610 	r=file1.Temp(TheFs,pritestfalseidname,fromTemp,EFileWrite);
   608 	test(r==KErrPermissionDenied);
   611 	test_Value(r, r == KErrPermissionDenied);
   609 
   612 
   610 	TBuf<25> prifilename;
   613 	TBuf<25> prifilename;
   611 	prifilename.Append(pritestname);
   614 	prifilename.Append(pritestname);
   612 	prifilename.Append(KFileSys);
   615 	prifilename.Append(KFileSys);
   613 
   616 
   614 	r=file1.Create(TheFs,prifilename,EFileWrite);
   617 	r=file1.Create(TheFs,prifilename,EFileWrite);
   615 	test(r==KErrPermissionDenied);
   618 	test_Value(r, r == KErrPermissionDenied);
   616 
   619 
   617 	r=file1.Open(TheFs,prifilename,EFileWrite);
   620 	r=file1.Open(TheFs,prifilename,EFileWrite);
   618 	test(r==KErrPermissionDenied);
   621 	test_Value(r, r == KErrPermissionDenied);
   619 
   622 
   620 	r=file1.Open(TheFs,prifilename,EFileRead);
   623 	r=file1.Open(TheFs,prifilename,EFileRead);
   621 	test(r==KErrPermissionDenied);
   624 	test_Value(r, r == KErrPermissionDenied);
   622 
   625 
   623 	r=file1.Replace(TheFs,prifilename,EFileWrite);
   626 	r=file1.Replace(TheFs,prifilename,EFileWrite);
   624 	test(r==KErrPermissionDenied);
   627 	test_Value(r, r == KErrPermissionDenied);
   625 	}
   628 	}
   626 
   629 
   627 
   630 
   628 LOCAL_C void privateRFiletest()
   631 LOCAL_C void privateRFiletest()
   629 //
   632 //
   630 //RFile testing with session path set to //Private//
   633 //RFile testing with session path set to //Private//
   631 //
   634 //
   632 	{
   635 	{
   633 	r=TheFs.SetSessionPath(pritestname);
   636 	r=TheFs.SetSessionPath(pritestname);
   634 	test(r==KErrPermissionDenied);
   637 	test_Value(r, r == KErrPermissionDenied);
   635 
   638 
   636 	r=file1.Temp(TheFs,pritestname,fromTemp,EFileWrite);
   639 	r=file1.Temp(TheFs,pritestname,fromTemp,EFileWrite);
   637 	test(r==KErrPermissionDenied);
   640 	test_Value(r, r == KErrPermissionDenied);
   638 
   641 
   639 	TBuf<25> prifilename;
   642 	TBuf<25> prifilename;
   640 	prifilename.Append(pritestname);
   643 	prifilename.Append(pritestname);
   641 	prifilename.Append(KFileSys);
   644 	prifilename.Append(KFileSys);
   642 
   645 
   643 	r=file1.Create(TheFs,prifilename,EFileWrite);
   646 	r=file1.Create(TheFs,prifilename,EFileWrite);
   644 	test(r==KErrPermissionDenied);
   647 	test_Value(r, r == KErrPermissionDenied);
   645 
   648 
   646 	r=file1.Open(TheFs,prifilename,EFileWrite);
   649 	r=file1.Open(TheFs,prifilename,EFileWrite);
   647 	test(r==KErrPermissionDenied);
   650 	test_Value(r, r == KErrPermissionDenied);
   648 	
   651 	
   649 	r=file1.Open(TheFs,prifilename,EFileRead);
   652 	r=file1.Open(TheFs,prifilename,EFileRead);
   650 	test(r==KErrPermissionDenied);
   653 	test_Value(r, r == KErrPermissionDenied);
   651 
   654 
   652 	r=file1.Replace(TheFs,prifilename,EFileWrite);
   655 	r=file1.Replace(TheFs,prifilename,EFileWrite);
   653 	test(r==KErrPermissionDenied);
   656 	test_Value(r, r == KErrPermissionDenied);
   654 	}
   657 	}
   655 
   658 
   656 
   659 
   657 LOCAL_C void privateSIDRFiletest()
   660 LOCAL_C void privateSIDRFiletest()
   658 //
   661 //
   659 //Rfile Testing with session path set to //Private//UID//
   662 //Rfile Testing with session path set to //Private//UID//
   660 //
   663 //
   661 	{
   664 	{
   662 	r=TheFs.SetSessionToPrivate(gTheDriveNum);
   665 	r=TheFs.SetSessionToPrivate(gTheDriveNum);
   663 	test(r==KErrNone);
   666 	test_KErrNone(r);
   664 		
   667 		
   665 	r=file1.Temp(TheFs,theprivatepath,fromTemp,EFileWrite);
   668 	r=file1.Temp(TheFs,theprivatepath,fromTemp,EFileWrite);
   666 	test(r==KErrNone);
   669 	test_KErrNone(r);
   667 	file1.Close();
   670 	file1.Close();
   668 
   671 
   669 	r=file1.Create(TheFs,KFilePri,EFileWrite);
   672 	r=file1.Create(TheFs,KFilePri,EFileWrite);
   670 	test(r==KErrNone || r==KErrAlreadyExists);
   673 	test_Value(r, r == KErrNone || r==KErrAlreadyExists);
   671 	file1.Close();
   674 	file1.Close();
   672 
   675 
   673 	r=file1.Open(TheFs,KFilePri,EFileWrite);
   676 	r=file1.Open(TheFs,KFilePri,EFileWrite);
   674 	test(r==KErrNone);
   677 	test_KErrNone(r);
   675 	file1.Close();
   678 	file1.Close();
   676 	
   679 	
   677 	r=file1.Open(TheFs,KFilePri,EFileRead);
   680 	r=file1.Open(TheFs,KFilePri,EFileRead);
   678 	test(r==KErrNone);
   681 	test_KErrNone(r);
   679 	file1.Close();
   682 	file1.Close();
   680 	
   683 	
   681 	r=file1.Replace(TheFs,KFilePri,EFileWrite);
   684 	r=file1.Replace(TheFs,KFilePri,EFileWrite);
   682 	test(r==KErrNone);
   685 	test_KErrNone(r);
   683 	
   686 	
   684 	r=file1.Rename(KFilePri3);
   687 	r=file1.Rename(KFilePri3);
   685 	test(r==KErrNone || r==KErrAlreadyExists);
   688 	test_Value(r, r == KErrNone || r==KErrAlreadyExists);
   686 	file1.Close();
   689 	file1.Close();
   687 	}
   690 	}
   688 
   691 
   689 
   692 
   690 LOCAL_C void RDirtest()
   693 LOCAL_C void RDirtest()
   695 	//system
   698 	//system
   696 	dirNameBuf.Zero();
   699 	dirNameBuf.Zero();
   697 	dirNameBuf = KSystemPath;
   700 	dirNameBuf = KSystemPath;
   698 	dirNameBuf[0]=(TText)gDriveToTest;
   701 	dirNameBuf[0]=(TText)gDriveToTest;
   699 	r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
   702 	r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
   700 	test(r==KErrPermissionDenied);
   703 	test_Value(r, r == KErrPermissionDenied);
   701 	dir.Close();
   704 	dir.Close();
   702 	r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
   705 	r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
   703 	test(r==KErrPermissionDenied);
   706 	test_Value(r, r == KErrPermissionDenied);
   704 	dirNameBuf.Zero();
   707 	dirNameBuf.Zero();
   705 	delete dirEntries;
   708 	delete dirEntries;
   706 	//Private//falseid
   709 	//Private//falseid
   707 	dirNameBuf=KPrivateFalseID;
   710 	dirNameBuf=KPrivateFalseID;
   708 	dirNameBuf[0]=(TText)gDriveToTest;
   711 	dirNameBuf[0]=(TText)gDriveToTest;
   709 	r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
   712 	r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
   710 	test(r==KErrPermissionDenied);
   713 	test_Value(r, r == KErrPermissionDenied);
   711 	dir.Close();
   714 	dir.Close();
   712 	r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
   715 	r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
   713 	test(r==KErrPermissionDenied);
   716 	test_Value(r, r == KErrPermissionDenied);
   714 	dirNameBuf.Zero();
   717 	dirNameBuf.Zero();
   715 	delete dirEntries;
   718 	delete dirEntries;
   716 	//Private
   719 	//Private
   717 	dirNameBuf=KPrivatePath;
   720 	dirNameBuf=KPrivatePath;
   718 	dirNameBuf[0]=(TText)gDriveToTest;
   721 	dirNameBuf[0]=(TText)gDriveToTest;
   719 	r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
   722 	r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
   720 	test(r==KErrPermissionDenied);
   723 	test_Value(r, r == KErrPermissionDenied);
   721 	dir.Close();
   724 	dir.Close();
   722 	r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
   725 	r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
   723 	test(r==KErrPermissionDenied);
   726 	test_Value(r, r == KErrPermissionDenied);
   724 	dirNameBuf.Zero();
   727 	dirNameBuf.Zero();
   725 	delete dirEntries;
   728 	delete dirEntries;
   726 	//Private/uid
   729 	//Private/uid
   727 	TheFs.PrivatePath(dirNameBuf);
   730 	TheFs.PrivatePath(dirNameBuf);
   728 	dirNameBuf.Insert(0,_L("?:"));
   731 	dirNameBuf.Insert(0,_L("?:"));
   729 	dirNameBuf[0]=(TText)gDriveToTest;
   732 	dirNameBuf[0]=(TText)gDriveToTest;
   730 	r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
   733 	r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
   731 	test(r==KErrNone);
   734 	test_KErrNone(r);
   732 	dir.Close();
   735 	dir.Close();
   733 	r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
   736 	r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
   734 	test(r==KErrNone);
   737 	test_KErrNone(r);
   735 	dirNameBuf.Zero();
   738 	dirNameBuf.Zero();
   736 	delete dirEntries;
   739 	delete dirEntries;
   737 	//Resource
   740 	//Resource
   738 	dirNameBuf=KResourcePath;
   741 	dirNameBuf=KResourcePath;
   739 	dirNameBuf[0]=(TText)gDriveToTest;
   742 	dirNameBuf[0]=(TText)gDriveToTest;
   740 	r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
   743 	r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
   741 	test(r==KErrNone || r==KErrPathNotFound || r==KErrNotFound);
   744 	test_Value(r, r == KErrNone || r==KErrPathNotFound || r==KErrNotFound);
   742 	r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
   745 	r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
   743 	test(r==KErrNone || r==KErrPathNotFound || r==KErrNotFound);
   746 	test_Value(r, r == KErrNone || r==KErrPathNotFound || r==KErrNotFound);
   744 	dir.Close();
   747 	dir.Close();
   745 	delete dirEntries;
   748 	delete dirEntries;
   746 	}
   749 	}
   747 
   750 
   748 
   751 
   750 //
   753 //
   751 //	test diskadministration capabilitiy
   754 //	test diskadministration capabilitiy
   752 //
   755 //
   753 	{
   756 	{
   754 	r=TheFs.FileSystemName(fsname,gTheDriveNum);
   757 	r=TheFs.FileSystemName(fsname,gTheDriveNum);
   755 	test(r==KErrNone);
   758 	test_KErrNone(r);
   756 	r = DismountFileSystem(TheFs, fsname, gTheDriveNum);
   759 	r = DismountFileSystem(TheFs, fsname, gTheDriveNum);
   757 	test(r==KErrNone);
   760 	test_KErrNone(r);
   758 //	r=TheFs.RemoveFileSystem(fsname);	//can not test due to bug else where fix exists
   761 //	r=TheFs.RemoveFileSystem(fsname);	//can not test due to bug else where fix exists
   759 //	test(r==KErrPermissionDenied);
   762 //	test_Value(r, r == KErrPermissionDenied);
   760 //	r=TheFs.AddFileSystem(fsname);
   763 //	r=TheFs.AddFileSystem(fsname);
   761 //	test(r==KErrPermissionDenied);
   764 //	test_Value(r, r == KErrPermissionDenied);
   762 	r = MountFileSystem(TheFs, fsname, gTheDriveNum);
   765 	r = MountFileSystem(TheFs, fsname, gTheDriveNum);
   763 	test(r==KErrNone);
   766 	test_KErrNone(r);
   764 	r=TheFs.SetDriveName(gTheDriveNum,KDriveName);
   767 	r=TheFs.SetDriveName(gTheDriveNum,KDriveName);
   765 	test(r==KErrNone);
   768 	test_KErrNone(r);
   766 	r=TheFs.SetVolumeLabel(KVolLable, gTheDriveNum);
   769 	r=TheFs.SetVolumeLabel(KVolLable, gTheDriveNum);
   767 	test(r==KErrNone || r==KErrNotSupported);
   770 	test_Value(r, r == KErrNone || r==KErrNotSupported);
   768 
   771 
   769 	systemRFstest();
   772 	systemRFstest();
   770 	resourceRFstest();
   773 	resourceRFstest();
   771 	privateRFstest();
   774 	privateRFstest();
   772 	privateSIDRFstest();
   775 	privateSIDRFstest();
   787 	test(aStat1==KErrPermissionDenied);
   790 	test(aStat1==KErrPermissionDenied);
   788 	test(aStat2==KErrPermissionDenied);
   791 	test(aStat2==KErrPermissionDenied);
   789 	test(aStat3==KErrNone);
   792 	test(aStat3==KErrNone);
   790 	
   793 	
   791 	r=TheFs.SetSessionPath(systestname);
   794 	r=TheFs.SetSessionPath(systestname);
   792 	test(r==KErrPermissionDenied);
   795 	test_Value(r, r == KErrPermissionDenied);
   793 	
   796 	
   794 //Test RRawDisk class
   797 //Test RRawDisk class
   795 	r=rawdisk.Open(TheFs,gTheDriveNum);
   798 	r=rawdisk.Open(TheFs,gTheDriveNum);
   796 	test(r==KErrPermissionDenied);
   799 	test_Value(r, r == KErrPermissionDenied);
   797 	rawdisk.Close();
   800 	rawdisk.Close();
   798 
   801 
   799 	RDirtest();
   802 	RDirtest();
   800 
   803 
   801 #ifdef __WINS__
   804 #ifdef __WINS__
   802 	if (User::UpperCase(driveBuf[0]) != 'C')
   805 	if (User::UpperCase(driveBuf[0]) != 'C')
   803 #endif
   806 #endif
   804 		{
   807 		{
   805 		//Test RFormat class
   808 		//Test RFormat class
   806 		r=format.Open(TheFs,driveBuf,EHighDensity,count);
   809 		r=format.Open(TheFs,driveBuf,EHighDensity,count);
   807 		test(r==KErrNone);
   810 		test_KErrNone(r);
   808 
   811 
   809 		while(count)
   812 		while(count)
   810 			{
   813 			{
   811 			TInt r=format.Next(count);
   814 			TInt r=format.Next(count);
   812 			test(r==KErrNone);
   815 			test_KErrNone(r);
   813 			}
   816 			}
   814 		format.Close();
   817 		format.Close();
   815 		}
   818 		}
   816 
   819 
   817 	driveBuf[0]=(TText)gDriveToTest;
   820 	driveBuf[0]=(TText)gDriveToTest;
   818 	r=TheFs.ScanDrive(driveBuf);
   821 	r=TheFs.ScanDrive(driveBuf);
   819 	test(r==KErrNone || r==KErrNotSupported);
   822 	test_Value(r, r == KErrNone || r==KErrNotSupported);
   820 	r=TheFs.CheckDisk(driveBuf);
   823 	r=TheFs.CheckDisk(driveBuf);
   821 	test(r==KErrNone || r==KErrNotSupported);
   824 	test_Value(r, r == KErrNone || r==KErrNotSupported);
   822 	}
   825 	}
   823 
   826 
   824 
   827 
   825 
   828 
   826 LOCAL_C void TestCaps()
   829 LOCAL_C void TestCaps()
   828 //	test format etc that require certain capabilities
   831 //	test format etc that require certain capabilities
   829 //
   832 //
   830 	{
   833 	{
   831 	driveBuf[0]=(TText)gDriveToTest;
   834 	driveBuf[0]=(TText)gDriveToTest;
   832 	r=TheFs.SessionPath(temp);
   835 	r=TheFs.SessionPath(temp);
   833 	test(r==KErrNone);
   836 	test_KErrNone(r);
   834 
   837 
   835 	test.Printf(_L("Session path: %S"),&temp);
   838 	test.Printf(_L("Session path: %S"),&temp);
   836 
   839 
   837 	r=TheFs.CreatePrivatePath(gTheDriveNum);
   840 	r=TheFs.CreatePrivatePath(gTheDriveNum);
   838 	test(r==KErrNone || r== KErrAlreadyExists);
   841 	test_Value(r, r == KErrNone || r== KErrAlreadyExists);
   839 
   842 
   840 	TBuf<18> tempPri;
   843 	TBuf<18> tempPri;
   841 	r=TheFs.PrivatePath(tempPri);
   844 	r=TheFs.PrivatePath(tempPri);
   842 	test(r==KErrNone);
   845 	test_KErrNone(r);
   843 	theprivatepath = _L("?:");
   846 	theprivatepath = _L("?:");
   844 	theprivatepath.Append(tempPri);
   847 	theprivatepath.Append(tempPri);
   845 	
   848 	
   846 	DiskAdminTest();
   849 	DiskAdminTest();
   847 
   850 
   848 	TFileName thesessionpath;
   851 	TFileName thesessionpath;
   849 
   852 
   850 	r=TheFs.SetSessionToPrivate(gTheDriveNum);
   853 	r=TheFs.SetSessionToPrivate(gTheDriveNum);
   851 	test(r==KErrNone);
   854 	test_KErrNone(r);
   852 	r=TheFs.SessionPath(thesessionpath);
   855 	r=TheFs.SessionPath(thesessionpath);
   853 	test(r==KErrNone);
   856 	test_KErrNone(r);
   854 
   857 
   855 	test(thesessionpath == theprivatepath);
   858 	test(thesessionpath == theprivatepath);
   856 	}
   859 	}
   857 
   860 
   858 
   861 
   862 //
   865 //
   863 	{
   866 	{
   864 	test.Next(_L("Delete test directory"));
   867 	test.Next(_L("Delete test directory"));
   865 	CFileMan* fMan=CFileMan::NewL(TheFs);
   868 	CFileMan* fMan=CFileMan::NewL(TheFs);
   866 	TInt r=fMan->RmDir(gSessionPath);
   869 	TInt r=fMan->RmDir(gSessionPath);
   867 	test(r==KErrNone || KErrPathNotFound);
   870 	test(r == KErrNone || KErrPathNotFound);
       
   871 //	test_Value(r, r == KErrNone || r == KErrPathNotFound);
   868 	delete fMan;
   872 	delete fMan;
   869 	}
   873 	}
   870 
   874 
   871 GLDEF_C void CallTestsL(/*TChar aDriveLetter*/)
   875 GLDEF_C void CallTestsL(/*TChar aDriveLetter*/)
   872 //
   876 //
   886 	TBuf<30> sesspath;
   890 	TBuf<30> sesspath;
   887 	sesspath=_L("?:\\");
   891 	sesspath=_L("?:\\");
   888 	sesspath[0] = (TText)gDriveToTest;
   892 	sesspath[0] = (TText)gDriveToTest;
   889 
   893 
   890 	TInt r= TheFs.SetSessionPath(sesspath);
   894 	TInt r= TheFs.SetSessionPath(sesspath);
   891 	test(r==KErrNone);
   895 	test_KErrNone(r);
   892 
   896 
   893 	//cleanup from previous run of this test
   897 	//cleanup from previous run of this test
   894 	TBuf<2> cmd;
   898 	TBuf<2> cmd;
   895 	cmd.SetLength(1);
   899 	cmd.SetLength(1);
   896 	cmd[0] = (TText)gDriveToTest;
   900 	cmd[0] = (TText)gDriveToTest;
   897 	RProcess tp;
   901 	RProcess tp;
   898 	r=tp.Create(_L("clean_prepdc.exe"),sesspath);
   902 	r=tp.Create(_L("clean_prepdc.exe"),sesspath);
   899 	test(r==KErrNone);
   903 	test_KErrNone(r);
   900 	{
   904 	{
   901 	TRequestStatus ps;
   905 	TRequestStatus ps;
   902 	tp.Logon(ps);
   906 	tp.Logon(ps);
   903 	tp.Resume();
   907 	tp.Resume();
   904 	tp.Close();
   908 	tp.Close();
   908 	//check double mode ie that Defpath still works	
   912 	//check double mode ie that Defpath still works	
   909 	RFs fs1;
   913 	RFs fs1;
   910 	RFs fs2;
   914 	RFs fs2;
   911 	
   915 	
   912 	r=fs1.Connect();
   916 	r=fs1.Connect();
   913 	test(r==KErrNone);
   917 	test_KErrNone(r);
   914 	r=fs1.SessionPath(sesspath);
   918 	r=fs1.SessionPath(sesspath);
   915 	test(r==KErrNone);
   919 	test_KErrNone(r);
   916 	test.Printf(_L("session1 Path=%S"),&sesspath);
   920 	test.Printf(_L("session1 Path=%S"),&sesspath);
   917 
   921 
   918 	TBuf<30> privatepath;
   922 	TBuf<30> privatepath;
   919 	r=fs1.SetSessionToPrivate(gTheDriveNum);
   923 	r=fs1.SetSessionToPrivate(gTheDriveNum);
   920 	test(r==KErrNone);
   924 	test_KErrNone(r);
   921 	r=fs1.PrivatePath(privatepath);
   925 	r=fs1.PrivatePath(privatepath);
   922 	test(r==KErrNone);
   926 	test_KErrNone(r);
   923 	r=privatepath.Compare(KExpectedPrivatePath());
   927 	r=privatepath.Compare(KExpectedPrivatePath());
   924 	test(r==0);
   928 	test_Value(r, r == 0);
   925 	r=fs1.SessionPath(sesspath);
   929 	r=fs1.SessionPath(sesspath);
   926 	test(r==KErrNone);
   930 	test_KErrNone(r);
   927 	r=privatepath.Compare(sesspath.Mid(KPathPosition));
   931 	r=privatepath.Compare(sesspath.Mid(KPathPosition));
   928 	test(r==0);
   932 	test_Value(r, r == 0);
   929 	r=fs1.CreatePrivatePath(gTheDriveNum);
   933 	r=fs1.CreatePrivatePath(gTheDriveNum);
   930 	test(r==KErrNone);
   934 	test_KErrNone(r);
   931 	fs1.Close();
   935 	fs1.Close();
   932 
   936 
   933 	r=fs2.Connect();
   937 	r=fs2.Connect();
   934 	test(r==KErrNone);
   938 	test_KErrNone(r);
   935 	r=fs2.SessionPath(sesspath);
   939 	r=fs2.SessionPath(sesspath);
   936 	test(r==KErrNone);
   940 	test_KErrNone(r);
   937 	test.Printf(_L("session2 Path=%S"),&sesspath);
   941 	test.Printf(_L("session2 Path=%S"),&sesspath);
   938 	fs2.Close();
   942 	fs2.Close();
   939 
   943 
   940 	TestCaps();
   944 	TestCaps();
   941 
   945