userlibandfileserver/fileserver/sfat32/sl_drv.cpp
changeset 33 0173bcd7697c
parent 15 4122176ea935
child 62 4a8fed1c0ef6
equal deleted inserted replaced
31:56f325a607ea 33:0173bcd7697c
    23 
    23 
    24 
    24 
    25 //---------------------------------------------------------------------------------------------------------------------------------------
    25 //---------------------------------------------------------------------------------------------------------------------------------------
    26 
    26 
    27 
    27 
    28 TFatDriveInterface::TFatDriveInterface() 
    28 TDriveInterface::TDriveInterface() 
    29                    :iMount(NULL)
    29                    :iMount(NULL)
    30 {
    30 {
    31 }
    31 }
    32 
    32 
    33 /**
    33 /**
    34     Initialise the interface object.
    34     Initialise the interface object.
    35     @param  aMount the CFatMountCB that owns this object
    35     @param  aMount the CFatMountCB that owns this object
    36 */
    36 */
    37 TBool TFatDriveInterface::Init(CFatMountCB* aMount)
    37 TBool TDriveInterface::Init(CFatMountCB* aMount)
    38 {
    38 {
    39     ASSERT(aMount);
    39     ASSERT(aMount);
    40     iMount = aMount;
    40     iMount = aMount;
    41 	aMount->LocalDrive()->SetMount(aMount);
    41 	aMount->LocalDrive()->SetMount(aMount);
    42     return iProxyDrive.Init(aMount->LocalDrive());
    42     return iProxyDrive.Init(aMount->LocalDrive());
    43 }
    43 }
    44 
    44 
    45 /**
    45 /**
    46     pseudo-destructor. 
    46     pseudo-destructor. 
    47 */
    47 */
    48 void TFatDriveInterface::Close()
    48 void TDriveInterface::Close()
    49 {
    49 {
    50 	 if(iMount)
    50 	 if(iMount)
    51 		iMount->LocalDrive()->SetMount(NULL);
    51 		iMount->LocalDrive()->SetMount(NULL);
    52      iMount = NULL;
    52      iMount = NULL;
    53 }
    53 }
    66     @return KErrNotReady - non-critical error
    66     @return KErrNotReady - non-critical error
    67     @return KErrCorrupt - an illegal write is detected
    67     @return KErrCorrupt - an illegal write is detected
    68     @return KErrBadPower - failure due to low power
    68     @return KErrBadPower - failure due to low power
    69 
    69 
    70 */
    70 */
    71 TInt TFatDriveInterface::ReadNonCritical(TInt64 aPos, TInt aLength, TDes8& aTrg) const
    71 TInt TDriveInterface::ReadNonCritical(TInt64 aPos, TInt aLength, TDes8& aTrg) const
    72 {
    72 {
    73     TInt nRes = KErrNone;
    73     TInt nRes = KErrNone;
    74     TInt cntRetry = KMaxRecoverableRetries;
    74     TInt cntRetry = KMaxRecoverableRetries;
    75 
    75 
    76     //__PRINT2(_L("#=+++ Read_nc1: pos:%LU, len:%u"), aPos, aLength);
    76     //__PRINT2(_L("#=+++ Read_nc1: pos:%LU, len:%u"), aPos, aLength);
    79     {
    79     {
    80         nRes = iProxyDrive.Read(aPos,aLength,aTrg);
    80         nRes = iProxyDrive.Read(aPos,aLength,aTrg);
    81         if (nRes==KErrNone)
    81         if (nRes==KErrNone)
    82             break;
    82             break;
    83 
    83 
    84         __PRINT4(_L("TFatDriveInterface::ReadNonCritical() failure! drv:%d Posl=%LU len=%d retval=%d"), iMount->DriveNumber(), aPos, aLength, nRes);
    84         __PRINT4(_L("TDriveInterface::ReadNonCritical() failure! drv:%d Posl=%LU len=%d retval=%d"), iMount->DriveNumber(), aPos, aLength, nRes);
    85         
    85         
    86         if(--cntRetry <= 0)
    86         if(--cntRetry <= 0)
    87         {
    87         {
    88             nRes = KErrCorrupt;
    88             nRes = KErrCorrupt;
    89             break;
    89             break;
   113     @return KErrNotReady - non-critical error
   113     @return KErrNotReady - non-critical error
   114     @return KErrCorrupt - an illegal write is detected
   114     @return KErrCorrupt - an illegal write is detected
   115     @return KErrBadPower - failure due to low power
   115     @return KErrBadPower - failure due to low power
   116 
   116 
   117 */
   117 */
   118 TInt TFatDriveInterface::ReadNonCritical(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset) const
   118 TInt TDriveInterface::ReadNonCritical(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset) const
   119 {
   119 {
   120     //__PRINT2(_L("#=+++ Read_nc2: pos:%LU, len:%u"), aPos, aLength);
   120     //__PRINT2(_L("#=+++ Read_nc2: pos:%LU, len:%u"), aPos, aLength);
   121 
   121 
   122     TInt nRes = KErrNone;
   122     TInt nRes = KErrNone;
   123     TInt cntRetry = KMaxRecoverableRetries;
   123     TInt cntRetry = KMaxRecoverableRetries;
   126     {
   126     {
   127         nRes = iProxyDrive.Read(aPos, aLength, aTrg, aMessage, anOffset);
   127         nRes = iProxyDrive.Read(aPos, aLength, aTrg, aMessage, anOffset);
   128         if (nRes==KErrNone)
   128         if (nRes==KErrNone)
   129             break;
   129             break;
   130 
   130 
   131         __PRINT4(_L("TFatDriveInterface::ReadNonCritical() Failure! drv:%d aPosl=%d len=%d anOffset=%d"), iMount->DriveNumber(), aPos,aLength, anOffset);
   131         __PRINT4(_L("TDriveInterface::ReadNonCritical() Failure! drv:%d aPosl=%d len=%d anOffset=%d"), iMount->DriveNumber(), aPos,aLength, anOffset);
   132         
   132         
   133         if(--cntRetry <= 0)
   133         if(--cntRetry <= 0)
   134         {
   134         {
   135             nRes = KErrCorrupt;
   135             nRes = KErrCorrupt;
   136             break;
   136             break;
   157     @return KErrNone - success
   157     @return KErrNone - success
   158     @return KErrNotReady - non-critical error
   158     @return KErrNotReady - non-critical error
   159     @return KErrCorrupt - an illegal write is detected
   159     @return KErrCorrupt - an illegal write is detected
   160     @return KErrAbort - user aborted read
   160     @return KErrAbort - user aborted read
   161 */
   161 */
   162 TInt TFatDriveInterface::ReadCritical(TInt64 aPos,TInt aLength,TDes8& aTrg) const
   162 TInt TDriveInterface::ReadCritical(TInt64 aPos,TInt aLength,TDes8& aTrg) const
   163 {
   163 {
   164     //__PRINT2(_L("#=+++ Read_C: pos:%LU, len:%u"), aPos, aLength);
   164     //__PRINT2(_L("#=+++ Read_C: pos:%LU, len:%u"), aPos, aLength);
   165 
   165 
   166     TInt nRes = KErrNone;
   166     TInt nRes = KErrNone;
   167 
   167 
   169     {
   169     {
   170         nRes = iProxyDrive.Read(aPos, aLength, aTrg);
   170         nRes = iProxyDrive.Read(aPos, aLength, aTrg);
   171 		if(nRes == KErrNone)
   171 		if(nRes == KErrNone)
   172             break;
   172             break;
   173 
   173 
   174 		__PRINT4(_L("TFatDriveInterface::ReadCritical() Error! drv:%d Posl=%LU len=%d retval=%d"), iMount->DriveNumber(), aPos, aLength, nRes);
   174 		__PRINT4(_L("TDriveInterface::ReadCritical() Error! drv:%d Posl=%LU len=%d retval=%d"), iMount->DriveNumber(), aPos, aLength, nRes);
   175 		
   175 		
   176         nRes=HandleCriticalError(nRes);
   176         nRes=HandleCriticalError(nRes);
   177 		if (nRes != ERetry)
   177 		if (nRes != ERetry)
   178             break;
   178             break;
   179     }
   179     }
   196     @return KErrNotReady - non-critical error
   196     @return KErrNotReady - non-critical error
   197     @return KErrBadPower - write not attempted due to low batteries
   197     @return KErrBadPower - write not attempted due to low batteries
   198     @return KErrCorrupt - an illegal write is detected
   198     @return KErrCorrupt - an illegal write is detected
   199     @return KErrAccessDenied - write to protected media
   199     @return KErrAccessDenied - write to protected media
   200 */
   200 */
   201 TInt TFatDriveInterface::WriteNonCritical(TInt64 aPos, TInt aLength, const TAny* aSrc, const RMessagePtr2 &aMessage, TInt anOffset)
   201 TInt TDriveInterface::WriteNonCritical(TInt64 aPos, TInt aLength, const TAny* aSrc, const RMessagePtr2 &aMessage, TInt anOffset)
   202 {
   202 {
   203     //__PRINT2(_L("#=+++ Write_NC: pos:%LU, len:%u"), aPos, aLength);
   203     //__PRINT2(_L("#=+++ Write_NC: pos:%LU, len:%u"), aPos, aLength);
   204 
   204 
   205     
   205     
   206     TInt nRes = KErrNone;
   206     TInt nRes = KErrNone;
   211         iMount->OpenMountForWrite(); //-- make a callback to CFatMountCB to perform some actions on 1st write.
   211         iMount->OpenMountForWrite(); //-- make a callback to CFatMountCB to perform some actions on 1st write.
   212         nRes = iProxyDrive.Write(aPos, aLength, aSrc, aMessage, anOffset);
   212         nRes = iProxyDrive.Write(aPos, aLength, aSrc, aMessage, anOffset);
   213         if (nRes==KErrNone)
   213         if (nRes==KErrNone)
   214             break;
   214             break;
   215 
   215 
   216         __PRINT4(_L("TFatDriveInterface::WriteNonCritical() failure! drv:%d, Pos=%LU len=%d anOffset=%d"), iMount->DriveNumber(), aPos, aLength, anOffset);
   216         __PRINT4(_L("TDriveInterface::WriteNonCritical() failure! drv:%d, Pos=%LU len=%d anOffset=%d"), iMount->DriveNumber(), aPos, aLength, anOffset);
   217         
   217         
   218         if(--cntRetry <= 0)
   218         if(--cntRetry <= 0)
   219         {
   219         {
   220             nRes = KErrCorrupt;
   220             nRes = KErrCorrupt;
   221             break;
   221             break;
   244     @return KErrNotReady - non-critical error
   244     @return KErrNotReady - non-critical error
   245     @return KErrBadPower - write not attempted due to low batteries
   245     @return KErrBadPower - write not attempted due to low batteries
   246     @return KErrCorrupt - an illegal write is detected
   246     @return KErrCorrupt - an illegal write is detected
   247     @return KErrAccessDenied - write to protected media
   247     @return KErrAccessDenied - write to protected media
   248 */
   248 */
   249 TInt TFatDriveInterface::WriteCritical(TInt64 aPos, const TDesC8& aSrc)
   249 TInt TDriveInterface::WriteCritical(TInt64 aPos, const TDesC8& aSrc)
   250 {
   250 {
   251     //__PRINT2(_L("#=+++ Write_C: pos:%LU, len:%u"), aPos, aSrc.Length());
   251     //__PRINT2(_L("#=+++ Write_C: pos:%LU, len:%u"), aPos, aSrc.Length());
   252 
   252 
   253     TInt nRes = KErrNone;
   253     TInt nRes = KErrNone;
   254 
   254 
   280                 
   280                 
   281                 iMount->InvalidateLeafDirCache();
   281                 iMount->InvalidateLeafDirCache();
   282 
   282 
   283                 nRes = iMount->WriteFailError(); 
   283                 nRes = iMount->WriteFailError(); 
   284                 simulatedWriteFailure = ETrue; //-- won't perform actual write later
   284                 simulatedWriteFailure = ETrue; //-- won't perform actual write later
   285                 __PRINT4(_L("TFatDriveInterface::WriteCritical() Simulating write failure. drv:%d, aPos=%LU len=%d Code=%d"), iMount->DriveNumber(), aPos,aSrc.Length(),nRes);
   285                 __PRINT4(_L("TDriveInterface::WriteCritical() Simulating write failure. drv:%d, aPos=%LU len=%d Code=%d"), iMount->DriveNumber(), aPos,aSrc.Length(),nRes);
   286 
   286 
   287 			}
   287 			}
   288 		}
   288 		}
   289     }//if(iMount->IsWriteFail())
   289     }//if(iMount->IsWriteFail())
   290 
   290 
   301 			    if (nRes==KErrNone)
   301 			    if (nRes==KErrNone)
   302                     return nRes;
   302                     return nRes;
   303 		    }
   303 		    }
   304 
   304 
   305             //-- write error occured
   305             //-- write error occured
   306             __PRINT4(_L("TFatDriveInterface::WriteCritical() failure! drv:%d, aPos=%LU len=%d retval=%d"), iMount->DriveNumber(), aPos,aSrc.Length(),nRes);
   306             __PRINT4(_L("TDriveInterface::WriteCritical() failure! drv:%d, aPos=%LU len=%d retval=%d"), iMount->DriveNumber(), aPos,aSrc.Length(),nRes);
   307 
   307 
   308             nRes=HandleCriticalError(nRes);
   308             nRes=HandleCriticalError(nRes);
   309             if (nRes!=ERetry)
   309             if (nRes!=ERetry)
   310                 break;
   310                 break;
   311 
   311 
   322         
   322         
   323     @param  aErrorInfo data descriptor for the error info.
   323     @param  aErrorInfo data descriptor for the error info.
   324     @return KErrNone - success, interrogate aErrorInfo for further info
   324     @return KErrNone - success, interrogate aErrorInfo for further info
   325     @return KErrNotSupported - media driver does not support
   325     @return KErrNotSupported - media driver does not support
   326 */
   326 */
   327 TInt TFatDriveInterface::GetLastErrorInfo(TDes8& aErrorInfo) const
   327 TInt TDriveInterface::GetLastErrorInfo(TDes8& aErrorInfo) const
   328 {
   328 {
   329     return iProxyDrive.GetLastErrorInfo(aErrorInfo);
   329     return iProxyDrive.GetLastErrorInfo(aErrorInfo);
   330 }
   330 }
   331 
   331 
   332 
   332 
   340     @return ERetry - Attempt operation again
   340     @return ERetry - Attempt operation again
   341     @return KErrAbort - User aborted notifier
   341     @return KErrAbort - User aborted notifier
   342     @return KErrAccessDenied - media is read only
   342     @return KErrAccessDenied - media is read only
   343     @return KErrCorrupt - cf-card is corrupt
   343     @return KErrCorrupt - cf-card is corrupt
   344 */
   344 */
   345 TInt TFatDriveInterface::HandleCriticalError(TInt aResult) const
   345 TInt TDriveInterface::HandleCriticalError(TInt aResult) const
   346 	{
   346 	{
   347     __PRINT2(_L("TFatDriveInterface::HandleCriticalError drv:%d, code:%d"), iMount->DriveNumber(),aResult);
   347     __PRINT2(_L("TDriveInterface::HandleCriticalError drv:%d, code:%d"), iMount->DriveNumber(),aResult);
   348 
   348 
   349 	TLocaleMessage line1;
   349 	TLocaleMessage line1;
   350 	TLocaleMessage line2;
   350 	TLocaleMessage line2;
   351 
   351 
   352 	TInt r=KErrAbort;
   352 	TInt r=KErrAbort;
   454     @return ERetry - retry write
   454     @return ERetry - retry write
   455     @return KErrCorrupt - media is corrupt
   455     @return KErrCorrupt - media is corrupt
   456     @return KErrBadPower - low power failure
   456     @return KErrBadPower - low power failure
   457     @return KErrNotReady - non-critical error
   457     @return KErrNotReady - non-critical error
   458 */
   458 */
   459 TInt TFatDriveInterface::HandleRecoverableError(TInt aResult) const
   459 TInt TDriveInterface::HandleRecoverableError(TInt aResult) const
   460 	{
   460 	{
   461 	__PRINT2(_L("TFatDriveInterface::HandleRecoverableError drv:%d, code:%d"), iMount->DriveNumber(),aResult);
   461 	__PRINT2(_L("TDriveInterface::HandleRecoverableError drv:%d, code:%d"), iMount->DriveNumber(),aResult);
   462 
   462 
   463 	if (aResult==KErrAccessDenied)
   463 	if (aResult==KErrAccessDenied)
   464 		return(KErrAccessDenied);
   464 		return(KErrAccessDenied);
   465 	if (aResult == KErrLocked)
   465 	if (aResult == KErrLocked)
   466 		return KErrLocked;
   466 		return KErrLocked;
   484 		}
   484 		}
   485 	return(ERetry);
   485 	return(ERetry);
   486 	}	
   486 	}	
   487 
   487 
   488 /** @return true if the mount can be remounted for a recoverable error */
   488 /** @return true if the mount can be remounted for a recoverable error */
   489 TBool TFatDriveInterface::IsRecoverableRemount() const
   489 TBool TDriveInterface::IsRecoverableRemount() const
   490 	{
   490 	{
   491 	if(IsDriveWriteProtected()&&(iMount->Drive().IsWriteableResource()||iMount->Drive().IsCurrentWriteFunction()))
   491 	if(IsDriveWriteProtected()&&(iMount->Drive().IsWriteableResource()||iMount->Drive().IsCurrentWriteFunction()))
   492 		return(EFalse);
   492 		return(EFalse);
   493 	return(ETrue);
   493 	return(ETrue);
   494 	}
   494 	}
   495 
   495 
   496 /** return true if the media is write protected */
   496 /** return true if the media is write protected */
   497 TBool TFatDriveInterface::IsDriveWriteProtected() const
   497 TBool TDriveInterface::IsDriveWriteProtected() const
   498 	{
   498 	{
   499 	TLocalDriveCapsV2Buf localDriveCaps;
   499 	TLocalDriveCapsV2Buf localDriveCaps;
   500     TInt r=iProxyDrive.Caps(localDriveCaps);
   500     TInt r=iProxyDrive.Caps(localDriveCaps);
   501 
   501 
   502 	if(r!=KErrNone)
   502 	if(r!=KErrNone)
   507 
   507 
   508 
   508 
   509 
   509 
   510 //---------------------------------------------------------------------------------------------------------------------------------------
   510 //---------------------------------------------------------------------------------------------------------------------------------------
   511 
   511 
   512 TFatDriveInterface::XProxyDriveWrapper::XProxyDriveWrapper() 
   512 TDriveInterface::XProxyDriveWrapper::XProxyDriveWrapper() 
   513                    :iLocalDrive(0) 
   513                    :iLocalDrive(0) 
   514 {
   514 {
   515     TInt nRes = iLock.CreateLocal();
   515     TInt nRes = iLock.CreateLocal();
   516     ASSERT(nRes == KErrNone);
   516     ASSERT(nRes == KErrNone);
   517     (void)nRes; 
   517     (void)nRes; 
   518 }
   518 }
   519 
   519 
   520 
   520 
   521 TFatDriveInterface::XProxyDriveWrapper::~XProxyDriveWrapper() 
   521 TDriveInterface::XProxyDriveWrapper::~XProxyDriveWrapper() 
   522 {
   522 {
   523     iLock.Close();
   523     iLock.Close();
   524 }
   524 }
   525 
   525 
   526 /** 
   526 /** 
   527     Initialise interface wrapper.
   527     Initialise interface wrapper.
   528     @param  aProxyDrive pointer to the raw drive access interface
   528     @param  aProxyDrive pointer to the raw drive access interface
   529     @return true on success
   529     @return true on success
   530 */
   530 */
   531 TBool TFatDriveInterface::XProxyDriveWrapper::Init(CProxyDrive* aProxyDrive) 
   531 TBool TDriveInterface::XProxyDriveWrapper::Init(CProxyDrive* aProxyDrive) 
   532 {
   532 {
   533     ASSERT(aProxyDrive);
   533     ASSERT(aProxyDrive);
   534     if(!iLock.Handle()) //-- the mutex must have been created by constructor
   534     if(!iLock.Handle()) //-- the mutex must have been created by constructor
   535         return EFalse;
   535         return EFalse;
   536     
   536     
   537     iLocalDrive = aProxyDrive;
   537     iLocalDrive = aProxyDrive;
   538     return ETrue;
   538     return ETrue;
   539 }
   539 }
   540 
   540 
   541 //-- see original TFatDriveInterface methods
   541 //-- see original TDriveInterface methods
   542 
   542 
   543 TInt TFatDriveInterface::XProxyDriveWrapper::Read(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset) const
   543 TInt TDriveInterface::XProxyDriveWrapper::Read(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset) const
   544 {
   544 {
   545     EnterCriticalSection();
   545     EnterCriticalSection();
   546     TInt nRes = iLocalDrive->Read(aPos, aLength, aTrg, aMessage.Handle(), anOffset);
   546     TInt nRes = iLocalDrive->Read(aPos, aLength, aTrg, aMessage.Handle(), anOffset);
   547     LeaveCriticalSection();
   547     LeaveCriticalSection();
   548     return nRes;
   548     return nRes;
   549 }
   549 }
   550        
   550        
   551 TInt TFatDriveInterface::XProxyDriveWrapper::Read(TInt64 aPos,TInt aLength,TDes8& aTrg) const
   551 TInt TDriveInterface::XProxyDriveWrapper::Read(TInt64 aPos,TInt aLength,TDes8& aTrg) const
   552 {
   552 {
   553     EnterCriticalSection();
   553     EnterCriticalSection();
   554     TInt nRes = iLocalDrive->Read(aPos, aLength, aTrg);
   554     TInt nRes = iLocalDrive->Read(aPos, aLength, aTrg);
   555     LeaveCriticalSection();
   555     LeaveCriticalSection();
   556     return nRes;
   556     return nRes;
   557 }
   557 }
   558 
   558 
   559 TInt TFatDriveInterface::XProxyDriveWrapper::Write(TInt64 aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2 &aMessage,TInt anOffset)
   559 TInt TDriveInterface::XProxyDriveWrapper::Write(TInt64 aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2 &aMessage,TInt anOffset)
   560 {
   560 {
   561     EnterCriticalSection();
   561     EnterCriticalSection();
   562     TInt nRes = iLocalDrive->Write(aPos, aLength, aSrc, aMessage.Handle(), anOffset);
   562     TInt nRes = iLocalDrive->Write(aPos, aLength, aSrc, aMessage.Handle(), anOffset);
   563     LeaveCriticalSection();
   563     LeaveCriticalSection();
   564     return nRes;
   564     return nRes;
   565 }
   565 }
   566 
   566 
   567 TInt TFatDriveInterface::XProxyDriveWrapper::Write(TInt64 aPos, const TDesC8& aSrc)
   567 TInt TDriveInterface::XProxyDriveWrapper::Write(TInt64 aPos, const TDesC8& aSrc)
   568 {
   568 {
   569     EnterCriticalSection();
   569     EnterCriticalSection();
   570     TInt nRes = iLocalDrive->Write(aPos, aSrc);
   570     TInt nRes = iLocalDrive->Write(aPos, aSrc);
   571     LeaveCriticalSection();
   571     LeaveCriticalSection();
   572     return nRes;
   572     return nRes;
   573 }
   573 }
   574 
   574 
   575 TInt TFatDriveInterface::XProxyDriveWrapper::GetLastErrorInfo(TDes8& aErrorInfo) const
   575 TInt TDriveInterface::XProxyDriveWrapper::GetLastErrorInfo(TDes8& aErrorInfo) const
   576 {
   576 {
   577     EnterCriticalSection();
   577     EnterCriticalSection();
   578     TInt nRes = iLocalDrive->GetLastErrorInfo(aErrorInfo);
   578     TInt nRes = iLocalDrive->GetLastErrorInfo(aErrorInfo);
   579     LeaveCriticalSection();
   579     LeaveCriticalSection();
   580     return nRes;
   580     return nRes;
   581 }
   581 }
   582 
   582 
   583 TInt TFatDriveInterface::XProxyDriveWrapper::Caps(TDes8& anInfo) const
   583 TInt TDriveInterface::XProxyDriveWrapper::Caps(TDes8& anInfo) const
   584 {
   584 {
   585     EnterCriticalSection();
   585     EnterCriticalSection();
   586     TInt nRes = iLocalDrive->Caps(anInfo);
   586     TInt nRes = iLocalDrive->Caps(anInfo);
   587     LeaveCriticalSection();
   587     LeaveCriticalSection();
   588     return nRes;
   588     return nRes;