C# Class LitDev.Engines.Win32Usb

Show file Open project: litdev1/LitDev

Public Properties

Property Type Description
NullHandle System.IntPtr

Protected Properties

Property Type Description
InvalidHandleValue System.IntPtr

Public Methods

Method Description
RegisterForUsbEvents ( IntPtr hWnd, System.Guid gClass ) : IntPtr

Registers a window to receive windows messages when a device is inserted/removed. Need to call this from a form when its handle has been created, not in the form constructor. Use form's OnHandleCreated override.

UnregisterForUsbEvents ( IntPtr hHandle ) : bool

Unregisters notifications. Can be used in form dispose

Private Methods

Method Description
CloseHandle ( IntPtr hFile ) : int
CreateFile ( [ strName, uint nAccess, uint nShareMode, IntPtr lpSecurity, uint nCreationFlags, uint nAttributes, IntPtr lpTemplate ) : IntPtr
HidD_FreePreparsedData ( IntPtr &pData ) : System.Boolean
HidD_GetHidGuid ( System.Guid &gHid ) : void
HidD_GetPreparsedData ( IntPtr hFile, IntPtr &lpData ) : System.Boolean
HidP_GetCaps ( IntPtr lpData, HidCaps &oCaps ) : int
RegisterDeviceNotification ( IntPtr hwnd, DeviceBroadcastInterface oInterface, uint nFlags ) : IntPtr
SetupDiDestroyDeviceInfoList ( IntPtr lpInfoSet ) : int
SetupDiEnumDeviceInterfaces ( IntPtr lpDeviceInfoSet, IntPtr pDeviceInfoData, System.Guid &gClass, uint nIndex, DeviceInterfaceData &oInterfaceData ) : bool
SetupDiGetClassDevs ( System.Guid &gClass, [ strEnumerator, IntPtr hParent, uint nFlags ) : IntPtr
SetupDiGetDeviceInterfaceDetail ( IntPtr lpDeviceInfoSet, DeviceInterfaceData &oInterfaceData, DeviceInterfaceDetailData &oDetailData, uint nDeviceInterfaceDetailDataSize, uint &nRequiredSize, DeviceInfoData &lpDeviceInfoData ) : bool
SetupDiGetDeviceInterfaceDetail ( IntPtr lpDeviceInfoSet, DeviceInterfaceData &oInterfaceData, IntPtr lpDeviceInterfaceDetailData, uint nDeviceInterfaceDetailDataSize, uint &nRequiredSize, DeviceInfoData &lpDeviceInfoData ) : bool
SetupDiGetDeviceRegistryProperty ( IntPtr DeviceInfoSet, DeviceInterfaceData &DeviceInfoData, uint Property, UInt32 &PropertyRegDataType, byte PropertyBuffer, uint PropertyBufferSize, UInt32 &RequiredSize ) : bool
UnregisterDeviceNotification ( IntPtr hHandle ) : bool

Method Details

RegisterForUsbEvents() public static method

Registers a window to receive windows messages when a device is inserted/removed. Need to call this from a form when its handle has been created, not in the form constructor. Use form's OnHandleCreated override.
public static RegisterForUsbEvents ( IntPtr hWnd, System.Guid gClass ) : IntPtr
hWnd System.IntPtr Handle to window that will receive messages
gClass System.Guid Class of devices to get messages for
return System.IntPtr

UnregisterForUsbEvents() public static method

Unregisters notifications. Can be used in form dispose
public static UnregisterForUsbEvents ( IntPtr hHandle ) : bool
hHandle System.IntPtr Handle returned from RegisterForUSBEvents
return bool

Property Details

InvalidHandleValue protected static property

Simple representation of the handle returned when CreateFile fails.
protected static IntPtr,System InvalidHandleValue
return System.IntPtr

NullHandle public static property

Simple representation of a null handle : a closed stream will get this handle. Note it is public for comparison by higher level classes.
public static IntPtr,System NullHandle
return System.IntPtr