Exemple #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));
        }
Exemple #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));
        }
Exemple #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);
        }
Exemple #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));
                }
            }
        }