예제 #1
0
        public IEnumerable <UcMemRegion> MemRegions()
        {
            var err = UcNative.UcMemRegions(Handle, out var regions, out var count);

            if (err != UcErr.UC_ERR_OK)
            {
                throw new UcException(err);
            }

            var size   = Marshal.SizeOf <UcMemRegion>();
            var result = new UcMemRegion[count];

            for (var i = 0; i < count; i++)
            {
                yield return(Marshal.PtrToStructure <UcMemRegion>(regions + (i * size)));
            }
        }