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












0
















This question already has an answer here:




  • .net Framework Error (HRESULT 0x8007000B)

    10 answers



  • Using 32-bit dll on 64-bit system shows 0x8007000B Error

    3 answers




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);
}









share|improve this question















marked as duplicate by Robert Harvey c#
Users with the  c# badge can single-handedly close c# questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 23 '18 at 3:31


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.



















  • Take a look at the following thread social.msdn.microsoft.com/Forums/fr-FR/…

    – Access Denied
    Nov 23 '18 at 3:31
















0
















This question already has an answer here:




  • .net Framework Error (HRESULT 0x8007000B)

    10 answers



  • Using 32-bit dll on 64-bit system shows 0x8007000B Error

    3 answers




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);
}









share|improve this question















marked as duplicate by Robert Harvey c#
Users with the  c# badge can single-handedly close c# questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 23 '18 at 3:31


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.



















  • Take a look at the following thread social.msdn.microsoft.com/Forums/fr-FR/…

    – Access Denied
    Nov 23 '18 at 3:31














0












0








0


0







This question already has an answer here:




  • .net Framework Error (HRESULT 0x8007000B)

    10 answers



  • Using 32-bit dll on 64-bit system shows 0x8007000B Error

    3 answers




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);
}









share|improve this question

















This question already has an answer here:




  • .net Framework Error (HRESULT 0x8007000B)

    10 answers



  • Using 32-bit dll on 64-bit system shows 0x8007000B Error

    3 answers




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);
}




This question already has an answer here:




  • .net Framework Error (HRESULT 0x8007000B)

    10 answers



  • Using 32-bit dll on 64-bit system shows 0x8007000B Error

    3 answers








c# dll






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 23 '18 at 5:58









marc_s

576k12811111258




576k12811111258










asked Nov 23 '18 at 3:30









allisminallismin

143




143




marked as duplicate by Robert Harvey c#
Users with the  c# badge can single-handedly close c# questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 23 '18 at 3:31


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









marked as duplicate by Robert Harvey c#
Users with the  c# badge can single-handedly close c# questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 23 '18 at 3:31


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.















  • Take a look at the following thread social.msdn.microsoft.com/Forums/fr-FR/…

    – Access Denied
    Nov 23 '18 at 3:31



















  • Take a look at the following thread social.msdn.microsoft.com/Forums/fr-FR/…

    – Access Denied
    Nov 23 '18 at 3:31

















Take a look at the following thread social.msdn.microsoft.com/Forums/fr-FR/…

– Access Denied
Nov 23 '18 at 3:31





Take a look at the following thread social.msdn.microsoft.com/Forums/fr-FR/…

– Access Denied
Nov 23 '18 at 3:31












0






active

oldest

votes

















0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes

Popular posts from this blog

Wiesbaden

Marschland

Dieringhausen