阅读:1342回复:1
我只知道usb设备的GUID怎么向这个设备鞋数据呢?
我只知道usb设备的GUID怎么向这个设备鞋数据呢?
由于使用的别的单位写的驱动没有源码也没有头文件安装后可以从 .inf文件中的得到设备的GUID请问怎样向这个设备中写数据呢? |
|
沙发#
发布于:2005-02-25 19:34
hCard = SetupDiGetClassDevs(&CardGuid, NULL, NULL, Flags);
if (hCard == INVALID_HANDLE_VALUE) return ERR_DEVICEOPENERROR; status = SetupDiEnumDeviceInterfaces(hCard, NULL, &CardGuid, 0, &DeviceInterfaceData); if (status == FALSE) { return ERR_DEVICEOPENERROR; } status = SetupDiGetInterfaceDeviceDetail(hCard, &DeviceInterfaceData, NULL, 0, &ReqLength, NULL); DeviceDetailData = (PSP_INTERFACE_DEVICE_DETAIL_DATA)malloc(ReqLength); DeviceDetailData->cbSize = sizeof(SP_INTERFACE_DEVICE_DETAIL_DATA); status = SetupDiGetInterfaceDeviceDetail(hCard, &DeviceInterfaceData, DeviceDetailData, ReqLength, &ReqLength, NULL); if (status == FALSE) { return ERR_DEVICEOPENERROR; } 用这几个函数, 得到的DeviceDetailData->DevicePath就是设备连接名, 用CreateFile打开, 然后就可以用WriteFile发数据了 |
|