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