Native.cs 735 B

12345678910111213141516171819202122
  1. using System;
  2. using System.Runtime.InteropServices;
  3. namespace Hooks
  4. {
  5. [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Unicode,
  6. SetLastError = true)]
  7. public delegate int DRecv(IntPtr handle, IntPtr buf, int count, int flag);
  8. [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Unicode,
  9. SetLastError = true)]
  10. public delegate int DSend(IntPtr handle, IntPtr buf, int count, int flag);
  11. public static class Native
  12. {
  13. [DllImport("Ws2_32.dll", EntryPoint = "recv")]
  14. public static extern int Recv(IntPtr handle, IntPtr buf, int count, int flag);
  15. [DllImport("Ws2_32.dll", EntryPoint = "send")]
  16. public static extern int Send(IntPtr handle, IntPtr buf, int count, int flag);
  17. }
  18. }