ViRb3 / de4dot-cex

📦 de4dot deobfuscator with full support for vanilla ConfuserEx
GNU General Public License v3.0
491 stars 122 forks source link

Project doesn't build #13

Closed theerfan closed 4 years ago

theerfan commented 4 years ago

Hi. I'm using Visual Studio 2019, and trying to build the x64 project which I cloned directly with the instruction given in the original repo, but it gives me the following exception:

BadImageFormatException: Could not load file or assembly 'de4dot.code, Version=3.1.41592.3405, Culture=neutral, PublicKeyToken=d3f3ed1e47f67fc6' or one of its dependencies. An attempt was made to load a program with an incorrect format.

Even though the de4dot.code project is right there alongside the rest.

I also tried to download the release zip file but it returns the following:

Unhandled Exception: System.BadImageFormatException: Invalid DOS signature at dnlib.PE.ImageDosHeader..ctor(IImageStream reader, Boolean verify) in D:\a\de4dot-cex\de4dot-cex\dnlib\src\PE\ImageDosHeader.cs:line 30 at dnlib.PE.PEInfo..ctor(IImageStream reader, Boolean verify) in D:\a\de4dot-cex\de4dot-cex\dnlib\src\PE\PEInfo.cs:line 44 at dnlib.PE.PEImage..ctor(IImageStreamCreator imageStreamCreator, ImageLayout imageLayout, Boolean verify) in D:\a\de4dot-cex\de4dot-cex\dnlib\src\PE\PEImage.cs:line 134 at dnlib.PE.PEImage..ctor(String fileName, Boolean mapAsImage, Boolean verify) in D:\a\de4dot-cex\de4dot-cex\dnlib\src\PE\PEImage.cs:line 165 at de4dot.code.ObfuscatedFile.UnpackNativeImage(IEnumerable1 deobfuscators) in D:\a\de4dot-cex\de4dot-cex\de4dot.code\ObfuscatedFile.cs:line 193 at de4dot.code.ObfuscatedFile.LoadModule(IEnumerable1 deobfuscators) in D:\a\de4dot-cex\de4dot-cex\de4dot.code\ObfuscatedFile.cs:line 182 at de4dot.code.ObfuscatedFile.Load(IList`1 deobfuscators) in D:\a\de4dot-cex\de4dot-cex\de4dot.code\ObfuscatedFile.cs:line 161 at de4dot.cui.FilesDeobfuscator.DotNetFileLoader.Add(IObfuscatedFile file, Boolean skipUnknownObfuscator, Boolean isFromPossibleFiles) in D:\a\de4dot-cex\de4dot-cex\de4dot.cui\FilesDeobfuscator.cs:line 246 at de4dot.cui.FilesDeobfuscator.DotNetFileLoader.CreateObfuscatedFile(SearchDir searchDir, String filename) in D:\a\de4dot-cex\de4dot-cex\de4dot.cui\FilesDeobfuscator.cs:line 347 at de4dot.cui.FilesDeobfuscator.DotNetFileLoader.d7.MoveNext() in D:\a\de4dot-cex\de4dot-cex\de4dot.cui\FilesDeobfuscator.cs:line 275 at de4dot.cui.FilesDeobfuscator.DotNetFileLoader.d5.MoveNext() in D:\a\de4dot-cex\de4dot-cex\de4dot.cui\FilesDeobfuscator.cs:line 203 at de4dot.cui.FilesDeobfuscator.d__11.MoveNext() in D:\a\de4dot-cex\de4dot-cex\de4dot.cui\FilesDeobfuscator.cs:line 167 at de4dot.cui.FilesDeobfuscator.DetectObfuscators() in D:\a\de4dot-cex\de4dot-cex\de4dot.cui\FilesDeobfuscator.cs:line 99 at de4dot.cui.Program.Main(String[] args) in D:\a\de4dot-cex\de4dot-cex\de4dot.cui\Program.cs:line 118 at de4dot_x64.Program.Main(String[] args) in D:\a\de4dot-cex\de4dot-cex\de4dot-x64\Program.cs:line 23 With both the de4dot.exe and de4dot-64.exe.

ViRb3 commented 4 years ago

From your log:

BadImageFormatException: Could not load file or assembly 'de4dot.code, Version=3.1.41592.3405, Culture=neutral, PublicKeyToken=d3f3ed1e47f67fc6' or one of its dependencies. An attempt was made to load a program with an incorrect format.

You are trying to build de4dot.code for an unsupported architecture. Note that many of de4dot's sub-projects compile for x86 only, but they will still work just fine on x64. That said, if you leave the build settings as default (Mixed Platforms), everything should compile successfully, or at least it does here, on the CI server, and for everybody else.

theerfan commented 4 years ago

image

I never even touched the build settings.

ViRb3 commented 4 years ago

Do you have .NET 2.0 installed? Seems like that's all sub-projects target. Unfortunately, I cannot reproduce this issue on my end or at GitHub's CI.

EDIT: Just reproduced it, please give me some time to investigate.

theerfan commented 4 years ago

Alright, thank you.

ViRb3 commented 4 years ago

Turns out I had accidentally made de4dot.code x86-only for Debug mode, which makes it unusable from de4dot-x64. This did not affect Release mode, so the CI and everything else was unaffected. I pushed a fix, please try it out and let me know how it goes.

Thanks for reporting!

theerfan commented 4 years ago

Yeah, it compiles now but I'm encountering this other problem. xD When I run:

de4dot-x64 Program.exe

I get:

Array dimensions exceeded supported range. Array dimensions exceeded supported range. Detected ConfuserEx v0.6.0 (G:\Blah\de4dot-cex\Debug\Program.exe) Cleaning G:\Blah\de4dot-cex\Debug\Program.exe

Unhandled Exception: System.ApplicationException: Invalid new target, it's null

ViRb3 commented 4 years ago

Can you confirm that it also happens with the pre-built binaries? If yes, please open a separate issue for that problem.

theerfan commented 4 years ago

I will, but it's also worth mentioning that now the Release config won't compile. image

ViRb3 commented 4 years ago

GitHub CI can compile it, and so can I. try to clean your project maybe?

theerfan commented 4 years ago

I cleaned the entire solution and tried again, still the same results. image

ViRb3 commented 4 years ago

Your output log suggests 17 succeeded and 0 failed builds, so there should be no problems.

theerfan commented 4 years ago

I will, but it's also worth mentioning that now the Release config won't compile. image

I got this again after the clean builds. P.S: Ik it's a run-time problem but still. xD