@@ -792,8 +792,9 @@ 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 isCom = false ;
799800 pnpId = NULL ;
@@ -802,6 +803,8 @@ void ListBaton::Execute() {
802803 name = NULL ;
803804 manufacturer = NULL ;
804805 locationId = NULL ;
806+ friendlyName = NULL ;
807+ isCom = false ;
805808
806809 ZeroMemory (&deviceInfoData, sizeof (SP_DEVINFO_DATA));
807810 deviceInfoData.cbSize = sizeof (SP_DEVINFO_DATA);
@@ -836,6 +839,12 @@ void ListBaton::Execute() {
836839 sizeof (szBuffer), &dwSize)) {
837840 locationId = strdup (szBuffer);
838841 }
842+ if (SetupDiGetDeviceRegistryProperty (hDevInfo, &deviceInfoData,
843+ SPDRP_FRIENDLYNAME, &dwPropertyRegDataType,
844+ reinterpret_cast <BYTE*>(szBuffer),
845+ sizeof (szBuffer), &dwSize)) {
846+ friendlyName = strdup (szBuffer);
847+ }
839848 if (SetupDiGetDeviceRegistryProperty (hDevInfo, &deviceInfoData,
840849 SPDRP_MFG, &dwPropertyRegDataType,
841850 reinterpret_cast <BYTE*>(szBuffer),
@@ -867,6 +876,9 @@ void ListBaton::Execute() {
867876 if (locationId) {
868877 resultItem->locationId = locationId;
869878 }
879+ if (friendlyName) {
880+ resultItem->friendlyName = friendlyName;
881+ }
870882 results.push_back (resultItem);
871883 }
872884 free (pnpId);
0 commit comments