/* * [DllImport("User32.dll")] * public static extern int MessageBox(int h, string m, string c, int type); * * [DllImport("kernel32.dll", CharSet = CharSet.Auto)] * public static extern int CreateEvent(ref Utilities.SECURITY_ATTRIBUTES SecurityAttributes, int bManualReset, int bInitialState, string lpName); * * [DllImport("kernel32.dll", SetLastError = true)] * public static extern bool WriteFile(IntPtr hFile, byte[] Buffer, int numBytesToWrite, ref int numBytesWritten, int Overlapped); * * [DllImport("kernel32", SetLastError = true)] * public static extern bool ReadFile(IntPtr hFile, byte[] Buffer, int NumberOfBytesToRead, ref int pNumberOfBytesRead, int Overlapped); * * [DllImport("kernel32.dll", SetLastError = true)] * public static extern int ReadFileEx(IntPtr hFile, byte[] lpBuffer, int nNumberOfBytesToRead, ref Utilities.OVERLAPPED lpOverlapped, int lpCompletionRoutine); * * [DllImport("kernel32.dll")] * public static extern int CloseHandle(IntPtr hObject); * * [DllImport("kernel32.dll")] * public static extern bool TerminateThread(IntPtr hThread, uint dwExitCode); * * [DllImport("kernel32.dll")] * public static extern IntPtr OpenThread(Utilities.ThreadAccess dwDesiredAccess, bool bInheritHandle, uint dwThreadId); * * [DllImport("kernel32.dll")] * public static extern int WaitForSingleObject(int hHandle, int dwMilliseconds); */ public static void InitializeParams() { Utilities.m_flags.HID_write_handle = IntPtr.Zero; Utilities.m_flags.HID_read_handle = IntPtr.Zero; Utilities.m_flags.write_buffer = new byte[65]; Utilities.m_flags.read_buffer = new byte[65]; Utilities.m_flags.bl_buffer = new byte[65]; Utilities.m_flags.orbl = 65; Utilities.m_flags.irbl = 65; Utilities.m_flags.g_status_packet_mutex = new Mutex(false); Utilities.g_comm_mode = Utilities.COMM_MODE.IDLE; Utilities.g_i2cs_mode = Utilities.I2CS_MODE.DEFAULT; Constants.STATUS_PACKET_DATA = new byte[65]; Mode.configure_run_mode_arrays(); Utilities.m_flags.g_status_packet_data_update_event = new AutoResetEvent(false); Utilities.m_flags.g_data_arrived_event = new AutoResetEvent(false); Utilities.m_flags.g_bl_data_arrived_event = new AutoResetEvent(false); Utilities.m_flags.g_PKSA_has_completed_script = new AutoResetEvent(false); Utilities.m_flags.g_special_status_request_event = new AutoResetEvent(false); USBWrite.Initialize_Write_Objects(); USBRead.Initialize_Read_Objects(); }