示例#1
0
        internal MachInfo Parse(IIntegerReader s)
        {
            var            magic = s.ReadUInt32();
            MachHeaderType type;

            if (magic == MH_MAGIC)
            {
                type = MachHeaderType.Mach32;
            }
            else if (magic == MH_MAGIC_64)
            {
                type = MachHeaderType.Mach64;
            }
            else
            {
                return(null);
            }

            var cpu      = s.ReadInt32();
            var subtype  = s.ReadInt32(); //machine specifier
            var filetype = s.ReadUInt32();

            s.ReadUInt32();             //# of load cmds
            s.ReadUInt32();             //size of load cms
            var flags = s.ReadUInt32(); //flags

            return(new MachInfo(type, cpu, subtype, (MachFileType)filetype));
        }
示例#2
0
        MachInfo ParseSingleArch(IIntegerReader s)
        {
            //CPU specifier
            var cpu = s.ReadInt32();
            //CPU subtype
            var subtype = s.ReadInt32();

            //offset, size, and alignment of obj. file
            s.ReadUInt32(); s.ReadUInt32(); s.ReadUInt32();
            return(new MachInfo(MachHeaderType.MachMulti, cpu, subtype, null));
        }