Update files more...

This commit is contained in:
SilicaAndPina 2020-08-25 06:50:46 +12:00
parent 9df7b33678
commit 5c58c31270
343 changed files with 7869 additions and 1310 deletions

View File

@ -1,309 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{78933B2F-C754-4904-804E-D3932536471C}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>CHOVY_JUAN</RootNamespace>
<AssemblyName>CHOVY-JUAN</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="AligningStream.cs" />
<Compile Include="ApplePartitionMap\BlockZero.cs" />
<Compile Include="ApplePartitionMap\PartitionMap.cs" />
<Compile Include="ApplePartitionMap\PartitionMapEntry.cs" />
<Compile Include="ApplePartitionMap\PartitionMapFactory.cs" />
<Compile Include="Archives\FileRecord.cs" />
<Compile Include="Archives\TarFile.cs" />
<Compile Include="Archives\TarFileBuilder.cs" />
<Compile Include="Archives\TarHeader.cs" />
<Compile Include="Archives\TarHeaderExtent.cs" />
<Compile Include="Archives\UnixBuildFileRecord.cs" />
<Compile Include="BaseVolumeDescriptor.cs" />
<Compile Include="Block\Block.cs" />
<Compile Include="Block\BlockCache.cs" />
<Compile Include="Block\BlockCacheSettings.cs" />
<Compile Include="Block\BlockCacheStatistics.cs" />
<Compile Include="Block\BlockCacheStream.cs" />
<Compile Include="BootDeviceEmulation.cs" />
<Compile Include="BootInitialEntry.cs" />
<Compile Include="BootValidationEntry.cs" />
<Compile Include="BootVolumeDescriptor.cs" />
<Compile Include="BootVolumeDescriptorRegion.cs" />
<Compile Include="Buffer\Buffer.cs" />
<Compile Include="Buffer\BufferStream.cs" />
<Compile Include="Buffer\IBuffer.cs" />
<Compile Include="Buffer\IMappedBuffer.cs" />
<Compile Include="Buffer\SubBuffer.cs" />
<Compile Include="BuildDirectoryInfo.cs" />
<Compile Include="BuildDirectoryMember.cs" />
<Compile Include="Builder\BuilderBufferExtent.cs" />
<Compile Include="Builder\BuilderBufferExtentSource.cs" />
<Compile Include="Builder\BuilderBytesExtent.cs" />
<Compile Include="Builder\BuilderExtent.cs" />
<Compile Include="Builder\BuilderExtentSource.cs" />
<Compile Include="Builder\BuilderSparseStreamExtent.cs" />
<Compile Include="Builder\BuilderStreamExtent.cs" />
<Compile Include="Builder\BuilderStreamExtentSource.cs" />
<Compile Include="Builder\PassthroughStreamBuilder.cs" />
<Compile Include="Builder\StreamBuilder.cs" />
<Compile Include="BuildFileInfo.cs" />
<Compile Include="BuildParameters.cs" />
<Compile Include="BuiltStream.cs" />
<Compile Include="CDBuilder.cs" />
<Compile Include="CDReader.cs" />
<Compile Include="ChsAddress.cs" />
<Compile Include="CircularStream.cs" />
<Compile Include="ClusterMap.cs" />
<Compile Include="ClusterRoles.cs" />
<Compile Include="CommonVolumeDescriptor.cs" />
<Compile Include="Compression\Adler32.cs" />
<Compile Include="Compression\BigEndianBitStream.cs" />
<Compile Include="Compression\BitStream.cs" />
<Compile Include="Compression\BlockCompressor.cs" />
<Compile Include="Compression\BZip2BlockDecoder.cs" />
<Compile Include="Compression\BZip2CombinedHuffmanTrees.cs" />
<Compile Include="Compression\BZip2DecoderStream.cs" />
<Compile Include="Compression\BZip2Randomizer.cs" />
<Compile Include="Compression\BZip2RleStream.cs" />
<Compile Include="Compression\CompressionResult.cs" />
<Compile Include="Compression\DataBlockTransform.cs" />
<Compile Include="Compression\HuffmanTree.cs" />
<Compile Include="Compression\InverseBurrowsWheeler.cs" />
<Compile Include="Compression\MoveToFront.cs" />
<Compile Include="Compression\SizedDeflateStream.cs" />
<Compile Include="Compression\ZlibBuffer.cs" />
<Compile Include="Compression\ZlibStream.cs" />
<Compile Include="ConcatStream.cs" />
<Compile Include="CoreCompat\EncodingHelper.cs" />
<Compile Include="CoreCompat\ReflectionHelper.cs" />
<Compile Include="CoreCompat\StringExtensions.cs" />
<Compile Include="DirectoryExtent.cs" />
<Compile Include="DirectoryRecord.cs" />
<Compile Include="DiscDirectoryInfo.cs" />
<Compile Include="DiscFileInfo.cs" />
<Compile Include="DiscFileLocator.cs" />
<Compile Include="DiscFileSystem.cs" />
<Compile Include="DiscFileSystemChecker.cs" />
<Compile Include="DiscFileSystemInfo.cs" />
<Compile Include="DiscFileSystemOptions.cs" />
<Compile Include="DiskImageBuilder.cs" />
<Compile Include="DiskImageFileSpecification.cs" />
<Compile Include="ExtentStream.cs" />
<Compile Include="File.cs" />
<Compile Include="FileExtent.cs" />
<Compile Include="FileFlags.cs" />
<Compile Include="FileLocator.cs" />
<Compile Include="FileSystemInfo.cs" />
<Compile Include="FileSystemManager.cs" />
<Compile Include="FileSystemParameters.cs" />
<Compile Include="FileTransport.cs" />
<Compile Include="FloppyDiskType.cs" />
<Compile Include="GenericDiskAdapterType.cs" />
<Compile Include="Geometry.cs" />
<Compile Include="GeometryCalculation.cs" />
<Compile Include="GeometryTranslation.cs" />
<Compile Include="IByteArraySerializable.cs" />
<Compile Include="IClusterBasedFileSystem.cs" />
<Compile Include="IDiagnosticTraceable.cs" />
<Compile Include="IFileSystem.cs" />
<Compile Include="Internal\Crc32.cs" />
<Compile Include="Internal\Crc32Algorithm.cs" />
<Compile Include="Internal\Crc32BigEndian.cs" />
<Compile Include="Internal\Crc32LittleEndian.cs" />
<Compile Include="Internal\LocalFileLocator.cs" />
<Compile Include="Internal\LogicalVolumeFactory.cs" />
<Compile Include="Internal\LogicalVolumeFactoryAttribute.cs" />
<Compile Include="Internal\ObjectCache.cs" />
<Compile Include="Internal\Utilities.cs" />
<Compile Include="Internal\VirtualDiskFactory.cs" />
<Compile Include="Internal\VirtualDiskFactoryAttribute.cs" />
<Compile Include="Internal\VirtualDiskTransport.cs" />
<Compile Include="Internal\VirtualDiskTransportAttribute.cs" />
<Compile Include="InvalidFileSystemException.cs" />
<Compile Include="Iso9660Variant.cs" />
<Compile Include="IsoContext.cs" />
<Compile Include="IsoUtilities.cs" />
<Compile Include="IUnixFileSystem.cs" />
<Compile Include="IWindowsFileSystem.cs" />
<Compile Include="LengthWrappingStream.cs" />
<Compile Include="LogicalDiskManager\ComponentRecord.cs" />
<Compile Include="LogicalDiskManager\Database.cs" />
<Compile Include="LogicalDiskManager\DatabaseHeader.cs" />
<Compile Include="LogicalDiskManager\DatabaseRecord.cs" />
<Compile Include="LogicalDiskManager\DiskGroupRecord.cs" />
<Compile Include="LogicalDiskManager\DiskRecord.cs" />
<Compile Include="LogicalDiskManager\DynamicDisk.cs" />
<Compile Include="LogicalDiskManager\DynamicDiskGroup.cs" />
<Compile Include="LogicalDiskManager\DynamicDiskManager.cs" />
<Compile Include="LogicalDiskManager\DynamicDiskManagerFactory.cs" />
<Compile Include="LogicalDiskManager\DynamicVolume.cs" />
<Compile Include="LogicalDiskManager\ExtentMergeType.cs" />
<Compile Include="LogicalDiskManager\ExtentRecord.cs" />
<Compile Include="LogicalDiskManager\PrivateHeader.cs" />
<Compile Include="LogicalDiskManager\RecordType.cs" />
<Compile Include="LogicalDiskManager\TocBlock.cs" />
<Compile Include="LogicalDiskManager\VolumeRecord.cs" />
<Compile Include="LogicalVolumeInfo.cs" />
<Compile Include="LogicalVolumeStatus.cs" />
<Compile Include="MappedStream.cs" />
<Compile Include="MirrorStream.cs" />
<Compile Include="NativeFileSystem.cs" />
<Compile Include="Partitions\BiosExtendedPartitionTable.cs" />
<Compile Include="Partitions\BiosPartitionedDiskBuilder.cs" />
<Compile Include="Partitions\BiosPartitionInfo.cs" />
<Compile Include="Partitions\BiosPartitionRecord.cs" />
<Compile Include="Partitions\BiosPartitionTable.cs" />
<Compile Include="Partitions\BiosPartitionTypes.cs" />
<Compile Include="Partitions\DefaultPartitionTableFactory.cs" />
<Compile Include="Partitions\GptEntry.cs" />
<Compile Include="Partitions\GptHeader.cs" />
<Compile Include="Partitions\GuidPartitionInfo.cs" />
<Compile Include="Partitions\GuidPartitionTable.cs" />
<Compile Include="Partitions\GuidPartitionTypes.cs" />
<Compile Include="Partitions\PartitionInfo.cs" />
<Compile Include="Partitions\PartitionTable.cs" />
<Compile Include="Partitions\PartitionTableFactory.cs" />
<Compile Include="Partitions\PartitionTableFactoryAttribute.cs" />
<Compile Include="Partitions\WellKnownPartitionType.cs" />
<Compile Include="PathTable.cs" />
<Compile Include="PathTableRecord.cs" />
<Compile Include="PhysicalVolumeInfo.cs" />
<Compile Include="PhysicalVolumeType.cs" />
<Compile Include="Plist.cs" />
<Compile Include="PositionWrappingStream.cs" />
<Compile Include="PrimaryVolumeDescriptor.cs" />
<Compile Include="PrimaryVolumeDescriptorRegion.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="PumpProgressEventArgs.cs" />
<Compile Include="Raw\Disk.cs" />
<Compile Include="Raw\DiskFactory.cs" />
<Compile Include="Raw\DiskImageFile.cs" />
<Compile Include="ReaderDirectory.cs" />
<Compile Include="ReaderDirEntry.cs" />
<Compile Include="ReaderWriter\BigEndianDataReader.cs" />
<Compile Include="ReaderWriter\BigEndianDataWriter.cs" />
<Compile Include="ReaderWriter\DataReader.cs" />
<Compile Include="ReaderWriter\DataWriter.cs" />
<Compile Include="ReaderWriter\LittleEndianDataReader.cs" />
<Compile Include="ReadOnlyDiscFileSystem.cs" />
<Compile Include="ReparsePoint.cs" />
<Compile Include="ReportLevels.cs" />
<Compile Include="RockRidge\ChildLinkSystemUseEntry.cs" />
<Compile Include="RockRidge\FileTimeSystemUseEntry.cs" />
<Compile Include="RockRidge\PosixFileInfoSystemUseEntry.cs" />
<Compile Include="RockRidge\PosixNameSystemUseEntry.cs" />
<Compile Include="RockRidge\RockRidgeExtension.cs" />
<Compile Include="Setup\FileOpenEventArgs.cs" />
<Compile Include="Setup\SetupHelper.cs" />
<Compile Include="SnapshotStream.cs" />
<Compile Include="SparseMemoryBuffer.cs" />
<Compile Include="SparseMemoryStream.cs" />
<Compile Include="SparseStream.cs" />
<Compile Include="SparseStreamOpenDelegate.cs" />
<Compile Include="StreamBuffer.cs" />
<Compile Include="StreamExtent.cs" />
<Compile Include="StreamPump.cs" />
<Compile Include="StripedStream.cs" />
<Compile Include="SubStream.cs" />
<Compile Include="SupplementaryVolumeDescriptor.cs" />
<Compile Include="SupplementaryVolumeDescriptorRegion.cs" />
<Compile Include="Susp\ContinuationSystemUseEntry.cs" />
<Compile Include="Susp\ExtensionSelectSystemUseEntry.cs" />
<Compile Include="Susp\ExtensionSystemUseEntry.cs" />
<Compile Include="Susp\GenericSuspExtension.cs" />
<Compile Include="Susp\GenericSystemUseEntry.cs" />
<Compile Include="Susp\PaddingSystemUseEntry.cs" />
<Compile Include="Susp\SharingProtocolSystemUseEntry.cs" />
<Compile Include="Susp\SuspExtension.cs" />
<Compile Include="Susp\SuspRecords.cs" />
<Compile Include="Susp\SystemUseEntry.cs" />
<Compile Include="System\DateTimeOffsetExtensions.cs" />
<Compile Include="System\ExtensionAttribute.cs" />
<Compile Include="System\Func.cs" />
<Compile Include="System\HashSet.cs" />
<Compile Include="System\Tuple.cs" />
<Compile Include="ThreadSafeStream.cs" />
<Compile Include="TimeConverter.cs" />
<Compile Include="UnixFilePermissions.cs" />
<Compile Include="UnixFileSystemInfo.cs" />
<Compile Include="UnixFileType.cs" />
<Compile Include="Util\BitCounter.cs" />
<Compile Include="Util\EndianUtilities.cs" />
<Compile Include="Util\MathUtilities.cs" />
<Compile Include="Util\Numbers.cs" />
<Compile Include="Util\Ownership.cs" />
<Compile Include="Util\Range.cs" />
<Compile Include="Util\Sizes.cs" />
<Compile Include="Util\StreamUtilities.cs" />
<Compile Include="VfsCDReader.cs" />
<Compile Include="Vfs\IVfsDirectory.cs" />
<Compile Include="Vfs\IVfsFile.cs" />
<Compile Include="Vfs\IVfsFileWithStreams.cs" />
<Compile Include="Vfs\IVfsSymlink.cs" />
<Compile Include="Vfs\VfsContext.cs" />
<Compile Include="Vfs\VfsDirEntry.cs" />
<Compile Include="Vfs\VfsFileSystem.cs" />
<Compile Include="Vfs\VfsFileSystemFacade.cs" />
<Compile Include="Vfs\VfsFileSystemFactory.cs" />
<Compile Include="Vfs\VfsFileSystemFactoryAttribute.cs" />
<Compile Include="Vfs\VfsFileSystemInfo.cs" />
<Compile Include="Vfs\VfsFileSystemOpener.cs" />
<Compile Include="Vfs\VfsReadOnlyFileSystem.cs" />
<Compile Include="VirtualDisk.cs" />
<Compile Include="VirtualDiskClass.cs" />
<Compile Include="VirtualDiskExtent.cs" />
<Compile Include="VirtualDiskLayer.cs" />
<Compile Include="VirtualDiskManager.cs" />
<Compile Include="VirtualDiskParameters.cs" />
<Compile Include="VirtualDiskTypeInfo.cs" />
<Compile Include="VolumeDescriptorDiskRegion.cs" />
<Compile Include="VolumeDescriptorSetTerminator.cs" />
<Compile Include="VolumeDescriptorSetTerminatorRegion.cs" />
<Compile Include="VolumeDescriptorType.cs" />
<Compile Include="VolumeInfo.cs" />
<Compile Include="VolumeManager.cs" />
<Compile Include="WindowsFileInformation.cs" />
<Compile Include="WrappingMappedStream.cs" />
<Compile Include="WrappingStream.cs" />
<Compile Include="ZeroStream.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -1,21 +0,0 @@
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DiscUtils.Streams")]
[assembly: AssemblyTrademark("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("cf8c37c3-69f4-40ef-a3a1-4d1dcc332058")]

1463
CHOVY-KIRK/aes.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -951,7 +951,7 @@ static void rijndaelDecrypt(const u32 rk[/*4*(Nr + 1)*/], int Nr, const u8 ct[16
}
/* setup key context for both encryption and decryption */
static int rijndael_set_key(AES_ctx *ctx, const u8 *key, int bits)
int rijndael_set_key(AES_ctx *ctx, const u8 *key, int bits)
{
int rounds;
@ -984,6 +984,17 @@ int AES_set_key(AES_ctx *ctx, const u8 *key, int bits)
return rijndael_set_key(ctx, key, bits);
}
void rijndael_encrypt(AES_ctx* ctx, const u8* src, u8* dst)
{
rijndaelEncrypt(ctx->ek, ctx->Nr, src, dst);
}
void rijndael_decrypt(AES_ctx* ctx, const u8* src, u8* dst)
{
rijndaelDecrypt(ctx->dk, ctx->Nr, src, dst);
}
void AES_decrypt(AES_ctx *ctx, const u8 *src, u8 *dst)
{
return rijndaelDecrypt(ctx->dk, ctx->Nr, src, dst);

View File

@ -23,12 +23,16 @@ typedef struct
u32 dk[4*(AES_MAXROUNDS + 1)]; /* decrypt key schedule */
} AES_ctx;
int AES_set_key(AES_ctx *ctx, const u8 *key, int bits);
void AES_encrypt(AES_ctx *ctx, const u8 *src, u8 *dst);
void AES_decrypt(AES_ctx *ctx, const u8 *src, u8 *dst);
void AES_cbc_encrypt(AES_ctx *ctx, u8 *src, u8 *dst, int size);
void AES_cbc_decrypt(AES_ctx *ctx, u8 *src, u8 *dst, int size);
void AES_CMAC(AES_ctx *ctx, unsigned char *input, int length, unsigned char *mac);
void rijndael_encrypt(AES_ctx* ctx, const u8* src, u8* dst);
void rijndael_decrypt(AES_ctx* ctx, const u8* src, u8* dst);
int rijndael_set_key(AES_ctx* ctx, const u8* key, int bits);
typedef struct SHA1Context
{

View File

@ -196,6 +196,46 @@ static void point_mul(struct point *d, u8 *a, struct point *b)
}
}
static void generate_ecdsa_norandom(u8* outR, u8* outS, u8* k, u8* hash)
{
u8 e[21];
u8 kk[21];
u8 m[21];
u8 R[21];
u8 S[21];
u8 minv[21];
struct point mG;
e[0] = 0; R[0] = 0; S[0] = 0;
memcpy(e + 1, hash, 20);
bn_reduce(e, ec_N, 21);
kirk_CMD14(m + 1, 20);
m[0] = 0;
point_mul(&mG, m, &ec_G);
point_from_mon(&mG);
R[0] = 0;
elt_copy(R + 1, mG.x);
bn_copy(kk, k, 21);
bn_reduce(kk, ec_N, 21);
bn_to_mon(m, ec_N, 21);
bn_to_mon(e, ec_N, 21);
bn_to_mon(R, ec_N, 21);
bn_to_mon(kk, ec_N, 21);
bn_mon_mul(S, R, kk, ec_N, 21);
bn_add(kk, S, e, ec_N, 21);
bn_mon_inv(minv, m, ec_N, 21);
bn_mon_mul(S, minv, kk, ec_N, 21);
bn_from_mon(R, ec_N, 21);
bn_from_mon(S, ec_N, 21);
memcpy(outR, R + 1, 0x20);
memcpy(outS, S + 1, 0x20);
}
static void generate_ecdsa(u8 *R, u8 *S, u8 *k, u8 *hash, u8 *random)
{
u8 e[20];
@ -337,12 +377,25 @@ int ecdsa_verify(u8 *hash, u8 *R, u8 *S)
{
return check_ecdsa(&ec_Q, R, S, hash);
}
void ecdsa_sign_norandom(u8* hash, u8* R, u8* S)
{
generate_ecdsa_norandom(R, S, ec_k, hash);
}
void ecdsa_sign(u8 *hash, u8 *R, u8 *S, u8 *random)
{
generate_ecdsa(R, S, ec_k, hash, random);
}
void ec_pub_mult(u8* k, u8* Q)
{
struct point ec_temp;
point_mul(&ec_temp, k, &ec_Q);
point_from_mon(&ec_temp);
memcpy(Q, ec_temp.x, 20);
memcpy(Q + 20, ec_temp.y, 20);
}
/*************************************************************/
// calculate the random and private key from signs with same r value

View File

@ -21,6 +21,7 @@ void ecdsa_set_pub(u8 *Qx, u8 *Qy);
void ecdsa_set_priv(u8 *k);
int ecdsa_verify(u8 *hash, u8 *R, u8 *S);
void ecdsa_sign(u8 *hash, u8 *R, u8 *S, u8 *random);
void ecdsa_sign_norandom(u8* hash, u8* R, u8* S);
void ecdsa_sign_fixed(u8 *hash, u8 *fixed_m, u8 *fixed_r, u8 *S);
void ecdsa_find_m_k(u8 *sig_r, u8 *sig_s1, u8 *hash1, u8 *sig_s2, u8 *hash2, u8 *N, u8 *ret_m, u8 *ret_k);

View File

@ -56,9 +56,11 @@ u8 priv_key_edata[20] = {0xe5,0xc4,0xd0,0xa8,0x24,0x9a,0x6f,0x27,0xe5,0xe0,0xc9,
u8 kirk1_key[16] = {0x98, 0xC9, 0x40, 0x97, 0x5C, 0x1D, 0x10, 0xE8, 0x7F, 0xE6, 0x0E, 0xA3, 0xFD, 0x03, 0xA8, 0xBA};
// AES key for kirk4/7
u8 kirk7_key02[] = {0xB8, 0x13, 0xC3, 0x5E, 0xC6, 0x44, 0x41, 0xE3, 0xDC, 0x3C, 0x16, 0xF5, 0xB4, 0x5E, 0x64, 0x84};
u8 kirk7_key03[] = {0x98, 0x02, 0xC4, 0xE6, 0xEC, 0x9E, 0x9E, 0x2F, 0xFC, 0x63, 0x4C, 0xE4, 0x2F, 0xBB, 0x46, 0x68};
u8 kirk7_key04[] = {0x99, 0x24, 0x4C, 0xD2, 0x58, 0xF5, 0x1B, 0xCB, 0xB0, 0x61, 0x9C, 0xA7, 0x38, 0x30, 0x07, 0x5F};
u8 kirk7_key05[] = {0x02, 0x25, 0xD7, 0xBA, 0x63, 0xEC, 0xB9, 0x4A, 0x9D, 0x23, 0x76, 0x01, 0xB3, 0xF6, 0xAC, 0x17};
u8 kirk7_key07[] = {0x76, 0x36, 0x8B, 0x43, 0x8F, 0x77, 0xD8, 0x7E, 0xFE, 0x5F, 0xB6, 0x11, 0x59, 0x39, 0x88, 0x5C};
u8 kirk7_key0C[] = {0x84, 0x85, 0xC8, 0x48, 0x75, 0x08, 0x43, 0xBC, 0x9B, 0x9A, 0xEC, 0xA7, 0x9C, 0x7F, 0x60, 0x18};
u8 kirk7_key0D[] = {0xB5, 0xB1, 0x6E, 0xDE, 0x23, 0xA9, 0x7B, 0x0E, 0xA1, 0x7C, 0xDB, 0xA2, 0xDC, 0xDE, 0xC4, 0x6E};
u8 kirk7_key0E[] = {0xC8, 0x71, 0xFD, 0xB3, 0xBC, 0xC5, 0xD2, 0xF2, 0xE2, 0xD7, 0x72, 0x9D, 0xDF, 0x82, 0x68, 0x82};
@ -69,6 +71,7 @@ u8 kirk7_key12[] = {0x5D, 0xC7, 0x11, 0x39, 0xD0, 0x19, 0x38, 0xBC, 0x02, 0x7F,
u8 kirk7_key38[] = {0x12, 0x46, 0x8D, 0x7E, 0x1C, 0x42, 0x20, 0x9B, 0xBA, 0x54, 0x26, 0x83, 0x5E, 0xB0, 0x33, 0x03};
u8 kirk7_key39[] = {0xC4, 0x3B, 0xB6, 0xD6, 0x53, 0xEE, 0x67, 0x49, 0x3E, 0xA9, 0x5F, 0xBC, 0x0C, 0xED, 0x6F, 0x8A};
u8 kirk7_key3A[] = {0x2C, 0xC3, 0xCF, 0x8C, 0x28, 0x78, 0xA5, 0xA6, 0x63, 0xE2, 0xAF, 0x2D, 0x71, 0x5E, 0x86, 0xBA};
u8 kirk7_key44[] = {0x7D, 0xF4, 0x92, 0x65, 0xE3, 0xFA, 0xD6, 0x78, 0xD6, 0xFE, 0x78, 0xAD, 0xBB, 0x3D, 0xFB, 0x63};
u8 kirk7_key4B[] = {0x0C, 0xFD, 0x67, 0x9A, 0xF9, 0xB4, 0x72, 0x4F, 0xD7, 0x8D, 0xD6, 0xE9, 0x96, 0x42, 0x28, 0x8B}; //1.xx game eboot.bin
u8 kirk7_key53[] = {0xAF, 0xFE, 0x8E, 0xB1, 0x3D, 0xD1, 0x7E, 0xD8, 0x0A, 0x61, 0x24, 0x1C, 0x95, 0x92, 0x56, 0xB6};
u8 kirk7_key57[] = {0x1C, 0x9B, 0xC4, 0x90, 0xE3, 0x06, 0x64, 0x81, 0xFA, 0x59, 0xFD, 0xB6, 0x00, 0xBB, 0x28, 0x70};
@ -76,6 +79,8 @@ u8 kirk7_key5D[] = {0x11, 0x5A, 0x5D, 0x20, 0xD5, 0x3A, 0x8D, 0xD3, 0x9C, 0xC5,
u8 kirk7_key63[] = {0x9C, 0x9B, 0x13, 0x72, 0xF8, 0xC6, 0x40, 0xCF, 0x1C, 0x62, 0xF5, 0xD5, 0x92, 0xDD, 0xB5, 0x82};
u8 kirk7_key64[] = {0x03, 0xB3, 0x02, 0xE8, 0x5F, 0xF3, 0x81, 0xB1, 0x3B, 0x8D, 0xAA, 0x2A, 0x90, 0xFF, 0x5E, 0x61};
// AES Key for kirk16
u8 kirk16_key[0x10] = { 0x47, 0x5E, 0x09, 0xF4, 0xA2, 0x37, 0xDA, 0x9B, 0xEF, 0xFF, 0x3B, 0xC0, 0x77, 0x14, 0x3D, 0x8A };
/* ------------------------- INTERNAL STUFF ------------------------- */
@ -97,6 +102,186 @@ int is_kirk_initialized = 0;
/* KIRK initial */
/*****************************************************************************/
// Internal variables
typedef struct kirk16_data
{
u8 fuseid[8];
u8 mesh[0x40];
} kirk16_data;
u32 g_fuse90;
u32 g_fuse94;
AES_ctx aes_kirk1;
u8 PRNG_DATA[0x14];
// Internal functions
u8* kirk_4_7_get_key(int key_type)
{
switch (key_type)
{
case(0x02): return kirk7_key02; break;
case(0x03): return kirk7_key03; break;
case(0x04): return kirk7_key04; break;
case(0x05): return kirk7_key05; break;
case(0x07): return kirk7_key07; break;
case(0x0C): return kirk7_key0C; break;
case(0x0D): return kirk7_key0D; break;
case(0x0E): return kirk7_key0E; break;
case(0x0F): return kirk7_key0F; break;
case(0x10): return kirk7_key10; break;
case(0x11): return kirk7_key11; break;
case(0x12): return kirk7_key12; break;
case(0x38): return kirk7_key38; break;
case(0x39): return kirk7_key39; break;
case(0x3A): return kirk7_key3A; break;
case(0x44): return kirk7_key44; break;
case(0x4B): return kirk7_key4B; break;
case(0x53): return kirk7_key53; break;
case(0x57): return kirk7_key57; break;
case(0x5D): return kirk7_key5D; break;
case(0x63): return kirk7_key63; break;
case(0x64): return kirk7_key64; break;
default: return (u8*)KIRK_INVALID_SIZE; break;
}
}
__declspec(dllexport) void decrypt_kirk16_private(u8* dA_out, u8* dA_enc)
{
int i, k;
kirk16_data keydata;
u8 subkey_1[0x10], subkey_2[0x10];
AES_ctx aes_ctx;
keydata.fuseid[7] = g_fuse90 & 0xFF;
keydata.fuseid[6] = (g_fuse90 >> 8) & 0xFF;
keydata.fuseid[5] = (g_fuse90 >> 16) & 0xFF;
keydata.fuseid[4] = (g_fuse90 >> 24) & 0xFF;
keydata.fuseid[3] = g_fuse94 & 0xFF;
keydata.fuseid[2] = (g_fuse94 >> 8) & 0xFF;
keydata.fuseid[1] = (g_fuse94 >> 16) & 0xFF;
keydata.fuseid[0] = (g_fuse94 >> 24) & 0xFF;
/* set encryption key */
rijndael_set_key(&aes_ctx, kirk16_key, 128);
/* set the subkeys */
for (i = 0; i < 0x10; i++)
{
/* set to the fuseid */
subkey_2[i] = subkey_1[i] = keydata.fuseid[i % 8];
}
/* do aes crypto */
for (i = 0; i < 3; i++)
{
/* encrypt + decrypt */
rijndael_encrypt(&aes_ctx, subkey_1, subkey_1);
rijndael_decrypt(&aes_ctx, subkey_2, subkey_2);
}
/* set new key */
rijndael_set_key(&aes_ctx, subkey_1, 128);
/* now lets make the key mesh */
for (i = 0; i < 3; i++)
{
/* do encryption in group of 3 */
for (k = 0; k < 3; k++)
{
/* crypto */
rijndael_encrypt(&aes_ctx, subkey_2, subkey_2);
}
/* copy to out block */
memcpy(&keydata.mesh[i * 0x10], subkey_2, 0x10);
}
/* set the key to the mesh */
rijndael_set_key(&aes_ctx, &keydata.mesh[0x20], 128);
/* do the encryption routines for the aes key */
for (i = 0; i < 2; i++)
{
/* encrypt the data */
rijndael_encrypt(&aes_ctx, &keydata.mesh[0x10], &keydata.mesh[0x10]);
}
/* set the key to that mesh shit */
rijndael_set_key(&aes_ctx, &keydata.mesh[0x10], 128);
/* cbc decrypt the dA */
AES_cbc_decrypt((AES_ctx*)&aes_ctx, dA_enc, dA_out, 0x20);
}
__declspec(dllexport) void encrypt_kirk16_private(u8* dA_out, u8* dA_dec)
{
int i, k;
kirk16_data keydata;
u8 subkey_1[0x10], subkey_2[0x10];
AES_ctx aes_ctx;
keydata.fuseid[7] = g_fuse90 & 0xFF;
keydata.fuseid[6] = (g_fuse90 >> 8) & 0xFF;
keydata.fuseid[5] = (g_fuse90 >> 16) & 0xFF;
keydata.fuseid[4] = (g_fuse90 >> 24) & 0xFF;
keydata.fuseid[3] = g_fuse94 & 0xFF;
keydata.fuseid[2] = (g_fuse94 >> 8) & 0xFF;
keydata.fuseid[1] = (g_fuse94 >> 16) & 0xFF;
keydata.fuseid[0] = (g_fuse94 >> 24) & 0xFF;
/* set encryption key */
rijndael_set_key(&aes_ctx, kirk16_key, 128);
/* set the subkeys */
for (i = 0; i < 0x10; i++)
{
/* set to the fuseid */
subkey_2[i] = subkey_1[i] = keydata.fuseid[i % 8];
}
/* do aes crypto */
for (i = 0; i < 3; i++)
{
/* encrypt + decrypt */
rijndael_encrypt(&aes_ctx, subkey_1, subkey_1);
rijndael_decrypt(&aes_ctx, subkey_2, subkey_2);
}
/* set new key */
rijndael_set_key(&aes_ctx, subkey_1, 128);
/* now lets make the key mesh */
for (i = 0; i < 3; i++)
{
/* do encryption in group of 3 */
for (k = 0; k < 3; k++)
{
/* crypto */
rijndael_encrypt(&aes_ctx, subkey_2, subkey_2);
}
/* copy to out block */
memcpy(&keydata.mesh[i * 0x10], subkey_2, 0x10);
}
/* set the key to the mesh */
rijndael_set_key(&aes_ctx, &keydata.mesh[0x20], 128);
/* do the encryption routines for the aes key */
for (i = 0; i < 2; i++)
{
/* encrypt the data */
rijndael_encrypt(&aes_ctx, &keydata.mesh[0x10], &keydata.mesh[0x10]);
}
/* set the key to that mesh shit */
rijndael_set_key(&aes_ctx, &keydata.mesh[0x10], 128);
/* cbc encrypt the dA */
AES_cbc_encrypt((AES_ctx*)&aes_ctx, dA_dec, dA_out, 0x20);
}
__declspec(dllexport) int kirk_init()
{
@ -106,6 +291,53 @@ __declspec(dllexport) int kirk_init()
return KIRK_OPERATION_SUCCESS;
}
int kirk_init2(u8* rnd_seed, u32 seed_size, u32 fuseid_90, u32 fuseid_94)
{
u8 temp[0x104];
KIRK_SHA1_HEADER* header = (KIRK_SHA1_HEADER*)temp;
// Another randomly selected data for a "key" to add to each randomization
u8 key[0x10] = { 0x07, 0xAB, 0xEF, 0xF8, 0x96, 0x8C, 0xF3, 0xD6, 0x14, 0xE0, 0xEB, 0xB2, 0x9D, 0x8B, 0x4E, 0x74 };
u32 curtime;
//Set PRNG_DATA initially, otherwise use what ever uninitialized data is in the buffer
if (seed_size > 0) {
u8* seedbuf;
KIRK_SHA1_HEADER* seedheader;;
seedbuf = (u8*)malloc(seed_size + 4);
seedheader = (KIRK_SHA1_HEADER*)seedbuf;
seedheader->data_size = seed_size;
kirk_CMD11(PRNG_DATA, seedbuf, seed_size + 4);
free(seedbuf);
}
memcpy(temp + 4, PRNG_DATA, 0x14);
// This uses the standard C time function for portability.
curtime = (u32)time(0);
temp[0x18] = curtime & 0xFF;
temp[0x19] = (curtime >> 8) & 0xFF;
temp[0x1A] = (curtime >> 16) & 0xFF;
temp[0x1B] = (curtime >> 24) & 0xFF;
memcpy(&temp[0x1C], key, 0x10);
// This leaves the remainder of the 0x100 bytes in temp to whatever remains on the stack
// in an uninitialized state. This should add unpredicableness to the results as well
header->data_size = 0x100;
kirk_CMD11(PRNG_DATA, temp, 0x104);
//Set Fuse ID
g_fuse90 = fuseid_90;
g_fuse94 = fuseid_94;
// Set KIRK1 main key
AES_set_key(&aes_kirk1, kirk1_key, 128);
is_kirk_initialized = 1;
return 0;
}
/*****************************************************************************/
/* KIRK 0x01 */
/*****************************************************************************/
@ -239,36 +471,6 @@ int kirk_CMD1(void* outbuff, void* inbuff, int size)
/* KIRK 0x04 0x05 0x06 0x07 0x08 0x09 */
/*****************************************************************************/
u8* kirk_4_7_get_key(int key_type)
{
switch(key_type)
{
case(0x03): return kirk7_key03; break;
case(0x04): return kirk7_key04; break;
case(0x05): return kirk7_key05; break;
case(0x0C): return kirk7_key0C; break;
case(0x0D): return kirk7_key0D; break;
case(0x0E): return kirk7_key0E; break;
case(0x0F): return kirk7_key0F; break;
case(0x10): return kirk7_key10; break;
case(0x11): return kirk7_key11; break;
case(0x12): return kirk7_key12; break;
case(0x38): return kirk7_key38; break;
case(0x39): return kirk7_key39; break;
case(0x3A): return kirk7_key3A; break;
case(0x4B): return kirk7_key4B; break;
case(0x53): return kirk7_key53; break;
case(0x57): return kirk7_key57; break;
case(0x5D): return kirk7_key5D; break;
case(0x63): return kirk7_key63; break;
case(0x64): return kirk7_key64; break;
default:
return NULL;
//need to get the real error code for that, placeholder now :)
}
}
int kirk_CMD4(void* outbuff, void* inbuff, int size)
{
KIRK_AES128CBC_HEADER *header;
@ -433,6 +635,24 @@ int kirk_CMD12(void *outbuff, int size)
/* KIRK 0x0E */
/*****************************************************************************/
int kirk_CMD13(u8* outbuff, int outsize, u8* inbuff, int insize)
{
u8 k[0x15];
KIRK_CMD13_BUFFER* pointmult = (KIRK_CMD13_BUFFER*)inbuff;
k[0] = 0;
if (outsize != 0x28) return KIRK_INVALID_SIZE;
if (insize != 0x3C) return KIRK_INVALID_SIZE;
ecdsa_set_curve(&ecdsa_app);
ecdsa_set_pub((u8*)pointmult->public_key.x, (u8*)pointmult->public_key.y);
memcpy(k + 1, pointmult->multiplier, 0x14);
ec_pub_mult(k, outbuff);
return KIRK_OPERATION_SUCCESS;
}
int kirk_CMD14(void* outbuff, int size)
{
int i;
@ -448,25 +668,65 @@ int kirk_CMD14(void* outbuff, int size)
return KIRK_OPERATION_SUCCESS;
}
int kirk_CMD16(u8* outbuff, int outsize, u8* inbuff, int insize)
{
u8 dec_private[0x20];
KIRK_CMD16_BUFFER* signbuf = (KIRK_CMD16_BUFFER*)inbuff;
ECDSA_SIG* sig = (ECDSA_SIG*)outbuff;
if (insize != 0x34) return KIRK_INVALID_SIZE;
if (outsize != 0x28) return KIRK_INVALID_SIZE;
decrypt_kirk16_private(dec_private, signbuf->enc_private);
// Clear out the padding for safety
memset(&dec_private[0x14], 0, 0xC);
ecdsa_set_curve(&ecdsa_app);
ecdsa_set_priv(dec_private);
ecdsa_sign_norandom(signbuf->message_hash, sig->r, sig->s);
return KIRK_OPERATION_SUCCESS;
}
int kirk_CMD17(u8* inbuff, int insize)
{
KIRK_CMD17_BUFFER* sig = (KIRK_CMD17_BUFFER*)inbuff;
if (insize != 0x64) return KIRK_INVALID_SIZE;
ecdsa_set_curve(&ecdsa_app);
ecdsa_set_pub(sig->public_key.x, sig->public_key.y);
if (ecdsa_verify(sig->message_hash, sig->signature.r, sig->signature.s)) {
return KIRK_OPERATION_SUCCESS;
}
else {
return KIRK_SIG_CHECK_INVALID;
}
}
/*****************************************************************************/
/* sceUtilsBufferCopyWithRange */
/*****************************************************************************/
int sceUtilsBufferCopyWithRange(void* outbuff, int outsize, void* inbuff, int insize, int cmd)
__declspec(dllexport) int sceUtilsBufferCopyWithRange(u8* outbuff, int outsize, u8* inbuff, int insize, int cmd)
{
switch(cmd)
{
case KIRK_CMD_DECRYPT_PRIVATE:
if(insize % 16) return SUBCWR_NOT_16_ALGINED;
int ret = kirk_CMD1(outbuff, inbuff, insize);
if(ret == KIRK_HEADER_HASH_INVALID) return SUBCWR_HEADER_HASH_INVALID;
return ret;
break;
case KIRK_CMD_ENCRYPT_IV_0: return kirk_CMD4(outbuff, inbuff, insize); break;
case KIRK_CMD_DECRYPT_IV_0: return kirk_CMD7(outbuff, inbuff, insize); break;
case KIRK_CMD_PRIV_SIGN_CHECK: return kirk_CMD10(inbuff, insize); break;
case KIRK_CMD_SHA1_HASH: return kirk_CMD11(outbuff, inbuff, insize); break;
switch(cmd)
{
case KIRK_CMD_DECRYPT_PRIVATE: return kirk_CMD1(outbuff, inbuff, insize); break;
case KIRK_CMD_ENCRYPT_IV_0: return kirk_CMD4(outbuff, inbuff, insize); break;
case KIRK_CMD_DECRYPT_IV_0: return kirk_CMD7(outbuff, inbuff, insize); break;
case KIRK_CMD_PRIV_SIGN_CHECK: return kirk_CMD10(inbuff, insize); break;
case KIRK_CMD_SHA1_HASH: return kirk_CMD11(outbuff, inbuff, insize); break;
case KIRK_CMD_ECDSA_GEN_KEYS: return kirk_CMD12(outbuff,outsize); break;
case KIRK_CMD_ECDSA_MULTIPLY_POINT: return kirk_CMD13(outbuff,outsize, inbuff, insize); break;
case KIRK_CMD_PRNG: return kirk_CMD14(outbuff,outsize); break;
case KIRK_CMD_ECDSA_SIGN: return kirk_CMD16(outbuff, outsize, inbuff, insize); break;
case KIRK_CMD_ECDSA_VERIFY: return kirk_CMD17(inbuff, insize); break;
}
return -1;
}

View File

@ -49,11 +49,50 @@ typedef struct
u8 unk5[16]; //80
} KIRK_CMD1_HEADER; //0x90
typedef struct
{
u8 r[0x14];
u8 s[0x14];
} ECDSA_SIG;
typedef struct
{
u8 x[0x14];
u8 y[0x14];
} ECDSA_POINT;
typedef struct
{
u32 data_size; //0
} KIRK_SHA1_HEADER; //4
typedef struct
{
u8 private_key[0x14];
ECDSA_POINT public_key;
} KIRK_CMD12_BUFFER;
typedef struct
{
u8 multiplier[0x14];
ECDSA_POINT public_key;
} KIRK_CMD13_BUFFER;
typedef struct
{
u8 enc_private[0x20];
u8 message_hash[0x14];
} KIRK_CMD16_BUFFER;
typedef struct
{
ECDSA_POINT public_key;
u8 message_hash[0x14];
ECDSA_SIG signature;
} KIRK_CMD17_BUFFER;
// sceUtilsBufferCopyWithRange modes
#define KIRK_CMD_DECRYPT_PRIVATE 1
#define KIRK_CMD_2 2
@ -130,6 +169,6 @@ int kirk_CMD1_ex(void* outbuff, void* inbuff, int size, KIRK_CMD1_HEADER* header
//sce-like funcs
int sceUtilsSetFuseID(void*fuse);
int sceUtilsBufferCopyWithRange(void* outbuff, int outsize, void* inbuff, int insize, int cmd);
__declspec(dllexport) int sceUtilsBufferCopyWithRange(void* outbuff, int outsize, void* inbuff, int insize, int cmd);
#endif

View File

@ -9,8 +9,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CHOVY-KIRK", "CHOVY-KIRK\CH
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CHOVY-GEN", "CHOVY-GEN\CHOVY-GEN.vcxproj", "{DCDBF747-DFB6-450E-A403-1C592D20EAEB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CHOVY-JUAN", "CHOVY-JUAN\CHOVY-JUAN.csproj", "{78933B2F-C754-4904-804E-D3932536471C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
@ -29,10 +27,6 @@ Global
{DCDBF747-DFB6-450E-A403-1C592D20EAEB}.Debug|x86.Build.0 = Debug|Win32
{DCDBF747-DFB6-450E-A403-1C592D20EAEB}.Release|x86.ActiveCfg = Release|Win32
{DCDBF747-DFB6-450E-A403-1C592D20EAEB}.Release|x86.Build.0 = Release|Win32
{78933B2F-C754-4904-804E-D3932536471C}.Debug|x86.ActiveCfg = Debug|x86
{78933B2F-C754-4904-804E-D3932536471C}.Debug|x86.Build.0 = Debug|x86
{78933B2F-C754-4904-804E-D3932536471C}.Release|x86.ActiveCfg = Release|x86
{78933B2F-C754-4904-804E-D3932536471C}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -6,7 +6,7 @@
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{D46AA2C2-2BDC-45C7-ACA5-D7A2295564E8}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>CHOVY</RootNamespace>
<RootNamespace>CHOVY_SIGN</RootNamespace>
<AssemblyName>CHOVY-SIGN</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
@ -64,11 +64,11 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="CHOVY.cs">
<Compile Include="CHOVYPspBuilder.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="CHOVY.Designer.cs">
<DependentUpon>CHOVY.cs</DependentUpon>
<Compile Include="CHOVYPspBuilder.Designer.cs">
<DependentUpon>CHOVYPspBuilder.cs</DependentUpon>
</Compile>
<Compile Include="CHOVYCmaSelector.cs">
<SubType>Form</SubType>
@ -82,9 +82,316 @@
<Compile Include="CHOVYPopsBuilder.Designer.cs">
<DependentUpon>CHOVYPopsBuilder.cs</DependentUpon>
</Compile>
<Compile Include="cmakeys.cs" />
<Compile Include="CmaKeys.cs" />
<Compile Include="DiscUtils\ApplePartitionMap\BlockZero.cs" />
<Compile Include="DiscUtils\ApplePartitionMap\PartitionMap.cs" />
<Compile Include="DiscUtils\ApplePartitionMap\PartitionMapEntry.cs" />
<Compile Include="DiscUtils\ApplePartitionMap\PartitionMapFactory.cs" />
<Compile Include="DiscUtils\Archives\FileRecord.cs" />
<Compile Include="DiscUtils\Archives\TarFile.cs" />
<Compile Include="DiscUtils\Archives\TarFileBuilder.cs" />
<Compile Include="DiscUtils\Archives\TarHeader.cs" />
<Compile Include="DiscUtils\Archives\TarHeaderExtent.cs" />
<Compile Include="DiscUtils\Archives\UnixBuildFileRecord.cs" />
<Compile Include="DiscUtils\ChsAddress.cs" />
<Compile Include="DiscUtils\ClusterMap.cs" />
<Compile Include="DiscUtils\ClusterRoles.cs" />
<Compile Include="DiscUtils\Compression\Adler32.cs" />
<Compile Include="DiscUtils\Compression\BigEndianBitStream.cs" />
<Compile Include="DiscUtils\Compression\BitStream.cs" />
<Compile Include="DiscUtils\Compression\BlockCompressor.cs" />
<Compile Include="DiscUtils\Compression\BZip2BlockDecoder.cs" />
<Compile Include="DiscUtils\Compression\BZip2CombinedHuffmanTrees.cs" />
<Compile Include="DiscUtils\Compression\BZip2DecoderStream.cs" />
<Compile Include="DiscUtils\Compression\BZip2Randomizer.cs" />
<Compile Include="DiscUtils\Compression\BZip2RleStream.cs" />
<Compile Include="DiscUtils\Compression\CompressionResult.cs" />
<Compile Include="DiscUtils\Compression\DataBlockTransform.cs" />
<Compile Include="DiscUtils\Compression\HuffmanTree.cs" />
<Compile Include="DiscUtils\Compression\InverseBurrowsWheeler.cs" />
<Compile Include="DiscUtils\Compression\MoveToFront.cs" />
<Compile Include="DiscUtils\Compression\SizedDeflateStream.cs" />
<Compile Include="DiscUtils\Compression\ZlibBuffer.cs" />
<Compile Include="DiscUtils\Compression\ZlibStream.cs" />
<Compile Include="DiscUtils\CoreCompat\EncodingHelper.cs" />
<Compile Include="DiscUtils\CoreCompat\ReflectionHelper.cs" />
<Compile Include="DiscUtils\CoreCompat\StringExtensions.cs" />
<Compile Include="DiscUtils\DiscDirectoryInfo.cs" />
<Compile Include="DiscUtils\DiscFileInfo.cs" />
<Compile Include="DiscUtils\DiscFileLocator.cs" />
<Compile Include="DiscUtils\DiscFileSystem.cs" />
<Compile Include="DiscUtils\DiscFileSystemChecker.cs" />
<Compile Include="DiscUtils\DiscFileSystemInfo.cs" />
<Compile Include="DiscUtils\DiscFileSystemOptions.cs" />
<Compile Include="DiscUtils\DiskImageBuilder.cs" />
<Compile Include="DiscUtils\DiskImageFileSpecification.cs" />
<Compile Include="DiscUtils\FileLocator.cs" />
<Compile Include="DiscUtils\FileSystemInfo.cs" />
<Compile Include="DiscUtils\FileSystemManager.cs" />
<Compile Include="DiscUtils\FileSystemParameters.cs" />
<Compile Include="DiscUtils\FileTransport.cs" />
<Compile Include="DiscUtils\FloppyDiskType.cs" />
<Compile Include="DiscUtils\GenericDiskAdapterType.cs" />
<Compile Include="DiscUtils\Geometry.cs" />
<Compile Include="DiscUtils\GeometryCalculation.cs" />
<Compile Include="DiscUtils\GeometryTranslation.cs" />
<Compile Include="DiscUtils\IClusterBasedFileSystem.cs" />
<Compile Include="DiscUtils\IDiagnosticTraceable.cs" />
<Compile Include="DiscUtils\IFileSystem.cs" />
<Compile Include="DiscUtils\Internal\Crc32.cs" />
<Compile Include="DiscUtils\Internal\Crc32Algorithm.cs" />
<Compile Include="DiscUtils\Internal\Crc32BigEndian.cs" />
<Compile Include="DiscUtils\Internal\Crc32LittleEndian.cs" />
<Compile Include="DiscUtils\Internal\LocalFileLocator.cs" />
<Compile Include="DiscUtils\Internal\LogicalVolumeFactory.cs" />
<Compile Include="DiscUtils\Internal\LogicalVolumeFactoryAttribute.cs" />
<Compile Include="DiscUtils\Internal\ObjectCache.cs" />
<Compile Include="DiscUtils\Internal\Utilities.cs" />
<Compile Include="DiscUtils\Internal\VirtualDiskFactory.cs" />
<Compile Include="DiscUtils\Internal\VirtualDiskFactoryAttribute.cs" />
<Compile Include="DiscUtils\Internal\VirtualDiskTransport.cs" />
<Compile Include="DiscUtils\Internal\VirtualDiskTransportAttribute.cs" />
<Compile Include="DiscUtils\InvalidFileSystemException.cs" />
<Compile Include="DiscUtils\Iso9660Ps1\BaseVolumeDescriptor.cs" />
<Compile Include="DiscUtils\Iso9660Ps1\BootDeviceEmulation.cs" />
<Compile Include="DiscUtils\Iso9660Ps1\BootInitialEntry.cs" />
<Compile Include="DiscUtils\Iso9660Ps1\BootValidationEntry.cs" />
<Compile Include="DiscUtils\Iso9660Ps1\BootVolumeDescriptor.cs" />
<Compile Include="DiscUtils\Iso9660Ps1\BootVolumeDescriptorRegion.cs" />
<Compile Include="DiscUtils\Iso9660Ps1\BuildDirectoryInfo.cs" />
<Compile Include="DiscUtils\Iso9660Ps1\BuildDirectoryMember.cs" />
<Compile Include="DiscUtils\Iso9660Ps1\BuildFileInfo.cs" />
<Compile Include="DiscUtils\Iso9660Ps1\BuildParameters.cs" />
<Compile Include="DiscUtils\Iso9660Ps1\CDBuilder.cs" />
<Compile Include="DiscUtils\Iso9660Ps1\CDReader.cs" />
<Compile Include="DiscUtils\Iso9660Ps1\CommonVolumeDescriptor.cs" />
<Compile Include="DiscUtils\Iso9660Ps1\DirectoryExtent.cs" />
<Compile Include="DiscUtils\Iso9660Ps1\DirectoryRecord.cs" />
<Compile Include="DiscUtils\Iso9660Ps1\ExtentStream.cs" />
<Compile Include="DiscUtils\Iso9660Ps1\File.cs" />
<Compile Include="DiscUtils\Iso9660Ps1\FileExtent.cs" />
<Compile Include="DiscUtils\Iso9660Ps1\FileFlags.cs" />
<Compile Include="DiscUtils\Iso9660Ps1\Iso9660Variant.cs" />
<Compile Include="DiscUtils\Iso9660Ps1\IsoContext.cs" />
<Compile Include="DiscUtils\Iso9660Ps1\IsoUtilities.cs" />
<Compile Include="DiscUtils\Iso9660Ps1\PathTable.cs" />
<Compile Include="DiscUtils\Iso9660Ps1\PathTableRecord.cs" />
<Compile Include="DiscUtils\Iso9660Ps1\PrimaryVolumeDescriptor.cs" />
<Compile Include="DiscUtils\Iso9660Ps1\PrimaryVolumeDescriptorRegion.cs" />
<Compile Include="DiscUtils\Iso9660Ps1\ReaderDirectory.cs" />
<Compile Include="DiscUtils\Iso9660Ps1\ReaderDirEntry.cs" />
<Compile Include="DiscUtils\Iso9660Ps1\RockRidge\ChildLinkSystemUseEntry.cs" />
<Compile Include="DiscUtils\Iso9660Ps1\RockRidge\FileTimeSystemUseEntry.cs" />
<Compile Include="DiscUtils\Iso9660Ps1\RockRidge\PosixFileInfoSystemUseEntry.cs" />
<Compile Include="DiscUtils\Iso9660Ps1\RockRidge\PosixNameSystemUseEntry.cs" />
<Compile Include="DiscUtils\Iso9660Ps1\RockRidge\RockRidgeExtension.cs" />
<Compile Include="DiscUtils\Iso9660Ps1\SupplementaryVolumeDescriptor.cs" />
<Compile Include="DiscUtils\Iso9660Ps1\SupplementaryVolumeDescriptorRegion.cs" />
<Compile Include="DiscUtils\Iso9660Ps1\Susp\ContinuationSystemUseEntry.cs" />
<Compile Include="DiscUtils\Iso9660Ps1\Susp\ExtensionSelectSystemUseEntry.cs" />
<Compile Include="DiscUtils\Iso9660Ps1\Susp\ExtensionSystemUseEntry.cs" />
<Compile Include="DiscUtils\Iso9660Ps1\Susp\GenericSuspExtension.cs" />
<Compile Include="DiscUtils\Iso9660Ps1\Susp\GenericSystemUseEntry.cs" />
<Compile Include="DiscUtils\Iso9660Ps1\Susp\PaddingSystemUseEntry.cs" />
<Compile Include="DiscUtils\Iso9660Ps1\Susp\SharingProtocolSystemUseEntry.cs" />
<Compile Include="DiscUtils\Iso9660Ps1\Susp\SuspExtension.cs" />
<Compile Include="DiscUtils\Iso9660Ps1\Susp\SuspRecords.cs" />
<Compile Include="DiscUtils\Iso9660Ps1\Susp\SystemUseEntry.cs" />
<Compile Include="DiscUtils\Iso9660Ps1\VfsCDReader.cs" />
<Compile Include="DiscUtils\Iso9660Ps1\VolumeDescriptorDiskRegion.cs" />
<Compile Include="DiscUtils\Iso9660Ps1\VolumeDescriptorSetTerminator.cs" />
<Compile Include="DiscUtils\Iso9660Ps1\VolumeDescriptorSetTerminatorRegion.cs" />
<Compile Include="DiscUtils\Iso9660Ps1\VolumeDescriptorType.cs" />
<Compile Include="DiscUtils\Iso9660\BaseVolumeDescriptor.cs" />
<Compile Include="DiscUtils\Iso9660\BootDeviceEmulation.cs" />
<Compile Include="DiscUtils\Iso9660\BootInitialEntry.cs" />
<Compile Include="DiscUtils\Iso9660\BootValidationEntry.cs" />
<Compile Include="DiscUtils\Iso9660\BootVolumeDescriptor.cs" />
<Compile Include="DiscUtils\Iso9660\BootVolumeDescriptorRegion.cs" />
<Compile Include="DiscUtils\Iso9660\BuildDirectoryInfo.cs" />
<Compile Include="DiscUtils\Iso9660\BuildDirectoryMember.cs" />
<Compile Include="DiscUtils\Iso9660\BuildFileInfo.cs" />
<Compile Include="DiscUtils\Iso9660\BuildParameters.cs" />
<Compile Include="DiscUtils\Iso9660\CDBuilder.cs" />
<Compile Include="DiscUtils\Iso9660\CDReader.cs" />
<Compile Include="DiscUtils\Iso9660\CommonVolumeDescriptor.cs" />
<Compile Include="DiscUtils\Iso9660\DirectoryExtent.cs" />
<Compile Include="DiscUtils\Iso9660\DirectoryRecord.cs" />
<Compile Include="DiscUtils\Iso9660\ExtentStream.cs" />
<Compile Include="DiscUtils\Iso9660\File.cs" />
<Compile Include="DiscUtils\Iso9660\FileExtent.cs" />
<Compile Include="DiscUtils\Iso9660\FileFlags.cs" />
<Compile Include="DiscUtils\Iso9660\Iso9660Variant.cs" />
<Compile Include="DiscUtils\Iso9660\IsoContext.cs" />
<Compile Include="DiscUtils\Iso9660\IsoUtilities.cs" />
<Compile Include="DiscUtils\Iso9660\PathTable.cs" />
<Compile Include="DiscUtils\Iso9660\PathTableRecord.cs" />
<Compile Include="DiscUtils\Iso9660\PrimaryVolumeDescriptor.cs" />
<Compile Include="DiscUtils\Iso9660\PrimaryVolumeDescriptorRegion.cs" />
<Compile Include="DiscUtils\Iso9660\ReaderDirectory.cs" />
<Compile Include="DiscUtils\Iso9660\ReaderDirEntry.cs" />
<Compile Include="DiscUtils\Iso9660\RockRidge\ChildLinkSystemUseEntry.cs" />
<Compile Include="DiscUtils\Iso9660\RockRidge\FileTimeSystemUseEntry.cs" />
<Compile Include="DiscUtils\Iso9660\RockRidge\PosixFileInfoSystemUseEntry.cs" />
<Compile Include="DiscUtils\Iso9660\RockRidge\PosixNameSystemUseEntry.cs" />
<Compile Include="DiscUtils\Iso9660\RockRidge\RockRidgeExtension.cs" />
<Compile Include="DiscUtils\Iso9660\SupplementaryVolumeDescriptor.cs" />
<Compile Include="DiscUtils\Iso9660\SupplementaryVolumeDescriptorRegion.cs" />
<Compile Include="DiscUtils\Iso9660\Susp\ContinuationSystemUseEntry.cs" />
<Compile Include="DiscUtils\Iso9660\Susp\ExtensionSelectSystemUseEntry.cs" />
<Compile Include="DiscUtils\Iso9660\Susp\ExtensionSystemUseEntry.cs" />
<Compile Include="DiscUtils\Iso9660\Susp\GenericSuspExtension.cs" />
<Compile Include="DiscUtils\Iso9660\Susp\GenericSystemUseEntry.cs" />
<Compile Include="DiscUtils\Iso9660\Susp\PaddingSystemUseEntry.cs" />
<Compile Include="DiscUtils\Iso9660\Susp\SharingProtocolSystemUseEntry.cs" />
<Compile Include="DiscUtils\Iso9660\Susp\SuspExtension.cs" />
<Compile Include="DiscUtils\Iso9660\Susp\SuspRecords.cs" />
<Compile Include="DiscUtils\Iso9660\Susp\SystemUseEntry.cs" />
<Compile Include="DiscUtils\Iso9660\VfsCDReader.cs" />
<Compile Include="DiscUtils\Iso9660\VolumeDescriptorDiskRegion.cs" />
<Compile Include="DiscUtils\Iso9660\VolumeDescriptorSetTerminator.cs" />
<Compile Include="DiscUtils\Iso9660\VolumeDescriptorSetTerminatorRegion.cs" />
<Compile Include="DiscUtils\Iso9660\VolumeDescriptorType.cs" />
<Compile Include="DiscUtils\IUnixFileSystem.cs" />
<Compile Include="DiscUtils\IWindowsFileSystem.cs" />
<Compile Include="DiscUtils\LogicalDiskManager\ComponentRecord.cs" />
<Compile Include="DiscUtils\LogicalDiskManager\Database.cs" />
<Compile Include="DiscUtils\LogicalDiskManager\DatabaseHeader.cs" />
<Compile Include="DiscUtils\LogicalDiskManager\DatabaseRecord.cs" />
<Compile Include="DiscUtils\LogicalDiskManager\DiskGroupRecord.cs" />
<Compile Include="DiscUtils\LogicalDiskManager\DiskRecord.cs" />
<Compile Include="DiscUtils\LogicalDiskManager\DynamicDisk.cs" />
<Compile Include="DiscUtils\LogicalDiskManager\DynamicDiskGroup.cs" />
<Compile Include="DiscUtils\LogicalDiskManager\DynamicDiskManager.cs" />
<Compile Include="DiscUtils\LogicalDiskManager\DynamicDiskManagerFactory.cs" />
<Compile Include="DiscUtils\LogicalDiskManager\DynamicVolume.cs" />
<Compile Include="DiscUtils\LogicalDiskManager\ExtentMergeType.cs" />
<Compile Include="DiscUtils\LogicalDiskManager\ExtentRecord.cs" />
<Compile Include="DiscUtils\LogicalDiskManager\PrivateHeader.cs" />
<Compile Include="DiscUtils\LogicalDiskManager\RecordType.cs" />
<Compile Include="DiscUtils\LogicalDiskManager\TocBlock.cs" />
<Compile Include="DiscUtils\LogicalDiskManager\VolumeRecord.cs" />
<Compile Include="DiscUtils\LogicalVolumeInfo.cs" />
<Compile Include="DiscUtils\LogicalVolumeStatus.cs" />
<Compile Include="DiscUtils\NativeFileSystem.cs" />
<Compile Include="DiscUtils\Partitions\BiosExtendedPartitionTable.cs" />
<Compile Include="DiscUtils\Partitions\BiosPartitionedDiskBuilder.cs" />
<Compile Include="DiscUtils\Partitions\BiosPartitionInfo.cs" />
<Compile Include="DiscUtils\Partitions\BiosPartitionRecord.cs" />
<Compile Include="DiscUtils\Partitions\BiosPartitionTable.cs" />
<Compile Include="DiscUtils\Partitions\BiosPartitionTypes.cs" />
<Compile Include="DiscUtils\Partitions\DefaultPartitionTableFactory.cs" />
<Compile Include="DiscUtils\Partitions\GptEntry.cs" />
<Compile Include="DiscUtils\Partitions\GptHeader.cs" />
<Compile Include="DiscUtils\Partitions\GuidPartitionInfo.cs" />
<Compile Include="DiscUtils\Partitions\GuidPartitionTable.cs" />
<Compile Include="DiscUtils\Partitions\GuidPartitionTypes.cs" />
<Compile Include="DiscUtils\Partitions\PartitionInfo.cs" />
<Compile Include="DiscUtils\Partitions\PartitionTable.cs" />
<Compile Include="DiscUtils\Partitions\PartitionTableFactory.cs" />
<Compile Include="DiscUtils\Partitions\PartitionTableFactoryAttribute.cs" />
<Compile Include="DiscUtils\Partitions\WellKnownPartitionType.cs" />
<Compile Include="DiscUtils\PhysicalVolumeInfo.cs" />
<Compile Include="DiscUtils\PhysicalVolumeType.cs" />
<Compile Include="DiscUtils\Plist.cs" />
<Compile Include="DiscUtils\Raw\Disk.cs" />
<Compile Include="DiscUtils\Raw\DiskFactory.cs" />
<Compile Include="DiscUtils\Raw\DiskImageFile.cs" />
<Compile Include="DiscUtils\ReadOnlyDiscFileSystem.cs" />
<Compile Include="DiscUtils\ReparsePoint.cs" />
<Compile Include="DiscUtils\ReportLevels.cs" />
<Compile Include="DiscUtils\Setup\FileOpenEventArgs.cs" />
<Compile Include="DiscUtils\Setup\SetupHelper.cs" />
<Compile Include="DiscUtils\Streams\AligningStream.cs" />
<Compile Include="DiscUtils\Streams\Block\Block.cs" />
<Compile Include="DiscUtils\Streams\Block\BlockCache.cs" />
<Compile Include="DiscUtils\Streams\Block\BlockCacheSettings.cs" />
<Compile Include="DiscUtils\Streams\Block\BlockCacheStatistics.cs" />
<Compile Include="DiscUtils\Streams\Block\BlockCacheStream.cs" />
<Compile Include="DiscUtils\Streams\Buffer\Buffer.cs" />
<Compile Include="DiscUtils\Streams\Buffer\BufferStream.cs" />
<Compile Include="DiscUtils\Streams\Buffer\IBuffer.cs" />
<Compile Include="DiscUtils\Streams\Buffer\IMappedBuffer.cs" />
<Compile Include="DiscUtils\Streams\Buffer\SubBuffer.cs" />
<Compile Include="DiscUtils\Streams\Builder\BuilderBufferExtent.cs" />
<Compile Include="DiscUtils\Streams\Builder\BuilderBufferExtentSource.cs" />
<Compile Include="DiscUtils\Streams\Builder\BuilderBytesExtent.cs" />
<Compile Include="DiscUtils\Streams\Builder\BuilderExtent.cs" />
<Compile Include="DiscUtils\Streams\Builder\BuilderExtentSource.cs" />
<Compile Include="DiscUtils\Streams\Builder\BuilderSparseStreamExtent.cs" />
<Compile Include="DiscUtils\Streams\Builder\BuilderStreamExtent.cs" />
<Compile Include="DiscUtils\Streams\Builder\BuilderStreamExtentSource.cs" />
<Compile Include="DiscUtils\Streams\Builder\PassthroughStreamBuilder.cs" />
<Compile Include="DiscUtils\Streams\Builder\StreamBuilder.cs" />
<Compile Include="DiscUtils\Streams\BuiltStream.cs" />
<Compile Include="DiscUtils\Streams\CircularStream.cs" />
<Compile Include="DiscUtils\Streams\ConcatStream.cs" />
<Compile Include="DiscUtils\Streams\IByteArraySerializable.cs" />
<Compile Include="DiscUtils\Streams\LengthWrappingStream.cs" />
<Compile Include="DiscUtils\Streams\MappedStream.cs" />
<Compile Include="DiscUtils\Streams\MirrorStream.cs" />
<Compile Include="DiscUtils\Streams\PositionWrappingStream.cs" />
<Compile Include="DiscUtils\Streams\PumpProgressEventArgs.cs" />
<Compile Include="DiscUtils\Streams\ReaderWriter\BigEndianDataReader.cs" />
<Compile Include="DiscUtils\Streams\ReaderWriter\BigEndianDataWriter.cs" />
<Compile Include="DiscUtils\Streams\ReaderWriter\DataReader.cs" />
<Compile Include="DiscUtils\Streams\ReaderWriter\DataWriter.cs" />
<Compile Include="DiscUtils\Streams\ReaderWriter\LittleEndianDataReader.cs" />
<Compile Include="DiscUtils\Streams\SnapshotStream.cs" />
<Compile Include="DiscUtils\Streams\SparseMemoryBuffer.cs" />
<Compile Include="DiscUtils\Streams\SparseMemoryStream.cs" />
<Compile Include="DiscUtils\Streams\SparseStream.cs" />
<Compile Include="DiscUtils\Streams\SparseStreamOpenDelegate.cs" />
<Compile Include="DiscUtils\Streams\StreamBuffer.cs" />
<Compile Include="DiscUtils\Streams\StreamExtent.cs" />
<Compile Include="DiscUtils\Streams\StreamPump.cs" />
<Compile Include="DiscUtils\Streams\StripedStream.cs" />
<Compile Include="DiscUtils\Streams\SubStream.cs" />
<Compile Include="DiscUtils\Streams\System\Func.cs" />
<Compile Include="DiscUtils\Streams\ThreadSafeStream.cs" />
<Compile Include="DiscUtils\Streams\Util\BitCounter.cs" />
<Compile Include="DiscUtils\Streams\Util\EndianUtilities.cs" />
<Compile Include="DiscUtils\Streams\Util\MathUtilities.cs" />
<Compile Include="DiscUtils\Streams\Util\Numbers.cs" />
<Compile Include="DiscUtils\Streams\Util\Ownership.cs" />
<Compile Include="DiscUtils\Streams\Util\Range.cs" />
<Compile Include="DiscUtils\Streams\Util\Sizes.cs" />
<Compile Include="DiscUtils\Streams\Util\StreamUtilities.cs" />
<Compile Include="DiscUtils\Streams\WrappingMappedStream.cs" />
<Compile Include="DiscUtils\Streams\WrappingStream.cs" />
<Compile Include="DiscUtils\Streams\ZeroStream.cs" />
<Compile Include="DiscUtils\System\DateTimeOffsetExtensions.cs" />
<Compile Include="DiscUtils\System\ExtensionAttribute.cs" />
<Compile Include="DiscUtils\System\HashSet.cs" />
<Compile Include="DiscUtils\System\Tuple.cs" />
<Compile Include="DiscUtils\TimeConverter.cs" />
<Compile Include="DiscUtils\UnixFilePermissions.cs" />
<Compile Include="DiscUtils\UnixFileSystemInfo.cs" />
<Compile Include="DiscUtils\UnixFileType.cs" />
<Compile Include="DiscUtils\Vfs\IVfsDirectory.cs" />
<Compile Include="DiscUtils\Vfs\IVfsFile.cs" />
<Compile Include="DiscUtils\Vfs\IVfsFileWithStreams.cs" />
<Compile Include="DiscUtils\Vfs\IVfsSymlink.cs" />
<Compile Include="DiscUtils\Vfs\VfsContext.cs" />
<Compile Include="DiscUtils\Vfs\VfsDirEntry.cs" />
<Compile Include="DiscUtils\Vfs\VfsFileSystem.cs" />
<Compile Include="DiscUtils\Vfs\VfsFileSystemFacade.cs" />
<Compile Include="DiscUtils\Vfs\VfsFileSystemFactory.cs" />
<Compile Include="DiscUtils\Vfs\VfsFileSystemFactoryAttribute.cs" />
<Compile Include="DiscUtils\Vfs\VfsFileSystemInfo.cs" />
<Compile Include="DiscUtils\Vfs\VfsFileSystemOpener.cs" />
<Compile Include="DiscUtils\Vfs\VfsReadOnlyFileSystem.cs" />
<Compile Include="DiscUtils\VirtualDisk.cs" />
<Compile Include="DiscUtils\VirtualDiskClass.cs" />
<Compile Include="DiscUtils\VirtualDiskExtent.cs" />
<Compile Include="DiscUtils\VirtualDiskLayer.cs" />
<Compile Include="DiscUtils\VirtualDiskManager.cs" />
<Compile Include="DiscUtils\VirtualDiskParameters.cs" />
<Compile Include="DiscUtils\VirtualDiskTypeInfo.cs" />
<Compile Include="DiscUtils\VolumeInfo.cs" />
<Compile Include="DiscUtils\VolumeManager.cs" />
<Compile Include="DiscUtils\WindowsFileInformation.cs" />
<Compile Include="MobyGamesDB.cs" />
<Compile Include="param.cs" />
<Compile Include="pbp.cs" />
<Compile Include="PSXPackager\ApplicationInfo.cs" />
<Compile Include="PSXPackager\FileExtensionHelper.cs" />
@ -120,13 +427,15 @@
<Compile Include="POPS\StreamExtensions.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="PSVIMGBuilder.cs" />
<Compile Include="PSVIMGFileStream.cs" />
<Compile Include="PSVIMGStream.cs" />
<Compile Include="PSVIMGStructs.cs" />
<Compile Include="PSVMDBuilder.cs" />
<EmbeddedResource Include="CHOVY.resx">
<DependentUpon>CHOVY.cs</DependentUpon>
<Compile Include="PSVIMGTOOLS\PSVIMGBuilder.cs" />
<Compile Include="PSVIMGTOOLS\PSVIMGFileStream.cs" />
<Compile Include="PSVIMGTOOLS\PSVIMGStream.cs" />
<Compile Include="PSVIMGTOOLS\PSVIMGStructs.cs" />
<Compile Include="PSVIMGTOOLS\PSVMDBuilder.cs" />
<Compile Include="DataUtils.cs" />
<Compile Include="ParamSfo.cs" />
<EmbeddedResource Include="CHOVYPspBuilder.resx">
<DependentUpon>CHOVYPspBuilder.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="CHOVYCmaSelector.resx">
<DependentUpon>CHOVYCmaSelector.cs</DependentUpon>
@ -180,11 +489,5 @@
<None Include="Resources\ps1.gif" />
<None Include="Resources\POPS.wav" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CHOVY-JUAN\CHOVY-JUAN.csproj">
<Project>{78933b2f-c754-4904-804e-d3932536471c}</Project>
<Name>CHOVY-JUAN</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -1,9 +1,10 @@
using Param_SFO;
using ParamSfo;
using System;
using System.Collections.Generic;
using System.IO;
using System.Windows.Forms;
namespace CHOVY
namespace CHOVY_SIGN
{
public partial class CHOVYCmaSelector : Form
{
@ -75,8 +76,8 @@ namespace CHOVY
{
string SfoPath = Path.Combine(BackupPath, Dir, "sce_sys", "param.sfo");
FileStream SfoStream = File.OpenRead(SfoPath);
PARAM_SFO sfo = new PARAM_SFO(SfoStream);
string Title = sfo.Title;
Dictionary<string,object> SfoKeys = Sfo.ReadSfo(SfoStream);
string Title = (string)SfoKeys["Title"];
SfoStream.Close();
string BackupName = (Path.GetFileName(Dir) + " - " + Title);
BackupList.Items.Add(BackupName);

View File

@ -1,4 +1,4 @@
namespace CHOVY
namespace CHOVY_SIGN
{
partial class CHOVYPopsBuilder
{
@ -547,7 +547,7 @@
//
// BubbleIcon
//
this.BubbleIcon.BackgroundImage = global::CHOVY.Properties.Resources.PopsDefaultIcon;
this.BubbleIcon.BackgroundImage = global::CHOVY_SIGN.Properties.Resources.PopsDefaultIcon;
this.BubbleIcon.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
this.BubbleIcon.Location = new System.Drawing.Point(18, 37);
this.BubbleIcon.Name = "BubbleIcon";
@ -566,7 +566,7 @@
//
// pictureBox1
//
this.pictureBox1.BackgroundImage = global::CHOVY.Properties.Resources.does_not_protect_from_illegal_copies;
this.pictureBox1.BackgroundImage = global::CHOVY_SIGN.Properties.Resources.does_not_protect_from_illegal_copies;
this.pictureBox1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.pictureBox1.Location = new System.Drawing.Point(7, 79);
this.pictureBox1.Name = "pictureBox1";

View File

@ -13,7 +13,7 @@ using System.Net;
using System.Threading;
using System.Windows.Forms;
namespace CHOVY
namespace CHOVY_SIGN
{
public partial class CHOVYPopsBuilder : Form
{

View File

@ -1,6 +1,6 @@
namespace CHOVY
namespace CHOVY_SIGN
{
partial class CHOVY
partial class CHOVYPspBuilder
{
/// <summary>
/// Required designer variable.
@ -28,7 +28,7 @@
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CHOVY));
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CHOVYPspBuilder));
this.label1 = new System.Windows.Forms.Label();
this.RifPath = new System.Windows.Forms.TextBox();
this.Versionkey = new System.Windows.Forms.TextBox();
@ -239,7 +239,7 @@
//
// pictureBox2
//
this.pictureBox2.BackgroundImage = global::CHOVY.Properties.Resources.UMD;
this.pictureBox2.BackgroundImage = global::CHOVY_SIGN.Properties.Resources.UMD;
this.pictureBox2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.pictureBox2.Location = new System.Drawing.Point(15, 31);
this.pictureBox2.Name = "pictureBox2";
@ -259,7 +259,7 @@
//
// Ps1Menu
//
this.Ps1Menu.BackgroundImage = global::CHOVY.Properties.Resources.ps1;
this.Ps1Menu.BackgroundImage = global::CHOVY_SIGN.Properties.Resources.ps1;
this.Ps1Menu.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.Ps1Menu.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.Ps1Menu.ForeColor = System.Drawing.Color.Lime;
@ -283,7 +283,7 @@
//
// PsmChan
//
this.PsmChan.BackgroundImage = global::CHOVY.Properties.Resources.idkbackground;
this.PsmChan.BackgroundImage = global::CHOVY_SIGN.Properties.Resources.idkbackground;
this.PsmChan.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.PsmChan.Location = new System.Drawing.Point(3, 3);
this.PsmChan.Name = "PsmChan";

View File

@ -1,10 +1,10 @@
using CHOVY.Properties;
using DiscUtils.Iso9660;
using CHOVY_SIGN.Properties;
using Ionic.Zlib;
using Microsoft.Win32;
using Param_SFO;
using ParamSfo;
using PSVIMGTOOLS;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.IO;
@ -13,16 +13,16 @@ using System.Text;
using System.Threading;
using System.Windows.Forms;
namespace CHOVY
namespace CHOVY_SIGN
{
public partial class CHOVY : Form
public partial class CHOVYPspBuilder : Form
{
bool MutedAudio = false;
public byte[] GetSfo(string ISOFile)
{
FileStream ISO = File.OpenRead(ISOFile);
CDReader cdr = new CDReader(ISO, false);
DiscUtils.Iso9660.CDReader cdr = new DiscUtils.Iso9660.CDReader(ISO, false);
Stream ParamSfo = cdr.OpenFile(@"PSP_GAME\PARAM.SFO", FileMode.Open,FileAccess.Read);
byte[] Sfo = new byte[ParamSfo.Length];
@ -35,7 +35,7 @@ namespace CHOVY
public byte[] GetIcon(string ISOFile)
{
FileStream ISO = File.OpenRead(ISOFile);
CDReader cdr = new CDReader(ISO, false);
DiscUtils.Iso9660.CDReader cdr = new DiscUtils.Iso9660.CDReader(ISO, false);
Stream ParamSfo = cdr.OpenFile(@"PSP_GAME\ICON0.PNG", FileMode.Open, FileAccess.Read);
byte[] Icon0 = new byte[ParamSfo.Length];
@ -48,12 +48,12 @@ namespace CHOVY
public static string GetTitleID(string ISOFile)
{
FileStream ISO = File.OpenRead(ISOFile);
CDReader cdr = new CDReader(ISO, false);
DiscUtils.Iso9660.CDReader cdr = new DiscUtils.Iso9660.CDReader(ISO, false);
Stream ParamSfo = cdr.OpenFile(@"PSP_GAME\PARAM.SFO", FileMode.Open, FileAccess.Read);
PARAM_SFO sfo = new PARAM_SFO(ParamSfo);
Dictionary<string,object> SfoKeys = Sfo.ReadSfo(ParamSfo);
string TitleID = sfo.GetValue("DISC_ID");
string TitleID = (string)SfoKeys["DISC_ID"];
ISO.Close();
return TitleID;
}
@ -61,7 +61,7 @@ namespace CHOVY
public static bool isMini(string ISOFile)
{
FileStream ISO = File.OpenRead(ISOFile);
CDReader cdr = new CDReader(ISO, false);
DiscUtils.Iso9660.CDReader cdr = new DiscUtils.Iso9660.CDReader(ISO, false);
Stream Icon0 = cdr.OpenFile(@"PSP_GAME\ICON0.PNG", FileMode.Open, FileAccess.Read);
Bitmap bmp = new Bitmap(Icon0);
@ -115,7 +115,7 @@ namespace CHOVY
}
}
public CHOVY()
public CHOVYPspBuilder()
{
InitializeComponent();
}

View File

@ -1,4 +1,4 @@
namespace CHOVY
namespace CHOVY_SIGN
{
partial class CHOVYCmaSelector
{

168
CHOVY-SIGN/DataUtils.cs Normal file
View File

@ -0,0 +1,168 @@
using System;
using System.IO;
using System.Linq;
using System.Text;
namespace BasicDataTypes
{
class DataUtils
{
public static void CopyString(byte[] str, String Text, int Index)
{
byte[] TextBytes = Encoding.UTF8.GetBytes(Text);
Array.ConstrainedCopy(TextBytes, 0, str, Index, TextBytes.Length);
}
public static void CopyInt32(byte[] str, Int32 Value, int Index)
{
byte[] ValueBytes = BitConverter.GetBytes(Value);
Array.ConstrainedCopy(ValueBytes, 0, str, Index, ValueBytes.Length);
}
public static void CopyInt32BE(byte[] str, Int32 Value, int Index)
{
byte[] ValueBytes = BitConverter.GetBytes(Value);
byte[] ValueBytesBE = ValueBytes.Reverse().ToArray();
Array.ConstrainedCopy(ValueBytesBE, 0, str, Index, ValueBytesBE.Length);
}
// Read From Streams
public static UInt32 ReadUInt32(Stream Str)
{
byte[] IntBytes = new byte[0x4];
Str.Read(IntBytes, 0x00, IntBytes.Length);
return BitConverter.ToUInt32(IntBytes, 0x00);
}
public static UInt32 ReadInt32(Stream Str)
{
byte[] IntBytes = new byte[0x4];
Str.Read(IntBytes, 0x00, IntBytes.Length);
return BitConverter.ToUInt32(IntBytes, 0x00);
}
public static UInt64 ReadUInt64(Stream Str)
{
byte[] IntBytes = new byte[0x8];
Str.Read(IntBytes, 0x00, IntBytes.Length);
return BitConverter.ToUInt64(IntBytes, 0x00);
}
public static Int64 ReadInt64(Stream Str)
{
byte[] IntBytes = new byte[0x8];
Str.Read(IntBytes, 0x00, IntBytes.Length);
return BitConverter.ToInt64(IntBytes, 0x00);
}
public static UInt16 ReadUInt16(Stream Str)
{
byte[] IntBytes = new byte[0x2];
Str.Read(IntBytes, 0x00, IntBytes.Length);
return BitConverter.ToUInt16(IntBytes, 0x00);
}
public static Int16 ReadInt16(Stream Str)
{
byte[] IntBytes = new byte[0x2];
Str.Read(IntBytes, 0x00, IntBytes.Length);
return BitConverter.ToInt16(IntBytes, 0x00);
}
public static UInt32 ReadUint32At(Stream Str, int location)
{
long oldPos = Str.Position;
Str.Seek(location, SeekOrigin.Begin);
UInt32 outp = ReadUInt32(Str);
Str.Seek(oldPos, SeekOrigin.Begin);
return outp;
}
public static byte[] ReadBytesAt(Stream Str, int location, int length)
{
long oldPos = Str.Position;
Str.Seek(location, SeekOrigin.Begin);
byte[] work_buf = new byte[length];
Str.Read(work_buf, 0x0, work_buf.Length);
Str.Seek(oldPos, SeekOrigin.Begin);
return work_buf;
}
public static string ReadStringAt(Stream Str,int location)
{
long oldPos = Str.Position;
Str.Seek(location, SeekOrigin.Begin);
string outp = ReadString(Str);
Str.Seek(oldPos,SeekOrigin.Begin);
return outp;
}
public static string ReadString(Stream Str)
{
MemoryStream ms = new MemoryStream();
while (true)
{
byte c = (byte)Str.ReadByte();
if (c == 0)
break;
ms.WriteByte(c);
}
ms.Seek(0x00, SeekOrigin.Begin);
string outp = Encoding.UTF8.GetString(ms.ToArray());
ms.Dispose();
return outp;
}
// Write To Streams
public static void WriteUInt32(Stream Str, UInt32 Numb)
{
byte[] IntBytes = BitConverter.GetBytes(Numb);
Str.Write(IntBytes, 0x00, IntBytes.Length);
}
public static void WriteInt32(Stream Str, Int32 Numb)
{
byte[] IntBytes = BitConverter.GetBytes(Numb);
Str.Write(IntBytes, 0x00, IntBytes.Length);
}
public static void WriteUInt64(Stream dst, UInt64 value)
{
byte[] ValueBytes = BitConverter.GetBytes(value);
dst.Write(ValueBytes, 0x00, 0x8);
}
public static void WriteInt64(Stream dst, Int64 value)
{
byte[] ValueBytes = BitConverter.GetBytes(value);
dst.Write(ValueBytes, 0x00, 0x8);
}
public static void WriteUInt16(Stream dst, UInt16 value)
{
byte[] ValueBytes = BitConverter.GetBytes(value);
dst.Write(ValueBytes, 0x00, 0x2);
}
public static void WriteInt16(Stream dst, Int16 value)
{
byte[] ValueBytes = BitConverter.GetBytes(value);
dst.Write(ValueBytes, 0x00, 0x2);
}
public static void WriteInt32BE(Stream Str, Int32 Numb)
{
byte[] IntBytes = BitConverter.GetBytes(Numb);
byte[] IntBytesBE = IntBytes.Reverse().ToArray();
Str.Write(IntBytesBE, 0x00, IntBytesBE.Length);
}
public static void WriteStringAt(Stream Str, string Text, int location)
{
long oldPos = Str.Position;
Str.Seek(location, SeekOrigin.Begin);
WriteString(Str,Text);
Str.Seek(oldPos, SeekOrigin.Begin);
}
public static void WriteString(Stream Str, String Text, int len = -1)
{
if (len < 0)
{
len = Text.Length;
}
byte[] TextBytes = Encoding.UTF8.GetBytes(Text);
Str.Write(TextBytes, 0x00, len);
}
}
}

View File

@ -0,0 +1,58 @@
//
// Copyright (c) 2008-2011, Kenneth Bell
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
using System;
using System.Text;
namespace DiscUtils.Iso9660
{
internal class BaseVolumeDescriptor
{
public const string Iso9660StandardIdentifier = "CD001";
public readonly string StandardIdentifier;
public readonly VolumeDescriptorType VolumeDescriptorType;
public readonly byte VolumeDescriptorVersion;
public BaseVolumeDescriptor(VolumeDescriptorType type, byte version)
{
VolumeDescriptorType = type;
StandardIdentifier = "CD001";
VolumeDescriptorVersion = version;
}
public BaseVolumeDescriptor(byte[] src, int offset)
{
VolumeDescriptorType = (VolumeDescriptorType)src[offset + 0];
StandardIdentifier = Encoding.ASCII.GetString(src, offset + 1, 5);
VolumeDescriptorVersion = src[offset + 6];
}
internal virtual void WriteTo(byte[] buffer, int offset)
{
Array.Clear(buffer, offset, IsoUtilities.SectorSize);
buffer[offset] = (byte)VolumeDescriptorType;
IsoUtilities.WriteAChars(buffer, offset + 1, 5, StandardIdentifier);
buffer[offset + 6] = VolumeDescriptorVersion;
}
}
}

View File

@ -0,0 +1,56 @@
//
// Copyright (c) 2008-2011, Kenneth Bell
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
using DiscUtils.Streams;
namespace DiscUtils.Iso9660
{
internal class BootVolumeDescriptor : BaseVolumeDescriptor
{
public const string ElToritoSystemIdentifier = "EL TORITO SPECIFICATION";
public BootVolumeDescriptor(uint catalogSector)
: base(VolumeDescriptorType.Boot, 1)
{
CatalogSector = catalogSector;
}
public BootVolumeDescriptor(byte[] src, int offset)
: base(src, offset)
{
SystemId = EndianUtilities.BytesToString(src, offset + 0x7, 0x20).TrimEnd('\0');
CatalogSector = EndianUtilities.ToUInt32LittleEndian(src, offset + 0x47);
}
public uint CatalogSector { get; }
public string SystemId { get; }
internal override void WriteTo(byte[] buffer, int offset)
{
base.WriteTo(buffer, offset);
EndianUtilities.StringToBytes(ElToritoSystemIdentifier, buffer, offset + 7, 0x20);
EndianUtilities.WriteBytesLittleEndian(CatalogSector, buffer, offset + 0x47);
}
}
}

View File

@ -0,0 +1,42 @@
//
// Copyright (c) 2008-2011, Kenneth Bell
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
namespace DiscUtils.Iso9660
{
internal class BootVolumeDescriptorRegion : VolumeDescriptorDiskRegion
{
private readonly BootVolumeDescriptor _descriptor;
public BootVolumeDescriptorRegion(BootVolumeDescriptor descriptor, long start)
: base(start)
{
_descriptor = descriptor;
}
protected override byte[] GetBlockData()
{
byte[] buffer = new byte[IsoUtilities.SectorSize];
_descriptor.WriteTo(buffer, 0);
return buffer;
}
}
}

View File

@ -0,0 +1,217 @@
//
// Copyright (c) 2008-2011, Kenneth Bell
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using DiscUtils.CoreCompat;
using DiscUtils.Streams;
namespace DiscUtils.Iso9660
{
/// <summary>
/// Represents a directory that will be built into the ISO image.
/// </summary>
public sealed class BuildDirectoryInfo : BuildDirectoryMember
{
internal static readonly Comparer<BuildDirectoryInfo> PathTableSortComparison = new PathTableComparison();
private readonly Dictionary<string, BuildDirectoryMember> _members;
private readonly BuildDirectoryInfo _parent;
private List<BuildDirectoryMember> _sortedMembers;
internal BuildDirectoryInfo(string name, BuildDirectoryInfo parent)
: base(name, MakeShortDirName(name, parent))
{
_parent = parent == null ? this : parent;
HierarchyDepth = parent == null ? 0 : parent.HierarchyDepth + 1;
_members = new Dictionary<string, BuildDirectoryMember>();
}
internal int HierarchyDepth { get; }
/// <summary>
/// The parent directory, or <c>null</c> if none.
/// </summary>
public override BuildDirectoryInfo Parent
{
get { return _parent; }
}
/// <summary>
/// Gets the specified child directory or file.
/// </summary>
/// <param name="name">The name of the file or directory to get.</param>
/// <param name="member">The member found (or <c>null</c>).</param>
/// <returns><c>true</c> if the specified member was found.</returns>
internal bool TryGetMember(string name, out BuildDirectoryMember member)
{
return _members.TryGetValue(name, out member);
}
internal void Add(BuildDirectoryMember member)
{
_members.Add(member.Name, member);
_sortedMembers = null;
}
internal override long GetDataSize(Encoding enc)
{
List<BuildDirectoryMember> sorted = GetSortedMembers();
long total = 34 * 2; // Two pseudo entries (self & parent)
foreach (BuildDirectoryMember m in sorted)
{
uint recordSize = m.GetDirectoryRecordSize(enc);
// If this record would span a sector boundary, then the current sector is
// zero-padded, and the record goes at the start of the next sector.
if (total % IsoUtilities.SectorSize + recordSize > IsoUtilities.SectorSize)
{
long padLength = IsoUtilities.SectorSize - total % IsoUtilities.SectorSize;
total += padLength;
}
total += recordSize;
}
return MathUtilities.RoundUp(total, IsoUtilities.SectorSize);
}
internal uint GetPathTableEntrySize(Encoding enc)
{
int nameBytes = enc.GetByteCount(PickName(null, enc));
return (uint)(8 + nameBytes + ((nameBytes & 0x1) == 1 ? 1 : 0));
}
internal int Write(byte[] buffer, int offset, Dictionary<BuildDirectoryMember, uint> locationTable, Encoding enc)
{
int pos = 0;
List<BuildDirectoryMember> sorted = GetSortedMembers();
// Two pseudo entries, effectively '.' and '..'
pos += WriteMember(this, "\0", Encoding.ASCII, buffer, offset + pos, locationTable, enc);
pos += WriteMember(_parent, "\x01", Encoding.ASCII, buffer, offset + pos, locationTable, enc);
foreach (BuildDirectoryMember m in sorted)
{
uint recordSize = m.GetDirectoryRecordSize(enc);
if (pos % IsoUtilities.SectorSize + recordSize > IsoUtilities.SectorSize)
{
int padLength = IsoUtilities.SectorSize - pos % IsoUtilities.SectorSize;
Array.Clear(buffer, offset + pos, padLength);
pos += padLength;
}
pos += WriteMember(m, null, enc, buffer, offset + pos, locationTable, enc);
}
// Ensure final padding data is zero'd
int finalPadLength = MathUtilities.RoundUp(pos, IsoUtilities.SectorSize) - pos;
Array.Clear(buffer, offset + pos, finalPadLength);
return pos + finalPadLength;
}
private static int WriteMember(BuildDirectoryMember m, string nameOverride, Encoding nameEnc, byte[] buffer, int offset, Dictionary<BuildDirectoryMember, uint> locationTable, Encoding dataEnc)
{
DirectoryRecord dr = new DirectoryRecord();
dr.FileIdentifier = m.PickName(nameOverride, nameEnc);
dr.LocationOfExtent = locationTable[m];
dr.DataLength = (uint)m.GetDataSize(dataEnc);
dr.RecordingDateAndTime = m.CreationTime;
dr.Flags = m is BuildDirectoryInfo ? FileFlags.Directory : FileFlags.None;
return dr.WriteTo(buffer, offset, nameEnc);
}
private static string MakeShortDirName(string longName, BuildDirectoryInfo dir)
{
if (IsoUtilities.IsValidDirectoryName(longName))
{
return longName;
}
char[] shortNameChars = longName.ToUpper(CultureInfo.InvariantCulture).ToCharArray();
for (int i = 0; i < shortNameChars.Length; ++i)
{
if (!IsoUtilities.IsValidDChar(shortNameChars[i]) && shortNameChars[i] != '.' && shortNameChars[i] != ';')
{
shortNameChars[i] = '_';
}
}
return new string(shortNameChars);
}
private List<BuildDirectoryMember> GetSortedMembers()
{
if (_sortedMembers == null)
{
List<BuildDirectoryMember> sorted = new List<BuildDirectoryMember>(_members.Values);
sorted.Sort(SortedComparison);
_sortedMembers = sorted;
}
return _sortedMembers;
}
private class PathTableComparison : Comparer<BuildDirectoryInfo>
{
public override int Compare(BuildDirectoryInfo x, BuildDirectoryInfo y)
{
if (x.HierarchyDepth != y.HierarchyDepth)
{
return x.HierarchyDepth - y.HierarchyDepth;
}
if (x.Parent != y.Parent)
{
return Compare(x.Parent, y.Parent);
}
return CompareNames(x.Name, y.Name, ' ');
}
private static int CompareNames(string x, string y, char padChar)
{
int max = Math.Max(x.Length, y.Length);
for (int i = 0; i < max; ++i)
{
char xChar = i < x.Length ? x[i] : padChar;
char yChar = i < y.Length ? y[i] : padChar;
if (xChar != yChar)
{
return xChar - yChar;
}
}
return 0;
}
}
}
}

View File

@ -0,0 +1,37 @@
//
// Copyright (c) 2008-2011, Kenneth Bell
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
namespace DiscUtils.Iso9660
{
internal class BuildParameters
{
public BuildParameters()
{
VolumeIdentifier = string.Empty;
UseJoliet = true;
}
public bool UseJoliet { get; set; }
public string VolumeIdentifier { get; set; }
}
}

Some files were not shown because too many files have changed in this diff Show More