Skip to content

Commit 139e72b

Browse files
committed
1 parent 1f72c4e commit 139e72b

File tree

9 files changed

+145
-4
lines changed

9 files changed

+145
-4
lines changed
132 Bytes
Binary file not shown.

Confuser.Protections/TypeScrambler/Scrambler/ScannedItem.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,23 @@ public bool RegisterGeneric(TypeSig t) {
2929

3030
public GenericMVar GetGeneric(TypeSig t) {
3131
GenericParam gp = null;
32-
if(Generics.TryGetValue(t.ScopeType.MDToken.Raw, out gp)) {
32+
33+
if (t.ContainsGenericParameter) return null;
34+
if(t.ScopeType == null) return null;
35+
36+
if (Generics.TryGetValue(t.ScopeType.MDToken.Raw, out gp))
37+
{
3338
return new GenericMVar(gp.Number);
34-
} else {
39+
}
40+
else
41+
{
3542
return null;
3643
}
44+
3745
}
3846

3947
public TypeSig ConvertToGenericIfAvalible(TypeSig t) {
48+
4049
TypeSig newSig = GetGeneric(t);
4150
if(newSig != null && t.IsSingleOrMultiDimensionalArray) {
4251
var tarr = t as SZArraySig;

Confuser.Runtime/Compressor.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,9 @@ static int Main(string[] args) {
5555
Module n = a.ManifestModule;
5656
GCHandle h = Decrypt(q, (uint)Mutation.KeyI1);
5757
var b = (byte[])h.Target;
58-
Module m = a.LoadModule("koi", b);
59-
Array.Clear(b, 0, b.Length);
58+
Module m = a.LoadModule("koi", b);
59+
60+
Array.Clear(b, 0, b.Length);
6061
h.Free();
6162
Array.Clear(q, 0, q.Length);
6263

Confuser2.sln

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Confuser.Runtime", "Confuse
2828
EndProject
2929
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConfuserEx", "ConfuserEx\ConfuserEx.csproj", "{B5205EBA-EC32-4C53-86A0-FAEEE7393EC0}"
3030
EndProject
31+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTest", "UnitTest\UnitTest.csproj", "{E98490BB-63E5-492D-B14E-304DE928F81A}"
32+
EndProject
3133
Global
3234
GlobalSection(SolutionConfigurationPlatforms) = preSolution
3335
Debug|Any CPU = Debug|Any CPU
@@ -66,6 +68,10 @@ Global
6668
{B5205EBA-EC32-4C53-86A0-FAEEE7393EC0}.Debug|Any CPU.Build.0 = Debug|Any CPU
6769
{B5205EBA-EC32-4C53-86A0-FAEEE7393EC0}.Release|Any CPU.ActiveCfg = Release|Any CPU
6870
{B5205EBA-EC32-4C53-86A0-FAEEE7393EC0}.Release|Any CPU.Build.0 = Release|Any CPU
71+
{E98490BB-63E5-492D-B14E-304DE928F81A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
72+
{E98490BB-63E5-492D-B14E-304DE928F81A}.Debug|Any CPU.Build.0 = Debug|Any CPU
73+
{E98490BB-63E5-492D-B14E-304DE928F81A}.Release|Any CPU.ActiveCfg = Release|Any CPU
74+
{E98490BB-63E5-492D-B14E-304DE928F81A}.Release|Any CPU.Build.0 = Release|Any CPU
6975
EndGlobalSection
7076
GlobalSection(SolutionProperties) = preSolution
7177
HideSolutionNode = FALSE

UnitTest/App.config

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
5+
</startup>
6+
</configuration>

UnitTest/GenericTest.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace UnitTest
8+
{
9+
internal class GenericTest<T> where T : IEnumerable<Char>
10+
{
11+
public IEnumerable<Char> GetReverse(T input) => input.Reverse();
12+
}
13+
}

UnitTest/Program.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace UnitTest
8+
{
9+
class Program
10+
{
11+
static void Main(string[] args)
12+
{
13+
Console.Write("Hello o/");
14+
Console.ReadKey();
15+
}
16+
}
17+
}

UnitTest/Properties/AssemblyInfo.cs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// Les informations générales relatives à un assembly dépendent de
6+
// l'ensemble d'attributs suivant. Changez les valeurs de ces attributs pour modifier les informations
7+
// associées à un assembly.
8+
[assembly: AssemblyTitle("UnitTest")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("")]
12+
[assembly: AssemblyProduct("UnitTest")]
13+
[assembly: AssemblyCopyright("Copyright © 2018")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// L'affectation de la valeur false à ComVisible rend les types invisibles dans cet assembly
18+
// aux composants COM. Si vous devez accéder à un type dans cet assembly à partir de
19+
// COM, affectez la valeur true à l'attribut ComVisible sur ce type.
20+
[assembly: ComVisible(false)]
21+
22+
// Le GUID suivant est pour l'ID de la typelib si ce projet est exposé à COM
23+
[assembly: Guid("e98490bb-63e5-492d-b14e-304de928f81a")]
24+
25+
// Les informations de version pour un assembly se composent des quatre valeurs suivantes :
26+
//
27+
// Version principale
28+
// Version secondaire
29+
// Numéro de build
30+
// Révision
31+
//
32+
// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut
33+
// en utilisant '*', comme indiqué ci-dessous :
34+
// [assembly: AssemblyVersion("1.0.*")]
35+
[assembly: AssemblyVersion("1.0.0.0")]
36+
[assembly: AssemblyFileVersion("1.0.0.0")]

UnitTest/UnitTest.csproj

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{E98490BB-63E5-492D-B14E-304DE928F81A}</ProjectGuid>
8+
<OutputType>Exe</OutputType>
9+
<RootNamespace>UnitTest</RootNamespace>
10+
<AssemblyName>UnitTest</AssemblyName>
11+
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
12+
<FileAlignment>512</FileAlignment>
13+
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
14+
</PropertyGroup>
15+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
16+
<PlatformTarget>AnyCPU</PlatformTarget>
17+
<DebugSymbols>true</DebugSymbols>
18+
<DebugType>full</DebugType>
19+
<Optimize>false</Optimize>
20+
<OutputPath>bin\Debug\</OutputPath>
21+
<DefineConstants>DEBUG;TRACE</DefineConstants>
22+
<ErrorReport>prompt</ErrorReport>
23+
<WarningLevel>4</WarningLevel>
24+
</PropertyGroup>
25+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
26+
<PlatformTarget>AnyCPU</PlatformTarget>
27+
<DebugType>pdbonly</DebugType>
28+
<Optimize>true</Optimize>
29+
<OutputPath>bin\Release\</OutputPath>
30+
<DefineConstants>TRACE</DefineConstants>
31+
<ErrorReport>prompt</ErrorReport>
32+
<WarningLevel>4</WarningLevel>
33+
</PropertyGroup>
34+
<ItemGroup>
35+
<Reference Include="System" />
36+
<Reference Include="System.Core" />
37+
<Reference Include="System.Xml.Linq" />
38+
<Reference Include="System.Data.DataSetExtensions" />
39+
<Reference Include="Microsoft.CSharp" />
40+
<Reference Include="System.Data" />
41+
<Reference Include="System.Net.Http" />
42+
<Reference Include="System.Xml" />
43+
</ItemGroup>
44+
<ItemGroup>
45+
<Compile Include="GenericTest.cs" />
46+
<Compile Include="Program.cs" />
47+
<Compile Include="Properties\AssemblyInfo.cs" />
48+
</ItemGroup>
49+
<ItemGroup>
50+
<None Include="App.config" />
51+
</ItemGroup>
52+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
53+
</Project>

0 commit comments

Comments
 (0)