public Enumerator(Dictionary <int, RegisterStorage> regs, ArmRewriter outer) { this.bytes = outer.rdr.Bytes; ulong addr = outer.rdr.Address.ToLinear(); this.hBytes = GCHandle.Alloc(bytes, GCHandleType.Pinned); this.m = new RtlEmitter(new List <RtlInstruction>()); this.ntf = new NativeTypeFactory(); this.rtlEmitter = new NativeRtlEmitter(m, ntf, outer.host); this.host = new ArmNativeRewriterHost(regs, outer.binder, outer.host, this.ntf, rtlEmitter); this.iRtlEmitter = GetCOMInterface(rtlEmitter, IID_IRtlEmitter); this.iNtf = GetCOMInterface(ntf, IID_INativeTypeFactory); this.iHost = GetCOMInterface(host, IID_INativeRewriterHost); IntPtr unk = CreateNativeRewriter(hBytes.AddrOfPinnedObject(), bytes.Length, (int)outer.rdr.Offset, addr, iRtlEmitter, iNtf, iHost); this.native = (INativeRewriter)Marshal.GetObjectForIUnknown(unk); }