/// <Summary>Creates a new overlapped pool.</Summary> public OvlK(KUSB_HANDLE UsbHandle, int MaxOverlappedCount, KOVL_POOL_FLAG Flags) { bool success = AllKFunctions.OvlK_Init(out mHandleStruct, UsbHandle, MaxOverlappedCount, Flags); if (!success) throw new Exception(string.Format("{0} failed initializing. ErrorCode={1:X8}h", GetType().Name, Marshal.GetLastWin32Error())); Debug.Print("{0} Init: handle 0x{1:X16}", GetType().Name, mHandleStruct.Pointer.ToInt64()); }
private static extern bool OvlK_Init(ref KOVL_POOL_HANDLE PoolHandle, KUSB_HANDLE UsbHandle, Int32 MaxOverlappedCount, KOVL_POOL_FLAG Flags);
public static extern bool OvlK_Init([Out] out KOVL_POOL_HANDLE PoolHandle, [In] KUSB_HANDLE UsbHandle, int MaxOverlappedCount, KOVL_POOL_FLAG Flags);
public bool OverlappedInit(ref KOVL_POOL_HANDLE PoolHandle, KUSB_HANDLE UsbHandle, Int32 MaxOverlappedCount, KOVL_POOL_FLAG Flags) { return(OvlK_Init(ref PoolHandle, UsbHandle, MaxOverlappedCount, Flags)); }
/// <Summary>Creates a new overlapped pool.</Summary> public OvlK(KUSB_HANDLE UsbHandle, int MaxOverlappedCount, KOVL_POOL_FLAG Flags) { RuntimeHelpers.PrepareConstrainedRegions(); try { } finally { bool success = Functions.OvlK_Init(out handle, UsbHandle, MaxOverlappedCount, Flags); if (!success || handle.IsInvalid || handle.IsClosed) { handle.SetHandleAsInvalid(); int errorCode = Marshal.GetLastWin32Error(); throw new Exception(GetType().Name + " failed. ErrorCode=" + errorCode.ToString("X")); } } }