首页 > 解决方案 > C# 导入 dll 文件 - 文件有坏图像... msb3246

问题描述

我尝试导入 DLL 库,但是当我想这样做时,我收到了警告

已解决的文件有错误的图像、没有元数据或无法访问。(MSB3246)

我使用 SharpDevelop。dll文件在工作目录中,我也尝试添加参考,但这对我没有帮助。我搜索了很多关于这个问题的信息,但我没有找到任何有意义的解决方案,这可以帮助我。

/*
 * Created by SharpDevelop.
 * User: Tomek
 * Date: 2019-04-04
 * Time: 02:47
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */
using System;
using System.Runtime.InteropServices;
using System.IO;
using System.Drawing;
using System.Windows.Forms;

namespace deobfuscator
{
    /// <summary>
    /// Description of MainForm.
    /// </summary>
    public partial class MainForm : Form
    {
        public MainForm()
        {
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();

            //
            // TODO: Add constructor code after the InitializeComponent() call.
            //
        }

        OpenFileDialog obfuscated_script = new OpenFileDialog();

        string obf_name;

        [DllImport("C:\\Users\\Tomek\\Documents\\SharpDevelop Projects\\deobfuscator\\deobfuscator\\netc.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern bool DeobfuscateScript(string inbuff, long insize, string outbuff, long outsize, string fname);

        void Button1Click(object sender, EventArgs e)
        {
            obfuscated_script.Filter = "LUAC|*luac|LUA|*lua";
            if (obfuscated_script.ShowDialog() == DialogResult.OK)
            {
                textBox1.Text = obfuscated_script.FileName;
                obf_name = obfuscated_script.SafeFileName;
            }
        }

        void Button2Click(object sender, EventArgs e)
        {
            if(textBox1.Text.Length > 0)
            {
                button2.Enabled = false;
                button1.Enabled = false;

                string appPath = Application.ExecutablePath;
                long size = new FileInfo(textBox1.Text).Length;

                //DeobfuscateScript(textBox1.Text, size, textBox1.Text + "decrypt", size, obf_name);

                if(checkBox1.Checked)
                {

                }
            }
        }

        void Label1Click(object sender, EventArgs e)
        {

        }
        void MainFormLoad(object sender, EventArgs e)
        {

        }
    }
}

我在那里导入dll

        [DllImport("C:\\Users\\Tomek\\Documents\\SharpDevelop Projects\\deobfuscator\\deobfuscator\\netc.dll", CallingConvention = CallingConvention.Cdecl)]

标签: c#c++dll

解决方案


推荐阅读