iaupdate/IAD/engine/controller/src/iaupdateutils.cpp
branchRCL_3
changeset 15 98a43fae6e2b
parent 11 3ba40be8e484
child 25 7333d7932ef7
equal deleted inserted replaced
14:09e5ea190d07 15:98a43fae6e2b
     1 /*
     1 /*
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    20 #include "iaupdateutils.h"
    20 #include "iaupdateutils.h"
    21 
    21 
    22 #include "iaupdateversion.h"
    22 #include "iaupdateversion.h"
    23 #include "iaupdatenode.h"
    23 #include "iaupdatenode.h"
    24 #include "iaupdatebasenode.h"
    24 #include "iaupdatebasenode.h"
       
    25 #include "iaupdatebasenodeimpl.h"
    25 #include "iaupdatefwversionfilehandler.h"
    26 #include "iaupdatefwversionfilehandler.h"
       
    27 #include "iaupdateprotocolconsts.h"
    26 #include "iaupdatedebug.h"
    28 #include "iaupdatedebug.h"
    27 
    29 
    28 #include <swi/sisregistrysession.h>
    30 #include <swi/sisregistrysession.h>
    29 #include <swi/sisregistryentry.h>
    31 #include <swi/sisregistryentry.h>
    30 #include <swi/sisregistrypackage.h>
    32 #include <swi/sisregistrypackage.h>
    38 
    40 
    39 #include <catalogsutils.h>
    41 #include <catalogsutils.h>
    40 #include <widgetregistryclient.h>
    42 #include <widgetregistryclient.h>
    41 
    43 
    42 //Constants
    44 //Constants
    43 const TInt KSpaceMarginal( 100 * 1024 );
       
    44 const TInt KSizeMultiplier( 1 );
       
    45 const TText KVersionSeparator( '.' );
    45 const TText KVersionSeparator( '.' );
       
    46 
       
    47 _LIT( KExe, ".exe" );
       
    48 _LIT( KDll, ".dll" );
    46 
    49 
    47 
    50 
    48 // -----------------------------------------------------------------------------
    51 // -----------------------------------------------------------------------------
    49 // IAUpdateUtils::DesHexToIntL
    52 // IAUpdateUtils::DesHexToIntL
    50 // 
    53 // 
   353     TInt sizeOfBiggest = 0;
   356     TInt sizeOfBiggest = 0;
   354     TInt i = 0;
   357     TInt i = 0;
   355     RFs fs;
   358     RFs fs;
   356     User::LeaveIfError( fs.Connect() );
   359     User::LeaveIfError( fs.Connect() );
   357     CleanupClosePushL( fs );  
   360     CleanupClosePushL( fs );  
       
   361     
       
   362     for ( i = 0; i < aNodes.Count(); ++i )
       
   363         {
       
   364         MIAUpdateNode* node( aNodes[ i ] );
       
   365         MIAUpdateBaseNode& baseNode( node->Base() );
       
   366         if ( baseNode.ContentSizeL() > sizeOfBiggest )
       
   367             {
       
   368             sizeOfBiggest = baseNode.ContentSizeL();
       
   369             }
       
   370         }
       
   371     
   358     TInt64 freeOnC = FreeDiskSpace( fs, EDriveC );
   372     TInt64 freeOnC = FreeDiskSpace( fs, EDriveC );
   359     TInt64 freeOnE = FreeDiskSpace( fs, EDriveE );
   373     TInt64 freeOnE = FreeDiskSpace( fs, EDriveE );
   360 
       
   361     if ( freeOnC >= freeOnE )
       
   362         {
       
   363         for ( i = 0; i < aNodes.Count(); ++i )
       
   364             {
       
   365             MIAUpdateNode* node( aNodes[ i ] );
       
   366             MIAUpdateBaseNode& baseNode( node->Base() );
       
   367             if ( baseNode.ContentSizeL() > sizeOfBiggest )
       
   368                 {
       
   369                 sizeOfBiggest = baseNode.ContentSizeL();
       
   370                 }
       
   371             }
       
   372         }
       
   373   
       
   374 	TDriveUnit driveUnit( EDriveC );
   374 	TDriveUnit driveUnit( EDriveC );
       
   375 	if ( freeOnE > freeOnC )
       
   376 	    {
       
   377 	    driveUnit = EDriveE;
       
   378 	    }
   375 	if ( SysUtil::DiskSpaceBelowCriticalLevelL( &fs, sizeOfBiggest, driveUnit ) ) 
   379 	if ( SysUtil::DiskSpaceBelowCriticalLevelL( &fs, sizeOfBiggest, driveUnit ) ) 
   376 	    { // no space even for package caching
   380 	    { // no space even for package caching
   377 		enoughSpaceFound = EFalse;
   381 		enoughSpaceFound = EFalse;
   378 	    }
   382 	    }
   379 	else
   383 /*	else
   380 	    {
   384 	    {
   381         TInt sizeNeededInDrive = sizeOfBiggest + KSpaceMarginal; //size of the biggest package is included in C drive
   385         TInt sizeNeededInDrive = sizeOfBiggest + KSpaceMarginal; //size of the biggest package is included in C drive
   382         for ( i = 0; i < aNodes.Count() && enoughSpaceFound; ++i )
   386         for ( i = 0; i < aNodes.Count() && enoughSpaceFound; ++i )
   383             {
   387             {
   384             TDriveUnit installedDrive;
   388             TDriveUnit installedDrive;
   385             MIAUpdateNode* node( aNodes[ i ] );
   389             MIAUpdateNode* node( aNodes[ i ] );
   386             MIAUpdateBaseNode& baseNode( node->Base() );
   390             MIAUpdateBaseNode& baseNode( node->Base() );
   387             if ( !IAUpdateUtils::InstalledDriveL( baseNode.Uid(), installedDrive ) )
   391             if ( !IAUpdateUtils::InstalledDriveL( fs, baseNode.Uid(), installedDrive ) )
   388                 { //let's assume that already installed package does not need extra space
   392                 { //let's assume that already installed package does not need extra space
   389         	    sizeNeededInDrive += ( baseNode.ContentSizeL() * KSizeMultiplier );       
   393         	    sizeNeededInDrive += ( baseNode.ContentSizeL() * KSizeMultiplier );       
   390                 if ( SysUtil::DiskSpaceBelowCriticalLevelL( &fs, sizeNeededInDrive, driveUnit ) )
   394                 if ( SysUtil::DiskSpaceBelowCriticalLevelL( &fs, sizeNeededInDrive, driveUnit ) )
   391                     { // not enough space in a drive, try the next internal drive 
   395                     { // not enough space in a drive, try the next internal drive 
   392                     enoughSpaceFound = EFalse;
   396                     enoughSpaceFound = EFalse;
   414              	    //        }    
   418              	    //        }    
   415                     //    }
   419                     //    }
   416                     }
   420                     }
   417         	    }
   421         	    }
   418             }
   422             }
   419         }
   423         }*/
   420     CleanupStack::PopAndDestroy( &fs );
   424     CleanupStack::PopAndDestroy( &fs );
   421     return enoughSpaceFound;
   425     return enoughSpaceFound;
   422     }
   426     }
   423 
   427 
   424 
   428 
   461 // ---------------------------------------------------------------------------
   465 // ---------------------------------------------------------------------------
   462 // IAUpdateUtils::SilentInstallOptionsL
   466 // IAUpdateUtils::SilentInstallOptionsL
   463 // 
   467 // 
   464 // ---------------------------------------------------------------------------
   468 // ---------------------------------------------------------------------------
   465 //
   469 //
   466 EXPORT_C SwiUI::TInstallOptions IAUpdateUtils::SilentInstallOptionsL( 
   470 SwiUI::TInstallOptions IAUpdateUtils::SilentInstallOptionsL(
   467     const TUid& aUid, TInt aSize )
   471     const CIAUpdateBaseNode& aNode )
   468     {
   472     {
       
   473     IAUPDATE_TRACE("[IAUPDATE] IAUpdateUtils::SilentInstallOptionsL() begin");
   469     SwiUI::TInstallOptions options;
   474     SwiUI::TInstallOptions options;
   470 
   475 
   471     // Upgrades are allowed        
   476     // Upgrades are allowed        
   472     options.iUpgrade = SwiUI::EPolicyAllowed;
   477     options.iUpgrade = SwiUI::EPolicyAllowed;
   473 
   478 
   498     
   503     
   499     // This only affects Java applications.
   504     // This only affects Java applications.
   500     options.iDownload = SwiUI::EPolicyAllowed;
   505     options.iDownload = SwiUI::EPolicyAllowed;
   501     
   506     
   502     // Where to save.
   507     // Where to save.
   503     TDriveUnit driveUnit = IAUpdateUtils::DriveToInstallL( aUid, aSize );
   508     IAUPDATE_TRACE("[IAUPDATE] IAUpdateUtils::SilentInstallOptionsL() before DriveToInstallL");
       
   509     TDriveUnit driveUnit;
       
   510     if ( aNode.Mime().Compare( IAUpdateProtocolConsts::KMimeWidget ) == 0 )
       
   511         {
       
   512         driveUnit = IAUpdateUtils::DriveToInstallWidgetL( aNode.Identifier() );
       
   513         }
       
   514     else
       
   515         {
       
   516         driveUnit = IAUpdateUtils::DriveToInstallL( aNode.Uid(), aNode.OwnContentSizeL() );
       
   517         }
       
   518      IAUPDATE_TRACE("[IAUPDATE] IAUpdateUtils::SilentInstallOptionsL() after DriveToInstallL");
       
   519     
   504     TDriveName driveName = driveUnit.Name();
   520     TDriveName driveName = driveUnit.Name();
       
   521     IAUPDATE_TRACE_1("[IAUPDATE] IAUpdateUtils::SilentInstallOptionsL() driveName: %S", &driveName );
   505     options.iDrive = driveName[0];
   522     options.iDrive = driveName[0];
   506     
   523     
   507     // Choose the phone language.
   524     // Choose the phone language.
   508     options.iLang = User::Language();
   525     options.iLang = User::Language();
   509     
   526     
   510     // If language is asked, then use the current phone language.
   527     // If language is asked, then use the current phone language.
   511     options.iUsePhoneLang = ETrue;
   528     options.iUsePhoneLang = ETrue;
   512     
   529     
   513     // Does not affect SISX. This is for Java.
   530     // Does not affect SISX. This is for Java.
   514     options.iUpgradeData = SwiUI::EPolicyAllowed;
   531     options.iUpgradeData = SwiUI::EPolicyAllowed;
   515 
   532     IAUPDATE_TRACE("[IAUPDATE] IAUpdateUtils::SilentInstallOptionsL() end");
   516     return options;
   533     return options;
   517     }
   534     }
   518 
   535 
   519 
   536 
   520 // -----------------------------------------------------------------------------
   537 // -----------------------------------------------------------------------------
   521 // IAUpdateUtils::InstalledDriveL
   538 // IAUpdateUtils::InstalledDriveL
   522 // 
   539 // 
   523 // -----------------------------------------------------------------------------
   540 // -----------------------------------------------------------------------------
   524 // 
   541 // 
   525 TBool IAUpdateUtils::InstalledDriveL( 
   542 TBool IAUpdateUtils::InstalledDriveL(
   526     const TUid& aUid, TDriveUnit& aLocationDrive )
   543     RFs& aFs, const TUid& aUid, TDriveUnit& aLocationDrive )
   527     {
   544     {
       
   545     IAUPDATE_TRACE("[IAUPDATE] IAUpdateUtils::InstalledDriveL() begin");
   528     TBool installed = EFalse;
   546     TBool installed = EFalse;
   529 	Swi::RSisRegistrySession registrySession;
   547 	Swi::RSisRegistrySession registrySession;
   530 	User::LeaveIfError( registrySession.Connect() );
   548 	User::LeaveIfError( registrySession.Connect() );
   531     CleanupClosePushL( registrySession );
   549     CleanupClosePushL( registrySession );
   532     Swi::RSisRegistryEntry entry;
   550     Swi::RSisRegistryEntry entry;
   539         {
   557         {
   540     	CleanupClosePushL( entry );  
   558     	CleanupClosePushL( entry );  
   541         if ( ( !entry.IsInRomL() ) && ( entry.IsPresentL() ) )
   559         if ( ( !entry.IsInRomL() ) && ( entry.IsPresentL() ) )
   542             { //only interested in a drive available for installation just now
   560             { //only interested in a drive available for installation just now
   543             installed = ETrue;
   561             installed = ETrue;
   544     	    TUint drivesMask = entry.InstalledDrivesL();
   562             }
       
   563         
       
   564         if ( !entry.IsInRomL() )
       
   565             {
       
   566             IAUPDATE_TRACE("[IAUPDATE] IAUpdateUtils::InstalledDriveL() entry not in ROM"); 
       
   567      	    TUint drivesMask = entry.InstalledDrivesL();
   545             if( drivesMask )
   568             if( drivesMask )
   546                 {
   569                 {
       
   570                 IAUPDATE_TRACE("[IAUPDATE] IAUpdateUtils::InstalledDriveL() drivesMask exists"); 
   547                 // Select the highest drive as location drive. That's the case when 
   571                 // Select the highest drive as location drive. That's the case when 
   548                 // all installation is not in same drive
   572                 // all installation is not in same drive
       
   573                 TInt driveCount = 0;
   549                 TInt drive = EDriveA;
   574                 TInt drive = EDriveA;
   550                 while( drivesMask >>= 1 )
   575                 while( drivesMask >>= 1 )
   551                     {
   576                     {
       
   577                     driveCount++; 
   552                     drive++;
   578                     drive++;
   553                     }
   579                     }
   554                 aLocationDrive = drive;
   580                 IAUPDATE_TRACE_1("[IAUPDATE] IAUpdateUtils::InstalledDriveL() driveCount: %d", driveCount );
       
   581                 if ( driveCount > 1 )
       
   582                     {
       
   583                     // installation is in multiple drives
       
   584                     // the drive where are binaries (EXEs and DLLs) is chosen
       
   585                     RArray<TInt> drivesWithBinaries; 
       
   586                     CleanupClosePushL( drivesWithBinaries );
       
   587                     DrivesWithBinariesL( entry, drivesWithBinaries ); 
       
   588                     if ( drivesWithBinaries.Count() == 0 )
       
   589                         {
       
   590                         //let's assume the highest drive 
       
   591                         aLocationDrive = drive;
       
   592                         }
       
   593                     else if ( drivesWithBinaries.Count() == 1 )
       
   594                         {
       
   595                         // there are binaries only in one drive, this one is chosen
       
   596                         aLocationDrive = drivesWithBinaries[0];
       
   597                         }
       
   598                     else
       
   599                         {
       
   600                         // there are binaries in multiple drives, C drive is chosen
       
   601                         aLocationDrive = EDriveC;
       
   602                         }
       
   603                     CleanupStack::PopAndDestroy( &drivesWithBinaries );
       
   604                     }
       
   605                 else
       
   606                     {
       
   607                     aLocationDrive = drive;
       
   608                     }
   555                 }
   609                 }
   556             else
   610             else
   557                 {
   611                 {
   558                 // No installed files, select C: as location drive
   612                 // No installed files, select C: as location drive
   559                 aLocationDrive = EDriveC;
   613                 aLocationDrive = EDriveC;
   560                 }
   614                 }
       
   615             IAUPDATE_TRACE_1("[IAUPDATE] IAUpdateUtils::InstalledDriveL() location drive: %d", aLocationDrive.operator int() );
       
   616             // if the drive chosen is physically removable and it's not available, then install to C drive
       
   617             TUint driveStatus = 0;
       
   618             User::LeaveIfError( DriveInfo::GetDriveStatus( aFs, aLocationDrive, driveStatus ) );
       
   619             if  ( driveStatus & DriveInfo::EDriveRemovable )
       
   620                 {
       
   621                 IAUPDATE_TRACE("[IAUPDATE] IAUpdateUtils::InstalledDriveL() removable"); 
       
   622                 }
       
   623             if  ( driveStatus & DriveInfo::EDrivePresent )
       
   624                 {
       
   625                 IAUPDATE_TRACE("[IAUPDATE] IAUpdateUtils::InstalledDriveL() present"); 
       
   626                 }
       
   627             if ( ( driveStatus & DriveInfo::EDriveRemovable ) && ( !(driveStatus & DriveInfo::EDrivePresent) ) )
       
   628                 {
       
   629                 aLocationDrive = EDriveC;
       
   630                 }
   561             }
   631             }
   562         CleanupStack::PopAndDestroy( &entry );
   632         CleanupStack::PopAndDestroy( &entry );
   563         }
   633         }
   564     else
   634     else
   565         {
   635         {
   566         entry.Close();	
   636         entry.Close();	
   567         }
   637         }
   568     
   638     
   569     CleanupStack::PopAndDestroy( &registrySession ); 
   639     CleanupStack::PopAndDestroy( &registrySession ); 
       
   640     IAUPDATE_TRACE_1("[IAUPDATE] IAUpdateUtils::InstalledDriveL() installed: %d", installed );
       
   641     IAUPDATE_TRACE_1("[IAUPDATE] IAUpdateUtils::InstalledDriveL() target drive: %d", aLocationDrive.operator int() );
   570 	return installed;
   642 	return installed;
       
   643     }
       
   644 
       
   645 // -----------------------------------------------------------------------------
       
   646 // IAUpdateUtils::InstalledDriveWidgetL
       
   647 // 
       
   648 // -----------------------------------------------------------------------------
       
   649 // 
       
   650 void IAUpdateUtils::InstalledDriveWidgetL( RFs& aFs, 
       
   651                                            RWidgetRegistryClientSession& aWidgetRegistry, 
       
   652                                            const TUid& aUid, 
       
   653                                            TDriveUnit& aLocationDrive )
       
   654     {
       
   655     IAUPDATE_TRACE("[IAUPDATE] IAUpdateUtils::InstalledDriveWidgetL() begin");
       
   656     TFileName widgetPath;
       
   657     aWidgetRegistry.GetWidgetPath( aUid, widgetPath );
       
   658     aLocationDrive = widgetPath.Mid( 0, 2 );
       
   659     IAUPDATE_TRACE_1("[IAUPDATE] IAUpdateUtils::InstalledDriveWidgetL() Drive in registry: %S", &aLocationDrive.Name() );
       
   660     if ( aLocationDrive == EDriveZ )
       
   661         {
       
   662         // if the installation is in ROM, then install to C drive
       
   663         aLocationDrive = EDriveC;
       
   664         IAUPDATE_TRACE("[IAUPDATE] IAUpdateUtils::InstalledDriveWidgetL() Exists in ROM, install to C:");
       
   665         }
       
   666     else
       
   667         {
       
   668         TUint driveStatus = 0;
       
   669         User::LeaveIfError( DriveInfo::GetDriveStatus( aFs, aLocationDrive, driveStatus ) );
       
   670         // if the installation drive physically removable and it's not available, then install to C drive
       
   671         if ( ( driveStatus & DriveInfo::EDriveRemovable ) && ( !(driveStatus & DriveInfo::EDrivePresent) ) )
       
   672             {
       
   673             aLocationDrive = EDriveC;
       
   674             IAUPDATE_TRACE("[IAUPDATE] IAUpdateUtils::InstalledDriveWidgetL() Physically removable drive not present, install to C:");
       
   675             }
       
   676         }
       
   677     IAUPDATE_TRACE("[IAUPDATE] IAUpdateUtils::InstalledDriveWidgetL() begin");
   571     }
   678     }
   572 
   679 
   573 
   680 
   574 // -----------------------------------------------------------------------------
   681 // -----------------------------------------------------------------------------
   575 // IAUpdateUtils::NextInternalDriveL
   682 // IAUpdateUtils::NextInternalDriveL
   613 // -----------------------------------------------------------------------------
   720 // -----------------------------------------------------------------------------
   614 // IAUpdateUtils::DriveToInstallL
   721 // IAUpdateUtils::DriveToInstallL
   615 // 
   722 // 
   616 // -----------------------------------------------------------------------------
   723 // -----------------------------------------------------------------------------
   617 //   
   724 //   
   618 TDriveUnit IAUpdateUtils::DriveToInstallL( const TUid& /*aUid*/, TInt /*aSize*/ )
   725 TDriveUnit IAUpdateUtils::DriveToInstallL( const TUid& aUid, TInt /*aSize*/ )
   619     {
   726     {
   620     
   727     IAUPDATE_TRACE("[IAUPDATE] IAUpdateUtils::DriveToInstallL() begin");
   621 	/*TDriveUnit preferredDriveUnit;
   728 	/*TDriveUnit preferredDriveUnit;
   622 	TDriveUnit targetDriveUnit( EDriveC );
   729 	TDriveUnit targetDriveUnit( EDriveC );
   623 	//preferred drive is same as a drive of previous installation
   730 	//preferred drive is same as a drive of previous installation
   624 	if ( !InstalledDriveL( aUid, preferredDriveUnit ) )
   731 	if ( !InstalledDriveL( aUid, preferredDriveUnit ) )
   625 	    {
   732 	    {
   633 		if ( !InternalDriveWithSpaceL( aSize * KSizeMultiplier, preferredDriveUnit, targetDriveUnit ) )
   740 		if ( !InternalDriveWithSpaceL( aSize * KSizeMultiplier, preferredDriveUnit, targetDriveUnit ) )
   634 		    { //no space with estimated size, let's try to preferred drive
   741 		    { //no space with estimated size, let's try to preferred drive
   635 			targetDriveUnit = preferredDriveUnit;
   742 			targetDriveUnit = preferredDriveUnit;
   636 		    }
   743 		    }
   637 	    }*/
   744 	    }*/
   638 	    
   745 	
   639 	// installation drive is alvays "C"
   746     RFs fs;
       
   747     User::LeaveIfError( fs.Connect() );
       
   748     CleanupClosePushL( fs );  
   640     TDriveUnit targetDriveUnit( EDriveC );
   749     TDriveUnit targetDriveUnit( EDriveC );
       
   750     InstalledDriveL( fs, aUid, targetDriveUnit );
       
   751     CleanupStack::PopAndDestroy( &fs );
       
   752     IAUPDATE_TRACE("[IAUPDATE] IAUpdateUtils::DriveToInstallL() end");
   641     return targetDriveUnit;
   753     return targetDriveUnit;
   642     }
   754     }
       
   755 
       
   756 // -----------------------------------------------------------------------------
       
   757 // IAUpdateUtils::DriveToInstallWidgetL
       
   758 // 
       
   759 // -----------------------------------------------------------------------------
       
   760 //   
       
   761 TDriveUnit IAUpdateUtils::DriveToInstallWidgetL( const TDesC& aIdentifier )
       
   762     {
       
   763     IAUPDATE_TRACE("[IAUPDATE] IAUpdateUtils::DriveToInstallWidgetL() begin");
       
   764     IAUPDATE_TRACE_1("[IAUPDATE] IAUpdateUtils::DriveToInstallWidgetL() identifier: %S", &aIdentifier );
       
   765     TDriveUnit targetDriveUnit( EDriveC );
       
   766     RWidgetRegistryClientSession widgetRegistry;
       
   767 
       
   768     User::LeaveIfError( widgetRegistry.Connect() );
       
   769         
       
   770     CleanupClosePushL( widgetRegistry );
       
   771         
       
   772     RPointerArray<CWidgetInfo> widgetInfoArr;
       
   773     CleanupResetAndDestroyPushL( widgetInfoArr );
       
   774     TInt err = widgetRegistry.InstalledWidgetsL(widgetInfoArr); 
       
   775     
       
   776     TBool foundInRegistry( EFalse );
       
   777     for( TInt i( widgetInfoArr.Count() - 1 ); !foundInRegistry && i >= 0; --i ) 
       
   778         {
       
   779         CWidgetInfo* widgetInfo( widgetInfoArr[i] );  
       
   780             
       
   781         CWidgetPropertyValue* BundleId = widgetRegistry.GetWidgetPropertyValueL(widgetInfo->iUid, EBundleIdentifier );
       
   782         CleanupStack::PushL( BundleId );
       
   783             
       
   784         if( aIdentifier.Compare( *(BundleId->iValue.s) )== 0 )
       
   785             {
       
   786             IAUPDATE_TRACE("[IAUPDATE] IAUpdateUtils::DriveToInstallWidgetL() Found in registry");
       
   787             foundInRegistry = ETrue;
       
   788             RFs fs;
       
   789             User::LeaveIfError( fs.Connect() );
       
   790             CleanupClosePushL( fs );
       
   791             InstalledDriveWidgetL( fs, widgetRegistry, widgetInfo->iUid, targetDriveUnit );
       
   792             CleanupStack::PopAndDestroy( &fs );
       
   793             }
       
   794         CleanupStack::PopAndDestroy( BundleId );
       
   795         }
       
   796         
       
   797     CleanupStack::PopAndDestroy( &widgetInfoArr );
       
   798     CleanupStack::PopAndDestroy( &widgetRegistry);
       
   799     IAUPDATE_TRACE("[IAUPDATE] IAUpdateUtils::DriveToInstallWidgetL() end");
       
   800     return targetDriveUnit;
       
   801     }
       
   802 
   643 
   803 
   644 
   804 
   645 // -----------------------------------------------------------------------------
   805 // -----------------------------------------------------------------------------
   646 // IAUpdateUtils::BiggestInternalDriveL
   806 // IAUpdateUtils::BiggestInternalDriveL
   647 // 
   807 // 
   824                     aDriveNumber, freeSpace / 1024 );
   984                     aDriveNumber, freeSpace / 1024 );
   825     
   985     
   826     IAUPDATE_TRACE("[IAUPDATE] IAUpdateUtils::FreeDiskSpace() end");
   986     IAUPDATE_TRACE("[IAUPDATE] IAUpdateUtils::FreeDiskSpace() end");
   827     return freeSpace;
   987     return freeSpace;
   828     }  
   988     }  
   829     
   989 
   830 
   990 // ---------------------------------------------------------------------------
   831 
   991 // IAUpdateUtils::DrivesWithBinariesL
       
   992 // ---------------------------------------------------------------------------
       
   993 //
       
   994 void IAUpdateUtils::DrivesWithBinariesL( Swi::RSisRegistryEntry& aEntry, RArray<TInt>& aDrives )
       
   995     {
       
   996     IAUPDATE_TRACE("[IAUPDATE] IAUpdateUtils::DrivesWithBinariesL() begin");
       
   997     RPointerArray<HBufC> files; 
       
   998     aEntry.FilesL( files );
       
   999     IAUPDATE_TRACE_1("[IAUPDATE] IAUpdateUtils::DrivesWithBinariesL() file count: %d", files.Count() );
       
  1000     for( TInt i = 0; i < files.Count(); i++)
       
  1001         {
       
  1002         TFileName fullName = *files[i]; 
       
  1003         IAUPDATE_TRACE_1("[IAUPDATE] IAUpdateUtils::DrivesWithBinariesL() fullname: %S", &fullName);
       
  1004         TParse parse;
       
  1005         parse.Set( fullName, NULL, NULL);    
       
  1006         IAUPDATE_TRACE_1("[IAUPDATE] IAUpdateUtils::DrivesWithBinariesL() extension: %S", &parse.Ext());
       
  1007         if ( parse.Ext().CompareF( KExe() ) == 0  || parse.Ext().CompareF( KDll() ) == 0 )
       
  1008             {
       
  1009             IAUPDATE_TRACE("[IAUPDATE] IAUpdateUtils::DrivesWithBinariesL() EXE or DLL found");
       
  1010             TDriveUnit driveUnit( parse.Drive() );
       
  1011             TInt driveInt = driveUnit;
       
  1012             IAUPDATE_TRACE_1("[IAUPDATE] IAUpdateUtils::DrivesWithBinariesL() driveInt: %d", driveInt );
       
  1013             TBool driveExistInList = EFalse;
       
  1014             for( TInt j = 0; !driveExistInList && j < aDrives.Count(); j++)
       
  1015                 {
       
  1016                 if ( driveInt == aDrives[j])
       
  1017                     {
       
  1018                     driveExistInList = ETrue;
       
  1019                     }
       
  1020                 }
       
  1021             if ( !driveExistInList )
       
  1022                 {
       
  1023                 TInt ret = aDrives.Append(driveInt);
       
  1024                 if ( ret != KErrNone )
       
  1025                     {
       
  1026                     files.ResetAndDestroy(); 
       
  1027                     User::Leave( ret );
       
  1028                     }
       
  1029                 IAUPDATE_TRACE_1("[IAUPDATE] IAUpdateUtils::DrivesWithBinariesL() drive added to list: %d", driveInt );
       
  1030                 }
       
  1031             }
       
  1032         }
       
  1033     files.ResetAndDestroy(); 
       
  1034     IAUPDATE_TRACE("[IAUPDATE] IAUpdateUtils::DrivesWithBinariesL() end");
       
  1035     }