public void Phase4(MetadataProcessor.ImageAccessor accessor) { uint size = 2 + 4 + codeLen; for (int i = 0; i < codes.Length; i++) { size += 4; if (rvas[i] == 0) { continue; } size += 8; } size = (((uint)size + 0x7f) & ~0x7fu) + 0x28; Section prev = accessor.Sections[accessor.Sections.Count - 1]; accessor.Sections[0].Characteristics = 0x60000020; Section sect = accessor.CreateSection(sectName, size, 0x40000040, prev); accessor.Sections.Add(sect); Section prev2 = accessor.Sections[accessor.Sections.Count - 1]; Section sect2 = accessor.CreateSection(sectName2, prev2.SizeOfRawData, 0x40000040, prev2); accessor.Sections.Add(sect2); }
public override void Process(NameValueCollection parameters, MetadataProcessor.ImageAccessor accessor) { uint size = EstimateSize(accessor); Section prev = accessor.Sections[accessor.Sections.Count - 1]; Section sect = accessor.CreateSection(".confuse", size, 0x40000040, prev); accessor.Sections.Add(sect); }
public void Phase4(MetadataProcessor.ImageAccessor accessor) { uint size = (((uint)finalDat.Length + 2 + 0x7f) & ~0x7fu) + 0x28; Section prev = accessor.Sections[accessor.Sections.Count - 1]; Section sect = accessor.CreateSection(sectName, size, 0x40000040, prev); accessor.Sections.Add(sect); }
public override void Process(NameValueCollection parameters, MetadataProcessor.ImageAccessor accessor) { accessor.Module.Attributes &= ~ModuleAttributes.ILOnly; MemoryStream ms = new MemoryStream(); BinaryWriter wtr = new BinaryWriter(ms); { //VTable wtr.Write(0x06000000 | (uint)c.xrid); //fixup table wtr.Write(0x12345678U); //rva wtr.Write((ushort)1); //size wtr.Write((ushort)1); //type wtr.Write(new byte[0x200]); } Section sect = accessor.CreateSection("XD", 4 + 4 + 2 + 2, 0xC0000040, accessor.Sections[accessor.Sections.Count - 1]); accessor.Sections.Add(sect); ms.Position = 4; ms.Write(BitConverter.GetBytes(sect.VirtualAddress), 0, 4); sect.Data = ms.ToArray(); c.vTblRva = sect.VirtualAddress + 4; }