chrome/browser/system_monitor/portable_device_watcher_win.cc
// Gets the manufacturer name of the device specified by the |pnp_device_id|.
// On success, returns true and fills in |name|.
Gets the manufacturer name of the device specified by the |pnp_device_id|.
On success, returns true and fills in |name|.
Gets the manufacturer name of the device specified by the |pnp_device_id| . On success returns true and fills in |name| .
bool GetManufacturerName(const string16& pnp_device_id,
                         IPortableDeviceManager* device_manager,
                         string16* name) {
  DCHECK(device_manager);
  DCHECK(name);
  DWORD name_len = 0;
  HRESULT hr = device_manager->GetDeviceManufacturer(pnp_device_id.c_str(),
                                                     NULL, &name_len);
  if (FAILED(hr))
    return false;
  hr = device_manager->GetDeviceManufacturer(pnp_device_id.c_str(),
                                             WriteInto(name, name_len),
                                             &name_len);
  return (SUCCEEDED(hr) && !name->empty());
}
bool GetManufacturerName ( const string16 & pnp_device_id , IPortableDeviceManager * device_manager , string16 * name ) { DCHECK ( device_manager ) ; DCHECK ( name ) ; DWORD name_len = 0 ; HRESULT hr = device_manager -> GetDeviceManufacturer ( pnp_device_id . c_str ( ) , NULL , & name_len ) ; if ( FAILED ( hr ) ) return false ; hr = device_manager -> GetDeviceManufacturer ( pnp_device_id . c_str ( ) , WriteInto ( name , name_len ) , & name_len ) ; return ( SUCCEEDED ( hr ) && ! name -> empty ( ) ) ; }
Gets the manufacturer name of the device specified by the |pnp_device_id|.
Gets the manufacturer name of the device specified by the |pnp_device_id| .