de4dot-cex/de4dot.code/deobfuscators/ConfuserEx/x86/Bea/Engine.cs
ViR Dash 7adf818194 Implement ConfuserEx generic constants and resource decryption; misc improvements
Move BeaEngine.dll to /bin/
Make sure BeaEngine.dll is loaded when the working directory is different
Disable file deobfuscation exception handler
Don't remove LZMA methods by default
Trim version read from ConfuserAttribute
Minor refactoring
2017-08-20 16:25:25 +03:00

51 lines
1.4 KiB
C#

using System.IO;
using System.Runtime.InteropServices;
namespace de4dot.Bea
{
public static class BeaEngine
{
// 'de4dot\bin\de4dot.blocks.dll' -> 'de4dot\bin\'
private static string _executingPath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
static BeaEngine()
{
if (!File.Exists(Path.Combine(_executingPath, "BeaEngine.dll")))
{
throw new FileNotFoundException("BeaEngine.dll missing!");
}
//TODO: Better handle native DLL discovery
SetDllDirectory(_executingPath);
}
[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
private static extern bool SetDllDirectory(string lpPathName);
[DllImport("BeaEngine.dll")]
public static extern int Disasm([In, Out, MarshalAs(UnmanagedType.LPStruct)] Disasm disasm);
[DllImport("BeaEngine.dll")]
private static extern string BeaEngineVersion();
[DllImport("BeaEngine.dll")]
private static extern string BeaEngineRevision();
public static string Version
{
get
{
return BeaEngineVersion();
}
}
public static string Revision
{
get
{
return BeaEngineRevision();
}
}
}
}