22 #define snprintf _snprintf
37 "URG Series USB Device Driver",
38 "URG-X002 USB Device Driver",
47 if (from_index == to_index) {
80 GUID GUID_DEVINTERFACE_COM_DEVICE = {
81 0x4D36E978L, 0xE325, 0x11CE,
82 {0xBF, 0xC1, 0x08, 0x00, 0x2B, 0xE1, 0x03, 0x18 }
86 SP_DEVINFO_DATA sDevInfo;
90 hdi = SetupDiGetClassDevs(&GUID_DEVINTERFACE_COM_DEVICE, 0, 0,
91 DIGCF_PRESENT | DIGCF_INTERFACEDEVICE);
92 if (hdi == INVALID_HANDLE_VALUE) {
96 sDevInfo.cbSize =
sizeof(SP_DEVINFO_DATA);
97 for (i = 0; SetupDiEnumDeviceInfo(hdi, i, &sDevInfo); ++i){
101 ComNameLengthMax = 7,
103 char buffer[BufferSize + 1];
112 SetupDiGetDeviceRegistryPropertyA(hdi, &sDevInfo, SPDRP_FRIENDLYNAME,
113 &dwRegType, (BYTE*)buffer, BufferSize,
115 n = (int)strlen(buffer);
116 if (n < ComNameLengthMax) {
123 p = strrchr(buffer,
')');
129 p = strstr(&buffer[n - ComNameLengthMax],
"COM");
137 SetupDiGetDeviceRegistryPropertyA(hdi, &sDevInfo, SPDRP_DEVICEDESC,
138 &dwRegType, (BYTE*)buffer, BufferSize,
142 for (j = 0; j < n; ++j) {
151 SetupDiDestroyDeviceInfoList(hdi);