yck1509 / ConfuserEx

An open-source, free protector for .NET applications
http://yck1509.github.io/ConfuserEx/
Other
3.56k stars 1.61k forks source link

Exception when contructing VTable #81

Open DavidPallett opened 10 years ago

DavidPallett commented 10 years ago

[INFO] ConfuserEx v0.2.0-custom Copyright (C) Ki 2014 [INFO] Running on Microsoft Windows NT 6.2.9200.0, .NET Framework v4.0.30319.34209, 64 bits [DEBUG] Discovering plugins... [INFO] Discovered 10 protections, 1 packers. [DEBUG] Resolving component dependency... [INFO] Loading input modules... [INFO] Loading 'CsvHelper.dll'... [INFO] Loading 'MediCoder3.exe'... [INFO] Loading 'SWL.ApplicationExtensions.dll'... [INFO] Loading 'SWL.AutoTestManager.dll'... [INFO] Loading 'SWL.BaseTypes.dll'... [INFO] Loading 'SWL.ButtonLibrary.dll'... [INFO] Loading 'SWL.CSVReader.dll'... [INFO] Loading 'SWL.DatabaseEngine.dll'... [INFO] Loading 'SWL.FolderBrowser.dll'... [INFO] Loading 'SWL.GenericLibrary.dll'... [INFO] Loading 'SWL.GenericWPF.dll'... [INFO] Loading 'SWL.ImportHandler.dll'... [INFO] Loading 'SWL.LocalDbApi.dll'... [INFO] Loading 'SWL.Logger.dll'... [INFO] Loading 'SWL.LoginLibrary.dll'... [INFO] Loading 'SWL.MCServer.dll'... [INFO] Loading 'SWL.MediCoder.CommonFiles.dll'... [INFO] Loading 'SWL.MessageBox.dll'... [INFO] Loading 'SWL.MetroButtons.dll'... [INFO] Loading 'SWL.RegistrySettings.dll'... [INFO] Loading 'SWL.ScreenManager.dll'... [INFO] Loading 'SWL.TaskButton.dll'... [INFO] Initializing... [DEBUG] Building pipeline... [INFO] Resolving dependencies... [DEBUG] Checking Strong Name... [WARN] [CsvHelper.dll] SN Key is not provided for a signed module, the output may not be working. [WARN] [SWL.AutoTestManager.dll] SN Key is not provided for a signed module, the output may not be working. [WARN] [SWL.ButtonLibrary.dll] SN Key is not provided for a signed module, the output may not be working. [WARN] [SWL.CSVReader.dll] SN Key is not provided for a signed module, the output may not be working. [WARN] [SWL.GenericLibrary.dll] SN Key is not provided for a signed module, the output may not be working. [WARN] [SWL.GenericWPF.dll] SN Key is not provided for a signed module, the output may not be working. [WARN] [SWL.Logger.dll] SN Key is not provided for a signed module, the output may not be working. [WARN] [SWL.MetroButtons.dll] SN Key is not provided for a signed module, the output may not be working. [WARN] [SWL.RegistrySettings.dll] SN Key is not provided for a signed module, the output may not be working. [WARN] [SWL.ScreenManager.dll] SN Key is not provided for a signed module, the output may not be working. [DEBUG] Creating global .cctors... [DEBUG] Watermarking... [DEBUG] Executing 'Name analysis' phase... [DEBUG] Building VTables & identifier list... [ERROR] Unknown error occurred. Exception: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary. at System.Collections.Generic.Dictionary2.get_Item(TKey key) at Confuser.Renamer.VTable.Override(Dictionary2 slotDict, VTableSignature sig, VTableSlot slot, MethodDef target) in c:\SWL\Tools\ConfuserEx-0.2.3\Confuser.Renamer\VTable.cs:line 125 at Confuser.Renamer.VTable.ConstructVTable(TypeDef typeDef, VTableStorage storage) in c:\SWL\Tools\ConfuserEx-0.2.3\Confuser.Renamer\VTable.cs:line 198 at Confuser.Renamer.VTableStorage.GetOrConstruct(TypeDef type) in c:\SWL\Tools\ConfuserEx-0.2.3\Confuser.Renamer\VTable.cs:line 252 at Confuser.Renamer.VTableStorage.GetVTable(ITypeDefOrRef type) in c:\SWL\Tools\ConfuserEx-0.2.3\Confuser.Renamer\VTable.cs:line 260 at Confuser.Renamer.AnalyzePhase.Execute(ConfuserContext context, ProtectionParameters parameters) in c:\SWL\Tools\ConfuserEx-0.2.3\Confuser.Renamer\AnalyzePhase.cs:line 43 at Confuser.Core.ProtectionPipeline.ExecuteStage(PipelineStage stage, Action1 func, Func1 targets, ConfuserContext context) in c:\SWL\Tools\ConfuserEx-0.2.3\Confuser.Core\ProtectionPipeline.cs:line 138 at Confuser.Core.ConfuserEngine.RunPipeline(ProtectionPipeline pipeline, ConfuserContext context) in c:\SWL\Tools\ConfuserEx-0.2.3\Confuser.Core\ConfuserEngine.cs:line 195 at Confuser.Core.ConfuserEngine.RunInternal(ConfuserParameters parameters, CancellationToken token) in c:\SWL\Tools\ConfuserEx-0.2.3\Confuser.Core\ConfuserEngine.cs:line 157 Failed at 18:18, 0:03 elapsed.

I have the actual data files preserved but cant see a way to attach a zip file?

yck1509 commented 9 years ago

Sorry for the late response. If you're still having this problem and would like to get it fixed, please contact me at confuser.net@gmail.com

CoderDennis commented 9 years ago

I'm getting this same error running release v0.4.0.

yck1509 commented 9 years ago

I've rewritten most of the V-Table building process in v0.4.0, so it should not be the same error. Please post your output log for me to have a look.

CoderDennis commented 9 years ago

Below is everything after the assembly loading. It would be helpful if it listed which key it was trying to find in the dictionary. I got the latest code yesterday and after removing the RickRoller class because it was causing an error, the obfuscation succeeds, but it breaks my .exe.

[INFO] Initializing... [DEBUG] Building pipeline... [INFO] Resolving dependencies... [DEBUG] Checking Strong Name... [DEBUG] Creating global .cctors... [DEBUG] Watermarking... [DEBUG] Executing 'Name analysis' phase... [DEBUG] Building VTables & identifier list... [ERROR] Unknown error occurred. Exception: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary. at System.ThrowHelper.ThrowKeyNotFoundException() at System.Collections.Generic.Dictionary2.get_Item(TKey key) at Confuser.Renamer.VTable.ConstructVTable(TypeDef typeDef, VTableStorage storage) in e:\Source\Public\Confuser2\Conf user.Renamer\VTable.cs:line 209 at Confuser.Renamer.VTableStorage.GetOrConstruct(TypeDef type) in e:\Source\Public\Confuser2\Confuser.Renamer\VTable. cs:line 312 at Confuser.Renamer.AnalyzePhase.Execute(ConfuserContext context, ProtectionParameters parameters) in e:\Source\Publi c\Confuser2\Confuser.Renamer\AnalyzePhase.cs:line 47 at Confuser.Core.ProtectionPipeline.ExecuteStage(PipelineStage stage, Action1 func, Func`1 targets, ConfuserContext context) in e:\Source\Public\Confuser2\Confuser.Core\ProtectionPipeline.cs:line 141 at Confuser.Core.ConfuserEngine.RunPipeline(ProtectionPipeline pipeline, ConfuserContext context) in e:\Source\Public \Confuser2\Confuser.Core\ConfuserEngine.cs:line 206 at Confuser.Core.ConfuserEngine.RunInternal(ConfuserParameters parameters, CancellationToken token) in e:\Source\Publ ic\Confuser2\Confuser.Core\ConfuserEngine.cs:line 160 Failed at 2:55 PM, 0:02 elapsed. Press any key to continue...

yck1509 commented 9 years ago

I've add a debug check in VTable construction, please run it and post the resulting log.

prom3theu5 commented 9 years ago

Getting a similar error.

[DEBUG] Building VTables & identifier list... [ERROR] Unknown error occurred. Exception: System.Runtime.InteropServices.SEHException (0x80004005): External component has thrown an exception. at dnlib.IO.UnmanagedMemoryImageStream.GetPositionOf(Byte b) in e:\Source\Public\Confuser2\dnlib\src\IO\UnmanagedMemoryImageStream.cs:line 145 at dnlib.IO.UnmanagedMemoryImageStream.ReadBytesUntilByte(Byte b) in e:\Source\Public\Confuser2\dnlib\src\IO\UnmanagedMemoryImageStream.cs:line 136 at dnlib.DotNet.MD.StringsStream.Read(UInt32 offset) in e:\Source\Public\Confuser2\dnlib\src\DotNet\MD\StringsStream.cs:line 53 at dnlib.DotNet.ModuleDefMD.b5(UInt32 rid2) in e:\Source\Public\Confuser2\dnlib\src\DotNet\ModuleDefMD.cs:line 546 at dnlib.DotNet.ModuleDefMD.ResolveTypeDef(UInt32 rid) in e:\Source\Public\Confuser2\dnlib\src\DotNet\ModuleDefMD.cs:line 765 at dnlib.Utils.LazyList1.ReadOriginalValue_NoLock(Int32 index, UInt32 origIndex) in e:\Source\Public\Confuser2\dnlib\src\Utils\LazyList.cs:line 322 at dnlib.Utils.LazyList1.LazyElement.GetValue_NoLock(Int32 index) in e:\Source\Public\Confuser2\dnlib\src\Utils\LazyList.cs:line 174 at dnlib.Threading.Extensions.de1.MoveNext() in e:\Source\Public\Confuser2\dnlib\src\Threading\IThreadSafeList.cs:line 820 at dnlib.DotNet.AllTypesHelper.<Types>d__0.MoveNext() in e:\Source\Public\Confuser2\dnlib\src\DotNet\AllTypesHelper.cs:line 43 at dnlib.DotNet.TypeDefFinder.GetNextTypeDef() in e:\Source\Public\Confuser2\dnlib\src\DotNet\TypeDefFinder.cs:line 240 at dnlib.DotNet.TypeDefFinder.GetNextTypeDefCache() in e:\Source\Public\Confuser2\dnlib\src\DotNet\TypeDefFinder.cs:line 255 at dnlib.DotNet.TypeDefFinder.FindCache(TypeRef typeRef) in e:\Source\Public\Confuser2\dnlib\src\DotNet\TypeDefFinder.cs:line 175 at dnlib.DotNet.AssemblyDef.Find(TypeRef typeRef) in e:\Source\Public\Confuser2\dnlib\src\DotNet\AssemblyDef.cs:line 666 at dnlib.DotNet.Resolver.Resolve(TypeRef typeRef) in e:\Source\Public\Confuser2\dnlib\src\DotNet\Resolver.cs:line 59 at dnlib.DotNet.TypeRef.ResolveThrow() in e:\Source\Public\Confuser2\dnlib\src\DotNet\TypeRef.cs:line 333 at Confuser.Renamer.VTableStorage.GetVTable(ITypeDefOrRef type) in e:\Source\Public\Confuser2\Confuser.Renamer\VTable.cs:line 322 at Confuser.Renamer.VTable.ConstructVTable(TypeDef typeDef, VTableStorage storage) in e:\Source\Public\Confuser2\Confuser.Renamer\VTable.cs:line 151 at Confuser.Renamer.VTableStorage.GetOrConstruct(TypeDef type) in e:\Source\Public\Confuser2\Confuser.Renamer\VTable.cs:line 312 at Confuser.Renamer.VTableStorage.GetVTable(ITypeDefOrRef type) in e:\Source\Public\Confuser2\Confuser.Renamer\VTable.cs:line 320 at Confuser.Renamer.AnalyzePhase.Execute(ConfuserContext context, ProtectionParameters parameters) in e:\Source\Public\Confuser2\Confuser.Renamer\AnalyzePhase.cs:line 45 at Confuser.Core.ProtectionPipeline.ExecuteStage(PipelineStage stage, Action1 func, Func`1 targets, ConfuserContext context) in e:\Source\Public\Confuser2\Confuser.Core\ProtectionPipeline.cs:line 141 at Confuser.Core.ConfuserEngine.RunPipeline(ProtectionPipeline pipeline, ConfuserContext context) in e:\Source\Public\Confuser2\Confuser.Core\ConfuserEngine.cs:line 204 at Confuser.Core.ConfuserEngine.RunInternal(ConfuserParameters parameters, CancellationToken token) in e:\Source\Public\Confuser2\Confuser.Core\ConfuserEngine.cs:line 158 Failed at 09:50, 0:02 elapsed.

yck1509 commented 9 years ago

Your error is unrelated to this issue. It is most likely caused by some invalid input modules. Is the input modules obfuscated?

badescud commented 9 years ago

Getting similar error. Following the remark that obfuscated input modules could lead to this error ... I figured out that the input assembly was signed prior to run obfuscation. I run the obfuscation on the clean version of the same assembly and the obfuscation succeeded.

Ruffio commented 8 years ago

@badescud do you have a sample that the dev. can have a look at or is it not relevant anymore?