Skip to content

Commit

Permalink
#5
Browse files Browse the repository at this point in the history
  • Loading branch information
XenocodeRCE committed Jul 22, 2018
1 parent 1f72c4e commit 139e72b
Show file tree
Hide file tree
Showing 9 changed files with 145 additions and 4 deletions.
Binary file modified .vs/Confuser2/DesignTimeBuild/.dtbcache
Binary file not shown.
13 changes: 11 additions & 2 deletions Confuser.Protections/TypeScrambler/Scrambler/ScannedItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,23 @@ public bool RegisterGeneric(TypeSig t) {

public GenericMVar GetGeneric(TypeSig t) {
GenericParam gp = null;
if(Generics.TryGetValue(t.ScopeType.MDToken.Raw, out gp)) {

if (t.ContainsGenericParameter) return null;
if(t.ScopeType == null) return null;

if (Generics.TryGetValue(t.ScopeType.MDToken.Raw, out gp))
{
return new GenericMVar(gp.Number);
} else {
}
else
{
return null;
}

}

public TypeSig ConvertToGenericIfAvalible(TypeSig t) {

TypeSig newSig = GetGeneric(t);
if(newSig != null && t.IsSingleOrMultiDimensionalArray) {
var tarr = t as SZArraySig;
Expand Down
5 changes: 3 additions & 2 deletions Confuser.Runtime/Compressor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ static int Main(string[] args) {
Module n = a.ManifestModule;
GCHandle h = Decrypt(q, (uint)Mutation.KeyI1);
var b = (byte[])h.Target;
Module m = a.LoadModule("koi", b);
Array.Clear(b, 0, b.Length);
Module m = a.LoadModule("koi", b);

Array.Clear(b, 0, b.Length);
h.Free();
Array.Clear(q, 0, q.Length);

Expand Down
6 changes: 6 additions & 0 deletions Confuser2.sln
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Confuser.Runtime", "Confuse
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConfuserEx", "ConfuserEx\ConfuserEx.csproj", "{B5205EBA-EC32-4C53-86A0-FAEEE7393EC0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTest", "UnitTest\UnitTest.csproj", "{E98490BB-63E5-492D-B14E-304DE928F81A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -66,6 +68,10 @@ Global
{B5205EBA-EC32-4C53-86A0-FAEEE7393EC0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B5205EBA-EC32-4C53-86A0-FAEEE7393EC0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B5205EBA-EC32-4C53-86A0-FAEEE7393EC0}.Release|Any CPU.Build.0 = Release|Any CPU
{E98490BB-63E5-492D-B14E-304DE928F81A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E98490BB-63E5-492D-B14E-304DE928F81A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E98490BB-63E5-492D-B14E-304DE928F81A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E98490BB-63E5-492D-B14E-304DE928F81A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
6 changes: 6 additions & 0 deletions UnitTest/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
</configuration>
13 changes: 13 additions & 0 deletions UnitTest/GenericTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace UnitTest
{
internal class GenericTest<T> where T : IEnumerable<Char>
{
public IEnumerable<Char> GetReverse(T input) => input.Reverse();
}
}
17 changes: 17 additions & 0 deletions UnitTest/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace UnitTest
{
class Program
{
static void Main(string[] args)
{
Console.Write("Hello o/");
Console.ReadKey();
}
}
}
36 changes: 36 additions & 0 deletions UnitTest/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// Les informations générales relatives à un assembly dépendent de
// l'ensemble d'attributs suivant. Changez les valeurs de ces attributs pour modifier les informations
// associées à un assembly.
[assembly: AssemblyTitle("UnitTest")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("UnitTest")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// L'affectation de la valeur false à ComVisible rend les types invisibles dans cet assembly
// aux composants COM. Si vous devez accéder à un type dans cet assembly à partir de
// COM, affectez la valeur true à l'attribut ComVisible sur ce type.
[assembly: ComVisible(false)]

// Le GUID suivant est pour l'ID de la typelib si ce projet est exposé à COM
[assembly: Guid("e98490bb-63e5-492d-b14e-304de928f81a")]

// Les informations de version pour un assembly se composent des quatre valeurs suivantes :
//
// Version principale
// Version secondaire
// Numéro de build
// Révision
//
// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut
// en utilisant '*', comme indiqué ci-dessous :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
53 changes: 53 additions & 0 deletions UnitTest/UnitTest.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?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>{E98490BB-63E5-492D-B14E-304DE928F81A}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>UnitTest</RootNamespace>
<AssemblyName>UnitTest</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</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>
<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="GenericTest.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

0 comments on commit 139e72b

Please sign in to comment.