Skip to content

Commit

Permalink
Small fixes, print XvcRegionFlags
Browse files Browse the repository at this point in the history
  • Loading branch information
emoose committed Mar 20, 2019
1 parent cd5e1d8 commit 0350519
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
21 changes: 18 additions & 3 deletions LibXboxOne/XVD/XVDStructs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public string SignedBy
var headerData = GetHeaderWithoutSignature();
foreach(var signKey in DurangoKeys.GetAllXvdSigningKeys())
{
if(HashUtils.VerifySignature(signKey.Value.KeyData, Signature, headerData))
if(signKey.Value.KeyData != null && HashUtils.VerifySignature(signKey.Value.KeyData, Signature, headerData))
return signKey.Key;
}
return "<UNKNOWN>";
Expand Down Expand Up @@ -364,7 +364,7 @@ public struct XvcRegionHeader
/* 0x0 */ public XvcRegionId Id;
/* 0x4 */ public ushort KeyId;
/* 0x6 */ public ushort Padding6;
/* 0x8 */ public uint Flags;
/* 0x8 */ public XvcRegionFlags Flags;
/* 0xC */ public uint FirstSegmentIndex;

[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 0x20)]
Expand Down Expand Up @@ -422,7 +422,22 @@ public string ToString(bool formatted)
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 + "Flags: 0x" + ((uint)Flags).ToString("X"));
if (Flags.HasFlag(XvcRegionFlags.Resident))
b.AppendLineSpace(fmt + " - Resident");
if (Flags.HasFlag(XvcRegionFlags.InitialPlay))
b.AppendLineSpace(fmt + " - InitialPlay");
if (Flags.HasFlag(XvcRegionFlags.Preview))
b.AppendLineSpace(fmt + " - Preview");
if (Flags.HasFlag(XvcRegionFlags.FileSystemMetadata))
b.AppendLineSpace(fmt + " - FileSystemMetadata");
if (Flags.HasFlag(XvcRegionFlags.Present))
b.AppendLineSpace(fmt + " - Present");
if (Flags.HasFlag(XvcRegionFlags.OnDemand))
b.AppendLineSpace(fmt + " - OnDemand");
if (Flags.HasFlag(XvcRegionFlags.Available))
b.AppendLineSpace(fmt + " - Available");

b.AppendLineSpace(fmt + "Offset: 0x" + Offset.ToString("X"));
b.AppendLineSpace(fmt + "Length: 0x" + Length.ToString("X"));
b.AppendLineSpace(fmt + "Hash: 0x" + Hash.ToString("X"));
Expand Down
3 changes: 1 addition & 2 deletions XVDTool/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -389,8 +389,7 @@ void PrintKnownKeys<T>(KeyType type, KeyValuePair<T,DurangoKeyEntry>[] keyCollec
{
if (!file.GetXvcKeyByGuid(cikToUse, out byte[] outputKey))
{
Console.WriteLine("Error: unable to find key for key GUID " +
new Guid(file.XvcInfo.EncryptionKeyIds[0].KeyId));
Console.WriteLine("Error: unable to find key for key GUID " + cikToUse);
return;
}
keyToUse = $"{cikToUse}: {outputKey.ToHexString()}";
Expand Down

0 comments on commit 0350519

Please sign in to comment.