C# using a DLL causes an error - how can I fix that?

0

I got dll from a C# app resources it works fine with the app, but when I use it In my c# code I get this error:

An incorrect format. (Exception from HRESULT: 0x8007000B)

I searched for the error, it's because dependency of the dll, so I used depends walker to see depends of the dll it returns:

1- kernel32.dll 2- MSVCRT.dll

Now what should I do with these dependencies?

This is my calling code

[DllImport("kex.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
private static IntPtr XXXFUN(IntPtr bytearray, string strk);

private string cfunction(byte[] keyfile)
{
        IntPtr num = Marshal.AllocHGlobal(keyfile.Length);
        Marshal.Copy(keyfile, 0, num, keyfile.Length);
        return Marshal.PtrToStringAnsi(Form1.XXXFUN(num, "yes"));
}

private void button1_Click(object sender, EventArgs e)
{
        string str1 = this.cfunction(Properties.Resources.bytearray);
}
c#
dll
asked on Stack Overflow Nov 23, 2018 by allismin • edited Nov 23, 2018 by marc_s

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0