Example #1
0
 /// <summary>
 /// Make a ModuleRef for this Module.
 /// </summary>
 /// <returns>ModuleRef for this Module</returns>
 public ModuleRef MakeRefOf(/*bool hasEntryPoint, byte[] hashValue*/)
 {
     if (refOf == null)
     {
         refOf = new ModuleRef(name/*,hasEntryPoint,hashValue*/);
         refOf.defOf = this;
     }/* else {  // fix this
     if (hasEntryPoint)
       refOf.SetEntryPoint();
     refOf.SetHash(hashValue);
       }*/
     return refOf;
 }
Example #2
0
 internal static ModuleRef ReadModuleRef(PEReader buff)
 {
     buff.ReadZeros(2);
     string name = buff.GetString();
     uint junk = buff.GetGUIDIx();
     junk = buff.GetGUIDIx();
     junk = buff.GetGUIDIx();
     ModuleRef mRef = new ModuleRef(new ModuleFile(name, null));
     mRef.ReadAsDef();
     return mRef;
 }
Example #3
0
 internal static void Read(PEReader buff, TableRow[] mods, bool resolve)
 {
     Contract.Requires(buff != null);
     Contract.Requires(mods != null);
     for (int i = 0; i < mods.Length; i++)
     {
         string name = buff.GetString();
         ModuleRef mRef = new ModuleRef(name);
         if (resolve) mRef.modFile = buff.GetFileDesc(name);
         mods[i] = mRef;
     }
 }
Example #4
0
 public void AddPInvokeInfo(ModuleRef scope, string methName,
     PInvokeAttr callAttr)
 {
     pinvokeImpl = new ImplMap((ushort)callAttr, this, methName, scope);
     methFlags |= PInvokeImpl;
 }
Example #5
0
 public static ModuleRef MakeModuleRef(string name, bool entryPoint, byte[] hashValue)
 {
     Contract.Requires(name != null);
     Contract.Requires(hashValue != null);
     ModuleRef mRef = new ModuleRef(name, entryPoint, hashValue);
     return mRef;
 }
Example #6
0
 internal override void Resolve(PEReader buff)
 {
     meth = (MethodDef)buff.GetCodedElement(CIx.MemberForwarded, memForIndex);
     importScope = (ModuleRef)buff.GetElement(MDTable.ModuleRef, scopeIx);
     if (meth != null) meth.AddPInvokeInfo(this);
 }
Example #7
0
 /*-------------------- Constructors ---------------------------------*/
 internal ImplMap(ushort flag, MethodDef implMeth, [CanBeNull] string iName, ModuleRef mScope)
 {
     flags = flag;
     meth = implMeth;
     importName = iName;
     importScope = mScope;
     tabIx = MDTable.ImplMap;
     if (iName == null) flags |= NoMangle;
     //throw(new NotYetImplementedException("PInvoke "));
 }
Example #8
0
 /// <summary>
 /// Add a managed resource from another module in this assembly.
 /// </summary>
 /// <param name="resName">The name of the resource</param>
 /// <param name="assem">The assembly where the resource is</param>
 /// <param name="isPublic">Access for the resource</param>
 public void AddExternalManagedResource(string resName, ModuleRef mod, uint offset, bool isPublic)
 {
     Contract.Requires(resName != null);
     Contract.Requires(mod != null);
     resources.Add(new ManifestResource(this, resName, mod.modFile, offset, isPublic));
 }
Example #9
0
 public void AddPInvokeInfo(ModuleRef scope, string methName,
                            PInvokeAttr callAttr)
 {
     pinvokeImpl = new ImplMap((ushort)callAttr, this, methName, scope);
     methFlags  |= PInvokeImpl;
 }