예제 #1
0
		protected override void UnpackageData(ReadingContext SR, int CommandSize)
		{
			// Read the segment
			SegmentName = SR.ReadFixedASCII(16);
			VirtualAddress = SR.ReadUInt(AddressSize);
			VirtualSize = SR.ReadUInt(AddressSize);
			FileOffset = SR.ReadUInt(AddressSize);
			FileSize = SR.ReadUInt(AddressSize);
			MaxProt = SR.ReadUInt32();
			InitProt = SR.ReadUInt32();
			UInt32 SectionCount = SR.ReadUInt32();
			Flags = SR.ReadUInt32();

			// Read the segment data
			//SR.PushPositionAndJump(FileOffset);
			//FileData = SR.ReadBytes(FileSize);
			//SR.PopPosition();

			// Read the sections belonging to the segment
			for (int SectionIndex = 0; SectionIndex < SectionCount; ++SectionIndex)
			{
				MachSection Section = new MachSection(AddressSize);
				Section.Read(SR);
				Sections.Add(Section);
			}
		}
예제 #2
0
			public override void ReadData(ReadingContext SR)
			{
				CertificateIndex = (int)SR.ReadUInt32();					// index in the mobile provision certificate list (always 0 for now)
				UInt32 Count = SR.ReadUInt32();
				FieldName = SR.ReadFixedASCII((int)Count);
				Count = 4 - Count % 4;
				if (Count > 0 && Count < 4)
					SR.ReadBytes(Count);
				MatchOp = new MatchSuffix();
				MatchOp.MatchOp = SR.ReadUInt32();											// must equal
				Count = SR.ReadUInt32();
				MatchOp.CertificateName = SR.ReadFixedASCII((int)Count);
				Count = 4 - Count % 4;
				if (Count > 0 && Count < 4)
					SR.ReadBytes(Count);
			}
예제 #3
0
		public void Read(ReadingContext SR)
		{
			SectionName = SR.ReadFixedASCII(16);
			SegmentName = SR.ReadFixedASCII(16);
			Addr = SR.ReadUInt(AddressSize);
			Size = SR.ReadUInt(AddressSize);
			UInt32 FileOffset = SR.ReadUInt32();
			LogAlignment = SR.ReadUInt32();
			RelocationOffset = SR.ReadUInt32();
			NumRelocations = SR.ReadUInt32();
			Flags = (int)SR.ReadUInt32();
			Reserved1 = SR.ReadUInt32();
			Reserved2 = SR.ReadUInt32();

			if (AddressSize == Bits.Num._64)
				Reserved3 = SR.ReadUInt32();

			if ((SectionType == S_ZEROFILL) || (SectionType == S_GB_ZEROFILL))
			{
				Debug.Assert(FileOffset == 0);
				SectionData = null;
			}
			else
			{
				SR.PushPositionAndJump((long)FileOffset);
				SectionData = SR.ReadBytes((int)Size);	  
				SR.PopPosition();
			}

			if (Config.bCodeSignVerbose)
			{
				Console.WriteLine("  v Read Section '{0}' in segment '{1}' with size {2} and offset 0x{3:X} and align {4} and flags {5:X}", SectionName, SegmentName, Size, FileOffset, 1 << (byte)LogAlignment, Flags);
			}
		}
예제 #4
0
			public override void ReadData(ReadingContext SR)
			{
				UInt32 Count = SR.ReadUInt32();
				BundleIdentifier = SR.ReadFixedASCII((int)Count);
				Count = 4 - Count % 4;
				if (Count > 0 && Count < 4)
					SR.ReadBytes(Count);
			}