Esempio n. 1
0
        public static int GetAutoEncodedSize(this Instruction Instruction, int bitness, ulong IP = 0)
        {
            var Writer   = new MemoryCodeWriter();
            var Compiler = Encoder.Create(bitness, Writer);

            return(Compiler.AutoEncode(Instruction, (ulong)Writer.Count + IP).GetEncodedSize(64));
        }
Esempio n. 2
0
        public static int GetAutoEncodedSize(this InstructionList List, int bitness, ulong IP = 0)
        {
            var Writer   = new MemoryCodeWriter();
            var Compiler = Encoder.Create(bitness, Writer);

            return((int)Compiler.AutoEncode(List, IP));
        }
Esempio n. 3
0
        public static int GetEncodedSize(this InstructionList List, int bitness, ulong IP = 0)
        {
            var Writer   = new MemoryCodeWriter();
            var Compiler = Encoder.Create(bitness, Writer);

            foreach (var Instruction in List)
            {
                Compiler.Encode(Instruction, (ulong)Writer.Count + IP);
            }

            return(Writer.Count);
        }
Esempio n. 4
0
        public unsafe static InstructionList AssembleToList(this Assembler Assembler, ulong RIP)
        {
            var CWBuffer = new MemoryCodeWriter();

            Assembler.Assemble(CWBuffer, RIP);
            var Buffer = CWBuffer.ToArray();

            fixed(void *pBuffer = &Buffer[0])
            {
                using (var Reader = new MemoryCodeReader(pBuffer, (uint)Buffer.Length))
                {
                    var AsmDecoder = Decoder.Create(Assembler.Bitness, Reader);
                    return(AsmDecoder.DecodeAmount((uint)Assembler.Instructions.Count));
                }
            }
        }