/// <Summary>Initializes a new usb device list containing only devices matching a specific class GUID.</Summary> public LstK(KLST_FLAG Flags, ref KLST_PATTERN_MATCH PatternMatch) { bool success = AllKFunctions.LstK_InitEx(out mHandleStruct, Flags, ref PatternMatch); 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()); }
/// <Summary>Initializes a new usb device list containing all supported devices.</Summary> protected bool Init(KLST_FLAG Flags) { bool success = AllKFunctions.LstK_Init(out mHandleStruct, 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()); return true; }
public static extern bool LstK_Init([Out] out KLST_HANDLE DeviceList, KLST_FLAG Flags);
public static extern bool LstK_InitEx([Out] out KLST_HANDLE DeviceList, KLST_FLAG Flags, [In] ref KLST_PATTERN_MATCH PatternMatch);
/// <Summary>Initializes a new usb device list containing only devices matching a specific class GUID.</Summary> public LstK(KLST_FLAG Flags, ref KLST_PATTERN_MATCH PatternMatch) { RuntimeHelpers.PrepareConstrainedRegions(); try { } finally { bool success = Functions.LstK_InitEx(out handle, Flags, ref PatternMatch); if (!success || handle.IsInvalid || handle.IsClosed) { handle.SetHandleAsInvalid(); int errorCode = Marshal.GetLastWin32Error(); throw new Exception(GetType().Name + " failed. ErrorCode=" + errorCode.ToString("X")); } } }