Пример #1
0
 public void Dispose()
 {
     if (this.native != null)
     {
         int n = native.GetCount();
         Marshal.ReleaseComObject(this.native);
         this.native = null;
     }
     if (iHost != null)
     {
         Marshal.Release(iHost);
     }
     if (iNtf != null)
     {
         Marshal.Release(iNtf);
     }
     if (iRtlEmitter != null)
     {
         Marshal.Release(iRtlEmitter);
     }
     if (this.hBytes != null && this.hBytes.IsAllocated)
     {
         this.hBytes.Free();
     }
 }
Пример #2
0
            public Enumerator(Dictionary <int, RegisterStorage> regs, ThumbRewriterRetired 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);

                this.native = outer.nArch.CreateRewriter(
                    hBytes.AddrOfPinnedObject(),
                    bytes.Length,
                    (int)outer.rdr.Offset,
                    addr,
                    rtlEmitter,
                    ntf,
                    host);
            }