Exemple #1
0
 public void Read(BinaryReader reader)
 {
     magic          = reader.ReadInt16();
     lMajor         = reader.ReadByte();
     lMinor         = reader.ReadByte();
     codeSize       = reader.ReadUInt32();
     initDataSize   = reader.ReadUInt32();
     uninitDataSize = reader.ReadUInt32();
     entryRVA       = new RVA(reader.ReadUInt32());
     codeBase       = new RVA(reader.ReadUInt32());
     dataBase       = new RVA(reader.ReadUInt32());
 }
Exemple #2
0
        public long RVAToVA(RVA rva)
        {
            string sectName = RVAToSectionName(rva);
            long   res      = 0;

            if (sectName != null)
            {
                Section s = (Section)Sections [sectName];
                res = rva + (s.PointerToRawData - s.VirtualAddress);
            }
            return(res);
        }
Exemple #3
0
			public void Read (BinaryReader reader)
			{
				magic = reader.ReadInt16 ();
				lMajor = reader.ReadByte ();
				lMinor = reader.ReadByte ();
				codeSize = reader.ReadUInt32 ();
				initDataSize = reader.ReadUInt32 ();
				uninitDataSize = reader.ReadUInt32 ();
				entryRVA = new RVA (reader.ReadUInt32 ());
				codeBase = new RVA (reader.ReadUInt32 ());
				dataBase = new RVA (reader.ReadUInt32 ());
			}
Exemple #4
0
 public void Read(BinaryReader reader)
 {
     phAddr_virtSize = reader.ReadUInt32();
     virtAddr        = new RVA(reader.ReadUInt32());
     rawSize         = reader.ReadUInt32();
     rawDataPtr      = new RVA(reader.ReadUInt32());
     relocPtr        = new RVA(reader.ReadUInt32());
     lineNumPtr      = new RVA(reader.ReadUInt32());
     relocNum        = reader.ReadInt16();
     linenumNum      = reader.ReadInt16();
     flags           = (SectionCharacteristics)reader.ReadUInt32();
 }
Exemple #5
0
			public void Read (BinaryReader reader)
			{
				phAddr_virtSize = reader.ReadUInt32 ();
				virtAddr = new RVA (reader.ReadUInt32 ());
				rawSize = reader.ReadUInt32 ();
				rawDataPtr = new RVA (reader.ReadUInt32 ());
				relocPtr = new RVA (reader.ReadUInt32 ());
				lineNumPtr = new RVA (reader.ReadUInt32 ());
				relocNum = reader.ReadInt16 ();
				linenumNum = reader.ReadInt16 ();
				flags = (SectionCharacteristics) reader.ReadUInt32 ();
			}
Exemple #6
0
        /// <summary>
        ///  Returns name of the section for the given RVA.
        /// </summary>
        /// <param name="rva"></param>
        /// <returns></returns>
        public string RVAToSectionName(RVA rva)
        {
            string res = null;

            foreach (Section s in Sections.Values)
            {
                RVA sva = s.VirtualAddress;
                if (rva >= sva && rva < sva + s.SizeOfRawData)
                {
                    res = s.Name;
                    break;
                }
            }
            return(res);
        }
Exemple #7
0
		public void Read (BinaryReader reader)
		{
			virtAddr = new RVA (reader.ReadUInt32 ());
			size = reader.ReadUInt32 ();
		}
Exemple #8
0
		public long RVAToVA(RVA rva)
		{
			string sectName = RVAToSectionName(rva);
			long res = 0;
			if (sectName != null) {
				Section s = (Section) Sections [sectName];
				res = rva + (s.PointerToRawData - s.VirtualAddress);
			}
			return res;
		}
Exemple #9
0
		/// <summary>
		///  Returns name of the section for the given RVA.
		/// </summary>
		/// <param name="rva"></param>
		/// <returns></returns>
		public string RVAToSectionName(RVA rva)
		{
			string res = null;
			foreach (Section s in Sections.Values) {
				RVA sva = s.VirtualAddress;
				if (rva >= sva && rva < sva + s.SizeOfRawData) {
					res = s.Name;
					break;
				}
			}
			return res;
		}
Exemple #10
0
 static RVA()
 {
     Null = new RVA(0);
 }
Exemple #11
0
 public void Read(BinaryReader reader)
 {
     virtAddr = new RVA(reader.ReadUInt32());
     size     = reader.ReadUInt32();
 }
Exemple #12
0
		static RVA()
		{
			Null = new RVA(0);
		}