userlibandfileserver/fileserver/sfile/sf_lwins.cpp
changeset 0 a41df078684a
equal deleted inserted replaced
-1:000000000000 0:a41df078684a
       
     1 // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // f32\sfile\sf_lwins.cpp
       
    15 // 
       
    16 //
       
    17 
       
    18 #include "sf_std.h"
       
    19 #include <f32image.h>
       
    20 #include "sf_image.h"
       
    21 #include <e32uid.h>
       
    22 #include <emulator.h>
       
    23 #include <e32wins.h>
       
    24 #include <stdlib.h>
       
    25 #include <hal.h>
       
    26 
       
    27 _LIT(KDirSystemPrograms,"\\System\\Programs\\");
       
    28 _LIT(KDirSystemLibs,"\\System\\Libs\\");
       
    29 _LIT8(KRomSystemLibs,"z:\\system\\libs\\");
       
    30 
       
    31 _LIT(KDirSysBin,"\\sys\\bin\\");
       
    32 _LIT8(KRomSysBin,"z:\\sys\\bin\\");
       
    33 _LIT(KDirSystemBin,"\\System\\Bin\\");
       
    34 _LIT8(KRomSystemBin,"z:\\system\\Bin\\");
       
    35 
       
    36 #ifdef _DEBUG
       
    37 extern TRequestStatus* ProcessDestructStatPtr;
       
    38 extern TBool ProcessCreated;
       
    39 #endif
       
    40 
       
    41 
       
    42 /******************************************************************************
       
    43  * Executable file find routines for WINS
       
    44  ******************************************************************************/
       
    45 
       
    46 TInt GetPEInfo(TProcessCreateInfo& aInfo)
       
    47 //
       
    48 // Extract the Uids, etc from the PE file
       
    49 //
       
    50 	{
       
    51 	TBuf<MAX_PATH> ifilename;
       
    52 	ifilename.Copy(aInfo.iFileName);
       
    53 	TBuf<MAX_PATH> filename;
       
    54 	TInt r = MapEmulatedFileName(filename, ifilename);
       
    55 	if (r == KErrNone)
       
    56 		{
       
    57 		Emulator::RImageFile pefile;
       
    58 		r = pefile.Open(filename.PtrZ());
       
    59 		if (r == KErrNone)
       
    60 			{
       
    61 			pefile.GetInfo(aInfo);
       
    62 			// Overide capabilities in image
       
    63 			for(TInt i=0; i<SCapabilitySet::ENCapW; i++)
       
    64 				{
       
    65 				aInfo.iS.iCaps[i] |= DisabledCapabilities[i];
       
    66 				aInfo.iS.iCaps[i] &= AllCapabilities[i];
       
    67 				}
       
    68 			pefile.Close();
       
    69 			}
       
    70 		}
       
    71 	return r;
       
    72 	}
       
    73 
       
    74 TBool CheckIsDirectoryName(TProcessCreateInfo& aInfo)
       
    75 //
       
    76 // Attempt to get file attributes from Windows if attributes can't be found 
       
    77 // just assume not a directory otherwise check the directory bit
       
    78 // Only intended for use by FindBin, FindDll and FindExe
       
    79 //
       
    80 	{	
       
    81 	TBuf<MAX_PATH> ifilename;
       
    82 	ifilename.Copy(aInfo.iFileName);
       
    83 	TBuf<MAX_PATH> filename;
       
    84 	if (MapEmulatedFileName(filename, ifilename) != KErrNone)
       
    85 		return EFalse; // just return EFalse as the error will be picked up later
       
    86 	
       
    87 	DWORD attr = Emulator::GetFileAttributes(filename.PtrZ());
       
    88 	if (attr != -1 && (attr & FILE_ATTRIBUTE_DIRECTORY))
       
    89 		return ETrue;
       
    90 	return EFalse;
       
    91 	}
       
    92 
       
    93 TInt FindBin(E32Image& aImage)
       
    94 //
       
    95 // WINS find Binary in system bin
       
    96 // System directories on all drives Y-A,Z
       
    97 //
       
    98 	{
       
    99 	__IF_DEBUG(Printf("FindBin"));
       
   100 
       
   101 	TInt len=aImage.iFileName.Length();
       
   102 	// check if it's a bare drive letter with no path
       
   103 	if (len>=3 && aImage.iFileName[1]==':' && aImage.iFileName[2]!='\\')
       
   104 		{
       
   105 		if (len + KRomSysBin().Length()-2 <= aImage.iFileName.MaxLength())
       
   106 			aImage.iFileName.Insert(2,KRomSysBin().Mid(2));
       
   107 		}
       
   108 	
       
   109 	// Ensure consistent error codes with h/w, see DEF092502
       
   110 	// Unlike Symbian on h/w targets, on Windows searching 
       
   111 	// for a driectory, including "." and "..", will return KErrorAccessDenied
       
   112 	if (CheckIsDirectoryName(aImage))
       
   113 		return KErrNotFound;	
       
   114 	
       
   115 	// first try and find it in the given directory
       
   116 	TInt r=GetPEInfo(aImage);
       
   117 
       
   118 	// Next : if looking at z:\sys\bin then look for it in emulator path
       
   119 	if (r == KErrNotFound || r == KErrPathNotFound)
       
   120 		{
       
   121 		if (aImage.iFileName.FindF(KRomSysBin) == 0)
       
   122 			{
       
   123 			aImage.iFileName.Delete(0, KRomSysBin().Length());
       
   124 			r = GetPEInfo(aImage);
       
   125 			}
       
   126 
       
   127 		if (r==KErrNotFound || r == KErrPathNotFound)
       
   128 			{
       
   129 			//	Now try finding it in the EPOC scheme of things
       
   130 			TBuf<MAX_PATH> ifilename;
       
   131 			ifilename.Copy(aImage.iFileName);
       
   132 			TFindFile ff(gTheLoaderFs);
       
   133 			r=ff.FindByDir(ifilename,KDirSysBin);
       
   134 			if (r==KErrNone)
       
   135 				{
       
   136 				aImage.iFileName.Copy(ff.File());
       
   137 				__IF_DEBUG(Printf("Found file %S",&aImage.iFileName));
       
   138 				r=GetPEInfo(aImage);
       
   139 				}
       
   140 			else
       
   141 				{
       
   142 				// Last chance look in emulator path for driveless things
       
   143 				if (aImage.iFileName.FindF(KRomSysBin().Mid(2)) == 0)
       
   144 					{
       
   145 					aImage.iFileName.Delete(0, KRomSysBin().Length()-2);
       
   146 					r = GetPEInfo(aImage);
       
   147 					}
       
   148 				else 
       
   149 					{
       
   150 					__IF_DEBUG(Printf("Filename %S not found in ?:\\sys\\bin",&aImage.iFileName));
       
   151 					r=KErrNotFound;
       
   152 					}
       
   153 				}
       
   154 			}
       
   155 		}
       
   156 
       
   157 	if(PlatSec::ConfigSetting(PlatSec::EPlatSecEnforceSysBin))
       
   158 		return r;
       
   159 
       
   160 	// Next : if looking at z:\system\bin then look for it in emulator path
       
   161 	if (r == KErrNotFound || r == KErrPathNotFound)
       
   162 		{
       
   163 		if (aImage.iFileName.FindF(KRomSystemBin) == 0)
       
   164 			{
       
   165 			aImage.iFileName.Delete(0, KRomSystemBin().Length());
       
   166 			r = GetPEInfo(aImage);
       
   167 			}
       
   168 
       
   169 		if (r==KErrNotFound || r == KErrPathNotFound)
       
   170 			{
       
   171 			//	Now try finding it in the EPOC scheme of things
       
   172 			TBuf<MAX_PATH> ifilename;
       
   173 			ifilename.Copy(aImage.iFileName);
       
   174 			TFindFile ff(gTheLoaderFs);
       
   175 			r=ff.FindByDir(ifilename,KDirSystemBin);
       
   176 			if (r==KErrNone)
       
   177 				{
       
   178 				aImage.iFileName.Copy(ff.File());
       
   179 				__IF_DEBUG(Printf("Found file %S",&aImage.iFileName));
       
   180 				r=GetPEInfo(aImage);
       
   181 				}
       
   182 			else
       
   183 				{
       
   184 				__IF_DEBUG(Printf("Filename %S not found",&aImage.iFileName));
       
   185 				r=KErrNotFound;
       
   186 				}
       
   187 			}
       
   188 		}
       
   189 	return r;
       
   190 	}
       
   191 
       
   192 
       
   193 TInt FindExe(E32Image& aImage)
       
   194 //
       
   195 // WINS find executable
       
   196 // System directories on all drives Y-A,Z
       
   197 //
       
   198 	{
       
   199 	__IF_DEBUG(Printf("FindExe"));
       
   200 
       
   201 	TInt len  = aImage.iFileName.Length();
       
   202 	// check if it's a bare drive letter with no path
       
   203 	if (len >= 3 && aImage.iFileName[1]==':' && aImage.iFileName[2]!='\\')
       
   204 		{
       
   205 		if (len + KRomSysBin().Length()-2 <= aImage.iFileName.MaxLength())
       
   206 			aImage.iFileName.Insert(2,KRomSysBin().Mid(2));
       
   207 		}
       
   208 	// Ensure consistent error codes with h/w, see DEF092502
       
   209 	// Unlike Symbian on h/w targets, on Windows searching 
       
   210 	// for a driectory, including "." and "..", will return KErrorAccessDenied
       
   211 	if (CheckIsDirectoryName(aImage))
       
   212 		return KErrNotFound;
       
   213 	
       
   214 	// first try and find it in the given directory
       
   215 	TInt r=GetPEInfo(aImage);
       
   216 
       
   217 	// Next : if looking at z:\sys\bin then look for it in emulator path
       
   218 	if (r == KErrNotFound || r == KErrPathNotFound)
       
   219 		{
       
   220 		if (aImage.iFileName.FindF(KRomSysBin) == 0)
       
   221 			{
       
   222 			aImage.iFileName.Delete(0, KRomSysBin().Length());
       
   223 			r = GetPEInfo(aImage);
       
   224 			}
       
   225 
       
   226 		if (r==KErrNotFound || r == KErrPathNotFound)
       
   227 			{
       
   228 			//	Now try finding it in the EPOC scheme of things
       
   229 			TBuf<MAX_PATH> ifilename;
       
   230 			ifilename.Copy(aImage.iFileName);
       
   231 			TFindFile ff(gTheLoaderFs);
       
   232 			r=ff.FindByDir(ifilename,KDirSysBin);
       
   233 			if (r==KErrNone)
       
   234 				{
       
   235 				aImage.iFileName.Copy(ff.File());
       
   236 				__IF_DEBUG(Printf("Found file %S",&aImage.iFileName));
       
   237 				r=GetPEInfo(aImage);
       
   238 				}
       
   239 			else
       
   240 				{
       
   241 				__IF_DEBUG(Printf("Filename %S not found in ?:\\sys\\bin",&aImage.iFileName));
       
   242 				r=KErrNotFound;
       
   243 				}
       
   244 			}
       
   245 		}
       
   246 
       
   247 	if(PlatSec::ConfigSetting(PlatSec::EPlatSecEnforceSysBin))
       
   248 		return r;
       
   249 
       
   250 	// Next : if looking at z:\system\libs then look for it in emulator path
       
   251 	if (r == KErrNotFound || r == KErrPathNotFound)
       
   252 		{
       
   253 		if (aImage.iFileName.FindF(KRomSystemLibs) == 0)
       
   254 			{
       
   255 			aImage.iFileName.Delete(0, KRomSystemLibs().Length());
       
   256 			r = GetPEInfo(aImage);
       
   257 			}
       
   258 
       
   259 		if (r==KErrNotFound || r == KErrPathNotFound)
       
   260 			{
       
   261 			//	Now try finding it in the EPOC scheme of things
       
   262 			TBuf<MAX_PATH> ifilename;
       
   263 			ifilename.Copy(aImage.iFileName);
       
   264 			TFindFile ff(gTheLoaderFs);
       
   265 			r=ff.FindByDir(ifilename,KDirSystemPrograms);
       
   266 			if (r==KErrNone)
       
   267 				{
       
   268 				aImage.iFileName.Copy(ff.File());
       
   269 				__IF_DEBUG(Printf("Found file %S",&aImage.iFileName));
       
   270 				r=GetPEInfo(aImage);
       
   271 				}
       
   272 			else
       
   273 				{
       
   274 				__IF_DEBUG(Printf("Filename %S not found",&aImage.iFileName));
       
   275 				r=KErrNotFound;
       
   276 				}
       
   277 			}
       
   278 		}
       
   279 	return r;
       
   280 	}
       
   281 
       
   282 // WINS FindDll
       
   283 TInt FindDll(E32Image& aImage, const TDesC8* aPath)
       
   284 //
       
   285 // Search for a dll in the following sequence ...
       
   286 // 1. Supplied path parameter
       
   287 // 2. System directories on all drives
       
   288 //
       
   289 	{
       
   290 
       
   291 	TInt len = aImage.iFileName.Length();
       
   292 	// check if it's a bare drive letter with no path
       
   293 	if (len >=3 && aImage.iFileName[1]==':' && aImage.iFileName[2]!='\\')
       
   294 		{
       
   295 		if (len + KRomSysBin().Length()-2 <= aImage.iFileName.MaxLength())
       
   296 			aImage.iFileName.Insert(2,KRomSysBin().Mid(2));
       
   297 		}
       
   298 	
       
   299 	// Ensure consistent error codes with h/w, see DEF092502
       
   300 	// Unlike Symbian on h/w targets, on Windows searching 
       
   301 	// for a driectory, including "." and "..", will return KErrorAccessDenied
       
   302 	if (CheckIsDirectoryName(aImage))
       
   303 		return KErrNotFound;
       
   304 	
       
   305 	TInt r=GetPEInfo(aImage);
       
   306 
       
   307 	// Next : if looking at z:\system\libs then look for it in emulator path
       
   308 	if (r == KErrNotFound || r == KErrPathNotFound)
       
   309 		{
       
   310 		if (aImage.iFileName.FindF(KRomSysBin) == 0)
       
   311 			{
       
   312 			aImage.iFileName.Delete(0, KRomSysBin().Length());
       
   313 			r = GetPEInfo(aImage);
       
   314 			}
       
   315 
       
   316 		if(!PlatSec::ConfigSetting(PlatSec::EPlatSecEnforceSysBin))
       
   317 			if (r == KErrNotFound || r == KErrPathNotFound)
       
   318 				if (aImage.iFileName.FindF(KRomSystemLibs) == 0)
       
   319 					{
       
   320 					aImage.iFileName.Delete(0, KRomSystemLibs().Length());
       
   321 					r = GetPEInfo(aImage);
       
   322 					}
       
   323 
       
   324 		TBuf<MAX_PATH> ifilename;
       
   325 		ifilename.Copy(aImage.iFileName);
       
   326 		if (r==KErrNotFound || r == KErrPathNotFound)
       
   327 			{
       
   328 			//	Now try finding it in the EPOC scheme of things
       
   329 			TFindFile ff(gTheLoaderFs);
       
   330 			__IF_DEBUG(Printf("FindDll aDllName %S, aPath %S",&aImage.iFileName,aPath?aPath:&KNullDesC8));
       
   331 			if (aPath && aPath->Length()!=0)
       
   332 				{
       
   333 				TBuf<MAX_PATH> ipath;
       
   334 				ipath.Copy(*aPath);
       
   335 				r=ff.FindByPath(ifilename, &ipath);
       
   336 				if (r==KErrNone)
       
   337 					{
       
   338 					aImage.iFileName.Copy(ff.File());
       
   339 					__IF_DEBUG(Printf("Found file %S",&aImage.iFileName));
       
   340 					r=GetPEInfo(aImage);
       
   341 					}
       
   342 				}
       
   343 
       
   344 			if (r!=KErrNone)
       
   345 				{
       
   346 				r=ff.FindByDir(ifilename,KDirSysBin);
       
   347 				if (r==KErrNone)
       
   348 					{
       
   349 					aImage.iFileName.Copy(ff.File());
       
   350 					__IF_DEBUG(Printf("Found file %S",&aImage.iFileName));
       
   351 					r=GetPEInfo(aImage);
       
   352 					}
       
   353 				}
       
   354 
       
   355 			if(!PlatSec::ConfigSetting(PlatSec::EPlatSecEnforceSysBin))
       
   356 				if (r!=KErrNone)
       
   357 					{
       
   358 					r=ff.FindByDir(ifilename,KDirSystemLibs);
       
   359 					if (r==KErrNone)
       
   360 						{
       
   361 						aImage.iFileName.Copy(ff.File());
       
   362 						__IF_DEBUG(Printf("Found file %S",&aImage.iFileName));
       
   363 						r=GetPEInfo(aImage);
       
   364 						}
       
   365 					}
       
   366 
       
   367 			if(r!=KErrNone)
       
   368 				{
       
   369 				__IF_DEBUG(Printf("Filename %S not found",&aImage.iFileName));
       
   370 				r=KErrNotFound;
       
   371 				}
       
   372 			}
       
   373 		}
       
   374 	return r;
       
   375 	}
       
   376 
       
   377 /******************************************************************************
       
   378  * WINS specific E32Image functions
       
   379  ******************************************************************************/
       
   380 
       
   381 TInt E32Image::ProcessFileName()
       
   382 //
       
   383 // Get the properly capitalised file name and root name
       
   384 //
       
   385 	{
       
   386 
       
   387 	TFileNameInfo fni;
       
   388 	TInt r = fni.Set(iFileName, 0);
       
   389 	if (r!=KErrNone)
       
   390 		return r;
       
   391 	iRootNameOffset = fni.iBasePos;
       
   392 	iRootNameLength = fni.iLen - fni.iBasePos;
       
   393 	iExtOffset = fni.iExtPos;
       
   394 //	TBuf<MAX_PATH> filename;
       
   395 //	TInt r=MapEmulatedFileName(filename, iFileName);
       
   396 //	if (r!=KErrNone)
       
   397 //		return r;
       
   398 //	WIN32_FIND_DATA w32fd;
       
   399 //	HANDLE h=Emulator::FindFirstFile(filename.PtrZ(), &w32fd);
       
   400 //	if (h==0)
       
   401 //		return Emulator::LastError();
       
   402 //	TPtrC real_filename((const TText*)&w32fd.cFileName[0]);
       
   403 //	FindClose(h);
       
   404 //	iFileName.SetLength(slash+1);
       
   405 //	iFileName+=real_filename;
       
   406 	__IF_DEBUG(Printf("ProcessFileName: %S,%d,%d,%d",&iFileName,iRootNameOffset,iRootNameLength,iExtOffset));
       
   407 	return KErrNone;
       
   408 	}
       
   409 
       
   410 TInt E32Image::LoadProcess(const RLdrReq& aReq)
       
   411 	{
       
   412 	__IF_DEBUG(Printf("E32Image::LoadProcess %S",&aReq.iFileName));
       
   413 
       
   414 	iFileName=*aReq.iFileName;
       
   415 	TInt r=FindExe(*this);
       
   416 	if (r!=KErrNone)
       
   417 		r=FindBin(*this);
       
   418 	if (r==KErrNone)
       
   419 		r=ProcessFileName();
       
   420 	if (r==KErrNone)
       
   421 		r=CheckUids(iUids, aReq.iRequestedUids);
       
   422 	if (r!=KErrNone)
       
   423 		return r;
       
   424 	r = aReq.iMsg->Client((RThread&)aReq.iClientThread);
       
   425 	if (r!=KErrNone)
       
   426 		return r;
       
   427 	iClientHandle=aReq.iClientThread.Handle();
       
   428 #ifdef _DEBUG
       
   429 	iDestructStat = ProcessDestructStatPtr;
       
   430 #endif
       
   431 	iFlags |= EDataUnpaged;	// Data paging is not supported on the emulator
       
   432 	r=E32Loader::ProcessCreate(*this, aReq.iCmd);
       
   433 	__IF_DEBUG(Printf("Done E32Loader::ProcessCreate %d",r));
       
   434 	if (r!=KErrNone)
       
   435 		return r;
       
   436 #ifdef _DEBUG
       
   437 	ProcessCreated = ETrue;
       
   438 #endif
       
   439 	iClientProcessHandle=iProcessHandle;
       
   440 	r=E32Loader::ProcessLoaded(*this);
       
   441 	return r;
       
   442 	}
       
   443 
       
   444 // Load a code segment, plus all imports if main loadee
       
   445 TInt E32Image::LoadCodeSeg(const RLdrReq& aReq)
       
   446 	{
       
   447 	__IF_DEBUG(Printf("E32Image::LoadCodeSeg %S",aReq.iFileName));
       
   448 
       
   449 	const TDesC8& reqName=*aReq.iFileName;
       
   450 	const TDesC8* searchPath=aReq.iPath;
       
   451 		
       
   452 	iFileName=reqName;
       
   453 	TInt r=FindDll(*this, searchPath);
       
   454 	if (r!=KErrNone)
       
   455 		r=FindBin(*this);
       
   456 	// Hack to support EXEDLLs which are DLLs but have EXE file extentions
       
   457 	if(r==KErrNotFound)
       
   458 		{
       
   459 		if(iFileName.Right(4).CompareF(_L8(".DLL"))==0)
       
   460 			{
       
   461 			TUint8* p = (TUint8*)iFileName.Ptr() + iFileName.Length() - 3;
       
   462 			*p++ = 'E';
       
   463 			*p++ = 'X';
       
   464 			*p++ = 'E';
       
   465 			r=FindDll(*this, searchPath);
       
   466 			if (r!=KErrNone)
       
   467 				r=FindBin(*this);
       
   468 			}
       
   469 		}
       
   470 	if (r==KErrNone)
       
   471 		r=ProcessFileName();
       
   472 	if (r==KErrNone)
       
   473 		r=CheckUids(iUids, aReq.iRequestedUids);
       
   474 
       
   475 	if(r==KErrNone)
       
   476 		{
       
   477 		if(this == iMain)
       
   478 			{
       
   479 			// Check that we can legally load the DLL into the process
       
   480 			r=aReq.CheckSecInfo(iS);
       
   481 			}
       
   482 		}
       
   483 	if (r!=KErrNone)
       
   484 		return r;
       
   485 		
       
   486 	__IF_DEBUG(Printf("Checking uids for %S", &iFileName));
       
   487 	if (iUids[0]!=KDynamicLibraryUid && iUids[0]!=KExecutableImageUid)
       
   488 	    return KErrNotSupported;
       
   489 	r=CheckAlreadyLoaded();
       
   490 	if (r!=KErrNone || iAlreadyLoaded)
       
   491 		{
       
   492 		__IF_DEBUG(Printf("<LoadCodeSeg AlreadyLoaded %d",r));
       
   493 		return r;		// already loaded, either share or give up
       
   494 		}
       
   495 	__IF_DEBUG(Printf("CodeSeg create"));
       
   496 	r=E32Loader::CodeSegCreate(*this);
       
   497 	if (r==KErrNone)
       
   498 		r=E32Loader::CodeSegLoaded(*this);
       
   499 
       
   500 	__IF_DEBUG(Printf("<LoadCodeSeg, r=%d",r));
       
   501 	return r;
       
   502 	}
       
   503 
       
   504 //__DATA_CAGING__
       
   505 TInt ReadCapabilities(RLdrReq& aReq)
       
   506 //	
       
   507 //	Wins version
       
   508 //
       
   509 	{
       
   510 	E32Image* e=new E32Image;
       
   511 	if (!e)
       
   512 		return KErrNoMemory;
       
   513 	e->iMain=e;
       
   514 	e->iFileName=*aReq.iFileName;
       
   515 	TInt r=GetPEInfo(*e);
       
   516 	if (r==KErrNotFound || r == KErrPathNotFound)
       
   517 		{
       
   518 		//	z:\sys\bin\* may be found in emulator path
       
   519 		if (e->iFileName.FindF(KRomSysBin) == 0)
       
   520 			{
       
   521 			e->iFileName.Delete(0, KRomSysBin().Length());
       
   522 			r = GetPEInfo(*e);
       
   523 			}
       
   524 		}
       
   525 
       
   526 	if(!PlatSec::ConfigSetting(PlatSec::EPlatSecEnforceSysBin))
       
   527 		if (r==KErrNotFound || r == KErrPathNotFound)
       
   528 			{
       
   529 			//	z:\system\bin\* may be found in emulator path
       
   530 			if (e->iFileName.FindF(KRomSystemBin) == 0)
       
   531 				{
       
   532 				e->iFileName.Delete(0, KRomSystemBin().Length());
       
   533 				r = GetPEInfo(*e);
       
   534 				}
       
   535 			}
       
   536 	TPtrC8 caps((const TUint8*)&e->iS.iCaps, sizeof(e->iS.iCaps));
       
   537 	if (r==KErrNone)
       
   538 		r=aReq.iMsg->Write(2, caps);
       
   539 	delete e;
       
   540 	return r;
       
   541 	}
       
   542 
       
   543 TInt GetModuleInfo(RLdrReq& aReq)
       
   544 //
       
   545 //	Read capabilities from file found
       
   546 //
       
   547 	{
       
   548 	__IF_DEBUG(Printf("ReadModuleInfo %S",aReq.iFileName));
       
   549 	TFileNameInfo& fi = aReq.iFileNameInfo;
       
   550 	TInt r = KErrNotSupported;
       
   551 
       
   552 	// must specify a fully qualified name
       
   553 	if (fi.DriveLen() && fi.PathLen())
       
   554 		{
       
   555 		E32Image* e=new E32Image;
       
   556 		if (!e)
       
   557 			return KErrNoMemory;
       
   558 		e->iMain = e;
       
   559 		e->iFileName = *aReq.iFileName;
       
   560 		r = GetPEInfo(*e);
       
   561 		if (r==KErrNotFound || r == KErrPathNotFound)
       
   562 			{
       
   563 			//	z:\system\bin\* may be found in emulator path
       
   564 			if (e->iFileName.FindF(KRomSysBin) == 0)
       
   565 				{
       
   566 				e->iFileName.Delete(0, KRomSysBin().Length());
       
   567 				r = GetPEInfo(*e);
       
   568 				}
       
   569 
       
   570 			if(!PlatSec::ConfigSetting(PlatSec::EPlatSecEnforceSysBin))
       
   571 				if(r!=KErrNone)
       
   572 					if (e->iFileName.FindF(KRomSystemBin) == 0)
       
   573 						{
       
   574 						e->iFileName.Delete(0, KRomSystemBin().Length());
       
   575 						r = GetPEInfo(*e);
       
   576 						}
       
   577 			}
       
   578 		if (r == KErrNone)
       
   579 			{
       
   580 			RLibrary::TInfo ret_info;
       
   581 			memclr(&ret_info,sizeof(ret_info));
       
   582 			ret_info.iModuleVersion = e->iModuleVersion;
       
   583 			ret_info.iUids = e->iUids;
       
   584 			*(SSecurityInfo*)&ret_info.iSecurityInfo = e->iS;
       
   585 			TPckgC<RLibrary::TInfo> ret_pckg(ret_info);
       
   586 			r = aReq.iMsg->Write(2, ret_pckg);
       
   587 			}
       
   588 		delete e;
       
   589 		}
       
   590 	return r;
       
   591 	}
       
   592 
       
   593 TInt GetInfoFromHeader(const RLoaderMsg& /*aMsg*/)
       
   594 	{
       
   595 	TInt r;
       
   596 	r = KErrNotSupported;
       
   597 	return r;
       
   598 	}
       
   599 
       
   600 
       
   601