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);
}
User contributions licensed under CC BY-SA 3.0