Add project files.

This commit is contained in:
Joshua Askharoun
2022-03-03 08:14:05 -06:00
parent cfa6f93211
commit 1198cc8a66
967 changed files with 118389 additions and 0 deletions
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup>
</configuration>
+66
View File
@@ -0,0 +1,66 @@
using dnlib.DotNet;
using dnlib.DotNet.Pdb;
using dnlib.DotNet.Writer;
using dnlib.IO;
using dnlib.PE;
using System;
using System.IO;
namespace UIXSign
{
class Program
{
static void Main(string[] args)
{
string dll = args[0];
string outputName = args.Length >= 2 ? args[1] : "UIX_signed.dll";
string outputDir = Path.GetDirectoryName(dll);
string dllCopy = Path.Combine(outputDir, outputName);
File.Copy(dll, dllCopy, true);
Console.WriteLine("Created working copy");
// Load DLL
using var module = ModuleDefMD.Load(dllCopy);
var asm = module.Assembly;
var writeOptions = new ModuleWriterOptions(module);
Console.WriteLine("Loaded copy");
if (module.Metadata.PEImage.ImageDebugDirectories.Count > 0)
Console.WriteLine(module.Metadata.PEImage.ImageDebugDirectories[0]);
Console.WriteLine("Original public key: " + asm.PublicKey.ToString());
// 'Sign' the library so it can be loaded by unmodified Zune executables
asm.PublicKey = new PublicKey("00240000048000009400000006020000002400005253413100040000010001001dc70401884cdfad2010ce192e1f08a30fb034cf504759943eec3359d4ed09af3ce1616dbb124e479617ec73e4162903766e7a5e7bf1984bb318040118fe0f69dfb8b6e5c7c47a0e1bc9a8984b22f7221cc235986c09c74cab38ea3562c18adb8e3a95b73faf1ed71d7c309058b86d951af2165eb215b47de335e360a6a25da7");
module.IsStrongNameSigned = true;
Console.WriteLine("Signed assembly");
if (module.Metadata.PEImage.ImageDebugDirectories.Count > 0)
Console.WriteLine(module.Metadata.PEImage.ImageDebugDirectories[0]);
// Set up PDB to enable debugging
if (module.Metadata.PEImage.ImageDebugDirectories.Count <= 0)
module.CreatePdbState(PdbFileKind.WindowsPDB);
using FileStream pdbFile = File.OpenRead(Path.ChangeExtension(dll, "pdb"));
writeOptions.WritePdb = true;
writeOptions.PdbOptions = PdbWriterOptions.PdbChecksum;
writeOptions.PdbFileName = Path.GetFileName(pdbFile.Name);
writeOptions.PdbFileNameInDebugDirectory = Path.GetFileName(pdbFile.Name);
//writeOptions.PdbFileNameInDebugDirectory = Path.ChangeExtension(Path.GetFileName(dll), ".dn2.pdb");
//module.CreatePdbState(PdbFileKind.EmbeddedPortablePDB);
//var pdbBytes = File.ReadAllBytes(Path.ChangeExtension(dll, "pdb"));
//var pdbStream = DataStreamFactory.Create(pdbBytes);
//var pdbReader = ByteArrayDataReaderFactory.CreateReader(pdbBytes);
//module.Metadata.PEImage.ImageDebugDirectories.Add(new ImageDebugDirectory(ref pdbReader, true));
Console.WriteLine("Loaded PDB");
if (module.Metadata.PEImage.ImageDebugDirectories.Count > 0)
Console.WriteLine(module.Metadata.PEImage.ImageDebugDirectories[0]);
// Replace the raw build with the modded DLL
module.Write(dll, writeOptions);
File.Delete(dllCopy);
Console.WriteLine("DLL modded:");
Console.WriteLine(dll);
}
}
}
+36
View File
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
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: AssemblyTitle("UIXSign")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("UIXSign")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 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("f0323473-f9b6-4875-93b2-df657c3f7197")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
+78
View File
@@ -0,0 +1,78 @@
<?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>{F0323473-F9B6-4875-93B2-DF657C3F7197}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>UIXSign</RootNamespace>
<AssemblyName>UIXSign</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>latest</LangVersion>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>latest</LangVersion>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="dnlib, Version=3.3.4.0, Culture=neutral, PublicKeyToken=50e96378b6e77999, processorArchitecture=MSIL">
<HintPath>..\..\packages\dnlib.3.3.4\lib\net45\dnlib.dll</HintPath>
</Reference>
<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="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
+4
View File
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="dnlib" version="3.3.4" targetFramework="net48" />
</packages>