Quote:
Originally Posted by kyle191
Ok I change what I needed, then I press F6. You mean start the debug? because I do that and get errors such as;
"Managed Debugging Assistant 'PInvokeStackImbalance' has detected a problem in 'C:\PluimpieCo\bin\Debug\PluimpieCo.vshost.exe'.
Additional Information: A call to PInvoke function 'PluimpieCo!PluimpieCo.Native::BF_cfb64_encrypt' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature."
I'm new to Visual so I don't have any idea what I'm doing.
Thanks.
|
Replace your native.cs with this
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace NewestCOServer
{
public unsafe class Native
{
[DllImport("kernel32.dll")]
public static extern IntPtr GetStdHandle(uint nStdHandle);
[DllImport("kernel32.dll")]
public static extern bool SetConsoleTextAttribute(IntPtr hConsoleOutput, int wAttributes);
[DllImport("msvcrt.dll")]
public static extern unsafe void* memcpy(void* dest, void* src, uint size);
[DllImport("user32.dll")]
public static extern int MessageBox(int h, string m, string c, int type);
[DllImport("winmm.dll")]
public static extern uint timeGetTime();
[DllImport("libeay32.dll")]
public extern static void BF_set_key(IntPtr _key, int len, byte[] data);
[DllImport("libeay32.dll")]
public extern static void BF_ecb_encrypt(byte[] in_, byte[] out_, IntPtr schedule, int enc);
[DllImport("libeay32.dll")]
public extern static void BF_cbc_encrypt(byte[] in_, byte[] out_, int length, IntPtr schedule, byte[] ivec, int enc);
[DllImport("libeay32.dll")]
public extern static void BF_cfb64_encrypt(byte[] in_, byte[] out_, int length, IntPtr schedule, byte[] ivec, ref int num, int enc);
[DllImport("libeay32.dll")]
public extern static void BF_ofb64_encrypt(byte[] in_, byte[] out_, int length, IntPtr schedule, byte[] ivec, out int num);
}
}