chrome/browser/system_monitor/portable_device_watcher_win.cc
// Opens the device for communication. |pnp_device_id| specifies the plug and
// play device ID string. On success, returns true and updates |device| with a
// reference to the portable device interface.
Opens the device for communication. |pnp_device_id| specifies the plug and
play device ID string. On success, returns true and updates |device| with a
reference to the portable device interface.
Opens the device for communication . |pnp_device_id| specifies the plug and play device ID string . On success returns true and updates |device| with a reference to the portable device interface .
bool SetUp(const string16& pnp_device_id,
           base::win::ScopedComPtr<IPortableDevice>* device) {
  base::win::ScopedComPtr<IPortableDeviceValues> client_info;
  if (!GetClientInformation(&client_info))
    return false;
  HRESULT hr = device->CreateInstance(__uuidof(PortableDevice), NULL,
                                      CLSCTX_INPROC_SERVER);
  if (FAILED(hr)) {
    DPLOG(ERROR) << "Failed to create an instance of IPortableDevice";
    return false;
  }
  hr = (*device)->Open(pnp_device_id.c_str(), client_info.get());
  if (SUCCEEDED(hr))
    return true;
  if (hr == E_ACCESSDENIED)
    DPLOG(ERROR) << "Access denied to open the device";
  return false;
}
bool SetUp ( const string16 & pnp_device_id , base :: win :: ScopedComPtr < IPortableDevice > * device ) { base :: win :: ScopedComPtr < IPortableDeviceValues > client_info ; if ( ! GetClientInformation ( & client_info ) ) return false ; HRESULT hr = device -> CreateInstance ( __uuidof ( PortableDevice ) , NULL , CLSCTX_INPROC_SERVER ) ; if ( FAILED ( hr ) ) { DPLOG ( ERROR ) << " " ; return false ; } hr = ( * device ) -> Open ( pnp_device_id . c_str ( ) , client_info . get ( ) ) ; if ( SUCCEEDED ( hr ) ) return true ; if ( hr == E_ACCESSDENIED ) DPLOG ( ERROR ) << " " ; return false ; }
Opens the device for communication.
Opens the device for communication .