Skip to content
This repository has been archived by the owner on Dec 10, 2018. It is now read-only.

Commit

Permalink
Added ESDDecrypt Source code by qad (credited in the readme)
Browse files Browse the repository at this point in the history
  • Loading branch information
gus33000 committed Aug 20, 2015
1 parent 2f143d6 commit 3351dd4
Show file tree
Hide file tree
Showing 7 changed files with 690 additions and 0 deletions.
Binary file added esddecrypt/.vs/esddecrypt/v14/.suo
Binary file not shown.
110 changes: 110 additions & 0 deletions esddecrypt/defines.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
#include <Windows.h>

typedef struct _RSAPUBKEYBLOB {
PUBLICKEYSTRUC hdr;
RSAPUBKEY pubkey;
BYTE modulus[0x100];
} RSAPUBKEYBLOB;

typedef struct _RSAPRIVKEYBLOB {
PUBLICKEYSTRUC hdr;
RSAPUBKEY pubkey;
BYTE modulus[0x100];
BYTE prime1[0x80];
BYTE prime2[0x80];
BYTE exp1[0x80];
BYTE exp2[0x80];
BYTE coeff[0x80];
BYTE priv_exp[0x100];
} RSAPRIVKEYBLOB;

typedef struct _SIMPLEKEYBLOB {
PUBLICKEYSTRUC hdr;
ALG_ID algid;
BYTE key[0x100];
} SIMPLEKEYBLOB;

typedef struct _RANGE_INFO {
LONGLONG offset;
ULONG bytes;
} RANGE_INFO;

#include <PshPack1.h>

typedef struct _RESHDR_DISK_SHORT {
ULONGLONG size_in_wim : 56;
ULONGLONG flags : 8;
LONGLONG offset_in_wim;
LONGLONG original_size;
} RESHDR_DISK_SHORT;

#include <PopPack.h>

#define WIM_TAG 0x0000004d4957534dULL // "MSWIM\0\0\0"
#define WIM_HEADER_SIZE 208

#define FLAG_HEADER_RESERVED 0x00000001
#define FLAG_HEADER_COMPRESSION 0x00000002
#define FLAG_HEADER_READONLY 0x00000004
#define FLAG_HEADER_SPANNED 0x00000008
#define FLAG_HEADER_RESOURCE_ONLY 0x00000010
#define FLAG_HEADER_METADATA_ONLY 0x00000020
#define FLAG_HEADER_WRITE_IN_PROGRESS 0x00000040
#define FLAG_HEADER_RP_FIX 0x00000080 // reparse point fixup
#define FLAG_HEADER_COMPRESS_RESERVED 0x00010000
#define FLAG_HEADER_COMPRESS_XPRESS 0x00020000
#define FLAG_HEADER_COMPRESS_LZX 0x00040000
#define FLAG_HEADER_COMPRESS_LZMS 0x00080000

#define RESHDR_FLAG_FREE 0x01
#define RESHDR_FLAG_METADATA 0x02
#define RESHDR_FLAG_COMPRESSED 0x04
#define RESHDR_FLAG_SPANNED 0x08

#define SWAP(t, a, b) { t temp = (a); (a) = (b); (b) = temp; }

typedef struct _WIM_HDR {
ULONGLONG wim_tag; // "MSWIM\0\0\0"
DWORD hdr_size;
DWORD wim_version;
DWORD wim_flags;
DWORD chunk_size;
GUID wim_guid;
WORD part_number;
WORD total_parts;
DWORD image_count;
RESHDR_DISK_SHORT lookup_table;
RESHDR_DISK_SHORT xml_data;
RESHDR_DISK_SHORT boot_metadata;
DWORD boot_index;
RESHDR_DISK_SHORT integrity_table;
BYTE unused[60];
} WIM_HDR;

typedef struct _WIM_XML_INFO {
ULONGLONG size;
LONGLONG offset;
WCHAR *data;
} WIM_XML_INFO;

#define SHA1_HASH_SIZE 20

#pragma warning( push )
#pragma warning( disable:4200 )
typedef struct _WIM_HASH_TABLE {
DWORD size;
DWORD num_elements;
DWORD chunk_size;
BYTE hash_list[][SHA1_HASH_SIZE];
} WIM_HASH_TABLE;
#pragma warning( pop )

typedef struct _WIM_INFO {
FILE *wim_file;
WIM_HDR hdr;
WIM_XML_INFO xml;
RSAPRIVKEYBLOB crypto_key;
SIMPLEKEYBLOB session_key;
int num_encrypted_ranges;
RANGE_INFO *encrypted_ranges;
} WIM_INFO;
437 changes: 437 additions & 0 deletions esddecrypt/esddecrypt.cpp

Large diffs are not rendered by default.

Binary file added esddecrypt/esddecrypt.sdf
Binary file not shown.
22 changes: 22 additions & 0 deletions esddecrypt/esddecrypt.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.30723.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "esddecrypt", "esddecrypt.vcxproj", "{96320661-16A9-4B81-A033-CE65D29C7CC3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{96320661-16A9-4B81-A033-CE65D29C7CC3}.Debug|Win32.ActiveCfg = Debug|Win32
{96320661-16A9-4B81-A033-CE65D29C7CC3}.Debug|Win32.Build.0 = Debug|Win32
{96320661-16A9-4B81-A033-CE65D29C7CC3}.Release|Win32.ActiveCfg = Release|Win32
{96320661-16A9-4B81-A033-CE65D29C7CC3}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
94 changes: 94 additions & 0 deletions esddecrypt/esddecrypt.vcxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{96320661-16A9-4B81-A033-CE65D29C7CC3}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>esddecrypt</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120_xp</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120_xp</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<AdditionalIncludeDirectories>$(SolutionDir)Include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(SolutionDir)Lib\x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>Crypt32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<Optimization>MinSpace</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>false</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<AdditionalIncludeDirectories>$(SolutionDir)Include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalLibraryDirectories>$(SolutionDir)Lib\x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>Crypt32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SetChecksum>true</SetChecksum>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="esddecrypt.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="defines.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
27 changes: 27 additions & 0 deletions esddecrypt/esddecrypt.vcxproj.filters
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resources">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="esddecrypt.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="defines.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>

0 comments on commit 3351dd4

Please sign in to comment.