appinstaller/AppinstUi/startuplistupdater/src/startuplistupdater.cpp
branchRCL_3
changeset 25 7333d7932ef7
equal deleted inserted replaced
24:5cc91383ab1e 25:7333d7932ef7
       
     1 /*
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Startup list updater implementation.
       
    15 *
       
    16 */
       
    17 
       
    18 #include "startuplistupdater.h"         // CStartupListUpdater
       
    19 #include "cleanupresetanddestroy.h"     // CleanupResetAndDestroyPushL
       
    20 #include <featmgr.h>                    // FeatureManager
       
    21 #include <driveinfo.h>                  // DriveInfo
       
    22 #include <barsc.h>                      // RResourceFile
       
    23 #include <barsread.h>                   // TResourceReader
       
    24 #include <StartupItem.hrh>              // EStartupItemExPolicyNone
       
    25 #include <dscitem.h>                    // CDscItem
       
    26 #include <swi/sisregistrysession.h>     // Swi::RSisRegistrySession
       
    27 #include <swi/sisregistrypackage.h>     // Swi::CSisRegistryPackage
       
    28 #include <swi/sisregistryentry.h>       // Swi::RSisRegistryEntry
       
    29 #include <swi/sistruststatus.h>         // Swi::TSisTrustStatus::IsTrusted
       
    30 
       
    31 _LIT( KImport, "import\\" );
       
    32 _LIT( KDriveAndPathFormat, "%c:%S" );
       
    33 _LIT( KResourceFileSpec, "c:*.rsc" );
       
    34 _LIT( KExecutableExtension, ".exe" );
       
    35 _LIT( KAsterisk, "*" );
       
    36 
       
    37 const TInt KDriveSpecLength = 2;
       
    38 const TInt KFirstStartupItemInfo = 1;
       
    39 
       
    40 
       
    41 // ======== LOCAL FUNCTIONS ========
       
    42 
       
    43 // ---------------------------------------------------------------------------
       
    44 // FileNamesEqual()
       
    45 // ---------------------------------------------------------------------------
       
    46 //
       
    47 TBool FileNamesEqual( const HBufC& aFile1, const HBufC& aFile2 )
       
    48     {
       
    49     return ( aFile1.CompareF( aFile2 ) == 0 );
       
    50     }
       
    51 
       
    52 
       
    53 // ======== MEMBER FUNCTIONS ========
       
    54 
       
    55 // ---------------------------------------------------------------------------
       
    56 // CStartupListUpdater::NewL()
       
    57 // ---------------------------------------------------------------------------
       
    58 //
       
    59 CStartupListUpdater* CStartupListUpdater::NewL()
       
    60     {
       
    61     CStartupListUpdater* self = new( ELeave ) CStartupListUpdater;
       
    62     CleanupStack::PushL( self );
       
    63     self->ConstructL();
       
    64     CleanupStack::Pop( self );
       
    65     return self;
       
    66     }
       
    67 
       
    68 // ---------------------------------------------------------------------------
       
    69 // CStartupListUpdater::~CStartupListUpdater()
       
    70 // ---------------------------------------------------------------------------
       
    71 //
       
    72 CStartupListUpdater::~CStartupListUpdater()
       
    73     {
       
    74     delete iPrivateImportPath;
       
    75     iFs.Close();
       
    76 
       
    77     FeatureManager::UnInitializeLib();
       
    78     }
       
    79 
       
    80 // ---------------------------------------------------------------------------
       
    81 // CStartupListUpdater::UpdateStartupListL()
       
    82 // ---------------------------------------------------------------------------
       
    83 //
       
    84 void CStartupListUpdater::UpdateStartupListL()
       
    85     {
       
    86     if ( FeatureManager::FeatureSupported( KFeatureIdExtendedStartup ) )
       
    87         {
       
    88         ProcessImportsAndUninstallsL();
       
    89         }
       
    90     }
       
    91 
       
    92 // ---------------------------------------------------------------------------
       
    93 // CStartupListUpdater::CStartupListUpdater()
       
    94 // ---------------------------------------------------------------------------
       
    95 //
       
    96 CStartupListUpdater::CStartupListUpdater()
       
    97     {
       
    98     }
       
    99 
       
   100 // ---------------------------------------------------------------------------
       
   101 // CStartupListUpdater::ConstructL()
       
   102 // ---------------------------------------------------------------------------
       
   103 //
       
   104 void CStartupListUpdater::ConstructL()
       
   105     {
       
   106     FeatureManager::InitializeLibL();
       
   107     User::LeaveIfError( iFs.Connect() );
       
   108 
       
   109     TInt err = iFs.MkDirAll( PrivateImportPathL() );
       
   110     if( err != KErrNone && err != KErrAlreadyExists )
       
   111         {
       
   112         User::Leave( err );
       
   113         }
       
   114     }
       
   115 
       
   116 // ---------------------------------------------------------------------------
       
   117 // CStartupListUpdater::PrivateImportPathL()
       
   118 // ---------------------------------------------------------------------------
       
   119 //
       
   120 const TDesC& CStartupListUpdater::PrivateImportPathL()
       
   121     {
       
   122     if( !iPrivateImportPath )
       
   123         {
       
   124         TFileName privateImportPath;
       
   125         User::LeaveIfError( iFs.PrivatePath( privateImportPath ) );
       
   126         privateImportPath.Append( KImport );
       
   127 
       
   128         TInt driveNumber;
       
   129         TInt err = DriveInfo::GetDefaultDrive( DriveInfo::EDefaultSystem, driveNumber );
       
   130         User::LeaveIfError( err );
       
   131         TChar driveLetter;
       
   132         User::LeaveIfError( RFs::DriveToChar( driveNumber, driveLetter ) );
       
   133 
       
   134         iPrivateImportPath = HBufC::NewL( KDriveSpecLength + privateImportPath.Length() );
       
   135         TPtr ptr( iPrivateImportPath->Des() );
       
   136         ptr.Format( KDriveAndPathFormat, static_cast< TUint >( driveLetter ), &privateImportPath );
       
   137         }
       
   138     return *iPrivateImportPath;
       
   139     }
       
   140 
       
   141 // ---------------------------------------------------------------------------
       
   142 // CStartupListUpdater::ProcessImportsAndUninstallsL()
       
   143 // ---------------------------------------------------------------------------
       
   144 //
       
   145 void CStartupListUpdater::ProcessImportsAndUninstallsL()
       
   146     {
       
   147     RDscStore dscStore;
       
   148     OpenDscStoreLC( dscStore );
       
   149 
       
   150     ImportNewResourceFilesL( dscStore );
       
   151     DeregisterUninstalledAppsL( dscStore );
       
   152 
       
   153     CleanupStack::PopAndDestroy( &dscStore );
       
   154     }
       
   155 
       
   156 // ---------------------------------------------------------------------------
       
   157 // CStartupListUpdater::OpenDscStoreLC()
       
   158 // ---------------------------------------------------------------------------
       
   159 //
       
   160 void CStartupListUpdater::OpenDscStoreLC( RDscStore& aDscStore )
       
   161     {
       
   162     if( !aDscStore.IsOpened() )
       
   163         {
       
   164         aDscStore.OpenL();
       
   165         CleanupClosePushL( aDscStore );
       
   166         if( !aDscStore.DscExistsL() )
       
   167             {
       
   168             aDscStore.CreateDscL();
       
   169             }
       
   170         }
       
   171     else
       
   172         {
       
   173         User::Leave( KErrAlreadyExists );
       
   174         }
       
   175     }
       
   176 
       
   177 // ---------------------------------------------------------------------------
       
   178 // CStartupListUpdater::ImportNewResourceFilesL()
       
   179 // ---------------------------------------------------------------------------
       
   180 //
       
   181 void CStartupListUpdater::ImportNewResourceFilesL( RDscStore& aDscStore )
       
   182     {
       
   183     RPointerArray<HBufC> executableArray;
       
   184     CleanupResetAndDestroyPushL( executableArray );
       
   185     RPointerArray<HBufC> resourceFileArray;
       
   186     CleanupResetAndDestroyPushL( resourceFileArray );
       
   187 
       
   188     GetDataToBeImportedL( executableArray, resourceFileArray );
       
   189     ImportExecutablesL( aDscStore, executableArray );
       
   190     RemoveImportedResourceFiles( resourceFileArray );
       
   191 
       
   192     CleanupStack::PopAndDestroy( 2, &executableArray );
       
   193     }
       
   194 
       
   195 // ---------------------------------------------------------------------------
       
   196 // CStartupListUpdater::DeregisterUninstalledAppsL()
       
   197 // ---------------------------------------------------------------------------
       
   198 //
       
   199 void CStartupListUpdater::DeregisterUninstalledAppsL( RDscStore& aDscStore )
       
   200     {
       
   201     RPointerArray<HBufC> startedAtBootArray;
       
   202     CleanupResetAndDestroyPushL( startedAtBootArray );
       
   203     RPointerArray<HBufC> installedArray;
       
   204     CleanupResetAndDestroyPushL( installedArray );
       
   205     RPointerArray<HBufC> startedNotInstalled;
       
   206     CleanupResetAndDestroyPushL( startedNotInstalled );
       
   207 
       
   208     GetStartupListAppsL( aDscStore, startedAtBootArray );
       
   209     GetInstalledAppsL( installedArray );
       
   210     StartedButNotInstalledAppsL( startedAtBootArray, installedArray, startedNotInstalled );
       
   211     RemoveFromStartupListL( aDscStore, startedNotInstalled );
       
   212 
       
   213     CleanupStack::PopAndDestroy( 3, &startedAtBootArray );
       
   214     }
       
   215 
       
   216 // ---------------------------------------------------------------------------
       
   217 // CStartupListUpdater::GetDataToBeImportedL()
       
   218 // ---------------------------------------------------------------------------
       
   219 //
       
   220 void CStartupListUpdater::GetDataToBeImportedL(
       
   221         RPointerArray<HBufC>& aExecutableArray,
       
   222         RPointerArray<HBufC>& aResourceFileArray )
       
   223     {
       
   224     TParse resourceFiles;
       
   225     User::LeaveIfError( resourceFiles.Set( KResourceFileSpec, &PrivateImportPathL(), NULL ) );
       
   226     const TPtrC importDir( resourceFiles.FullName() );
       
   227 
       
   228     CDir* dir;
       
   229     User::LeaveIfError( iFs.GetDir( importDir, KEntryAttMaskSupported, ESortNone, dir ) );
       
   230     CleanupStack::PushL( dir );
       
   231     for( TInt index = 0; index < dir->Count(); ++index )
       
   232         {
       
   233         TFileName resourceFile;
       
   234         TInt lastSeparator = importDir.LocateReverse( '\\' );
       
   235         if( lastSeparator > 0 )
       
   236             {
       
   237             resourceFile.Copy( importDir.Mid( 0, lastSeparator + 1 ) );
       
   238             resourceFile.Append( ( *dir )[ index ].iName );
       
   239             aResourceFileArray.AppendL( resourceFile.AllocL() );
       
   240 
       
   241             AppendExecutablesFromResourceFileL( resourceFile, aExecutableArray );
       
   242             }
       
   243         }
       
   244     CleanupStack::PopAndDestroy( dir );
       
   245     }
       
   246 
       
   247 // ---------------------------------------------------------------------------
       
   248 // CStartupListUpdater::ImportExecutablesL()
       
   249 // ---------------------------------------------------------------------------
       
   250 //
       
   251 void CStartupListUpdater::ImportExecutablesL( RDscStore& aDscStore,
       
   252         RPointerArray<HBufC>& aExecutableArray )
       
   253     {
       
   254     for( TInt index = 0; index < aExecutableArray.Count(); ++index )
       
   255         {
       
   256         const TDesC& executableName = *( aExecutableArray[ index ] );
       
   257         CDscItem* item = CDscItem::NewLC( executableName, KNullDesC );
       
   258         if( !aDscStore.ItemExistsL( *item ) )
       
   259             {
       
   260             aDscStore.AddItemL( *item );
       
   261             }
       
   262         CleanupStack::PopAndDestroy( item );
       
   263         }
       
   264     }
       
   265 
       
   266 // ---------------------------------------------------------------------------
       
   267 // CStartupListUpdater::RemoveImportedResourceFiles()
       
   268 // ---------------------------------------------------------------------------
       
   269 //
       
   270 void CStartupListUpdater::RemoveImportedResourceFiles(
       
   271         RPointerArray<HBufC>& aResourceFileArray )
       
   272     {
       
   273     for( TInt index = 0; index < aResourceFileArray.Count(); ++index )
       
   274         {
       
   275         const TDesC& fileName = *( aResourceFileArray[ index ] );
       
   276         TInt err = iFs.Delete( fileName );
       
   277         if( err )
       
   278             {
       
   279 #ifdef _DEBUG
       
   280             RDebug::Print( _L("CStartupListUpdater: cannot delete %S, error %d"),
       
   281                     &fileName, err );
       
   282 #endif
       
   283             }
       
   284         }
       
   285     }
       
   286 
       
   287 // ---------------------------------------------------------------------------
       
   288 // CStartupListUpdater::AppendExecutablesFromResourceFileL()
       
   289 // ---------------------------------------------------------------------------
       
   290 //
       
   291 void CStartupListUpdater::AppendExecutablesFromResourceFileL(
       
   292         const TDesC& aResourceFile,
       
   293         RPointerArray<HBufC>& aExecutableArray )
       
   294     {
       
   295     RResourceFile resource;
       
   296     CleanupClosePushL( resource );
       
   297     resource.OpenL( iFs, aResourceFile );
       
   298 
       
   299     for( TInt id = KFirstStartupItemInfo; resource.OwnsResourceId( id ); ++id )
       
   300         {
       
   301         HBufC8* buffer = resource.AllocReadLC( id );
       
   302 
       
   303         TResourceReader reader;
       
   304         reader.SetBuffer( buffer );
       
   305 
       
   306         // Read STARTUP_ITEM_INFO
       
   307         TInt versionInfo = reader.ReadUint8();
       
   308         TFileName executableName;
       
   309         executableName.Copy( reader.ReadTPtrC() );
       
   310         TInt recoveryPolicy = reader.ReadUint16();
       
   311 
       
   312         CleanupStack::PopAndDestroy( buffer );
       
   313 
       
   314         if( versionInfo == 0 && recoveryPolicy == EStartupItemExPolicyNone )
       
   315             {
       
   316             // PKG files use '!' for drive letters that user can decide at installation time
       
   317             if( executableName.Length() > 0 && executableName[ 0 ] == '!' )
       
   318                 {
       
   319                 executableName.Replace( 0, 1, KAsterisk );
       
   320 
       
   321                 TFindFile fileFinder( iFs );
       
   322                 CDir* executableDir;            // next FindWildByDir needs AllFiles capability
       
   323                 TInt err = fileFinder.FindWildByDir( executableName, KNullDesC, executableDir );
       
   324                 if( !err )
       
   325                     {
       
   326                     CleanupStack::PushL( executableDir );
       
   327                     executableName.Replace( 0, 1, fileFinder.File() );
       
   328                     CleanupStack::PopAndDestroy( executableDir );
       
   329                     }
       
   330                 }
       
   331 
       
   332             if( IsValidExecutableForStartupL( aResourceFile, executableName ) )
       
   333                 {
       
   334                 aExecutableArray.AppendL( executableName.AllocL() );
       
   335                 }
       
   336             }
       
   337         }
       
   338 
       
   339     CleanupStack::PopAndDestroy( &resource );
       
   340     }
       
   341 
       
   342 // ---------------------------------------------------------------------------
       
   343 // CStartupListUpdater::IsValidExecutableForStartupL()
       
   344 // ---------------------------------------------------------------------------
       
   345 //
       
   346 TBool CStartupListUpdater::IsValidExecutableForStartupL( const TDesC& aResourceFile,
       
   347         const TDesC& aExecutableName )
       
   348     {
       
   349     TBool isValid = EFalse;
       
   350 
       
   351     TEntry entry;
       
   352     if( iFs.Entry( aExecutableName, entry ) == KErrNone )   // needs AllFiles capability
       
   353         {
       
   354         isValid = ETrue;
       
   355 
       
   356         // Extract package UID from the resource file name
       
   357         // - allow both "[1234ABCD]" and "1234ABCD" formats
       
   358         // - allow possible "0x" prefix too
       
   359         TUid packageUid = KNullUid;
       
   360         TParsePtrC parse( aResourceFile );
       
   361         TPtrC parseName = parse.Name();
       
   362         TInt fileNameLength = parseName.Length();
       
   363         if( !parse.IsNameWild() && fileNameLength > 0 )
       
   364             {
       
   365             TPtr fileName( const_cast<TUint16*>( parseName.Ptr() ),
       
   366                 fileNameLength, fileNameLength );
       
   367 
       
   368             if( fileName[ 0 ] == '[' && fileName[ fileNameLength - 1 ] == ']' )
       
   369                 {
       
   370                 const TInt KTwoCharsLength = 2;
       
   371                 fileNameLength -= KTwoCharsLength;
       
   372                 fileName = fileName.Mid( 1, fileNameLength );
       
   373                 }
       
   374 
       
   375             _LIT( KHexPrefix, "0x" );
       
   376             const TInt KHexPrefixLength = 2;
       
   377             if( fileName.Left( KHexPrefixLength ) == KHexPrefix )
       
   378                 {
       
   379                 fileNameLength -= KHexPrefixLength;
       
   380                 fileName = fileName.Mid( KHexPrefixLength, fileNameLength );
       
   381                 }
       
   382 
       
   383             TLex lex( fileName );
       
   384             TUint32 uidValue = 0;
       
   385             TInt lexError = lex.Val( uidValue, EHex );
       
   386             if( !lexError )
       
   387                 {
       
   388                 packageUid.iUid = uidValue;
       
   389                 }
       
   390             }
       
   391 
       
   392         // Get package info from RSisRegistry, and check that
       
   393         // - the package contains the resource file
       
   394         // - the package is properly signed
       
   395         if( packageUid != KNullUid )
       
   396             {
       
   397             Swi::RSisRegistrySession sisRegSession;
       
   398             User::LeaveIfError( sisRegSession.Connect() );
       
   399             CleanupClosePushL( sisRegSession );
       
   400 
       
   401             Swi::RSisRegistryEntry package;
       
   402             CleanupClosePushL( package );
       
   403             TInt openError = package.Open( sisRegSession, packageUid );
       
   404             if( !openError )
       
   405                 {
       
   406                 TBool hasResourceFile = EFalse;
       
   407 
       
   408                 RPointerArray<HBufC> files;
       
   409                 CleanupResetAndDestroyPushL( files );
       
   410                 package.FilesL( files );
       
   411                 for( TInt index = 0; index < files.Count() && !hasResourceFile; ++index )
       
   412                     {
       
   413                     hasResourceFile = ( aResourceFile.CompareF( *files[ index ] ) == 0 );
       
   414                     }
       
   415 
       
   416                 if( hasResourceFile && package.TrustStatusL().IsTrusted() )
       
   417                     {
       
   418                     isValid = ETrue;
       
   419                     }
       
   420 
       
   421                 CleanupStack::PopAndDestroy( &files );
       
   422                 }
       
   423 
       
   424             CleanupStack::PopAndDestroy( 2, &sisRegSession );  // package, sisRegSession
       
   425             }
       
   426         }
       
   427 
       
   428     return isValid;
       
   429     }
       
   430 
       
   431 // ---------------------------------------------------------------------------
       
   432 // CStartupListUpdater::GetInstalledAppsL()
       
   433 // ---------------------------------------------------------------------------
       
   434 //
       
   435 void CStartupListUpdater::GetInstalledAppsL(
       
   436         RPointerArray<HBufC>& aInstalledExecutableArray )
       
   437     {
       
   438     Swi::RSisRegistrySession sisRegistrySession;
       
   439     User::LeaveIfError( sisRegistrySession.Connect() );
       
   440     CleanupClosePushL( sisRegistrySession );
       
   441 
       
   442     RPointerArray<Swi::CSisRegistryPackage> removablePackages;
       
   443     CleanupResetAndDestroyPushL( removablePackages );
       
   444     sisRegistrySession.RemovablePackagesL( removablePackages );
       
   445 
       
   446     for( TInt index = 0; index < removablePackages.Count(); ++index )
       
   447         {
       
   448         Swi::RSisRegistryEntry entry;
       
   449         CleanupClosePushL( entry );
       
   450         entry.OpenL( sisRegistrySession, *( removablePackages[ index ] ) );
       
   451         if( entry.RemovableL() )
       
   452             {
       
   453             GetExecutablesFromEntryL( entry, aInstalledExecutableArray );
       
   454             }
       
   455         CleanupStack::PopAndDestroy( &entry );
       
   456         }
       
   457 
       
   458     CleanupStack::PopAndDestroy( 2, &sisRegistrySession );
       
   459     }
       
   460 
       
   461 // ---------------------------------------------------------------------------
       
   462 // CStartupListUpdater::GetStartupListAppsL()
       
   463 // ---------------------------------------------------------------------------
       
   464 //
       
   465 void CStartupListUpdater::GetStartupListAppsL( RDscStore& aDscStore,
       
   466         RPointerArray<HBufC>& aStartedExecutableArray )
       
   467     {
       
   468     aDscStore.EnumOpenLC();
       
   469 
       
   470     while( CDscItem* item = aDscStore.EnumReadNextL() )
       
   471         {
       
   472         CleanupStack::PushL( item );
       
   473         aStartedExecutableArray.AppendL( item->FileName().AllocL() );
       
   474         CleanupStack::PopAndDestroy( item );
       
   475         }
       
   476 
       
   477     CleanupStack::PopAndDestroy();  // runs EnumClose
       
   478     }
       
   479 
       
   480 // ---------------------------------------------------------------------------
       
   481 // CStartupListUpdater::StartedButNotInstalledAppsL()
       
   482 // ---------------------------------------------------------------------------
       
   483 //
       
   484 void CStartupListUpdater::StartedButNotInstalledAppsL(
       
   485         RPointerArray<HBufC>& aStartedExecutableArray,                  // in
       
   486         RPointerArray<HBufC>& aInstalledExecutableArray,                // in
       
   487         RPointerArray<HBufC>& aStartedButNotInstalledExecutableArray )  // out
       
   488     {
       
   489     aStartedButNotInstalledExecutableArray.ResetAndDestroy();
       
   490 
       
   491     TIdentityRelation<HBufC> identityRelation( FileNamesEqual );
       
   492     for( TInt index = 0; index < aStartedExecutableArray.Count(); ++index )
       
   493         {
       
   494         const HBufC* startedAppName = aStartedExecutableArray[ index ];
       
   495         if( aInstalledExecutableArray.Find( startedAppName, identityRelation ) == KErrNotFound )
       
   496             {
       
   497             aStartedButNotInstalledExecutableArray.AppendL( startedAppName->AllocL() );
       
   498             }
       
   499         }
       
   500     }
       
   501 
       
   502 // ---------------------------------------------------------------------------
       
   503 // CStartupListUpdater::RemoveFromStartupListL()
       
   504 // ---------------------------------------------------------------------------
       
   505 //
       
   506 void CStartupListUpdater::RemoveFromStartupListL( RDscStore& aDscStore,
       
   507         RPointerArray<HBufC>& aExecutableArray )
       
   508     {
       
   509     for( TInt index = 0; index < aExecutableArray.Count(); ++index )
       
   510         {
       
   511         const TDesC& executableName = *( aExecutableArray[ index ] );
       
   512         CDscItem* item = CDscItem::NewLC( executableName, KNullDesC );
       
   513         if( aDscStore.ItemExistsL( *item ) )
       
   514             {
       
   515             aDscStore.DeleteItemL( *item );
       
   516             }
       
   517         CleanupStack::PopAndDestroy( item );
       
   518         }
       
   519     }
       
   520 
       
   521 // ---------------------------------------------------------------------------
       
   522 // CStartupListUpdater::GetExecutablesFromEntryL()
       
   523 // ---------------------------------------------------------------------------
       
   524 //
       
   525 void CStartupListUpdater::GetExecutablesFromEntryL( Swi::RSisRegistryEntry& aEntry,
       
   526         RPointerArray<HBufC>& aExecutableArray )
       
   527     {
       
   528     RPointerArray<HBufC> filesList;
       
   529     CleanupResetAndDestroyPushL( filesList );
       
   530     aEntry.FilesL( filesList );
       
   531 
       
   532     for( TInt index = 0; index < filesList.Count(); ++index )
       
   533         {
       
   534         TParse parse;
       
   535         TInt err = parse.SetNoWild( KNullDesC, filesList[ index ], NULL );
       
   536         if( !err && ( parse.Ext().CompareF( KExecutableExtension ) == 0 ) )
       
   537             {
       
   538             aExecutableArray.AppendL( parse.FullName().AllocL() );
       
   539             }
       
   540         }
       
   541 
       
   542     CleanupStack::PopAndDestroy( &filesList );
       
   543     }
       
   544