using System;
using System.Runtime.InteropServices;
namespace xClient.Core.Utilities
{
///
/// Provides access to Win32 API and Microsoft C Runtime Library (msvcrt.dll).
///
public static class NativeMethods
{
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool DeleteFile(string name);
[DllImport("user32.dll")]
public static extern bool SetCursorPos(int x, int y);
[DllImport("user32.dll")]
public static extern void mouse_event(int dwFlags, int dx, int dy, int cButtons, int dwExtraInfo);
///
/// Performs a bit-block transfer of the color data corresponding to a
/// rectangle of pixels from the specified source device context into
/// a destination device context.
///
/// Handle to the destination device context.
/// The leftmost x-coordinate of the destination rectangle (in pixels).
/// The topmost y-coordinate of the destination rectangle (in pixels).
/// The width of the source and destination rectangles (in pixels).
/// The height of the source and the destination rectangles (in pixels).
/// Handle to the source device context.
/// The leftmost x-coordinate of the source rectangle (in pixels).
/// The topmost y-coordinate of the source rectangle (in pixels).
/// A raster-operation code.
///
/// true if the operation succeedes, false otherwise. To get extended error information, call .
///
[DllImport("gdi32.dll", EntryPoint = "BitBlt", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool BitBlt([In] IntPtr hdc, int nXDest, int nYDest, int nWidth, int nHeight, [In] IntPtr hdcSrc, int nXSrc, int nYSrc, int dwRop);
[DllImport("gdi32.dll")]
public static extern IntPtr CreateDC(string lpszDriver, string lpszDevice, string lpszOutput, IntPtr lpInitData);
[DllImport("gdi32.dll")]
public static extern bool DeleteDC([In] IntPtr hdc);
[DllImport("msvcrt.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern unsafe int memcmp(byte* ptr1, byte* ptr2, uint count);
[DllImport("msvcrt.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int memcmp(IntPtr ptr1, IntPtr ptr2, uint count);
[DllImport("msvcrt.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int memcpy(IntPtr dst, IntPtr src, uint count);
[DllImport("msvcrt.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern unsafe int memcpy(void* dst, void* src, uint count);
}
}