Skip to content

Commit 47540e7

Browse files
authored
Merge pull request #2 from greenozon/update_dnlib
Update dnlib to uptodate version 4.5.0
2 parents 4b81716 + 465d826 commit 47540e7

3 files changed

Lines changed: 7 additions & 8 deletions

File tree

De4DotCommon.props

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414
<Copyright>Copyright (C) 2011-2018 de4dot@gmail.com</Copyright>
1515
<OutputPath>$(MSBuildThisFileDirectory)\$(Configuration)</OutputPath>
1616
<DisableOutOfProcTaskHost>true</DisableOutOfProcTaskHost>
17-
18-
<DnlibVersion>3.6.0</DnlibVersion>
17+
<DnlibVersion>4.5.0</DnlibVersion>
1918
</PropertyGroup>
2019
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
2120
<SelfContained>true</SelfContained>

de4dot.blocks/de4dot.blocks.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
</PropertyGroup>
99

1010
<ItemGroup>
11-
<PackageReference Include="dnlib" Version="3.6.0" />
11+
<PackageReference Include="dnlib" Version='$(DnlibVersion)' />
1212
</ItemGroup>
1313

1414
</Project>

de4dot.code/deobfuscators/CodeVeil/ResourceConverter.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public ResourceConverter(ModuleDefMD module, ResourceInfo[] infos) {
4848
}
4949

5050
public byte[] Convert() {
51-
var resources = new ResourceElementSet();
51+
var resources = ResourceElementSet.CreateForResourceReader(module);
5252
foreach (var info in infos)
5353
resources.Add(Convert(info));
5454

@@ -145,7 +145,7 @@ ResourceElement Convert(ResourceInfo info) {
145145
break;
146146

147147
case 31: // binary
148-
resourceData = dataCreator.CreateSerialized(reader.ReadBytes(info.length));
148+
resourceData = dataCreator.CreateSerialized(reader.ReadBytes(info.length), SerializationFormat.BinaryFormatter, new UserResourceType("Binary", ResourceTypeCode.ByteArray));
149149
break;
150150

151151
case 21: // Point (CV doesn't restore this type)
@@ -166,7 +166,7 @@ class CharArrayResourceData : UserResourceData {
166166
public CharArrayResourceData(UserResourceType type, char[] data) : base(type) => this.data = data;
167167
#pragma warning disable SYSLIB0011
168168
#warning "Insecure! Rewrite with custom parser https://learn.microsoft.com/en-us/dotnet/standard/serialization/binaryformatter-security-guide"
169-
public override void WriteData(BinaryWriter writer, IFormatter formatter) => formatter.Serialize(writer.BaseStream, data);
169+
public override void WriteData(ResourceBinaryWriter writer, IFormatter formatter) => formatter.Serialize(writer.BaseStream, data);
170170
#pragma warning restore SYSLIB0011
171171
public override string ToString() => $"char[]: Length: {data.Length}";
172172
}
@@ -177,7 +177,7 @@ class IconResourceData : UserResourceData {
177177
public IconResourceData(UserResourceType type, byte[] data) : base(type) => icon = new Icon(new MemoryStream(data));
178178
#pragma warning disable SYSLIB0011
179179
#warning "Insecure! Rewrite with custom parser https://learn.microsoft.com/en-us/dotnet/standard/serialization/binaryformatter-security-guide"
180-
public override void WriteData(BinaryWriter writer, IFormatter formatter) => formatter.Serialize(writer.BaseStream, icon);
180+
public override void WriteData(ResourceBinaryWriter writer, IFormatter formatter) => formatter.Serialize(writer.BaseStream, icon);
181181
#pragma warning restore SYSLIB0011
182182
public override string ToString() => $"Icon: {icon}";
183183
}
@@ -188,7 +188,7 @@ class ImageResourceData : UserResourceData {
188188
public ImageResourceData(UserResourceType type, byte[] data) : base(type) => bitmap = new Bitmap(Image.FromStream(new MemoryStream(data)));
189189
#pragma warning disable SYSLIB0011
190190
#warning "Insecure! Rewrite with custom parser https://learn.microsoft.com/en-us/dotnet/standard/serialization/binaryformatter-security-guide"
191-
public override void WriteData(BinaryWriter writer, IFormatter formatter) => formatter.Serialize(writer.BaseStream, bitmap);
191+
public override void WriteData(ResourceBinaryWriter writer, IFormatter formatter) => formatter.Serialize(writer.BaseStream, bitmap);
192192
#pragma warning restore SYSLIB0011
193193
public override string ToString() => "Bitmap";
194194
}

0 commit comments

Comments
 (0)