author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 14 Apr 2010 17:22:59 +0300 | |
branch | RCL_3 |
changeset 89 | 1df514389a47 |
parent 62 | 4a8fed1c0ef6 |
child 134 | 95847726fe57 |
permissions | -rw-r--r-- |
0 | 1 |
// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 |
// All rights reserved. |
|
3 |
// This component and the accompanying materials are made available |
|
4 |
// under the terms of the License "Eclipse Public License v1.0" |
|
5 |
// which accompanies this distribution, and is available |
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 |
// |
|
8 |
// Initial Contributors: |
|
9 |
// Nokia Corporation - initial contribution. |
|
10 |
// |
|
11 |
// Contributors: |
|
12 |
// |
|
13 |
// Description: |
|
14 |
// f32\sfile\sf_dat.cpp |
|
15 |
// |
|
16 |
// |
|
17 |
||
18 |
#include "sf_std.h" |
|
19 |
||
20 |
||
21 |
CFsObjectConIx* TheContainer; |
|
22 |
CFsObjectCon* FileSystems; |
|
23 |
CFsObjectCon* Files; |
|
24 |
CFsObjectCon* FileShares; |
|
25 |
CFsObjectCon* Dirs; |
|
26 |
CFsObjectCon* Formats; |
|
27 |
CFsObjectCon* RawDisks; |
|
28 |
CFsObjectCon* Extensions; |
|
29 |
CFsObjectCon* ProxyDrives; |
|
30 |
||
31 |
CServerFs* TheFileServer; |
|
32 |
TDrive TheDrives[KMaxDrives]; |
|
33 |
||
34 |
//#ifndef __SECURE_API__ |
|
35 |
TFileName TheDefaultPath; |
|
36 |
//#endif |
|
37 |
||
38 |
HBufC* TheDriveNames[KMaxDrives]; |
|
39 |
||
40 |
||
41 |
SCapabilitySet AllCapabilities; |
|
42 |
SCapabilitySet DisabledCapabilities; |
|
43 |
||
44 |
RThread TheServerThread; |
|
45 |
RAllocator* ServerThreadAllocator; |
|
46 |
TBool OpenOnDriveZOnly; |
|
47 |
TBool LocalFileSystemInitialized; |
|
48 |
TBool RefreshZDriveCache; |
|
49 |
TBool CompFsMounted; |
|
50 |
TBool CompFsSync; |
|
51 |
TBool StartupInitCompleted; |
|
52 |
TBool LocalDriveMappingSet; |
|
53 |
CKernEventNotifier* TheKernEventNotifier; |
|
54 |
RFTrace TheFtrace; |
|
55 |
||
56 |
||
57 |
GLDEF_D TCodePageUtils TheCodePage; |
|
58 |
||
59 |
TBool FatUtilityFunctionsSet = EFalse; //-- Flag. Is set to ETrue when LoadLocale() sets a pointer to TFatUtilityFunctions |
|
60 |
TBool FatUtilitiesUpdateDrivesNotified = EFalse; //-- Flag. Is set to ETrue when all drives get a notification about locale change |
|
61 |
||
62 |
||
63 |
||
64 |
#if defined(_DEBUG) || defined(_DEBUG_RELEASE) |
|
65 |
TInt ErrorCondition; |
|
66 |
TInt ErrorCount; |
|
67 |
TUint32 DebugReg; |
|
68 |
TInt UserHeapAllocFailCount; |
|
69 |
TInt KernHeapAllocFailCount; |
|
70 |
TInt DebugNCNotifier=0; |
|
71 |
TCorruptNameRec* gCorruptFileNameList=NULL; |
|
72 |
TCorruptLogRec* gCorruptLogRecordList=NULL; |
|
73 |
TInt gNumberOfCorruptHits=0; |
|
74 |
HBufC* gCorruptFileNamesListFile=NULL; |
|
62
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
75 |
TInt SessionCount; // number of CSessionFs's |
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
76 |
TInt ObjectCount; // number of CFsObjects |
0 | 77 |
|
78 |
#endif |
|
79 |
||
80 |
TBool F32Properties::iInitialised = 0; |
|
81 |
TInt F32Properties::iRomAddress = 0; |
|
82 |
TInt F32Properties::iRomLength = 0; |
|
83 |
||
84 |
EXPORT_C TBusLocalDrive& GetLocalDrive(TInt aDrive) |
|
85 |
// |
|
86 |
// Export localdrives |
|
87 |
// |
|
88 |
{ |
|
89 |
return(LocalDrives::GetLocalDrive(aDrive)); |
|
90 |
} |
|
91 |
||
92 |
EXPORT_C TInt GetProxyDrive(TInt aDrive, CProxyDrive*& aProxyDrive) |
|
93 |
// |
|
94 |
// Export proxy drives |
|
95 |
// |
|
96 |
{ |
|
97 |
return TheDrives[aDrive].CurrentMount().ProxyDrive(aProxyDrive); |
|
98 |
} |
|
99 |
||
100 |
EXPORT_C CExtProxyDrive* GetProxyDrive(TInt aDrive) |
|
101 |
{ |
|
102 |
return (LocalDrives::GetProxyDrive(aDrive)); |
|
103 |
} |
|
104 |
||
105 |
EXPORT_C TBool IsProxyDrive(TInt aDrive) |
|
106 |
{ |
|
107 |
return (LocalDrives::IsProxyDrive(aDrive)); |
|
108 |
} |
|
109 |
||
110 |
EXPORT_C TBool IsValidLocalDriveMapping(TInt aDrive) |
|
111 |
// |
|
112 |
// Is the drive number to local drive mapping valid? |
|
113 |
// |
|
114 |
{ |
|
115 |
return(LocalDrives::IsValidDriveMapping(aDrive)); |
|
116 |
} |
|
117 |
||
118 |
EXPORT_C TInt DriveNumberToLocalDriveNumber(TInt aDrive) |
|
119 |
// |
|
120 |
// Get the mapping from drive number to local drive |
|
121 |
// |
|
122 |
{ |
|
123 |
return(LocalDrives::DriveNumberToLocalDriveNumber(aDrive)); |
|
124 |
} |
|
125 |
||
126 |
EXPORT_C TInt GetLocalDriveNumber(TBusLocalDrive* aLocDrv) |
|
127 |
// |
|
128 |
// Get the local drive number from local drive |
|
129 |
// |
|
130 |
{ |
|
131 |
return(LocalDrives::GetLocalDriveNumber(aLocDrv)); |
|
132 |
} |
|
133 |
||
134 |
struct TFatUtilityFunctions; |
|
135 |
#if defined(_DEBUG) || defined(_DEBUG_RELEASE) |
|
136 |
TBool EnableFatUtilityFunctions = ETrue; |
|
137 |
#endif |
|
138 |
EXPORT_C const TFatUtilityFunctions* GetFatUtilityFunctions() |
|
139 |
{ |
|
140 |
#if defined(_DEBUG) || defined(_DEBUG_RELEASE) |
|
141 |
if (!EnableFatUtilityFunctions) |
|
142 |
{ |
|
143 |
return NULL; // Bypass Locale Dll/Codepage FAT converions, use default implementation |
|
144 |
} |
|
145 |
#endif |
|
146 |
switch(TheCodePage.CodepageLoaded()) |
|
147 |
{ |
|
148 |
case TCodePageUtils::ECodePageDll: |
|
149 |
return ((TFatUtilityFunctions*)(TheCodePage.CodepageFatUtilityFunctions().iConvertFromUnicodeL)); |
|
150 |
case TCodePageUtils::ELocaleDll: |
|
151 |
return TheCodePage.LocaleFatUtilityFunctions(); |
|
152 |
default: |
|
153 |
return NULL; // if no Locale Dll/Codepage Dll is loaded, use default implementation |
|
154 |
} |
|
155 |
} |
|
156 |
||
157 |
EXPORT_C const TCodePageUtils& GetCodePage() |
|
158 |
{ |
|
159 |
return TheCodePage; |
|
160 |
} |
|
161 |
||
162 |
/** |
|
163 |
@internalTechnology |
|
164 |
Helper class for parsing F32 INI files |
|
165 |
*/ |
|
166 |
class TIniFileReader |
|
167 |
{ |
|
168 |
public: |
|
169 |
TIniFileReader(const TPtrC8& aData); |
|
170 |
TInt Next(); |
|
171 |
TBool IsSection(const TDesC8& aSection = KNullDesC8); |
|
172 |
TBool IsProperty(const TDesC8& aProperty, TBool& aPropVal); |
|
173 |
TBool IsProperty(const TDesC8& aProperty, TInt32& aPropVal); |
|
174 |
TBool IsProperty(const TDesC8& aProperty, TDes8& aPropVal); |
|
175 |
public: |
|
176 |
const TPtrC8& iData; |
|
177 |
TPtr8 iCurrentLine; |
|
178 |
TInt iCurrentPos; |
|
179 |
}; |
|
180 |
||
181 |
||
182 |
/** |
|
183 |
@internalTechnology |
|
184 |
TIniFileReader constructor |
|
185 |
*/ |
|
186 |
TIniFileReader::TIniFileReader(const TPtrC8& aData) |
|
187 |
: iData(aData), |
|
188 |
iCurrentLine(NULL,0,256), |
|
189 |
iCurrentPos(0) |
|
190 |
{ |
|
191 |
} |
|
192 |
||
193 |
/** |
|
194 |
@internalTechnology |
|
195 |
||
196 |
Reads the next line from an F32 INI file. |
|
197 |
- On exit, iCurrentLine represents the current line |
|
198 |
- On exit, iCurrentPos points to the next line in the INI file |
|
199 |
*/ |
|
200 |
TInt TIniFileReader::Next() |
|
201 |
{ |
|
202 |
// Check if we have run into the end of the file |
|
203 |
TInt bufRemainder = (iData.Length()-iCurrentPos); |
|
204 |
if (!bufRemainder) |
|
205 |
{ |
|
206 |
return(KErrEof); |
|
207 |
} |
|
208 |
||
209 |
// Setup the descriptor passed with the next record - don't include the record terminator |
|
210 |
// The line terminators are CR + LF for DOS |
|
211 |
// whereas only LF for Unix line endings |
|
212 |
iCurrentLine.Set(((TUint8*)iData.Ptr()+iCurrentPos),bufRemainder,bufRemainder); |
|
213 |
TInt len = iCurrentLine.Locate('\n'); |
|
214 |
if (len != KErrNotFound) |
|
215 |
{ |
|
216 |
iCurrentPos += len; |
|
217 |
// Check for DOS line ending to support both DOS and Unix formats |
|
218 |
if ((len != 0) && (((TUint8*)iData.Ptr())[iCurrentPos-1] == '\r')) |
|
219 |
{ |
|
220 |
len--; |
|
221 |
} |
|
222 |
iCurrentLine.SetLength(len); |
|
223 |
} |
|
224 |
else |
|
225 |
{ |
|
226 |
iCurrentPos=iData.Length(); |
|
227 |
} |
|
228 |
||
229 |
// Point iCurrentPos to the next non-empty line |
|
230 |
while (iCurrentPos<iData.Length() && (((TUint8*)iData.Ptr())[iCurrentPos]=='\n' || ((TUint8*)iData.Ptr())[iCurrentPos]=='\r')) |
|
231 |
{ |
|
232 |
iCurrentPos++; |
|
233 |
} |
|
234 |
||
235 |
// iCurrentLine now describes a single line of the INI file |
|
236 |
return(KErrNone); |
|
237 |
} |
|
238 |
||
239 |
/** |
|
240 |
@internalTechnology |
|
241 |
||
242 |
Examines the current INI line, returning ETrue if the line contains the requested INI section |
|
243 |
- An INI section must be of the form [section_name] |
|
244 |
- Passing KNullDesC as an argument returns ETrue if the line describes any INI section |
|
245 |
*/ |
|
246 |
TBool TIniFileReader::IsSection(const TDesC8& aSection) |
|
247 |
{ |
|
248 |
TInt sectionStart = iCurrentLine.Locate('['); |
|
249 |
TInt sectionEnd = iCurrentLine.Locate(']'); |
|
250 |
if(sectionStart == 0 && sectionEnd > 1) |
|
251 |
{ |
|
252 |
if(aSection == KNullDesC8) |
|
253 |
{ |
|
254 |
return(ETrue); |
|
255 |
} |
|
256 |
||
257 |
const TInt sectionLength = sectionEnd-sectionStart-1; |
|
258 |
// Found a start of section marker - does it match what we're interested in? |
|
259 |
TPtr8 sectionPtr(&iCurrentLine[1+sectionStart], sectionLength, sectionLength); |
|
260 |
if(sectionPtr == aSection) |
|
261 |
{ |
|
262 |
return(ETrue); |
|
263 |
} |
|
264 |
} |
|
265 |
return(EFalse); |
|
266 |
} |
|
267 |
||
268 |
/** |
|
269 |
@internalTechnology |
|
270 |
||
271 |
Examines the current INI line, returning ETrue if the line contains the requested property |
|
272 |
*/ |
|
273 |
TBool TIniFileReader::IsProperty(const TDesC8& aProperty, TBool& aPropVal) |
|
274 |
{ |
|
275 |
TPtrC8 token; |
|
276 |
TLex8 lex(iCurrentLine); |
|
277 |
token.Set(lex.NextToken()); |
|
278 |
if (token.Length() == 0 || token != aProperty) |
|
279 |
{ |
|
280 |
return(EFalse); |
|
281 |
} |
|
282 |
||
283 |
lex.SkipSpace(); |
|
284 |
||
285 |
TInt32 propVal; |
|
286 |
if (lex.BoundedVal(propVal, 1) == KErrNone) |
|
287 |
{ |
|
288 |
aPropVal = propVal; |
|
289 |
return(ETrue); |
|
290 |
} |
|
291 |
||
292 |
// allow "on" or "off" strings if no integer found |
|
293 |
_LIT8(KBoolOn,"ON"); |
|
294 |
_LIT8(KBoolOff,"OFF"); |
|
295 |
||
296 |
if (lex.Remainder().Left(KBoolOn().Length()).CompareF(KBoolOn) == KErrNone) |
|
297 |
{ |
|
298 |
aPropVal = ETrue; |
|
299 |
return(ETrue); |
|
300 |
} |
|
301 |
if (lex.Remainder().Left(KBoolOff().Length()).CompareF(KBoolOff) == KErrNone) |
|
302 |
{ |
|
303 |
aPropVal = EFalse; |
|
304 |
return(ETrue); |
|
305 |
} |
|
306 |
||
307 |
return(EFalse); |
|
308 |
} |
|
309 |
||
310 |
/** |
|
311 |
@internalTechnology |
|
312 |
||
313 |
Examines the current INI line, returning ETrue if the line contains the requested property |
|
314 |
*/ |
|
315 |
TBool TIniFileReader::IsProperty(const TDesC8& aProperty, TInt32& aPropVal) |
|
316 |
{ |
|
317 |
TPtrC8 token; |
|
318 |
TLex8 lex(iCurrentLine); |
|
319 |
token.Set(lex.NextToken()); |
|
320 |
if (token.Length() == 0 || token != aProperty) |
|
321 |
{ |
|
322 |
return(EFalse); |
|
323 |
} |
|
324 |
||
325 |
lex.SkipSpace(); |
|
326 |
||
327 |
TInt32 propVal; |
|
328 |
if (lex.Val(propVal) != KErrNone) |
|
329 |
{ |
|
330 |
return(EFalse); |
|
331 |
} |
|
332 |
||
333 |
aPropVal = propVal; |
|
334 |
||
335 |
return(ETrue); |
|
336 |
} |
|
337 |
||
338 |
/** |
|
339 |
@internalTechnology |
|
340 |
||
341 |
Examines the current INI line, returning ETrue if the line contains the requested property |
|
342 |
*/ |
|
343 |
TBool TIniFileReader::IsProperty(const TDesC8& aProperty, TDes8& aPropVal) |
|
344 |
{ |
|
345 |
TPtrC8 token; |
|
346 |
TLex8 lex(iCurrentLine); |
|
347 |
token.Set(lex.NextToken()); |
|
348 |
if (token.Length() == 0 || token != aProperty) |
|
349 |
{ |
|
350 |
return(EFalse); |
|
351 |
} |
|
352 |
||
353 |
lex.SkipSpace(); |
|
354 |
||
355 |
aPropVal = lex.Remainder().Left(aPropVal.MaxLength()); |
|
356 |
||
357 |
return(ETrue); |
|
358 |
} |
|
359 |
||
360 |
/** |
|
361 |
@internalTechnology |
|
362 |
||
363 |
Initialises the F32 properties with a ROM address representing the INI file in ROM |
|
364 |
||
365 |
@return KErrNone on success |
|
366 |
@return KErrAlreadyExists if the properties have already been initialised |
|
367 |
*/ |
|
368 |
EXPORT_C TInt F32Properties::Initialise(TInt aRomAddress, TInt aLength) |
|
369 |
{ |
|
370 |
if(iInitialised) |
|
371 |
{ |
|
372 |
// F32 properties have already been initialised |
|
373 |
return(KErrAlreadyExists); |
|
374 |
} |
|
375 |
||
376 |
iInitialised = ETrue; |
|
377 |
iRomAddress = aRomAddress; |
|
378 |
iRomLength = aLength; |
|
379 |
||
380 |
return(KErrNone); |
|
381 |
} |
|
382 |
||
383 |
/** |
|
384 |
@internalTechnology |
|
385 |
||
386 |
Returns the requested F32 property string |
|
387 |
||
388 |
@param aSection The name of the F32 INI section |
|
389 |
@param aProperty The name of the F32 propery within the section |
|
390 |
@param aPropVal Returns the requested property value (unchanged if the property does not exist) |
|
391 |
||
392 |
@return ETrue if the property exists, EFalse otherwise |
|
393 |
*/ |
|
394 |
EXPORT_C TBool F32Properties::GetString(const TDesC8& aSection, const TDesC8& aProperty, TDes8& aPropVal) |
|
395 |
{ |
|
396 |
if(!iInitialised) |
|
397 |
{ |
|
398 |
return(EFalse); |
|
399 |
} |
|
400 |
||
401 |
TPtrC8 iniPtr((TUint8*)iRomAddress, iRomLength); |
|
402 |
TIniFileReader iniReader(iniPtr); |
|
403 |
||
404 |
FOREVER |
|
405 |
{ |
|
406 |
// Read the next line of the INI file |
|
407 |
if(iniReader.Next() == KErrEof) |
|
408 |
{ |
|
409 |
break; |
|
410 |
} |
|
411 |
||
412 |
if(iniReader.IsSection(aSection)) |
|
413 |
{ |
|
414 |
// Found the section we're interested in |
|
415 |
// - look for the property, until we get to EOF or the next section |
|
416 |
FOREVER |
|
417 |
{ |
|
418 |
if(iniReader.Next() == KErrEof) |
|
419 |
{ |
|
420 |
return(EFalse); |
|
421 |
} |
|
422 |
||
423 |
if(iniReader.IsSection()) |
|
424 |
{ |
|
425 |
return(EFalse); |
|
426 |
} |
|
427 |
||
428 |
if(iniReader.IsProperty(aProperty, aPropVal)) |
|
429 |
{ |
|
430 |
return(ETrue); |
|
431 |
} |
|
432 |
} |
|
433 |
} |
|
434 |
} |
|
435 |
||
436 |
// No section found... |
|
437 |
return(EFalse); |
|
438 |
} |
|
439 |
||
440 |
/** |
|
441 |
@internalTechnology |
|
442 |
||
443 |
Returns the requested integer F32 property value |
|
444 |
||
445 |
@param aSection The name of the F32 INI section |
|
446 |
@param aProperty The name of the F32 propery within the section |
|
447 |
@param aPropVal Returns the requested property value (unchanged if the property does not exist) |
|
448 |
||
449 |
@return ETrue if the property exists, EFalse otherwise |
|
450 |
*/ |
|
451 |
EXPORT_C TBool F32Properties::GetInt(const TDesC8& aSection, const TDesC8& aProperty, TInt32& aPropVal) |
|
452 |
{ |
|
453 |
if(!iInitialised) |
|
454 |
{ |
|
455 |
return(EFalse); |
|
456 |
} |
|
457 |
||
458 |
TPtrC8 iniPtr((TUint8*)iRomAddress, iRomLength); |
|
459 |
TIniFileReader iniReader(iniPtr); |
|
460 |
||
461 |
FOREVER |
|
462 |
{ |
|
463 |
// Read the next line of the INI file |
|
464 |
if(iniReader.Next() == KErrEof) |
|
465 |
{ |
|
466 |
break; |
|
467 |
} |
|
468 |
||
469 |
if(iniReader.IsSection(aSection)) |
|
470 |
{ |
|
471 |
// Found the section we're interested in |
|
472 |
// - look for the property, until we get to EOF or the next section |
|
473 |
FOREVER |
|
474 |
{ |
|
475 |
if(iniReader.Next() == KErrEof) |
|
476 |
{ |
|
477 |
return(EFalse); |
|
478 |
} |
|
479 |
||
480 |
||
481 |
if(iniReader.IsSection()) |
|
482 |
{ |
|
483 |
return(EFalse); |
|
484 |
} |
|
485 |
||
486 |
if(iniReader.IsProperty(aProperty, aPropVal)) |
|
487 |
{ |
|
488 |
return(ETrue); |
|
489 |
} |
|
490 |
} |
|
491 |
} |
|
492 |
} |
|
493 |
||
494 |
// No section found... |
|
495 |
return(EFalse); |
|
496 |
} |
|
497 |
||
498 |
/** |
|
499 |
@internalTechnology |
|
500 |
||
501 |
Returns the requested boolean F32 property value |
|
502 |
||
503 |
@param aSection The name of the F32 INI section |
|
504 |
@param aProperty The name of the F32 propery within the section |
|
505 |
@param aPropVal Returns the requested property value (unchanged if the property does not exist) |
|
506 |
||
507 |
@return ETrue if the property exists, EFalse otherwise |
|
508 |
*/ |
|
509 |
EXPORT_C TBool F32Properties::GetBool(const TDesC8& aSection, const TDesC8& aProperty, TBool& aPropVal) |
|
510 |
{ |
|
511 |
if(!iInitialised) |
|
512 |
{ |
|
513 |
return(EFalse); |
|
514 |
} |
|
515 |
||
516 |
TPtrC8 iniPtr((TUint8*)iRomAddress, iRomLength); |
|
517 |
TIniFileReader iniReader(iniPtr); |
|
518 |
||
519 |
FOREVER |
|
520 |
{ |
|
521 |
// Read the next line of the INI file |
|
522 |
if(iniReader.Next() == KErrEof) |
|
523 |
{ |
|
524 |
break; |
|
525 |
} |
|
526 |
||
527 |
if(iniReader.IsSection(aSection)) |
|
528 |
{ |
|
529 |
// Found the section we're interested in |
|
530 |
// - look for the property, until we get to EOF or the next section |
|
531 |
FOREVER |
|
532 |
{ |
|
533 |
if(iniReader.Next() == KErrEof) |
|
534 |
{ |
|
535 |
return(EFalse); |
|
536 |
} |
|
537 |
if(iniReader.IsSection()) |
|
538 |
{ |
|
539 |
return(EFalse); |
|
540 |
} |
|
541 |
||
542 |
if(iniReader.IsProperty(aProperty, aPropVal)) |
|
543 |
{ |
|
544 |
return(ETrue); |
|
545 |
} |
|
546 |
} |
|
547 |
} |
|
548 |
} |
|
549 |
||
550 |
// No section found... |
|
551 |
return(EFalse); |
|
552 |
} |
|
553 |
||
33
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
554 |
/** |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
555 |
Obtain drive information. This function is called by the default implementation of CFileSystem::DriveInfo(). |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
556 |
@param anInfo out: drive information |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
557 |
@param aDriveNumber drive number |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
558 |
*/ |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
559 |
EXPORT_C void GetDriveInfo(TDriveInfo& anInfo, TInt aDriveNumber) |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
560 |
{ |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
561 |
if(!IsValidLocalDriveMapping(aDriveNumber)) |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
562 |
return; |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
563 |
|
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
564 |
TLocalDriveCapsBuf localDriveCaps; |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
565 |
|
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
566 |
TInt r = KErrNone; |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
567 |
|
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
568 |
// is the drive local? |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
569 |
if (!IsProxyDrive(aDriveNumber)) |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
570 |
{ |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
571 |
// if not valid local drive, use default values in localDriveCaps |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
572 |
// if valid local drive and not locked, use TBusLocalDrive::Caps() values |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
573 |
// if valid drive and locked, hard-code attributes |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
574 |
r = GetLocalDrive(aDriveNumber).Caps(localDriveCaps); |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
575 |
} |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
576 |
else |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
577 |
{ |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
578 |
CExtProxyDrive* pD = GetProxyDrive(aDriveNumber); |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
579 |
__ASSERT_ALWAYS(pD != NULL,User::Panic(_L("GetDriveInfo - pProxyDrive == NULL"), -999)); |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
580 |
r = pD->Caps(localDriveCaps); |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
581 |
} |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
582 |
|
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
583 |
TLocalDriveCaps& caps = localDriveCaps(); |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
584 |
if (r != KErrLocked) |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
585 |
{ |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
586 |
anInfo.iMediaAtt=caps.iMediaAtt; |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
587 |
} |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
588 |
else |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
589 |
{ |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
590 |
anInfo.iMediaAtt = KMediaAttLocked | KMediaAttLockable | KMediaAttHasPassword; |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
591 |
} |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
592 |
|
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
593 |
anInfo.iType=caps.iType; |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
594 |
anInfo.iDriveAtt=caps.iDriveAtt; |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
595 |
anInfo.iConnectionBusType=caps.iConnectionBusType; |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
596 |
} |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
597 |
|
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
598 |
|
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
599 |
|
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
600 |