DBT_DEVTYP_HANDLE pnpevent not captured in Windows 7 64 bits using CyAPI.lib in x86 | Cypress Semiconductor
DBT_DEVTYP_HANDLE pnpevent not captured in Windows 7 64 bits using CyAPI.lib in x86
We are using CyAPI.lib and capturing pnpevents waiting for a DBT_DEVTYP_HANDLE. All is running ok if used on a 32 bits machine. But the same app, when used in a Windows 7 64 bits, is not capturing the DBT_DEVICEREMOVECOMPLETE in the same way.
The documentation says we should capture DBT_DEVICEREMOVECOMPLETE events, and then check if the event is:
pDBHdr = (PDEV_BROADCAST_HDR) lParam;
if (pDBHdr->dbch_devicetype == DBT_DEVTYP_HANDLE)
After some debugging, we noticed that sometime the event is DBT_DEVTYP_DEVICEINTERFACE, and not DBT_DEVTYP_HANDLE. We are sometimes receiving both events. That should not be a problem if we just capture the DBT_DEVTYP_HANDLE types. What happens is that the first time I disconnect the device, we are just receiving a DBT_DEVTYP_DEVICEINTERFACE event. If we continue pluging in and out, we are receiving the DBT_DEVTYP_HANDLE event on the nexts, but the first time we are not receiving the DBT_DEVTYP_HANDLE.
Is there something we are missing?