@@ -792,15 +792,18 @@ void ListBaton::Execute() {
792792 char *name;
793793 char *manufacturer;
794794 char *locationId;
795+ char *friendlyName;
795796 char serialNumber[MAX_REGISTRY_KEY_SIZE];
796- bool isCom = false ;
797+ bool isCom;
797798 while (true ) {
798799 pnpId = NULL ;
799800 vendorId = NULL ;
800801 productId = NULL ;
801802 name = NULL ;
802803 manufacturer = NULL ;
803804 locationId = NULL ;
805+ friendlyName = NULL ;
806+ isCom = false ;
804807
805808 ZeroMemory (&deviceInfoData, sizeof (SP_DEVINFO_DATA));
806809 deviceInfoData.cbSize = sizeof (SP_DEVINFO_DATA);
@@ -835,6 +838,12 @@ void ListBaton::Execute() {
835838 sizeof (szBuffer), &dwSize)) {
836839 locationId = strdup (szBuffer);
837840 }
841+ if (SetupDiGetDeviceRegistryProperty (hDevInfo, &deviceInfoData,
842+ SPDRP_FRIENDLYNAME, &dwPropertyRegDataType,
843+ reinterpret_cast <BYTE*>(szBuffer),
844+ sizeof (szBuffer), &dwSize)) {
845+ friendlyName = strdup (szBuffer);
846+ }
838847 if (SetupDiGetDeviceRegistryProperty (hDevInfo, &deviceInfoData,
839848 SPDRP_MFG, &dwPropertyRegDataType,
840849 reinterpret_cast <BYTE*>(szBuffer),
@@ -866,6 +875,9 @@ void ListBaton::Execute() {
866875 if (locationId) {
867876 resultItem->locationId = locationId;
868877 }
878+ if (friendlyName) {
879+ resultItem->friendlyName = friendlyName;
880+ }
869881 results.push_back (resultItem);
870882 }
871883 free (pnpId);
0 commit comments