Ejemplo n.º 1
0
		protected override void UnpackageData(ReadingContext SR, int CommandSize)
		{
			int DataSize = (int)CommandSize - (2 * sizeof(UInt32));
			Debug.Assert(DataSize >= 0);
			MyCommandData = SR.ReadBytes(DataSize);
		}
Ejemplo n.º 2
0
		protected override void UnpackageData(ReadingContext SR, UInt32 Length)
		{
			long StartOfBlob = SR.Position - sizeof(UInt32) * 2;

			Version = SR.ReadUInt32();
			Flags = SR.ReadUInt32();
			UInt32 HashOffset = SR.ReadUInt32();
			UInt32 IdentifierStringOffset = SR.ReadUInt32();
			SpecialSlotCount = SR.ReadUInt32();
			CodeSlotCount = SR.ReadUInt32();
			MainImageSignatureLimit = SR.ReadUInt32();
			BytesPerHash = SR.ReadByte();
			HashType = SR.ReadByte();
			Spare1 = SR.ReadByte();
			LogPageSize = SR.ReadByte();
			Spare2 = SR.ReadUInt32();
			ScatterCount = SR.ReadUInt32();

			// Read the identifier string
			SR.PushPositionAndJump(StartOfBlob + IdentifierStringOffset);
			Identifier = SR.ReadASCIIZ();
			SR.PopPosition();

			// Read the hashes
			long TotalNumHashes = SpecialSlotCount + CodeSlotCount;
			Hashes = new byte[TotalNumHashes * BytesPerHash];

			SR.PushPositionAndJump(StartOfBlob + HashOffset - BytesPerHash * SpecialSlotCount);
			for (long i = 0; i < TotalNumHashes; ++i)
			{
				byte[] Hash = SR.ReadBytes(BytesPerHash);
				Array.Copy(Hash, 0, Hashes, i * BytesPerHash, BytesPerHash);
			}
			SR.PopPosition();


			if (Config.bCodeSignVerbose)
			{
				PrintHash("Info:", cdSlotMax - cdInfoSlot);
				PrintHash("Requirements:", cdSlotMax - cdRequirementsSlot);
				PrintHash("ResourceDir:", cdSlotMax - cdResourceDirSlot);
				PrintHash("Application:", cdSlotMax - cdApplicationSlot);
				PrintHash("Entitlements:", cdSlotMax - cdEntitlementSlot);
			}
		}
Ejemplo n.º 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);
			}
		}
Ejemplo n.º 4
0
		protected override void UnpackageData(ReadingContext SR, UInt32 Length)
		{
			MyData = SR.ReadBytes(Length - (2 * sizeof(UInt32)));
		}
Ejemplo n.º 5
0
			public override void ReadData(ReadingContext SR)
			{
				CertificateIndex = (int)SR.ReadUInt32();
				UInt32 Count = SR.ReadUInt32();
				Hash = SR.ReadBytes((int)Count);
				Count = 4 - Count % 4;
				if (Count > 0 && Count < 4)
					SR.ReadBytes(Count);
			}
Ejemplo n.º 6
0
			public override void ReadData(ReadingContext SR)
			{
				OIDIndex = (int)SR.ReadUInt32();							// index of the OID value (always 1)
				UInt32 Count = SR.ReadUInt32();
				OID = SR.ReadBytes((int)Count);
				Count = 4 - Count % 4;
				if (Count > 0 && Count < 4)
					SR.ReadBytes(Count);

				MatchOp.MatchOp = SR.ReadUInt32();							// OID must exist
			}
Ejemplo n.º 7
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);
			}
Ejemplo n.º 8
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);
			}