[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnet/image context.c,1.10,1.11 link.c,1.19,1.
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnet/image context.c,1.10,1.11 link.c,1.19,1.20 |
Date: |
Fri, 28 Feb 2003 01:57:33 -0500 |
Update of /cvsroot/dotgnu-pnet/pnet/image
In directory subversions:/tmp/cvs-serv28210/image
Modified Files:
context.c link.c
Log Message:
Load the modules specified in the File table during dynamic linking.
Index: context.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/context.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** context.c 28 Feb 2003 04:57:46 -0000 1.10
--- context.c 28 Feb 2003 06:57:31 -0000 1.11
***************
*** 359,362 ****
--- 359,389 ----
}
+ ILImage *ILContextGetFile(ILContext *context, const char *name)
+ {
+ ILImage *image;
+ const char *filename;
+ int len;
+ image = context->firstImage;
+ while(image != 0)
+ {
+ filename = image->filename;
+ if(filename)
+ {
+ len = strlen(filename);
+ while(len > 0 && filename[len - 1] != '/' &&
+ filename[len - 1] != '\\')
+ {
+ --len;
+ }
+ if(!ILStrICmp(filename + len, name))
+ {
+ return image;
+ }
+ }
+ image = image->nextImage;
+ }
+ return 0;
+ }
+
ILImage *ILContextNextImage(ILContext *context, ILImage *image)
{
Index: link.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/link.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -r1.19 -r1.20
*** link.c 28 Feb 2003 04:57:47 -0000 1.19
--- link.c 28 Feb 2003 06:57:31 -0000 1.20
***************
*** 501,508 ****
--- 501,511 ----
ILContext *context = ILImageToContext(image);
ILAssembly *assem;
+ ILFileDecl *file;
char *pathname;
int error;
ILImage *newImage;
int sameDir;
+ int loadFlags;
+ int len, retryLower;
/* Scan the AssemblyRef table for the assemblies that we require */
***************
*** 538,542 ****
if(!sameDir)
{
! flags &= ~IL_LOADFLAG_INSECURE;
}
--- 541,628 ----
if(!sameDir)
{
! loadFlags = flags & ~IL_LOADFLAG_INSECURE;
! }
! else
! {
! loadFlags = flags;
! }
!
! /* Load the image */
! error = ILImageLoadFromFile(pathname, image->context,
! &newImage,
flags, 0);
! ILFree(pathname);
! if(error != 0)
! {
! if(error == -1)
! {
! return IL_LOADERR_UNRESOLVED;
! }
! else
! {
! return error;
! }
! }
! }
!
! /* If we loaded the parent from an insecure source, then bail out
! without attempting to load the module files */
! if((flags & IL_LOADFLAG_INSECURE) != 0 || !filename)
! {
! return 0;
! }
!
! /* Strip the final component from the filename */
! len = strlen(filename);
! while(len > 0 && filename[len - 1] != '/' && filename[len - 1] != '\\')
! {
! --len;
! }
! if(len > 0)
! {
! --len;
! }
!
! /* Scan the File table for the external module files that we require */
! file = 0;
! while((file = (ILFileDecl *)ILImageNextToken
! (image, IL_META_TOKEN_FILE, file)) != 0)
! {
! /* Ignore this file if it does not contain metadata */
! if(!ILFileDecl_HasMetaData(file))
! {
! continue;
! }
!
! /* Ignore this file if we already have it */
! if(ILContextGetFile(image->context, file->name) != 0)
! {
! continue;
! }
!
! /* Ignore this file if its name contains a '/' or '\', because
! files in other directories may be a security risk */
! if(ILMemChr(file->name, '/', strlen(file->name)) != 0 ||
! ILMemChr(file->name, '\\', strlen(file->name)) != 0)
! {
! continue;
! }
!
! /* Get the full pathname of the referenced file */
! retryLower = 0;
! pathname = TestPathForFile(filename, len,
! file->name,
strlen(file->name),
! 0, 0,
&retryLower, 0);
! if(!pathname && retryLower)
! {
! pathname = TestPathForFile(filename, len,
!
file->name, strlen(file->name),
! 0,
0, &retryLower, 1);
! }
! if(!pathname)
! {
! #if IL_DEBUG_META
! fprintf(stderr, "could not locate the file %s\n",
file->name);
! #endif
! return IL_LOADERR_UNRESOLVED;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnet/image context.c,1.10,1.11 link.c,1.19,1.20,
Rhys Weatherley <address@hidden> <=