public LstK(int Flags, ref KLST_PATTERN_MATCH PatternMatch) { if (!AllKFunctions.LstK_InitEx(out mHandleStruct, Flags, ref PatternMatch)) { throw new Exception(); } }
/// <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 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")); } } }