Ejemplo n.º 1
0
        public Acid(Stream stream, int offset)
        {
            stream.Seek(offset, SeekOrigin.Begin);

            BinaryReader reader = new BinaryReader(stream);

            Rsa2048Signature = reader.ReadBytes(0x100);
            Rsa2048Modulus   = reader.ReadBytes(0x100);

            if (reader.ReadInt32() != AcidMagic)
            {
                throw new InvalidNpdmException("ACID Stream doesn't contain ACID section!");
            }

            // Size field used with the above signature (?).
            Unknown1 = reader.ReadInt32();

            reader.ReadInt32();

            // Bit0 must be 1 on retail, on devunit 0 is also allowed. Bit1 is unknown.
            Flags = reader.ReadInt32();

            TitleIdRangeMin = reader.ReadInt64();
            TitleIdRangeMax = reader.ReadInt64();

            int fsAccessControlOffset      = reader.ReadInt32();
            int fsAccessControlSize        = reader.ReadInt32();
            int serviceAccessControlOffset = reader.ReadInt32();
            int serviceAccessControlSize   = reader.ReadInt32();
            int kernelAccessControlOffset  = reader.ReadInt32();
            int kernelAccessControlSize    = reader.ReadInt32();

            FsAccessControl = new FsAccessControl(stream, offset + fsAccessControlOffset, fsAccessControlSize);

            ServiceAccessControl = new ServiceAccessControl(stream, offset + serviceAccessControlOffset, serviceAccessControlSize);

            KernelAccessControl = new KernelAccessControl(stream, offset + kernelAccessControlOffset, kernelAccessControlSize);
        }
Ejemplo n.º 2
0
        public ACID(Stream Stream, int Offset)
        {
            Stream.Seek(Offset, SeekOrigin.Begin);

            BinaryReader Reader = new BinaryReader(Stream);

            RSA2048Signature = Reader.ReadBytes(0x100);
            RSA2048Modulus   = Reader.ReadBytes(0x100);

            if (Reader.ReadInt32() != ACIDMagic)
            {
                throw new InvalidNpdmException("ACID Stream doesn't contain ACID section!");
            }

            //Size field used with the above signature (?).
            Unknown1 = Reader.ReadInt32();

            Reader.ReadInt32();

            //Bit0 must be 1 on retail, on devunit 0 is also allowed. Bit1 is unknown.
            Flags = Reader.ReadInt32();

            TitleIdRangeMin = Reader.ReadInt64();
            TitleIdRangeMax = Reader.ReadInt64();

            int FsAccessControlOffset      = Reader.ReadInt32();
            int FsAccessControlSize        = Reader.ReadInt32();
            int ServiceAccessControlOffset = Reader.ReadInt32();
            int ServiceAccessControlSize   = Reader.ReadInt32();
            int KernelAccessControlOffset  = Reader.ReadInt32();
            int KernelAccessControlSize    = Reader.ReadInt32();

            FsAccessControl = new FsAccessControl(Stream, Offset + FsAccessControlOffset, FsAccessControlSize);

            ServiceAccessControl = new ServiceAccessControl(Stream, Offset + ServiceAccessControlOffset, ServiceAccessControlSize);

            KernelAccessControl = new KernelAccessControl(Stream, Offset + KernelAccessControlOffset, KernelAccessControlSize);
        }