Ejemplo n.º 1
0
        public Unicorn(UcArch arch, UcMode mode)
        {
            _callbacks  = new Dictionary <int, UnicornCallbackData>();
            _callbackId = 0;

            var result = Marshal.AllocHGlobal(Marshal.SizeOf <IntPtr>());
            var err    = UcNative.UcOpen(arch, mode, result);

            if (err != UcErr.UC_ERR_OK)
            {
                throw new UcException($"Failed to create native Unicorn instance, error {err}.", err);
            }

            Handle = (IntPtr)Marshal.PtrToStructure(result, typeof(IntPtr));
        }