Example #1
1
        public string ToString(bool formatted)
        {
            var b = new StringBuilder();
            b.AppendLine("XbfsEntry:");

            string fmt = formatted ? "    " : "";

            if (!Padding.IsArrayEmpty())
                b.AppendLineSpace(fmt + "Padding != null");

            b.AppendLine();

            b.AppendLineSpace(fmt + "LBA: 0x" + LBA.ToString("X") + " (0x" + (LBA * 0x1000).ToString("X") + ")");
            b.AppendLineSpace(fmt + "Length: 0x" + Length.ToString("X") + " (0x" + (Length * 0x1000).ToString("X") + ")");
            b.AppendLineSpace(fmt + "Padding: " + Padding.ToHexString());

            return b.ToString();
        }
Example #2
0
        public string ToString(bool formatted)
        {
            var b = new StringBuilder();

            string fmt = formatted ? "    " : "";

            b.AppendLine("XvdMiscInfo:");
            b.AppendLineSpace(fmt + "Block Count: 0x" + XvdDataBlockCount.ToString("X"));

            if (Header.EmbeddedXVDLength > 0)
                b.AppendLineSpace(fmt + "Embedded XVD Offset: 0x3000");

            if(Header.UserDataLength > 0)
                b.AppendLineSpace(fmt + "User Data Offset: 0x" + UserDataOffset.ToString("X"));

            b.AppendLineSpace(fmt + "XVD Data Offset: 0x" + DataOffset.ToString("X"));

            if (IsDataIntegrityEnabled)
            {
                b.AppendLineSpace(fmt + "Hash Tree Block Count: 0x" + HashTreeBlockCount.ToString("X"));
                b.AppendLineSpace(fmt + "Hash Tree Levels: 0x" + HashTreeLevels.ToString("X"));
                b.AppendLineSpace(fmt + "Hash Tree Valid: " + (HashTreeValid ? "true" : "false"));

                if (!DisableDataHashChecking)
                    b.AppendLineSpace(fmt + "Data Hash Tree Valid: " + (DataHashTreeValid ? "true" : "false"));
            }

            if(IsXvcFile)
                b.AppendLineSpace(fmt + "XVC Data Hash Valid: " + (XvcDataHashValid ? "true" : "false"));

            b.AppendLine();
            b.Append(Header.ToString(formatted));

            if (XvcInfo.ContentID == null)
                return b.ToString();

            b.AppendLine();
            if (formatted)
            {
                byte[] decryptKey;
                string licenseFile = GetXvcKey(0, out decryptKey);
                if (!String.IsNullOrEmpty(licenseFile))
                {
                    if (licenseFile != "testsigned")
                        b.AppendLine("Decrypt key from license file " + licenseFile +
                                     " (key is wrong though until the obfuscation/encryption on it is figured out)");
                    else
                        b.AppendLine("Decrypt key for test-signed package:");

                    b.AppendLine(decryptKey.ToHexString());
                    b.AppendLine();
                }
            }
            b.AppendLine(XvcInfo.ToString(formatted));

            if(RegionHeaders != null)
                for (int i = 0; i < RegionHeaders.Count; i++)
                {
                    b.AppendLine();
                    b.AppendLine("Region " + i);
                    b.Append(RegionHeaders[i].ToString(formatted));
                }

            if (RegionHeaders != null)
                for (int i = 0; i < UpdateSegments.Count; i++)
                {
                    if (UpdateSegments[i].Unknown1 == 0)
                        break;
                    b.AppendLine();
                    b.AppendLine("Update Segment " + i);
                    b.Append(UpdateSegments[i].ToString(formatted));
                }

            return b.ToString();
        }
Example #3
0
        public string ToString(bool formatted)
        {
            var b = new StringBuilder();
            b.AppendLine("XbfsHeader:");

            string fmt = formatted ? "    " : "";

            if (Version != 1)
                b.AppendLineSpace(fmt + "Version != 1");
            if (Unknown1 != 3)
                b.AppendLineSpace(fmt + "Unknown1 != 3");
            if (Unknown2 != 0)
                b.AppendLineSpace(fmt + "Unknown2 != 0");
            if (Unknown3 != 0)
                b.AppendLineSpace(fmt + "Unknown3 != 0");
            if (Unknown4 != 0)
                b.AppendLineSpace(fmt + "Unknown4 != 0");
            if (!Unknown5.IsArrayEmpty())
                b.AppendLineSpace(fmt + "Unknown5 != null");
            if (!Unknown6.IsArrayEmpty())
                b.AppendLineSpace(fmt + "Unknown6 != null");
            if (!Unknown7.IsArrayEmpty())
                b.AppendLineSpace(fmt + "Unknown7 != null");

            b.AppendLine();
            b.AppendLineSpace(fmt + "Magic: " + new string(Magic));
            b.AppendLineSpace(fmt + "Version: 0x" + Version.ToString("X"));
            b.AppendLineSpace(fmt + "Boot Slot: 0x" + BootSlot.ToString("X"));
            b.AppendLineSpace(fmt + "Unknown1: 0x" + Unknown1.ToString("X"));
            b.AppendLineSpace(fmt + "Unknown2: 0x" + Unknown2.ToString("X"));
            b.AppendLineSpace(fmt + "Unknown3: 0x" + Unknown3.ToString("X"));
            b.AppendLineSpace(fmt + "Unknown4: 0x" + Unknown4.ToString("X"));
            b.AppendLineSpace(fmt + "Unknown5: 0x" + Unknown5.ToHexString());
            b.AppendLineSpace(fmt + "Unknown6: 0x" + Unknown6.ToHexString());
            b.AppendLineSpace(fmt + "Unknown7: 0x" + Unknown7.ToHexString());
            b.AppendLineSpace(fmt + "XBFS header hash: " + Environment.NewLine + fmt + XbfsHash.ToHexString());

            for(int i = 0; i < Entries.Length; i++)
            {
                XbfsEntry entry = Entries[i];
                b.AppendLine("Entry " + i);
                b.Append(entry.ToString(formatted));
            }

            return b.ToString();
        }
Example #4
0
        public string ToString(bool formatted)
        {
            var b = new StringBuilder();
            b.AppendLine("XvdHeader:");

            string fmt = formatted ? "    " : "";

            if (FormatVersion != 3)
                b.AppendLineSpace(fmt + "FormatVersion != 3");
            if (Unknown1_HashTableRelated != 1)
                b.AppendLineSpace(fmt + "Unknown1 != 1");
            if (Unknown2 != 0xAA000)
                b.AppendLineSpace(fmt + "Unknown2 != 0xAA000");
            if (!Unknown3.IsArrayEmpty())
                b.AppendLineSpace(fmt + "Unknown3 != null");
            if (Unknown4 != 0)
                b.AppendLineSpace(fmt + "Unknown4 != 0");
            if (!Unknown5.IsArrayEmpty())
                b.AppendLineSpace(fmt + "Unknown5 != null");
            if (Unknown6 != 0)
                b.AppendLineSpace(fmt + "Unknown6 != 0");
            if (Unknown7 != 0)
                b.AppendLineSpace(fmt + "Unknown7 != 0");
            if (!Unknown8.IsArrayEmpty())
                b.AppendLineSpace(fmt + "Unknown8 != null");
            if (!Reserved.IsArrayEmpty())
                b.AppendLineSpace(fmt + "Reserved != null");

            if (!Enum.IsDefined(typeof(XvdContentType), ContentType))
                b.AppendLineSpace(fmt + "Unknown content type 0x" + ContentType.ToString("X"));

            b.AppendLineSpace(fmt + (IsSignedWithRedKey ? "Signed" : "Not signed") + " with red key");

            if (VolumeFlags.IsFlagSet((uint)XvdVolumeFlags.SystemFile))
                b.AppendLineSpace(fmt + "System file");

            b.AppendLineSpace(fmt + "Read-only flag " + (VolumeFlags.IsFlagSet((uint)XvdVolumeFlags.ReadOnly) ? "set" : "not set"));

            b.AppendLineSpace(fmt + (VolumeFlags.IsFlagSet((uint)XvdVolumeFlags.EncryptionDisabled)
                ? "Decrypted"
                : "Encrypted"));

            if (Unk_0x2_Means_Test_ODK != 0)
            {
                if (Unk_0x2_Means_Test_ODK == 0x2)
                    b.AppendLineSpace(fmt + "(using test ODK) (maybe)");
                else
                    b.AppendLineSpace(fmt + "Unk_0x2_Means_Test_ODK != 0 && != 2! (actually 0x" + Unk_0x2_Means_Test_ODK.ToString("X") + ")");
            }

            b.AppendLineSpace(fmt + (VolumeFlags.IsFlagSet((uint)XvdVolumeFlags.DataIntegrityDisabled)
                ? "Data integrity disabled (doesn't use hash tree)"
                : "Data integrity enabled (uses hash tree)"));

            b.AppendLineSpace(fmt + "Unknown flag 0x40 " + (VolumeFlags.IsFlagSet((uint)XvdVolumeFlags.Unknown) ? "set" : "not set"));

            b.AppendLine();

            b.AppendLineSpace(fmt + "Magic: " + new string(Magic));
            b.AppendLineSpace(fmt + "Volume Flags: 0x" + VolumeFlags.ToString("X"));

            string contentType = "0x" + ContentType.ToString("X") + " (" + ((XvdContentType)ContentType) + ")";

            b.AppendLineSpace(fmt + "File Time Created: " + DateTime.FromFileTime(FileTimeCreated));
            b.AppendLineSpace(fmt + "Drive Size: 0x" + DriveSize.ToString("X"));
            b.AppendLineSpace(fmt + "Format Version: 0x" + FormatVersion.ToString("X"));

            b.AppendLineSpace(fmt + String.Format("VDUID / Drive Id: {0} (UDUID / User Id: {1})", new Guid(VDUID), new Guid(UDUID)));
            b.AppendLineSpace(fmt + "Content Type: " + contentType);
            b.AppendLineSpace(fmt + "Embedded XVD PDUID/Build Id: " + new Guid(EmbeddedXVD_PDUID));
            b.AppendLineSpace(fmt + "Embedded XVD Length: 0x" + EmbeddedXVDLength.ToString("X"));
            b.AppendLineSpace(fmt + "User Data Length: 0x" + UserDataLength.ToString("X"));
            b.AppendLineSpace(fmt + "XVC Data Length: 0x" + XvcDataLength.ToString("X"));
            b.AppendLineSpace(fmt + "Dynamic Header Length: 0x" + DynamicHeaderLength.ToString("X"));
            b.AppendLineSpace(fmt + "Top Hash Block Hash:" + Environment.NewLine + fmt + TopHashBlockHash.ToHexString());
            b.AppendLineSpace(fmt + "Original XVC Data Hash:" + Environment.NewLine + fmt + OriginalXvcDataHash.ToHexString());
            b.AppendLineSpace(fmt + "Sandbox Id: " + new string(SandboxId).Replace("\0", ""));
            b.AppendLineSpace(fmt + "Product Id: " + new Guid(ProductId));
            b.AppendLineSpace(fmt + "PDUID/Build Id: " + new Guid(PDUID));
            b.AppendLineSpace(fmt + String.Format("Package Version: {3}.{2}.{1}.{0}", PackageVersion1, PackageVersion2, PackageVersion3, PackageVersion4));
            b.AppendLineSpace(fmt + String.Format("Required System Version: {3}.{2}.{1}.{0}", RequiredSystemVersion1, RequiredSystemVersion2, RequiredSystemVersion3, RequiredSystemVersion4));
            b.AppendLineSpace(fmt + "Encrypted CIK:" + Environment.NewLine + fmt + EncryptedCIK.ToHexString());
            b.AppendLineSpace(fmt + "PECatalogInfo0: 0x" + PECatalogInfo0.ToString("X"));

            string catalogInfo1 = "";
            foreach (ulong catalogInfo in PECatalogInfo1)
                catalogInfo1 += "0x" + catalogInfo.ToString("X") + " ";

            b.AppendLine(fmt + "PECatalogInfo1: " + catalogInfo1);

            string catalogInfo2 = "";
            foreach (ulong catalogInfo in PECatalogInfo2)
                catalogInfo2 += "0x" + catalogInfo.ToString("X") + " ";

            b.AppendLine(fmt + "PECatalogInfo2: " + catalogInfo2);

            b.AppendLine(fmt + "PECatalogInfo3: ");
            b.Append(fmt);
            foreach (ulong catalogInfo in PECatalogInfo3)
                b.Append("0x" + catalogInfo.ToString("X") + " ");

            b.AppendLine();
            b.AppendLine();

            b.AppendLineSpace(fmt + "Unknown1: 0x" + Unknown1_HashTableRelated.ToString("X"));
            b.AppendLineSpace(fmt + "Unknown2: 0x" + Unknown2.ToString("X"));
            b.AppendLineSpace(fmt + "Unknown3:" + Environment.NewLine + fmt + Unknown3.ToHexString());
            b.AppendLineSpace(fmt + "Unknown4: 0x" + Unknown4.ToString("X"));
            b.AppendLineSpace(fmt + "Unknown5:" + Environment.NewLine + fmt + Unknown5.ToHexString());
            b.AppendLineSpace(fmt + "Unknown6: 0x" + Unknown6.ToString("X"));
            b.AppendLineSpace(fmt + "Unknown7: 0x" + Unknown7.ToString("X"));
            b.AppendLineSpace(fmt + "Unknown8: " + Environment.NewLine + fmt + Unknown8.ToHexString());
            b.AppendLineSpace(fmt + "Unknown9/TestODK indicator: 0x" + Unk_0x2_Means_Test_ODK.ToString("X"));

            if (!Reserved.IsArrayEmpty())
                b.AppendLineSpace(fmt + "Reserved: " + Environment.NewLine + fmt + Reserved.ToHexString());

            return b.ToString();
        }
Example #5
0
        public string ToString(bool formatted)
        {
            var b = new StringBuilder();
            b.AppendLine("XvcUpdateSegmentInfo");
            b.AppendLine();

            string fmt = formatted ? "    " : "";

            b.AppendLineSpace(fmt + "Unknown1: 0x" + Unknown1.ToString("X"));
            b.AppendLineSpace(fmt + "Unknown2: 0x" + Unknown2.ToString("X"));
            b.AppendLineSpace(fmt + "Unknown3: 0x" + Unknown3.ToString("X"));

            return b.ToString();
        }
Example #6
0
        public string ToString(bool formatted)
        {
            var b = new StringBuilder();
            b.AppendLine("XvcRegionHeader (ID/EncryptionIV: 0x" + Id.ToString("X8") + "):");

            string fmt = formatted ? "    " : "";

            if(Unknown1 != 0)
                b.AppendLineSpace(fmt + "Unknown1 != 0");
            if (Unknown2 != 0)
                b.AppendLineSpace(fmt + "Unknown2 != 0");
            if (Unknown3 != 0)
                b.AppendLineSpace(fmt + "Unknown3 != 0");
            if (Unknown4 != 0)
                b.AppendLineSpace(fmt + "Unknown4 != 0");
            if (Unknown5 != 0)
                b.AppendLineSpace(fmt + "Unknown5 != 0");

            string keyid = KeyId.ToString("X");
            if (KeyId == 0xFFFF)
                keyid += " (not encrypted)";
            b.AppendLineSpace(fmt + "Description: " + Description.Replace("\0", ""));
            b.AppendLineSpace(fmt + "Key ID: 0x" + keyid);
            b.AppendLineSpace(fmt + "Flags: 0x" + Flags.ToString("X"));
            b.AppendLineSpace(fmt + "Offset: 0x" + Offset.ToString("X"));
            b.AppendLineSpace(fmt + "Length: 0x" + Length.ToString("X"));
            b.AppendLineSpace(fmt + "Region PDUID: 0x" + RegionPDUID.ToString("X"));
            b.AppendLine();
            b.AppendLineSpace(fmt + "Unknown1: 0x" + Unknown1.ToString("X"));
            b.AppendLineSpace(fmt + "Unknown2: 0x" + Unknown2.ToString("X"));
            b.AppendLineSpace(fmt + "Unknown3: 0x" + Unknown3.ToString("X"));
            b.AppendLineSpace(fmt + "Unknown4: 0x" + Unknown4.ToString("X"));
            b.AppendLineSpace(fmt + "Unknown5: 0x" + Unknown5.ToString("X"));

            return b.ToString();
        }
Example #7
0
        public string ToString(bool formatted)
        {
            var b = new StringBuilder();
            b.AppendLine("XvcInfo:");

            string fmt = formatted ? "    " : "";

            if (Flags != 0)
                b.AppendLineSpace(fmt + "Flags != 0");
            if (Unknown1 != 0)
                b.AppendLineSpace(fmt + "Unknown1 != 0");
            if (Unknown2 != 0)
                b.AppendLineSpace(fmt + "Unknown2 != 0");
            if (PreviewRegionId != 0)
                b.AppendLineSpace(fmt + "PreviewRegionId != 0");
            if (PreviewOffset != 0)
                b.AppendLineSpace(fmt + "PreviewOffset != 0");
            if (UnusedSpace != 0)
                b.AppendLineSpace(fmt + "UnusedSpace != 0");
            if (!Reserved.IsArrayEmpty())
                b.AppendLineSpace(fmt + "Reserved != null");

            var signType = "Unsigned/not crypted (/LU)";
            if (KeyCount > 0)
                if (IsUsingTestCik)
                    signType = "Test-crypted (/LT)";
                else if (!IsAnyKeySet)
                    signType = "Unsigned with KeyCount > 0";
                else
                    signType = "Submission-crypted (not using test key) (/L)";

            b.AppendLineSpace(fmt + signType);
            b.AppendLineSpace(fmt + "/updcompat type " + (UpdateSegmentCount == 0 ? "1" : "2"));

            b.AppendLine();

            b.AppendLineSpace(fmt + "ContentID: " + new Guid(ContentID));
            for(int i = 0; i < EncryptionKeyIds.Length; i++)
                if(!EncryptionKeyIds[i].IsKeyNulled)
                    b.AppendLineSpace(fmt + "Encryption Key " + i + " GUID: " + new Guid(EncryptionKeyIds[i].KeyId));

            b.AppendLine();

            b.AppendLineSpace(fmt + "Description: " + Encoding.Unicode.GetString(Description).Replace("\0", ""));
            b.AppendLineSpace(fmt + "Version: 0x" + Version.ToString("X"));
            b.AppendLineSpace(fmt + "Region Count: 0x" + RegionCount.ToString("X"));
            b.AppendLineSpace(fmt + "Flags: 0x" + Flags.ToString("X"));
            b.AppendLineSpace(fmt + "Key Count: 0x" + KeyCount.ToString("X"));
            b.AppendLineSpace(fmt + "InitialPlay Region Id: 0x" + InitialPlayRegionId.ToString("X"));
            b.AppendLineSpace(fmt + "InitialPlay Offset: 0x" + InitialPlayOffset.ToString("X"));
            b.AppendLineSpace(fmt + "File Time Created: " + DateTime.FromFileTime(FileTimeCreated));
            b.AppendLineSpace(fmt + "Preview Region Id: 0x" + PreviewRegionId.ToString("X"));
            b.AppendLineSpace(fmt + "Update Segment Count: 0x" + UpdateSegmentCount.ToString("X"));
            b.AppendLineSpace(fmt + "Preview Offset: 0x" + PreviewOffset.ToString("X"));
            b.AppendLineSpace(fmt + "Unused Space: 0x" + UnusedSpace.ToString("X"));
            b.AppendLine();
            b.AppendLineSpace(fmt + "Unknown1: 0x" + Unknown1.ToString("X"));
            b.AppendLineSpace(fmt + "Unknown2: 0x" + Unknown2.ToString("X"));

            if (!Reserved.IsArrayEmpty())
                b.AppendLineSpace(fmt + "Reserved: " + Environment.NewLine + fmt + Reserved.ToHexString());

            return b.ToString();
        }