sl@0
|
1 |
// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// f32test\server\t_dcdiskadminallfiles.cpp
|
sl@0
|
15 |
//
|
sl@0
|
16 |
//
|
sl@0
|
17 |
|
sl@0
|
18 |
#include <f32file.h>
|
sl@0
|
19 |
#include <e32test.h>
|
sl@0
|
20 |
#include <e32std.h>
|
sl@0
|
21 |
#include <e32std_private.h>
|
sl@0
|
22 |
#include <e32def.h>
|
sl@0
|
23 |
#include <e32def_private.h>
|
sl@0
|
24 |
#include <e32svr.h>
|
sl@0
|
25 |
#include "t_server.h"
|
sl@0
|
26 |
|
sl@0
|
27 |
GLDEF_D RTest test(_L("T_DCDISKADMINALLFILES"));
|
sl@0
|
28 |
GLDEF_D TTime gTimeNow;
|
sl@0
|
29 |
LOCAL_D TInt gTheDriveNum;
|
sl@0
|
30 |
|
sl@0
|
31 |
|
sl@0
|
32 |
const TInt KPathPosition = 2;
|
sl@0
|
33 |
_LIT(KExpectedPrivatePath, "\\Private\\00000001\\");
|
sl@0
|
34 |
_LIT(KResourcePath, "?:\\Resource\\");
|
sl@0
|
35 |
_LIT(KSystemPath, "?:\\Sys\\");
|
sl@0
|
36 |
_LIT(KPrivatePath, "?:\\Private\\");
|
sl@0
|
37 |
_LIT(KPrivateFalseID, "?:\\Private\\FFFFFFFF\\");
|
sl@0
|
38 |
_LIT(KDriveName, "Billy");
|
sl@0
|
39 |
_LIT(KVolLable, "Benny");
|
sl@0
|
40 |
_LIT(KFileSys, "systemfile.txt");
|
sl@0
|
41 |
_LIT(KFileSys3, "sysfile.rna");
|
sl@0
|
42 |
_LIT(KFilePri, "privatefile.txt");
|
sl@0
|
43 |
_LIT(KFilePri2, "privatefile.tmp");
|
sl@0
|
44 |
_LIT(KFilePri3, "prifile.rna");
|
sl@0
|
45 |
_LIT(KFileRes, "resourcefile.txt");
|
sl@0
|
46 |
_LIT(KFileRes3, "resfile.rna");
|
sl@0
|
47 |
_LIT(KMkDirSub,"Subdir\\");
|
sl@0
|
48 |
_LIT(KOldFile,"?:\\Anyold.txt");
|
sl@0
|
49 |
|
sl@0
|
50 |
#ifndef __WINS__
|
sl@0
|
51 |
_LIT(KWildPath, "Z:\\SYSTEM\\"); // Until Loader is modified to use /Sys/
|
sl@0
|
52 |
#else
|
sl@0
|
53 |
_LIT(KWildPath, "Z:\\SYS\\");
|
sl@0
|
54 |
#endif
|
sl@0
|
55 |
_LIT(KWildFile, "*");
|
sl@0
|
56 |
|
sl@0
|
57 |
TCapability TheCaps;
|
sl@0
|
58 |
TBuf<4> driveBuf=_L("?:\\");
|
sl@0
|
59 |
RFormat format;
|
sl@0
|
60 |
TInt count;
|
sl@0
|
61 |
RRawDisk rawdisk;
|
sl@0
|
62 |
RFile file1;
|
sl@0
|
63 |
RFile file2;
|
sl@0
|
64 |
RDir dir;
|
sl@0
|
65 |
|
sl@0
|
66 |
TInt r;
|
sl@0
|
67 |
TBuf<40> fsname;
|
sl@0
|
68 |
TBuf<40> systestname;
|
sl@0
|
69 |
TBuf<40> pritestname;
|
sl@0
|
70 |
TBuf<40> restestname;
|
sl@0
|
71 |
TBuf<40> theprivatepath;
|
sl@0
|
72 |
TBuf<40> pritestfalseidname;
|
sl@0
|
73 |
TBuf<40> mkdirname;
|
sl@0
|
74 |
TFileName fromTemp;
|
sl@0
|
75 |
|
sl@0
|
76 |
TBuf<25> sysfilename;
|
sl@0
|
77 |
TBuf<30> realName;
|
sl@0
|
78 |
TBuf<40> shortfilename;
|
sl@0
|
79 |
TBuf<40> longfilename;
|
sl@0
|
80 |
|
sl@0
|
81 |
TRequestStatus aStat1;
|
sl@0
|
82 |
TRequestStatus aStat2;
|
sl@0
|
83 |
TRequestStatus aStat3;
|
sl@0
|
84 |
TRequestStatus aStat4;
|
sl@0
|
85 |
|
sl@0
|
86 |
TVolumeInfo aVolInfo;
|
sl@0
|
87 |
// TDriveInfo adriveInfo;
|
sl@0
|
88 |
|
sl@0
|
89 |
TBuf<40> systestfile;
|
sl@0
|
90 |
TBuf<40> pritestfile;
|
sl@0
|
91 |
TBuf<40> restestfile;
|
sl@0
|
92 |
TBuf<40> systestfile1;
|
sl@0
|
93 |
TBuf<40> pritestfile1;
|
sl@0
|
94 |
TBuf<40> restestfile1;
|
sl@0
|
95 |
|
sl@0
|
96 |
TTime testtime;
|
sl@0
|
97 |
TBuf<20> oldName;
|
sl@0
|
98 |
|
sl@0
|
99 |
TBuf<25> temp;
|
sl@0
|
100 |
|
sl@0
|
101 |
TEntry entry;
|
sl@0
|
102 |
|
sl@0
|
103 |
|
sl@0
|
104 |
LOCAL_C void systemRFsTest()
|
sl@0
|
105 |
//
|
sl@0
|
106 |
// RFs test on system Directory
|
sl@0
|
107 |
//
|
sl@0
|
108 |
{
|
sl@0
|
109 |
systestname=KSystemPath;
|
sl@0
|
110 |
systestname[0]=(TText)('A' + gTheDriveNum);
|
sl@0
|
111 |
|
sl@0
|
112 |
mkdirname.Zero();
|
sl@0
|
113 |
mkdirname.Append(systestname);
|
sl@0
|
114 |
mkdirname.Append(KMkDirSub);
|
sl@0
|
115 |
r=TheFs.MkDirAll(mkdirname);
|
sl@0
|
116 |
test(r==KErrPermissionDenied);
|
sl@0
|
117 |
|
sl@0
|
118 |
TheFs.RmDir(mkdirname);
|
sl@0
|
119 |
test(r==KErrPermissionDenied);
|
sl@0
|
120 |
|
sl@0
|
121 |
r=TheFs.SetSubst(systestname,EDriveO);
|
sl@0
|
122 |
test(r==KErrPermissionDenied);
|
sl@0
|
123 |
|
sl@0
|
124 |
r=TheFs.SetSessionPath(systestname);
|
sl@0
|
125 |
test(r==KErrNone);
|
sl@0
|
126 |
|
sl@0
|
127 |
TheFs.NotifyChange(ENotifyAll,aStat1,systestname);
|
sl@0
|
128 |
test(aStat1==KRequestPending);
|
sl@0
|
129 |
|
sl@0
|
130 |
systestfile=KSystemPath;
|
sl@0
|
131 |
systestfile[0]=(TText)('A' + gTheDriveNum);
|
sl@0
|
132 |
systestfile1=systestfile;
|
sl@0
|
133 |
systestfile.Append(KFileSys);
|
sl@0
|
134 |
systestfile1.Append(KFileSys3);
|
sl@0
|
135 |
|
sl@0
|
136 |
oldName=KOldFile;
|
sl@0
|
137 |
oldName[0]=(TText)gDriveToTest;
|
sl@0
|
138 |
|
sl@0
|
139 |
r=TheFs.GetShortName(systestfile, shortfilename);
|
sl@0
|
140 |
test(r==KErrNone || r==KErrNotFound || r==KErrNotSupported);
|
sl@0
|
141 |
|
sl@0
|
142 |
r=TheFs.GetLongName(systestfile1, longfilename);
|
sl@0
|
143 |
test(r==KErrNone || r==KErrNotFound || r==KErrNotSupported);
|
sl@0
|
144 |
|
sl@0
|
145 |
r=file1.Create(TheFs,oldName,EFileWrite);
|
sl@0
|
146 |
test(r==KErrNone || r==KErrAlreadyExists);
|
sl@0
|
147 |
file1.Close();
|
sl@0
|
148 |
|
sl@0
|
149 |
r=TheFs.Replace(oldName,systestfile);
|
sl@0
|
150 |
test(r==KErrPermissionDenied);
|
sl@0
|
151 |
|
sl@0
|
152 |
r=TheFs.Rename(systestfile,systestfile1);
|
sl@0
|
153 |
test(r==KErrPermissionDenied);
|
sl@0
|
154 |
|
sl@0
|
155 |
r=TheFs.Entry(systestfile1,entry);
|
sl@0
|
156 |
test(r==KErrNone || KErrNotFound);
|
sl@0
|
157 |
|
sl@0
|
158 |
r=TheFs.SetEntry(systestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
|
sl@0
|
159 |
test(r==KErrPermissionDenied);
|
sl@0
|
160 |
|
sl@0
|
161 |
r=TheFs.Delete(systestfile1);
|
sl@0
|
162 |
test(r==KErrPermissionDenied);
|
sl@0
|
163 |
}
|
sl@0
|
164 |
|
sl@0
|
165 |
LOCAL_C void ResourceRFsTest()
|
sl@0
|
166 |
//
|
sl@0
|
167 |
//
|
sl@0
|
168 |
//
|
sl@0
|
169 |
{
|
sl@0
|
170 |
restestname=KResourcePath;
|
sl@0
|
171 |
restestname[0]=(TText)('A' + gTheDriveNum);
|
sl@0
|
172 |
|
sl@0
|
173 |
mkdirname.Zero();
|
sl@0
|
174 |
mkdirname.Append(restestname);
|
sl@0
|
175 |
mkdirname.Append(KMkDirSub);
|
sl@0
|
176 |
r=TheFs.MkDirAll(mkdirname);
|
sl@0
|
177 |
test(r==KErrPermissionDenied);
|
sl@0
|
178 |
|
sl@0
|
179 |
TheFs.RmDir(mkdirname);
|
sl@0
|
180 |
test(r==KErrPermissionDenied);
|
sl@0
|
181 |
|
sl@0
|
182 |
// Change due to defect DEF099546 fix
|
sl@0
|
183 |
// TCB capability is required for following operation.
|
sl@0
|
184 |
r=TheFs.SetSubst(restestname,EDriveO);
|
sl@0
|
185 |
//test(r==KErrNone);
|
sl@0
|
186 |
test(r==KErrPermissionDenied);
|
sl@0
|
187 |
|
sl@0
|
188 |
// SetSubst will fail.
|
sl@0
|
189 |
//r=TheFs.RealName(_L("O:\\File.XXX"),realName);
|
sl@0
|
190 |
//test(r==KErrNone);
|
sl@0
|
191 |
|
sl@0
|
192 |
//r=TheFs.SetSubst(_L(""),EDriveO);
|
sl@0
|
193 |
//test(r==KErrNone);
|
sl@0
|
194 |
|
sl@0
|
195 |
r=TheFs.SetSessionPath(restestname);
|
sl@0
|
196 |
test(r==KErrNone);
|
sl@0
|
197 |
|
sl@0
|
198 |
TheFs.NotifyChange(ENotifyAll,aStat4,restestname);
|
sl@0
|
199 |
test(aStat4==KRequestPending);
|
sl@0
|
200 |
|
sl@0
|
201 |
restestfile=KResourcePath;
|
sl@0
|
202 |
restestfile[0]=(TText)('A' + gTheDriveNum);
|
sl@0
|
203 |
restestfile1=restestfile;
|
sl@0
|
204 |
restestfile.Append(KFileRes);
|
sl@0
|
205 |
restestfile1.Append(KFileRes3);
|
sl@0
|
206 |
|
sl@0
|
207 |
oldName=KOldFile;
|
sl@0
|
208 |
oldName[0]=(TText)gDriveToTest;
|
sl@0
|
209 |
|
sl@0
|
210 |
r=TheFs.GetShortName(restestfile, shortfilename);
|
sl@0
|
211 |
test(r==KErrNone || r==KErrNotFound || r==KErrNotSupported);
|
sl@0
|
212 |
|
sl@0
|
213 |
r=TheFs.GetLongName(restestfile1, longfilename);
|
sl@0
|
214 |
test(r==KErrNone || r==KErrNotFound || r==KErrNotSupported);
|
sl@0
|
215 |
|
sl@0
|
216 |
r=file1.Create(TheFs,oldName,EFileWrite);
|
sl@0
|
217 |
test(r==KErrNone || r==KErrAlreadyExists);
|
sl@0
|
218 |
file1.Close();
|
sl@0
|
219 |
|
sl@0
|
220 |
r=TheFs.Replace(oldName,restestfile);
|
sl@0
|
221 |
test(r==KErrPermissionDenied);
|
sl@0
|
222 |
|
sl@0
|
223 |
r=TheFs.Rename(restestfile,restestfile1);
|
sl@0
|
224 |
test(r==KErrPermissionDenied);
|
sl@0
|
225 |
|
sl@0
|
226 |
r=TheFs.Entry(restestfile1,entry);
|
sl@0
|
227 |
test(r==KErrNone || r==KErrPathNotFound || r==KErrNotFound);
|
sl@0
|
228 |
|
sl@0
|
229 |
r=TheFs.SetEntry(restestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
|
sl@0
|
230 |
test(r==KErrPermissionDenied);
|
sl@0
|
231 |
|
sl@0
|
232 |
r=TheFs.Delete(restestfile1);
|
sl@0
|
233 |
test(r==KErrPermissionDenied);
|
sl@0
|
234 |
|
sl@0
|
235 |
}
|
sl@0
|
236 |
|
sl@0
|
237 |
|
sl@0
|
238 |
LOCAL_C void privatefalseIDRFsTest()
|
sl@0
|
239 |
//
|
sl@0
|
240 |
//
|
sl@0
|
241 |
//
|
sl@0
|
242 |
{
|
sl@0
|
243 |
pritestfalseidname=KPrivateFalseID;
|
sl@0
|
244 |
pritestfalseidname[0]=(TText)('A' + gTheDriveNum);
|
sl@0
|
245 |
|
sl@0
|
246 |
mkdirname.Zero();
|
sl@0
|
247 |
mkdirname.Append(pritestfalseidname);
|
sl@0
|
248 |
mkdirname.Append(KMkDirSub);
|
sl@0
|
249 |
|
sl@0
|
250 |
r=TheFs.MkDirAll(mkdirname);
|
sl@0
|
251 |
test(r==KErrNone);
|
sl@0
|
252 |
|
sl@0
|
253 |
r=TheFs.RmDir(mkdirname);
|
sl@0
|
254 |
test(r==KErrNone);
|
sl@0
|
255 |
|
sl@0
|
256 |
r=TheFs.SetSubst(pritestfalseidname,EDriveO);
|
sl@0
|
257 |
test(r==KErrNone);
|
sl@0
|
258 |
|
sl@0
|
259 |
r=TheFs.RealName(_L("O:\\File.XXX"),realName);
|
sl@0
|
260 |
test(r==KErrNone);
|
sl@0
|
261 |
|
sl@0
|
262 |
r=TheFs.SetSubst(_L(""),EDriveO);
|
sl@0
|
263 |
test(r==KErrNone);
|
sl@0
|
264 |
|
sl@0
|
265 |
r=TheFs.SetSessionPath(pritestfalseidname);
|
sl@0
|
266 |
test(r==KErrNone);
|
sl@0
|
267 |
|
sl@0
|
268 |
TheFs.NotifyChange(ENotifyAll,aStat2,pritestfalseidname);
|
sl@0
|
269 |
test(aStat2==KRequestPending);
|
sl@0
|
270 |
|
sl@0
|
271 |
|
sl@0
|
272 |
pritestfile=KPrivateFalseID;
|
sl@0
|
273 |
pritestfile[0]=(TText)('A' + gTheDriveNum);
|
sl@0
|
274 |
pritestfile1=pritestfile;
|
sl@0
|
275 |
pritestfile.Append(KFilePri2);
|
sl@0
|
276 |
pritestfile1.Append(KFilePri3);
|
sl@0
|
277 |
|
sl@0
|
278 |
oldName=KOldFile;
|
sl@0
|
279 |
oldName[0]=(TText)gDriveToTest;
|
sl@0
|
280 |
|
sl@0
|
281 |
r=TheFs.GetShortName(pritestfile, shortfilename);
|
sl@0
|
282 |
test(r==KErrNone || r==KErrNotFound || r==KErrNotSupported);
|
sl@0
|
283 |
|
sl@0
|
284 |
r=TheFs.GetLongName(pritestfile1, longfilename);
|
sl@0
|
285 |
test(r==KErrNone || r==KErrNotFound || r==KErrNotSupported);
|
sl@0
|
286 |
|
sl@0
|
287 |
r=file1.Create(TheFs,oldName,EFileWrite);
|
sl@0
|
288 |
test(r==KErrNone || r==KErrAlreadyExists);
|
sl@0
|
289 |
file1.Close();
|
sl@0
|
290 |
|
sl@0
|
291 |
r=TheFs.Replace(oldName,pritestfile);
|
sl@0
|
292 |
test(r==KErrNone);
|
sl@0
|
293 |
|
sl@0
|
294 |
r=TheFs.Rename(pritestfile,pritestfile1);
|
sl@0
|
295 |
test(r==KErrNone);
|
sl@0
|
296 |
|
sl@0
|
297 |
r=TheFs.Entry(pritestfile1,entry);
|
sl@0
|
298 |
test(r==KErrNone);
|
sl@0
|
299 |
|
sl@0
|
300 |
r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
|
sl@0
|
301 |
test(r==KErrNone);
|
sl@0
|
302 |
|
sl@0
|
303 |
r=TheFs.Delete(pritestfile1);
|
sl@0
|
304 |
test(r==KErrNone);
|
sl@0
|
305 |
|
sl@0
|
306 |
}
|
sl@0
|
307 |
|
sl@0
|
308 |
|
sl@0
|
309 |
LOCAL_C void privateRFsTest()
|
sl@0
|
310 |
//
|
sl@0
|
311 |
//
|
sl@0
|
312 |
//
|
sl@0
|
313 |
{
|
sl@0
|
314 |
//private
|
sl@0
|
315 |
pritestname=KPrivatePath;
|
sl@0
|
316 |
pritestname[0]=(TText)('A' + gTheDriveNum);
|
sl@0
|
317 |
|
sl@0
|
318 |
mkdirname.Zero();
|
sl@0
|
319 |
mkdirname.Append(pritestname);
|
sl@0
|
320 |
mkdirname.Append(KMkDirSub);
|
sl@0
|
321 |
|
sl@0
|
322 |
r=TheFs.MkDirAll(mkdirname);
|
sl@0
|
323 |
test(r==KErrNone);
|
sl@0
|
324 |
|
sl@0
|
325 |
r=TheFs.RmDir(mkdirname);
|
sl@0
|
326 |
test(r==KErrNone);
|
sl@0
|
327 |
|
sl@0
|
328 |
r=TheFs.SetSubst(pritestname,EDriveO);
|
sl@0
|
329 |
test(r==KErrNone);
|
sl@0
|
330 |
|
sl@0
|
331 |
r=TheFs.RealName(_L("O:\\File.XXX"),realName);
|
sl@0
|
332 |
test(r==KErrNone);
|
sl@0
|
333 |
|
sl@0
|
334 |
r=TheFs.SetSubst(_L(""),EDriveO);
|
sl@0
|
335 |
test(r==KErrNone);
|
sl@0
|
336 |
|
sl@0
|
337 |
r=TheFs.SetSessionPath(pritestname);
|
sl@0
|
338 |
test(r==KErrNone);
|
sl@0
|
339 |
|
sl@0
|
340 |
TheFs.NotifyChange(ENotifyAll,aStat2,pritestname);
|
sl@0
|
341 |
test(aStat2==KRequestPending);
|
sl@0
|
342 |
|
sl@0
|
343 |
|
sl@0
|
344 |
pritestfile=KPrivatePath;
|
sl@0
|
345 |
pritestfile[0]=(TText)('A' + gTheDriveNum);
|
sl@0
|
346 |
pritestfile1=pritestfile;
|
sl@0
|
347 |
pritestfile.Append(KFilePri2);
|
sl@0
|
348 |
pritestfile1.Append(KFilePri3);
|
sl@0
|
349 |
|
sl@0
|
350 |
oldName=KOldFile;
|
sl@0
|
351 |
oldName[0]=(TText)gDriveToTest;
|
sl@0
|
352 |
|
sl@0
|
353 |
r=TheFs.GetShortName(pritestfile, shortfilename);
|
sl@0
|
354 |
test(r==KErrNone || r==KErrNotFound || r==KErrNotSupported);
|
sl@0
|
355 |
|
sl@0
|
356 |
r=TheFs.GetLongName(pritestfile1, longfilename);
|
sl@0
|
357 |
test(r==KErrNone || r==KErrNotFound || r==KErrNotSupported);
|
sl@0
|
358 |
|
sl@0
|
359 |
r=file1.Create(TheFs,oldName,EFileWrite);
|
sl@0
|
360 |
test(r==KErrNone || r==KErrAlreadyExists);
|
sl@0
|
361 |
file1.Close();
|
sl@0
|
362 |
|
sl@0
|
363 |
r=TheFs.Replace(oldName,pritestfile);
|
sl@0
|
364 |
test(r==KErrNone || r==KErrNotFound);
|
sl@0
|
365 |
|
sl@0
|
366 |
r=TheFs.Rename(pritestfile,pritestfile1);
|
sl@0
|
367 |
test(r==KErrNone);
|
sl@0
|
368 |
|
sl@0
|
369 |
r=TheFs.Entry(pritestfile1,entry);
|
sl@0
|
370 |
test(r==KErrNone);
|
sl@0
|
371 |
|
sl@0
|
372 |
r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
|
sl@0
|
373 |
test(r==KErrNone);
|
sl@0
|
374 |
|
sl@0
|
375 |
r=TheFs.Delete(pritestfile1);
|
sl@0
|
376 |
test(r==KErrNone);
|
sl@0
|
377 |
|
sl@0
|
378 |
}
|
sl@0
|
379 |
|
sl@0
|
380 |
|
sl@0
|
381 |
LOCAL_C void privateSIDRFstest()
|
sl@0
|
382 |
{
|
sl@0
|
383 |
theprivatepath[0]=(TText)gDriveToTest;
|
sl@0
|
384 |
test.Printf(_L("the Private Path = %S"),&theprivatepath);
|
sl@0
|
385 |
|
sl@0
|
386 |
mkdirname.Zero();
|
sl@0
|
387 |
mkdirname.Append(theprivatepath);
|
sl@0
|
388 |
mkdirname.Append(KMkDirSub);
|
sl@0
|
389 |
r=TheFs.MkDirAll(mkdirname);
|
sl@0
|
390 |
test(r==KErrNone);
|
sl@0
|
391 |
|
sl@0
|
392 |
r=TheFs.RmDir(mkdirname);
|
sl@0
|
393 |
test(r==KErrNone);
|
sl@0
|
394 |
|
sl@0
|
395 |
r=TheFs.SetSubst(theprivatepath,EDriveO);
|
sl@0
|
396 |
test(r==KErrNone);
|
sl@0
|
397 |
|
sl@0
|
398 |
r=TheFs.RealName(_L("O:\\File.XXX"),realName);
|
sl@0
|
399 |
test(r==KErrNone);
|
sl@0
|
400 |
|
sl@0
|
401 |
r=TheFs.SetSubst(_L(""),EDriveO);
|
sl@0
|
402 |
test(r==KErrNone);
|
sl@0
|
403 |
|
sl@0
|
404 |
r=TheFs.SetSessionPath(theprivatepath);
|
sl@0
|
405 |
test(r==KErrNone);
|
sl@0
|
406 |
|
sl@0
|
407 |
TheFs.NotifyChange(ENotifyAll,aStat3,theprivatepath);
|
sl@0
|
408 |
test(aStat3==KRequestPending);
|
sl@0
|
409 |
|
sl@0
|
410 |
pritestfile=theprivatepath;
|
sl@0
|
411 |
pritestfile[0]=(TText)('A' + gTheDriveNum);
|
sl@0
|
412 |
pritestfile1=pritestfile;
|
sl@0
|
413 |
pritestfile.Append(KFilePri2);
|
sl@0
|
414 |
pritestfile1.Append(KFilePri3);
|
sl@0
|
415 |
|
sl@0
|
416 |
oldName=KOldFile;
|
sl@0
|
417 |
oldName[0]=(TText)gDriveToTest;
|
sl@0
|
418 |
|
sl@0
|
419 |
r=TheFs.GetShortName(pritestfile, shortfilename);
|
sl@0
|
420 |
test(r==KErrNone || r==KErrNotFound || r==KErrNotSupported);
|
sl@0
|
421 |
|
sl@0
|
422 |
r=TheFs.GetLongName(pritestfile1, longfilename);
|
sl@0
|
423 |
test(r==KErrNone || r==KErrNotFound || r==KErrNotSupported);
|
sl@0
|
424 |
|
sl@0
|
425 |
r=file1.Create(TheFs,oldName,EFileWrite);
|
sl@0
|
426 |
test(r==KErrNone || r==KErrAlreadyExists);
|
sl@0
|
427 |
file1.Close();
|
sl@0
|
428 |
|
sl@0
|
429 |
r=TheFs.Replace(oldName,pritestfile);
|
sl@0
|
430 |
test(r==KErrNone);
|
sl@0
|
431 |
|
sl@0
|
432 |
r=TheFs.Rename(pritestfile,pritestfile1);
|
sl@0
|
433 |
test(r==KErrNone || r==KErrAlreadyExists);
|
sl@0
|
434 |
|
sl@0
|
435 |
r=TheFs.Entry(pritestfile1,entry);
|
sl@0
|
436 |
test(r==KErrNone);
|
sl@0
|
437 |
|
sl@0
|
438 |
r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
|
sl@0
|
439 |
test(r==KErrNone);
|
sl@0
|
440 |
|
sl@0
|
441 |
r=TheFs.Delete(pritestfile1);
|
sl@0
|
442 |
test(r==KErrNone);
|
sl@0
|
443 |
}
|
sl@0
|
444 |
|
sl@0
|
445 |
|
sl@0
|
446 |
LOCAL_C void systemRFiletest()
|
sl@0
|
447 |
//
|
sl@0
|
448 |
//RFile testing with session path set to //system//
|
sl@0
|
449 |
//
|
sl@0
|
450 |
{
|
sl@0
|
451 |
|
sl@0
|
452 |
r=TheFs.SetSessionPath(systestname);
|
sl@0
|
453 |
test(r==KErrNone);
|
sl@0
|
454 |
|
sl@0
|
455 |
r=file1.Temp(TheFs,systestname,fromTemp,EFileWrite);
|
sl@0
|
456 |
test(r==KErrPermissionDenied);
|
sl@0
|
457 |
file1.Close();
|
sl@0
|
458 |
|
sl@0
|
459 |
systestfile=systestname;
|
sl@0
|
460 |
systestfile.Append(KFileSys);
|
sl@0
|
461 |
r=file1.Create(TheFs,systestfile,EFileWrite);
|
sl@0
|
462 |
test(r==KErrPermissionDenied);
|
sl@0
|
463 |
file1.Close();
|
sl@0
|
464 |
|
sl@0
|
465 |
r=file1.Open(TheFs,systestfile,EFileWrite);
|
sl@0
|
466 |
test(r==KErrPermissionDenied);
|
sl@0
|
467 |
|
sl@0
|
468 |
r=file1.Open(TheFs,systestfile,EFileRead);
|
sl@0
|
469 |
test(r==KErrNone|| r==KErrNotFound);
|
sl@0
|
470 |
|
sl@0
|
471 |
r=file1.Replace(TheFs,systestfile,EFileWrite);
|
sl@0
|
472 |
test(r==KErrPermissionDenied);
|
sl@0
|
473 |
|
sl@0
|
474 |
TFindFile finder(TheFs);
|
sl@0
|
475 |
CDir* dir = NULL;
|
sl@0
|
476 |
r=finder.FindWildByDir(KWildFile, KWildPath, dir);
|
sl@0
|
477 |
if (!(r==KErrNone))
|
sl@0
|
478 |
test.Printf(_L("T_DCDISKADMINALLFILES: test find wildcards r = %d (expected KErrNone)\n"), r);
|
sl@0
|
479 |
test(r==KErrNone);
|
sl@0
|
480 |
delete dir;
|
sl@0
|
481 |
}
|
sl@0
|
482 |
|
sl@0
|
483 |
LOCAL_C void resourceRFiletest()
|
sl@0
|
484 |
//
|
sl@0
|
485 |
//RFile testing with session path set to //resource//
|
sl@0
|
486 |
//
|
sl@0
|
487 |
{
|
sl@0
|
488 |
r=TheFs.SetSessionPath(restestname);
|
sl@0
|
489 |
test(r==KErrNone);
|
sl@0
|
490 |
|
sl@0
|
491 |
r=file1.Temp(TheFs,restestname,fromTemp,EFileWrite);
|
sl@0
|
492 |
test(r==KErrPermissionDenied);
|
sl@0
|
493 |
file1.Close();
|
sl@0
|
494 |
|
sl@0
|
495 |
r=file1.Create(TheFs,KFileRes,EFileWrite);
|
sl@0
|
496 |
test(r==KErrPermissionDenied);
|
sl@0
|
497 |
file1.Close();
|
sl@0
|
498 |
|
sl@0
|
499 |
r=file1.Open(TheFs,KFileRes,EFileWrite|EFileShareExclusive );
|
sl@0
|
500 |
test(r==KErrPermissionDenied);
|
sl@0
|
501 |
|
sl@0
|
502 |
r=file1.Open(TheFs,KFileRes,EFileShareReadersOnly);
|
sl@0
|
503 |
test(r==KErrNone || KErrPathNotFound || KErrNotFound);
|
sl@0
|
504 |
file1.Close();
|
sl@0
|
505 |
|
sl@0
|
506 |
r=file1.Open(TheFs,KFileRes,EFileShareReadersOrWriters|EFileRead);
|
sl@0
|
507 |
test(r==KErrNone || KErrPathNotFound || KErrNotFound);
|
sl@0
|
508 |
file1.Close();
|
sl@0
|
509 |
|
sl@0
|
510 |
r=file1.Open(TheFs,KFileRes,EFileShareReadersOrWriters|EFileWrite);
|
sl@0
|
511 |
test(r==KErrPermissionDenied);
|
sl@0
|
512 |
file1.Close();
|
sl@0
|
513 |
|
sl@0
|
514 |
r=file1.Replace(TheFs,KFileRes3,EFileWrite);
|
sl@0
|
515 |
test(r==KErrPermissionDenied);
|
sl@0
|
516 |
file1.Close();
|
sl@0
|
517 |
}
|
sl@0
|
518 |
|
sl@0
|
519 |
|
sl@0
|
520 |
LOCAL_C void privatefalseIDRFiletest()
|
sl@0
|
521 |
//
|
sl@0
|
522 |
//RFile testing with session path set to //Private//false ID
|
sl@0
|
523 |
//
|
sl@0
|
524 |
{
|
sl@0
|
525 |
r=TheFs.SetSessionPath(pritestfalseidname);
|
sl@0
|
526 |
test(r==KErrNone);
|
sl@0
|
527 |
|
sl@0
|
528 |
r=file1.Temp(TheFs,pritestfalseidname,fromTemp,EFileWrite);
|
sl@0
|
529 |
test(r==KErrNone);
|
sl@0
|
530 |
file1.Close();
|
sl@0
|
531 |
|
sl@0
|
532 |
r=file1.Create(TheFs,KFilePri,EFileWrite);
|
sl@0
|
533 |
test(r==KErrNone);
|
sl@0
|
534 |
file1.Close();
|
sl@0
|
535 |
|
sl@0
|
536 |
r=file1.Open(TheFs,KFilePri,EFileWrite);
|
sl@0
|
537 |
test(r==KErrNone);
|
sl@0
|
538 |
file1.Close();
|
sl@0
|
539 |
|
sl@0
|
540 |
r=file1.Open(TheFs,KFilePri,EFileRead);
|
sl@0
|
541 |
test(r==KErrNone);
|
sl@0
|
542 |
file1.Close();
|
sl@0
|
543 |
|
sl@0
|
544 |
r=file1.Replace(TheFs,KFilePri,EFileWrite);
|
sl@0
|
545 |
test(r==KErrNone);
|
sl@0
|
546 |
|
sl@0
|
547 |
r=file1.Rename(KFilePri3);
|
sl@0
|
548 |
test(r==KErrNone);
|
sl@0
|
549 |
file1.Close();
|
sl@0
|
550 |
}
|
sl@0
|
551 |
|
sl@0
|
552 |
|
sl@0
|
553 |
LOCAL_C void privateRFiletest()
|
sl@0
|
554 |
//
|
sl@0
|
555 |
//RFile testing with session path set to //Private//
|
sl@0
|
556 |
//
|
sl@0
|
557 |
{
|
sl@0
|
558 |
r=TheFs.SetSessionPath(pritestname);
|
sl@0
|
559 |
test(r==KErrNone);
|
sl@0
|
560 |
|
sl@0
|
561 |
r=file1.Temp(TheFs,pritestname,fromTemp,EFileWrite);
|
sl@0
|
562 |
test(r==KErrNone);
|
sl@0
|
563 |
file1.Close();
|
sl@0
|
564 |
|
sl@0
|
565 |
r=file1.Create(TheFs,KFilePri,EFileWrite);
|
sl@0
|
566 |
test(r==KErrNone);
|
sl@0
|
567 |
file1.Close();
|
sl@0
|
568 |
|
sl@0
|
569 |
r=file1.Open(TheFs,KFilePri,EFileWrite);
|
sl@0
|
570 |
test(r==KErrNone);
|
sl@0
|
571 |
file1.Close();
|
sl@0
|
572 |
|
sl@0
|
573 |
r=file1.Open(TheFs,KFilePri,EFileRead);
|
sl@0
|
574 |
test(r==KErrNone);
|
sl@0
|
575 |
file1.Close();
|
sl@0
|
576 |
|
sl@0
|
577 |
r=file1.Replace(TheFs,KFilePri,EFileWrite);
|
sl@0
|
578 |
test(r==KErrNone);
|
sl@0
|
579 |
|
sl@0
|
580 |
r=file1.Rename(KFilePri3);
|
sl@0
|
581 |
test(r==KErrNone);
|
sl@0
|
582 |
file1.Close();
|
sl@0
|
583 |
}
|
sl@0
|
584 |
|
sl@0
|
585 |
|
sl@0
|
586 |
LOCAL_C void privateSIDRFiletest()
|
sl@0
|
587 |
//
|
sl@0
|
588 |
//Rfile Testing with session path set to //Private//UID//
|
sl@0
|
589 |
//
|
sl@0
|
590 |
{
|
sl@0
|
591 |
r=TheFs.SetSessionToPrivate(gTheDriveNum);
|
sl@0
|
592 |
test(r==KErrNone);
|
sl@0
|
593 |
|
sl@0
|
594 |
r=file1.Temp(TheFs,theprivatepath,fromTemp,EFileWrite);
|
sl@0
|
595 |
test(r==KErrNone);
|
sl@0
|
596 |
file1.Close();
|
sl@0
|
597 |
|
sl@0
|
598 |
r=file1.Create(TheFs,KFilePri,EFileWrite);
|
sl@0
|
599 |
test(r==KErrNone);
|
sl@0
|
600 |
file1.Close();
|
sl@0
|
601 |
|
sl@0
|
602 |
r=file1.Open(TheFs,KFilePri,EFileWrite);
|
sl@0
|
603 |
test(r==KErrNone);
|
sl@0
|
604 |
file1.Close();
|
sl@0
|
605 |
|
sl@0
|
606 |
r=file1.Open(TheFs,KFilePri,EFileRead);
|
sl@0
|
607 |
test(r==KErrNone);
|
sl@0
|
608 |
file1.Close();
|
sl@0
|
609 |
|
sl@0
|
610 |
|
sl@0
|
611 |
r=file1.Replace(TheFs,KFilePri,EFileWrite);
|
sl@0
|
612 |
test(r==KErrNone);
|
sl@0
|
613 |
|
sl@0
|
614 |
r=file1.Rename(KFilePri3);
|
sl@0
|
615 |
test(r==KErrNone);
|
sl@0
|
616 |
file1.Close();
|
sl@0
|
617 |
}
|
sl@0
|
618 |
|
sl@0
|
619 |
LOCAL_C void RDirtest()
|
sl@0
|
620 |
//
|
sl@0
|
621 |
//
|
sl@0
|
622 |
//
|
sl@0
|
623 |
{
|
sl@0
|
624 |
|
sl@0
|
625 |
//system
|
sl@0
|
626 |
CDir* dirEntries;
|
sl@0
|
627 |
TBuf<30> dirNameBuf(KSystemPath);
|
sl@0
|
628 |
dirNameBuf[0]=(TText)gDriveToTest;
|
sl@0
|
629 |
r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
|
sl@0
|
630 |
test(r==KErrNone || r==KErrPathNotFound || r==KErrNotFound);
|
sl@0
|
631 |
dir.Close();
|
sl@0
|
632 |
if(r==KErrNone)
|
sl@0
|
633 |
{
|
sl@0
|
634 |
r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
|
sl@0
|
635 |
test(r==KErrNone);
|
sl@0
|
636 |
delete dirEntries;
|
sl@0
|
637 |
}
|
sl@0
|
638 |
dirNameBuf.Zero();
|
sl@0
|
639 |
//Private//falseID
|
sl@0
|
640 |
dirNameBuf=KPrivateFalseID;
|
sl@0
|
641 |
dirNameBuf[0]=(TText)gDriveToTest;
|
sl@0
|
642 |
r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
|
sl@0
|
643 |
test(r==KErrNone);
|
sl@0
|
644 |
dir.Close();
|
sl@0
|
645 |
r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
|
sl@0
|
646 |
test(r==KErrNone);
|
sl@0
|
647 |
dirNameBuf.Zero();
|
sl@0
|
648 |
delete dirEntries;
|
sl@0
|
649 |
//Private
|
sl@0
|
650 |
dirNameBuf=KPrivatePath;
|
sl@0
|
651 |
dirNameBuf[0]=(TText)gDriveToTest;
|
sl@0
|
652 |
r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
|
sl@0
|
653 |
test(r==KErrNone);
|
sl@0
|
654 |
dir.Close();
|
sl@0
|
655 |
r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
|
sl@0
|
656 |
test(r==KErrNone);
|
sl@0
|
657 |
dirNameBuf.Zero();
|
sl@0
|
658 |
delete dirEntries;
|
sl@0
|
659 |
//Private/uid
|
sl@0
|
660 |
TheFs.PrivatePath(dirNameBuf);
|
sl@0
|
661 |
dirNameBuf.Insert(0,_L("?:"));
|
sl@0
|
662 |
dirNameBuf[0]=(TText)gDriveToTest;
|
sl@0
|
663 |
r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
|
sl@0
|
664 |
test(r==KErrNone);
|
sl@0
|
665 |
dir.Close();
|
sl@0
|
666 |
r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
|
sl@0
|
667 |
test(r==KErrNone);
|
sl@0
|
668 |
dirNameBuf.Zero();
|
sl@0
|
669 |
delete dirEntries;
|
sl@0
|
670 |
//Resource
|
sl@0
|
671 |
dirNameBuf=KResourcePath;
|
sl@0
|
672 |
dirNameBuf[0]=(TText)gDriveToTest;
|
sl@0
|
673 |
r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
|
sl@0
|
674 |
test(r==KErrNone || r==KErrPathNotFound);
|
sl@0
|
675 |
if(r==KErrNone)
|
sl@0
|
676 |
{
|
sl@0
|
677 |
r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
|
sl@0
|
678 |
test(r==KErrNone);
|
sl@0
|
679 |
dir.Close();
|
sl@0
|
680 |
delete dirEntries;
|
sl@0
|
681 |
}
|
sl@0
|
682 |
}
|
sl@0
|
683 |
|
sl@0
|
684 |
|
sl@0
|
685 |
LOCAL_C void TestDiskAdminAllfiles()
|
sl@0
|
686 |
//
|
sl@0
|
687 |
// Test with root capabilities
|
sl@0
|
688 |
//
|
sl@0
|
689 |
{
|
sl@0
|
690 |
r=TheFs.FileSystemName(fsname,gTheDriveNum);
|
sl@0
|
691 |
test(r==KErrNone);
|
sl@0
|
692 |
r = DismountFileSystem(TheFs, fsname, gTheDriveNum);
|
sl@0
|
693 |
test(r==KErrNone);
|
sl@0
|
694 |
// r=TheFs.RemoveFileSystem(fsname); //can not test due to bug else where fix exists
|
sl@0
|
695 |
// test(r==KErrNone);
|
sl@0
|
696 |
// r=TheFs.AddFileSystem(fsname);
|
sl@0
|
697 |
// test(r==KErrNone);
|
sl@0
|
698 |
r = MountFileSystem(TheFs, fsname, gTheDriveNum);
|
sl@0
|
699 |
test(r==KErrNone);
|
sl@0
|
700 |
r=TheFs.SetDriveName(gTheDriveNum,KDriveName);
|
sl@0
|
701 |
test(r==KErrNone);
|
sl@0
|
702 |
#ifndef __WINS__
|
sl@0
|
703 |
r=TheFs.SetVolumeLabel(KVolLable, gTheDriveNum);
|
sl@0
|
704 |
test(r==KErrNone);
|
sl@0
|
705 |
#endif
|
sl@0
|
706 |
|
sl@0
|
707 |
systemRFsTest();
|
sl@0
|
708 |
ResourceRFsTest();
|
sl@0
|
709 |
privateRFsTest();
|
sl@0
|
710 |
privateSIDRFstest();
|
sl@0
|
711 |
privatefalseIDRFsTest();
|
sl@0
|
712 |
|
sl@0
|
713 |
systemRFiletest();
|
sl@0
|
714 |
resourceRFiletest();
|
sl@0
|
715 |
privateRFiletest();
|
sl@0
|
716 |
privateSIDRFiletest();
|
sl@0
|
717 |
privatefalseIDRFiletest();
|
sl@0
|
718 |
|
sl@0
|
719 |
//check notifier return values set in rfs testing
|
sl@0
|
720 |
//User::WaitForRequest(aStat1);
|
sl@0
|
721 |
User::WaitForRequest(aStat2);
|
sl@0
|
722 |
User::WaitForRequest(aStat3);
|
sl@0
|
723 |
//User::WaitForRequest(aStat4);
|
sl@0
|
724 |
test(aStat2==KErrNone);
|
sl@0
|
725 |
test(aStat3==KErrNone);
|
sl@0
|
726 |
|
sl@0
|
727 |
test(aStat1 == KRequestPending);
|
sl@0
|
728 |
TheFs.NotifyChangeCancel(aStat1);
|
sl@0
|
729 |
test(aStat1==KErrCancel);
|
sl@0
|
730 |
|
sl@0
|
731 |
test(aStat4 == KRequestPending);
|
sl@0
|
732 |
TheFs.NotifyChangeCancel(aStat4);
|
sl@0
|
733 |
test(aStat4==KErrCancel);
|
sl@0
|
734 |
|
sl@0
|
735 |
r=TheFs.SetSessionPath(systestname);
|
sl@0
|
736 |
test(r==KErrNone);
|
sl@0
|
737 |
|
sl@0
|
738 |
//Test RRawDisk class
|
sl@0
|
739 |
r=rawdisk.Open(TheFs,gTheDriveNum);
|
sl@0
|
740 |
test(r==KErrPermissionDenied);
|
sl@0
|
741 |
rawdisk.Close();
|
sl@0
|
742 |
|
sl@0
|
743 |
RDirtest();
|
sl@0
|
744 |
|
sl@0
|
745 |
#ifdef __WINS__
|
sl@0
|
746 |
if (User::UpperCase(driveBuf[0]) != 'C')
|
sl@0
|
747 |
#endif
|
sl@0
|
748 |
{
|
sl@0
|
749 |
//Test RFormat class
|
sl@0
|
750 |
r=format.Open(TheFs,driveBuf,EHighDensity,count);
|
sl@0
|
751 |
test(r==KErrNone);
|
sl@0
|
752 |
while(count)
|
sl@0
|
753 |
{
|
sl@0
|
754 |
TInt r=format.Next(count);
|
sl@0
|
755 |
test(r==KErrNone);
|
sl@0
|
756 |
}
|
sl@0
|
757 |
format.Close();
|
sl@0
|
758 |
}
|
sl@0
|
759 |
|
sl@0
|
760 |
driveBuf[0]=(TText)gDriveToTest;
|
sl@0
|
761 |
r=TheFs.ScanDrive(driveBuf);
|
sl@0
|
762 |
test(r==KErrNone || r==KErrNotSupported || KErrInUse);
|
sl@0
|
763 |
r=TheFs.CheckDisk(driveBuf);
|
sl@0
|
764 |
test(r==KErrNone || r==KErrNotSupported || KErrInUse);
|
sl@0
|
765 |
}
|
sl@0
|
766 |
|
sl@0
|
767 |
LOCAL_C void TestCaps()
|
sl@0
|
768 |
//
|
sl@0
|
769 |
// test format etc that require certain capabilities
|
sl@0
|
770 |
//
|
sl@0
|
771 |
{
|
sl@0
|
772 |
#ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
|
sl@0
|
773 |
const char myDiagMsg[] = "Capability Check Failure";
|
sl@0
|
774 |
#endif //__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
|
sl@0
|
775 |
r=RProcess().HasCapability(ECapabilityAllFiles, __PLATSEC_DIAGNOSTIC_STRING(myDiagMsg));
|
sl@0
|
776 |
test(r);
|
sl@0
|
777 |
r=RProcess().HasCapability(ECapabilityDiskAdmin, __PLATSEC_DIAGNOSTIC_STRING(myDiagMsg));
|
sl@0
|
778 |
test(r);
|
sl@0
|
779 |
|
sl@0
|
780 |
driveBuf[0]=(TText)gDriveToTest;
|
sl@0
|
781 |
r=TheFs.SessionPath(temp);
|
sl@0
|
782 |
test(r==KErrNone);
|
sl@0
|
783 |
|
sl@0
|
784 |
test.Printf(_L("Session path: %S"),&temp);
|
sl@0
|
785 |
|
sl@0
|
786 |
r=TheFs.CreatePrivatePath(gTheDriveNum);
|
sl@0
|
787 |
test(r==KErrNone || r== KErrAlreadyExists);
|
sl@0
|
788 |
|
sl@0
|
789 |
TBuf<18> tempPri;
|
sl@0
|
790 |
r=TheFs.PrivatePath(tempPri);
|
sl@0
|
791 |
test(r==KErrNone);
|
sl@0
|
792 |
theprivatepath = _L("?:");
|
sl@0
|
793 |
theprivatepath.Append(tempPri);
|
sl@0
|
794 |
|
sl@0
|
795 |
TestDiskAdminAllfiles();
|
sl@0
|
796 |
|
sl@0
|
797 |
TFileName thesessionpath;
|
sl@0
|
798 |
r=TheFs.SetSessionToPrivate(gTheDriveNum);
|
sl@0
|
799 |
test(r==KErrNone);
|
sl@0
|
800 |
r=TheFs.SessionPath(thesessionpath);
|
sl@0
|
801 |
test(r==KErrNone);
|
sl@0
|
802 |
test(thesessionpath == theprivatepath);
|
sl@0
|
803 |
}
|
sl@0
|
804 |
|
sl@0
|
805 |
|
sl@0
|
806 |
LOCAL_C void CleanupL()
|
sl@0
|
807 |
//
|
sl@0
|
808 |
// Clean up tests
|
sl@0
|
809 |
//
|
sl@0
|
810 |
{
|
sl@0
|
811 |
test.Next(_L("Delete test directory"));
|
sl@0
|
812 |
CFileMan* fMan=CFileMan::NewL(TheFs);
|
sl@0
|
813 |
TInt r=fMan->RmDir(gSessionPath);
|
sl@0
|
814 |
test(r==KErrNone || KErrPathNotFound);
|
sl@0
|
815 |
delete fMan;
|
sl@0
|
816 |
}
|
sl@0
|
817 |
|
sl@0
|
818 |
GLDEF_C void CallTestsL(/*TChar aDriveLetter*/)
|
sl@0
|
819 |
//
|
sl@0
|
820 |
// Do all tests
|
sl@0
|
821 |
//
|
sl@0
|
822 |
{
|
sl@0
|
823 |
if( !PlatSec::IsCapabilityEnforced(ECapabilityAllFiles) ||
|
sl@0
|
824 |
!PlatSec::IsCapabilityEnforced(ECapabilityDiskAdmin))
|
sl@0
|
825 |
{
|
sl@0
|
826 |
test.Printf(_L("Capabilities insufficient - leaving t_dcdiskadminallfiles"));
|
sl@0
|
827 |
test.Printf(_L("\n")); // Prevent overwrite by next print
|
sl@0
|
828 |
return;
|
sl@0
|
829 |
}
|
sl@0
|
830 |
TurnAllocFailureOff();
|
sl@0
|
831 |
TheFs.CharToDrive(gDriveToTest,gTheDriveNum);
|
sl@0
|
832 |
|
sl@0
|
833 |
TBuf<30> sesspath;
|
sl@0
|
834 |
sesspath=_L("?:\\");
|
sl@0
|
835 |
sesspath[0] = (TText)gDriveToTest;
|
sl@0
|
836 |
|
sl@0
|
837 |
TInt r= TheFs.SetSessionPath(sesspath);
|
sl@0
|
838 |
test(r==KErrNone);
|
sl@0
|
839 |
|
sl@0
|
840 |
TBuf<2> cmd;
|
sl@0
|
841 |
cmd.SetLength(1);
|
sl@0
|
842 |
cmd[0] = (TText)gDriveToTest;
|
sl@0
|
843 |
RProcess tp;
|
sl@0
|
844 |
r=tp.Create(_L("clean_prepdc.exe"),sesspath);
|
sl@0
|
845 |
test(r==KErrNone);
|
sl@0
|
846 |
{
|
sl@0
|
847 |
TRequestStatus ps;
|
sl@0
|
848 |
tp.Logon(ps);
|
sl@0
|
849 |
tp.Resume();
|
sl@0
|
850 |
tp.Close();
|
sl@0
|
851 |
User::WaitForRequest(ps);
|
sl@0
|
852 |
}
|
sl@0
|
853 |
|
sl@0
|
854 |
//check double mode ie that Defpath still works
|
sl@0
|
855 |
RFs fs1;
|
sl@0
|
856 |
RFs fs2;
|
sl@0
|
857 |
|
sl@0
|
858 |
r=fs1.Connect();
|
sl@0
|
859 |
test(r==KErrNone);
|
sl@0
|
860 |
r=fs1.SessionPath(sesspath);
|
sl@0
|
861 |
test(r==KErrNone);
|
sl@0
|
862 |
test.Printf(_L("session1 Path=%S"),&sesspath);
|
sl@0
|
863 |
|
sl@0
|
864 |
TBuf<30> privatepath;
|
sl@0
|
865 |
r=fs1.SetSessionToPrivate(gTheDriveNum);
|
sl@0
|
866 |
test(r==KErrNone);
|
sl@0
|
867 |
r=fs1.PrivatePath(privatepath);
|
sl@0
|
868 |
test(r==KErrNone);
|
sl@0
|
869 |
r=privatepath.Compare(KExpectedPrivatePath());
|
sl@0
|
870 |
test(r==0);
|
sl@0
|
871 |
r=fs1.SessionPath(sesspath);
|
sl@0
|
872 |
test(r==KErrNone);
|
sl@0
|
873 |
r=privatepath.Compare(sesspath.Mid(KPathPosition));
|
sl@0
|
874 |
test(r==0);
|
sl@0
|
875 |
r=fs1.CreatePrivatePath(gTheDriveNum);
|
sl@0
|
876 |
test(r==KErrNone);
|
sl@0
|
877 |
fs1.Close();
|
sl@0
|
878 |
|
sl@0
|
879 |
r=fs2.Connect();
|
sl@0
|
880 |
test(r==KErrNone);
|
sl@0
|
881 |
r=fs2.SessionPath(sesspath);
|
sl@0
|
882 |
test(r==KErrNone);
|
sl@0
|
883 |
test.Printf(_L("session2 Path=%S"),&sesspath);
|
sl@0
|
884 |
fs2.Close();
|
sl@0
|
885 |
|
sl@0
|
886 |
TestCaps();
|
sl@0
|
887 |
|
sl@0
|
888 |
test.Printf(_L("No of files open=%d"), TheFs.ResourceCount());
|
sl@0
|
889 |
|
sl@0
|
890 |
CleanupL();
|
sl@0
|
891 |
}
|