acessing dbcc_name from DEV_BROADCAST_DEVICEINTERFACE win32 programming

前端 未结 2 1003
不知归路
不知归路 2021-01-15 07:14

I have some c code with me which detects the usb cable removal and insertion.

I found one structure DEV_BROADCAST_DEVICEINTERFACE which is having

2条回答
  •  天命终不由人
    2021-01-15 07:38

    You need to cast a DEV_BROADCAST_HEADER* to a DEV_BROADCAST_DEVICEINTERFACE*. You are allowed to do so if and only if dbch_devicetype==DBT_DEVTYP_DEVICEINTERFACE.

    You getDEV_BROADCAST_HEADER* as the LPARAM of WM_DEVICECHANGE.

    To do something useful with dbcc_name, you have to pass it to SetupDiOpenDeviceInterface(). This will give you a SP_DEVICE_INTERFACE_DATA with one SP_DEVINFO_DATA. You can then call functions like SetupDiGetDeviceRegistryProperty to learn more about the device.

提交回复
热议问题