internal void InitializeReports(HIDP_CAPS caps) { m_inReport.ReportLength = m_capabilities.InputReportByteLength; if (m_inReport.Buffer != IntPtr.Zero) { Marshal.FreeHGlobal(m_inReport.Buffer); m_inReport.Buffer = IntPtr.Zero; } m_inReport.Buffer = Marshal.AllocHGlobal(m_inReport.ReportLength); m_inReport.OverLappedEvent = new AutoResetEvent(false); m_inReport.Overlapped = new Overlapped(); if (null!=m_inReport.NativeOverlapped) Overlapped.Unpack(m_inReport.NativeOverlapped); m_inReport.NativeOverlapped = m_inReport.Overlapped.Pack(CompleteHIDInReport, m_inReport.Buffer); if (sizeof(IntPtr) == 8) m_inReport.NativeOverlappedIntPtr = new IntPtr((long)m_inReport.NativeOverlapped); else m_inReport.NativeOverlappedIntPtr = new IntPtr((int)m_inReport.NativeOverlapped); m_outReport.ReportLength = m_capabilities.OutputReportByteLength; if (m_outReport.Buffer != IntPtr.Zero) { Marshal.FreeHGlobal(m_outReport.Buffer); m_outReport.Buffer = IntPtr.Zero; } m_outReport.Buffer = Marshal.AllocHGlobal(m_outReport.ReportLength); m_outReport.OverLappedEvent = new AutoResetEvent(false); m_outReport.Overlapped = new Overlapped(); if (null!=m_outReport.NativeOverlapped) Overlapped.Unpack(m_outReport.NativeOverlapped); m_outReport.NativeOverlapped = m_outReport.Overlapped.Pack(CompleteHIDOutReport, m_outReport.Buffer); if (sizeof(IntPtr) == 8) m_outReport.NativeOverlappedIntPtr = new IntPtr((long)m_outReport.NativeOverlapped); else m_outReport.NativeOverlappedIntPtr = new IntPtr((int)m_outReport.NativeOverlapped); }
internal static extern bool HidP_GetCaps(IntPtr PreparsedData, out HIDP_CAPS capabilities);