コード例 #1
0
ファイル: MachObjects.cs プロジェクト: xiangyuan/Unreal4
		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);
			}
		}