sl@0: // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // f32\etshell\ts_deps.cpp sl@0: // sl@0: // sl@0: sl@0: #include "ts_std.h" sl@0: #include "f32image.h" sl@0: #include sl@0: #include "sf_deflate.h" sl@0: #include "sf_image.h" sl@0: sl@0: //#define _DETAILED_CHECK // Select for detailed dependency check sl@0: sl@0: #if defined(_DETAILED_CHECK) // Prints information to screen sl@0: #define __PRINT(t) {CShell::TheConsole->Printf(t);} sl@0: #define __PRINT1(t,a) {CShell::TheConsole->Printf(t,a);} sl@0: #define __PRINT2(t,a,b) {CShell::TheConsole->Printf(t,a,b);} sl@0: #define __PRINTWAIT(t){CShell::TheConsole->Printf(t);CShell::TheConsole->Getch();} sl@0: #else sl@0: #define __PRINT(t) sl@0: #define __PRINT1(t,a) sl@0: #define __PRINT2(t,a,b) sl@0: #define __PRINTWAIT(t) sl@0: #endif sl@0: sl@0: /* sl@0: sl@0: CDllChecker::GetImportDataL(aFilename) reads the Image Header, Import Section sl@0: and all import data for aFilename. If aFilename is a ROM dll, and thus has no sl@0: import data, or if the file contains no import data for some other reason the sl@0: function leaves with KErrGeneral. If a file is compressed, function calls sl@0: appropriate decompression routine to inflate the import data. sl@0: The function then calls GetDllTableL function which sl@0: reads the first import block and enters a "for" loop. The Dll's name and Uid3 are obtained sl@0: from CDllChecker::GetFileNameAndUid(). If the Dll name does not occur in the sl@0: array of previously checked Dlls, CDllChecker::FindDll() is called. If the Dll sl@0: is found,the function then calls CDllChecker::GetImportDataL on the filename acquired by sl@0: GetFileNameAndUid()(recursive call). sl@0: sl@0: If the Dll contains no import data or cannot be found, or if the Uid is invalid, sl@0: the next import is checked. sl@0: sl@0: The Uid3 value is checked by calling CDllChecker::CheckUid. This compares the sl@0: Uid3 value found in the image header of the file, with that found by sl@0: GetFileNameAndUid(). If there are any discrepancies,these are noted. sl@0: sl@0: Each potential import is added to the array by dllAppendL(TResultCheck) to sl@0: indicate its import status. sl@0: sl@0: CDllChecker::ListArray() lists the contents of the array when all imports sl@0: have been checked. sl@0: */ sl@0: sl@0: sl@0: CDllChecker::CDllChecker() sl@0: // sl@0: // Constructor sl@0: // sl@0: { sl@0: iDllArray=NULL; sl@0: iCalls=0; sl@0: } sl@0: sl@0: sl@0: sl@0: void CDllChecker::ConstructL() sl@0: // sl@0: // Creates an array to hold DLLs referenced by this executable sl@0: // sl@0: { sl@0: iDllArray = new(ELeave)CArrayFixFlat(4); sl@0: __PRINT(_L(" Successfully created iDllArray\n")); sl@0: } sl@0: sl@0: sl@0: CDllChecker::~CDllChecker() sl@0: // sl@0: // Destructor sl@0: // sl@0: { sl@0: delete iDllArray; sl@0: } sl@0: sl@0: sl@0: GLDEF_C void Get16BitDllName(TDes8& aDllName,TDes& aFileName) sl@0: // sl@0: // Convert an 8 bit name to a 16 bit name - zero padded automatically sl@0: // No effect in 8 bit builds - just sets aFileName to aDllName sl@0: // sl@0: { sl@0: aFileName.SetLength(aDllName.Length()); sl@0: aFileName.Copy(aDllName); sl@0: } sl@0: sl@0: void FileCleanup(TAny* aPtr) sl@0: { sl@0: TFileInput* f=(TFileInput*)aPtr; sl@0: f->Cancel(); sl@0: delete f; sl@0: } sl@0: sl@0: void CDllChecker::LoadFileInflateL(E32ImageHeaderComp* aHeader,TUint8* aRestOfFileData,TUint32 aRestOfFileSize) sl@0: { sl@0: TInt pos = aHeader->TotalSize(); sl@0: User::LeaveIfError(iFile.Seek(ESeekStart,pos)); // Start at beginning of compressed data sl@0: sl@0: TFileInput* file = new (ELeave) TFileInput(iFile); sl@0: CleanupStack::PushL(TCleanupItem(&FileCleanup,file)); sl@0: CInflater* inflater=CInflater::NewLC(*file); sl@0: sl@0: if (aHeader->iCodeSize) sl@0: { sl@0: TUint8* CodeData = (TUint8*)User::AllocLC(aHeader->iCodeSize ); sl@0: TInt count=inflater->ReadL((TUint8*)CodeData ,aHeader->iCodeSize,&Mem::Move); sl@0: if(count!=aHeader->iCodeSize) sl@0: User::Leave(KErrCorrupt); sl@0: CleanupStack::PopAndDestroy(CodeData); sl@0: } sl@0: sl@0: if (aRestOfFileSize) sl@0: { sl@0: TUint32 count=inflater->ReadL(aRestOfFileData,aRestOfFileSize,&Mem::Move); sl@0: if(count!=aRestOfFileSize) sl@0: User::Leave(KErrCorrupt); sl@0: } sl@0: CleanupStack::PopAndDestroy(2,file); sl@0: } sl@0: sl@0: void CDllChecker::LoadFileNoCompressL(E32ImageHeaderComp* aHeader,TUint8* aRestOfFileData,TUint32 aRestOfFileSize) sl@0: { sl@0: TInt pos = (aHeader->TotalSize()+aHeader->iCodeSize); sl@0: if (aRestOfFileSize) sl@0: { sl@0: User::LeaveIfError(iFile.Seek(ESeekStart,pos)); // Start at beginning of import table sl@0: TPtr8 ptrToData((TText8*)(aRestOfFileData),aRestOfFileSize,aRestOfFileSize); sl@0: User::LeaveIfError(iFile.Read(ptrToData, (TInt)aRestOfFileSize)); sl@0: } sl@0: } sl@0: //function loads file's import information calling decompression routine if needed sl@0: TInt CDllChecker::LoadFile(TUint32 aCompression,E32ImageHeaderComp* aHeader,TUint8* aRestOfFileData,TUint32 aRestOfFileSize) sl@0: { sl@0: TInt r=KErrNone; sl@0: if(aCompression==KFormatNotCompressed) sl@0: { sl@0: TRAP(r,LoadFileNoCompressL(aHeader,aRestOfFileData,aRestOfFileSize)); sl@0: } sl@0: else if(aCompression==KUidCompressionDeflate) sl@0: { sl@0: TRAP(r,LoadFileInflateL(aHeader,aRestOfFileData,aRestOfFileSize)); sl@0: } sl@0: else sl@0: r=KErrNotSupported; sl@0: sl@0: return r; sl@0: } sl@0: sl@0: //function iterates through the list of libraries the current executable depends on sl@0: //for each dependency in the list the function checks whether the .dll being checked is already added to the array of dependencies sl@0: //if not, the function adds dependency being checked to the array of dependencies and calls GetImportDataL function recursively sl@0: void CDllChecker::GetDllTableL(TUint8* aImportData, TInt aDllRefTableCount,TUint aFlags) sl@0: { sl@0: E32ImportBlock* block = (E32ImportBlock*)((TUint8*)aImportData+sizeof(E32ImportSection)); sl@0: sl@0: //*********Beginning of the loop********* sl@0: for (TInt i=0; iiOffsetOfDllName); sl@0: TPtrC8 dllNamePtr(dllName, User::StringLength(dllName)); sl@0: GetFileNameAndUid(dllInfo,dllNamePtr);//Gets name and Uid of dependency sl@0: TUid* pointer=&dllInfo.iUid; sl@0: __PRINT(_L(" Check Dll has not already been imported\n")); sl@0: TKeyArrayFix key(0,ECmpFolded); sl@0: TInt pos; sl@0: TInt r=iDllArray->Find(dllInfo,key,pos);// Search array by Dll Name sl@0: if (r==KErrNone) // **********IT IS ALREADY IN THE ARRAY*********** sl@0: { sl@0: __PRINT1(_L(" Dll %S has already been checked\n"),&dllInfo.iDllName); sl@0: sl@0: //Check its Uid3 against that noted in the array sl@0: if (iDllArray->At(pos).iUid!=dllInfo.iUid) sl@0: { sl@0: // Uid3 is different to that of the same named Dll sl@0: // Add it to the array for comparative purposes sl@0: __PRINT2(_L(" Uid3 [%08x] for %S is different from that noted previously\n"),dllInfo.iUid, &dllInfo.iDllName); sl@0: dllInfo.iResult=EUidDifference; sl@0: sl@0: // Add this entry to iDllArray sl@0: DllAppendL(dllInfo); sl@0: } sl@0: }// Run to the end of the "for" loop for this i value sl@0: else // **********THE FILE IS NOT YET IN THE ARRAY********** sl@0: { sl@0: __PRINT(_L(" Dll has not previously been checked\n")); sl@0: sl@0: // Check through it and add the relevant information to the array sl@0: sl@0: // Search for the DLL sl@0: TPath aPath=(TPath)CShell::currentPath; sl@0: TFileName fileName; sl@0: TName dll16BitName; sl@0: sl@0: #if defined(UNICODE) sl@0: Get16BitDllName(dllInfo.iDllName,dll16BitName); sl@0: #else sl@0: dll16BitName=(dllInfo.iDllName); sl@0: #endif sl@0: r=FindDll(dll16BitName,fileName,aPath); sl@0: sl@0: __PRINT1(_L("dll16BitName=%S\n"),&dll16BitName); sl@0: __PRINTWAIT(_L(" Press any key to continue\n")); sl@0: sl@0: if (r==KErrNotFound) // Could not find Dll sl@0: { sl@0: dllInfo.iResult=ENotFound; sl@0: }// Run to the end of the "for" loop for this i value sl@0: sl@0: else // File was located sl@0: sl@0: // Go recursive. Call GetImportDataL on the new dll, if it imports anything. sl@0: // ROM dlls have no import data so this is never called for ROM dlls. sl@0: // This *will* terminate. It is only called on "new" dlls not in the array. sl@0: sl@0: { sl@0: __PRINT(_L(" ****Go recursive****\n")); sl@0: __PRINTWAIT(_L(" Press any key to continue\n")); sl@0: sl@0: iCalls++; sl@0: sl@0: TRAP(r,GetImportDataL(fileName, pointer)); sl@0: // Pass in (parsed) fileName and Uid3 (from file header) sl@0: switch(r) sl@0: { sl@0: case(KErrGeneral): // No import data sl@0: { sl@0: dllInfo.iResult=ENoImportData; sl@0: break; sl@0: // Run to the end of the for loop for this i value sl@0: } sl@0: case(EUidNotSupported): sl@0: { sl@0: dllInfo.iResult=EUidNotSupported; sl@0: break; sl@0: } sl@0: case(KErrNone): // Import data was read sl@0: { sl@0: dllInfo.iResult=EFileFoundAndUidSupported; sl@0: break; sl@0: // Run to the end of the for loop for this i value sl@0: } sl@0: case(KErrInUse): sl@0: { sl@0: __PRINT2(_L(" File %S is already open\n"),&fileName,r); sl@0: dllInfo.iResult=EAlreadyOpen; sl@0: break; sl@0: } sl@0: case(KErrCorrupt): sl@0: { sl@0: __PRINT2(_L(" File %S has unexpected format\n"),&fileName,r); sl@0: dllInfo.iResult=EAlreadyOpen; sl@0: break; sl@0: } sl@0: default: sl@0: { sl@0: __PRINT1(_L(" File %S could not be opened \n"),&fileName); sl@0: dllInfo.iResult=ECouldNotOpenFile; sl@0: break; sl@0: } sl@0: // Run to the end of the for loop for this i value sl@0: } sl@0: } sl@0: sl@0: // Add the information about the dependency to iDllArray sl@0: DllAppendL(dllInfo); sl@0: } sl@0: // Runs to here when all import data has been read for this i value sl@0: sl@0: __PRINT(_L(" Go to next dll to be imported...\n")); sl@0: __PRINTWAIT(_L(" Press any key to continue\n")); sl@0: sl@0: block = (E32ImportBlock*)block->NextBlock(E32ImageHeader::ImpFmtFromFlags(aFlags)); sl@0: sl@0: }// The end of the loop. Every DLL has been located sl@0: sl@0: } sl@0: sl@0: sl@0: void CDllChecker::GetImportDataL(const TDesC& aFileName, TUid* aPointer) sl@0: { sl@0: TInt cleanupCount=0; sl@0: // Check that the file is not a ROM dll. These have no import data sl@0: if (ShellFunction::TheShell->TheFs.IsFileInRom(aFileName)) sl@0: { sl@0: User::Leave(KErrGeneral); sl@0: } sl@0: sl@0: //open file for reading and push it to autoclose stack sl@0: TAutoClose autoFile; sl@0: User::LeaveIfError(autoFile.iObj.Open(CShell::TheFs,aFileName,EFileStream)); sl@0: autoFile.PushL(); sl@0: cleanupCount++; sl@0: iFile=autoFile.iObj; sl@0: sl@0: //Create a pointer to an Image Header sl@0: //reserve enough memory for compressed file header because we don't know whether the file is compressed or not sl@0: E32ImageHeaderComp* imageHeader=new(ELeave)E32ImageHeaderComp; sl@0: CleanupStack::PushL(imageHeader); sl@0: cleanupCount++; sl@0: sl@0: //read file header sl@0: TPtr8 ptrToImageHeader((TText8*)(imageHeader),sizeof(E32ImageHeaderComp),sizeof(E32ImageHeaderComp)); sl@0: User::LeaveIfError(iFile.Read(ptrToImageHeader,sizeof(E32ImageHeaderComp))); sl@0: sl@0: if (imageHeader->iImportOffset==0)// File contains no import data sl@0: { sl@0: User::Leave(KErrGeneral); sl@0: } sl@0: sl@0: TUint32 compression = imageHeader->CompressionType(); sl@0: TInt restOfFileSize=0; sl@0: TUint8* restOfFileData=NULL; sl@0: //detect the size of import information sl@0: if (compression != KFormatNotCompressed) sl@0: { sl@0: // Compressed executable sl@0: // iCodeOffset = header size for format V or above sl@0: // = sizeof(E32ImageHeader) for format J sl@0: restOfFileSize = imageHeader->UncompressedFileSize() - imageHeader->iCodeOffset; sl@0: } sl@0: else sl@0: { sl@0: TInt FileSize; sl@0: iFile.Size(FileSize); sl@0: restOfFileSize = FileSize-imageHeader->TotalSize(); sl@0: } sl@0: restOfFileSize -= imageHeader->iCodeSize; // the size of the exe less header & code sl@0: sl@0: //allocate memory for import information sl@0: if (restOfFileSize >0) sl@0: { sl@0: restOfFileData = (TUint8*)User::AllocLC(restOfFileSize ); sl@0: cleanupCount++; sl@0: } sl@0: sl@0: User::LeaveIfError(LoadFile(compression,imageHeader,restOfFileData,restOfFileSize)); // Read import information in sl@0: sl@0: TInt32 uid3=imageHeader->iUid3; sl@0: if(iCalls!=0) // Only check Uid3 of dependencies (ie only after first sl@0: { // call of recursive function) sl@0: TInt r=CheckUid3(uid3,*aPointer); sl@0: sl@0: if (r!=KErrNone) // Dll's Uid3 is not valid sl@0: User::Leave(EUidNotSupported); sl@0: } sl@0: sl@0: TInt bufferOffset=imageHeader->iImportOffset-(imageHeader->iCodeOffset + imageHeader->iCodeSize); sl@0: if( TInt(bufferOffset+sizeof(E32ImportSection))>restOfFileSize) sl@0: User::Leave(KErrCorrupt); sl@0: //get the table of dependencies sl@0: GetDllTableL(restOfFileData+bufferOffset,imageHeader->iDllRefTableCount,imageHeader->iFlags); sl@0: sl@0: CleanupStack::PopAndDestroy(cleanupCount); sl@0: } sl@0: sl@0: sl@0: TUint8* CDllChecker::NextBlock(TUint8* aBlock) sl@0: { sl@0: E32ImportBlock* block; sl@0: // Advance the pointer to the next block sl@0: block=(E32ImportBlock*)aBlock; sl@0: aBlock=(aBlock+sizeof(E32ImportBlock)+((block->iNumberOfImports)*sizeof(TUint))); sl@0: return (aBlock); sl@0: } sl@0: sl@0: sl@0: TFileNameInfo::TFileNameInfo() sl@0: { sl@0: memclr(this, sizeof(TFileNameInfo)); sl@0: } sl@0: sl@0: TInt TFileNameInfo::Set(const TDesC8& aFileName, TUint aFlags) sl@0: { sl@0: iUid = 0; sl@0: iVersion = 0; sl@0: iPathPos = 0; sl@0: iName = aFileName.Ptr(); sl@0: iLen = aFileName.Length(); sl@0: iExtPos = aFileName.LocateReverse('.'); sl@0: if (iExtPos<0) sl@0: iExtPos = iLen; sl@0: TInt osq = aFileName.LocateReverse('['); sl@0: TInt csq = aFileName.LocateReverse(']'); sl@0: if (!(aFlags & EAllowUid) && (osq>=0 || csq>=0)) sl@0: { sl@0: return KErrBadName; sl@0: } sl@0: if (osq>=iExtPos || csq>=iExtPos) sl@0: { sl@0: return KErrBadName; sl@0: } sl@0: TInt p = iExtPos; sl@0: if ((aFlags & EAllowUid) && p>=10 && iName[p-1]==']' && iName[p-10]=='[') sl@0: { sl@0: TPtrC8 uidstr(iName + p - 9, 8); sl@0: TLex8 uidlex(uidstr); sl@0: TUint32 uid = 0; sl@0: TInt r = uidlex.Val(uid, EHex); sl@0: if (r==KErrNone && uidlex.Eos()) sl@0: iUid = uid, p -= 10; sl@0: } sl@0: iUidPos = p; sl@0: TInt ob = aFileName.LocateReverse('{'); sl@0: TInt cb = aFileName.LocateReverse('}'); sl@0: if (ob>=iUidPos || cb>=iUidPos) sl@0: { sl@0: return KErrBadName; sl@0: } sl@0: if (ob>=0 && cb>=0 && p-1==cb) sl@0: { sl@0: TPtrC8 p8(iName, p); sl@0: TInt d = p8.LocateReverse('.'); sl@0: TPtrC8 verstr(iName+ob+1, p-ob-2); sl@0: TLex8 verlex(verstr); sl@0: if (ob==p-10 && dob && p-1>d && (aFlags & EAllowDecimalVersion)) sl@0: { sl@0: TUint32 maj = 0; sl@0: TUint32 min = 0; sl@0: TInt r = verlex.Val(maj, EDecimal); sl@0: TUint c = (TUint)verlex.Get(); sl@0: TInt r2 = verlex.Val(min, EDecimal); sl@0: if (r==KErrNone && c=='.' && r2==KErrNone && verlex.Eos() && maj<32768 && min<32768) sl@0: iVersion = (maj << 16) | min, p = ob; sl@0: } sl@0: } sl@0: iVerPos = p; sl@0: if (iLen>=2 && iName[1]==':') sl@0: { sl@0: TUint c = iName[0]; sl@0: if (c!='?' || !(aFlags & EAllowPlaceholder)) sl@0: { sl@0: c |= 0x20; sl@0: if (c<'a' || c>'z') sl@0: { sl@0: return KErrBadName; sl@0: } sl@0: } sl@0: iPathPos = 2; sl@0: } sl@0: TPtrC8 pathp(iName+iPathPos, iVerPos-iPathPos); sl@0: if (pathp.Locate('[')>=0 || pathp.Locate(']')>=0 || pathp.Locate('{')>=0 || pathp.Locate('}')>=0 || pathp.Locate(':')>=0) sl@0: { sl@0: return KErrBadName; sl@0: } sl@0: iBasePos = pathp.LocateReverse('\\') + 1 + iPathPos; sl@0: return KErrNone; sl@0: } sl@0: sl@0: void TFileNameInfo::GetName(TDes8& aName, TUint aFlags) const sl@0: { sl@0: if (aFlags & EIncludeDrive) sl@0: aName.Append(Drive()); sl@0: if (aFlags & EIncludePath) sl@0: { sl@0: if (PathLen() && iName[iPathPos]!='\\') sl@0: aName.Append('\\'); sl@0: aName.Append(Path()); sl@0: } sl@0: if (aFlags & EIncludeBase) sl@0: aName.Append(Base()); sl@0: if ((aFlags & EForceVer) || ((aFlags & EIncludeVer) && VerLen()) ) sl@0: { sl@0: aName.Append('{'); sl@0: aName.AppendNumFixedWidth(iVersion, EHex, 8); sl@0: aName.Append('}'); sl@0: } sl@0: if ((aFlags & EForceUid) || ((aFlags & EIncludeUid) && UidLen()) ) sl@0: { sl@0: aName.Append('['); sl@0: aName.AppendNumFixedWidth(iUid, EHex, 8); sl@0: aName.Append(']'); sl@0: } sl@0: if (aFlags & EIncludeExt) sl@0: aName.Append(Ext()); sl@0: } sl@0: sl@0: sl@0: void CDllChecker::GetFileNameAndUid(SDllInfo &aDllInfo, const TDesC8 &aExportName) sl@0: // sl@0: // Gets filename and UID sl@0: // sl@0: { sl@0: TFileNameInfo filename; sl@0: filename.Set(aExportName,TFileNameInfo::EAllowUid|TFileNameInfo::EAllowDecimalVersion); sl@0: filename.GetName(aDllInfo.iDllName,TFileNameInfo::EIncludeBaseExt); sl@0: aDllInfo.iUid=TUid::Uid(filename.Uid()); sl@0: } sl@0: sl@0: sl@0: TInt CDllChecker::CheckUid3(TInt32 aUid3,TUid aUid) sl@0: // sl@0: // Check that Uid3 is the same in the iDllName and as noted by the Image Header sl@0: // aUid3 is the value found by the image header sl@0: // aUid is the value found by parsing the result of block->dllname sl@0: // using GetFileNameAndUid() sl@0: { sl@0: sl@0: if ((aUid.iUid)==aUid3) sl@0: { sl@0: sl@0: __PRINT(_L(" Uid3 is valid\n")); sl@0: sl@0: return KErrNone; sl@0: } sl@0: else sl@0: { sl@0: sl@0: __PRINT(_L(" Uid3 value is not supported\n")); sl@0: sl@0: return (EUidNotSupported); sl@0: } sl@0: } sl@0: sl@0: sl@0: sl@0: TInt CDllChecker::FindDll(TDes& aDllName,TFileName& aFileName, TPath& aPath) sl@0: // sl@0: // Search for a dll in the following sequence ... sl@0: // 1. Supplied path parameter sl@0: // 2. System directories on all drives sl@0: // sl@0: { sl@0: TFindFile findFile(CShell::TheFs); sl@0: TInt r=findFile.FindByPath(aDllName,&aPath); sl@0: if (r==KErrNone) sl@0: { sl@0: aFileName=findFile.File(); sl@0: sl@0: __PRINT1(_L(" Dependency %S was found (supplied path)\n"),&aFileName); sl@0: sl@0: return(r); sl@0: } sl@0: sl@0: r=findFile.FindByDir(aDllName,_L("\\Sys\\Bin\\")); sl@0: if (r==KErrNone) sl@0: { sl@0: aFileName=findFile.File(); sl@0: sl@0: __PRINT1(_L(" Dependency %S was found (system directory)\n"),&aFileName); sl@0: sl@0: return(r); sl@0: } sl@0: sl@0: if(!PlatSec::ConfigSetting(PlatSec::EPlatSecEnforceSysBin)) sl@0: { sl@0: r=findFile.FindByDir(aDllName,_L("\\System\\Bin\\")); sl@0: if (r==KErrNone) sl@0: { sl@0: aFileName=findFile.File(); sl@0: sl@0: __PRINT1(_L(" Dependency %S was found (system directory)\n"),&aFileName); sl@0: sl@0: return(r); sl@0: } sl@0: } sl@0: sl@0: __PRINT1(_L(" Dependency %S was not found\n"),&aDllName); sl@0: sl@0: return(KErrNotFound); sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: void CDllChecker::DllAppendL(const SDllInfo& aDllInfo) sl@0: { sl@0: TInt leaveCode=KErrNone; sl@0: TRAP(leaveCode,iDllArray->AppendL(aDllInfo)); // Add it to iDllArray sl@0: sl@0: if (leaveCode!=KErrNone) sl@0: { sl@0: __PRINT(_L(" Could not add Dll to the array\n")); sl@0: __PRINTWAIT(_L(" Press any key to continue\n")); sl@0: sl@0: User::Leave(leaveCode); sl@0: } sl@0: else sl@0: { sl@0: __PRINT(_L(" Added this information to the array\n")); sl@0: __PRINT1(_L(" Number of elements in array=%d\n"),iDllArray->Count()); sl@0: sl@0: } sl@0: } sl@0: sl@0: sl@0: sl@0: void CDllChecker::ListArray() sl@0: { sl@0: TInt elements=iDllArray->Count(); sl@0: sl@0: CShell::TheConsole->Printf(_L(" Number of dependencies checked = %d\n"),elements); sl@0: sl@0: for (TInt i=0;iAt(i).iDllName,filename); sl@0: CShell::TheConsole->Printf(_L(" %d: %-15S Uid3: [%08x] "),(i+1),&(filename),(iDllArray->At(i).iUid)); sl@0: #else sl@0: CShell::TheConsole->Printf(_L(" %d: %-15S Uid3: [%08x] "),(i+1),&(iDllArray->At(i).iDllName),(iDllArray->At(i).iUid)); sl@0: #endif sl@0: switch(iDllArray->At(i).iResult) sl@0: { sl@0: case(ENoImportData): sl@0: CShell::TheConsole->Printf(_L("--- No import data\n")); sl@0: break; sl@0: sl@0: case(EUidNotSupported): sl@0: CShell::TheConsole->Printf(_L("--- Uid3 is not supported\n")); sl@0: break; sl@0: sl@0: case(ENotFound): sl@0: CShell::TheConsole->Printf(_L("--- File was not found\n")); sl@0: break; sl@0: sl@0: case(ECouldNotOpenFile): sl@0: CShell::TheConsole->Printf(_L("--- File could not be opened\n")); sl@0: break; sl@0: sl@0: case(EUidDifference): sl@0: CShell::TheConsole->Printf(_L("--- File already noted with different Uid\n")); sl@0: break; sl@0: sl@0: case(EAlreadyOpen): sl@0: CShell::TheConsole->Printf(_L("--- File already open\n")); sl@0: break; sl@0: sl@0: case(EFileFoundAndUidSupported): sl@0: CShell::TheConsole->Printf(_L("--- File was found, Uid3 is supported\n")); sl@0: break; sl@0: default: // Will never reach here sl@0: CShell::TheConsole->Printf(_L("--- Undefined\n")); sl@0: break; sl@0: } sl@0: } sl@0: } sl@0: