IPNPXDeviceAssociation::Associate method (pnpxassoc.h)

[Function Discovery is available for use in the operating systems specified in the Requirements section. It may be altered or unavailable in subsequent versions.]

Marks an association database entry as associated and sends an appropriate notification. If there is no association database entry for the function instance, one is created; otherwise the existing entry is updated. Any notification sent reflects the online presence of the device, as reported by the Plug and Play (PnP) component.

Syntax

HRESULT Associate(
  [in, optional] const WCHAR                    *pszSubCategory,
  [in]           IFunctionDiscoveryNotification *pIFunctionDiscoveryNotification
);

Parameters

[in, optional] pszSubCategory

The subcategory of the association database in which the entry is stored. This parameter can be NULL.

[in] pIFunctionDiscoveryNotification

An IFunctionDiscoveryNotification object that is registered for notifications with Function Discovery.

Return value

This method can return one of these values.

Return code Description
S_OK
The method succeeded.
E_FAIL
The method failed.

Remarks

This method modifies the association database entry corresponding to the function instance from which the IPNPXDeviceAssociation interface was obtained.

Once a device is associated, the PnP-X Service IP Bus Enumerator (IPBusEnum) sends a request to the PnP component to create the device devnode. Once the devnode has been created, the appropriate notification is sent. The following logic is used to determine the callback method used for notification:

  • If a PnP notification is received after the device is associated, then the IFunctionDiscoveryNotification::OnUpdate method is called with the enumQueryUpdateAction parameter set to QUA_ADD.
  • If no PnP notification is received after the device is associated, and there are no pending PnP events, then the IFunctionDiscoveryNotification::OnError method is called.
  • Finally, if no PnP notification is received after the device is associated, and there are pending PnP events, then no callback method is called.
The Found New Hardware wizard appears if user intervention is required to install a device driver after association.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header pnpxassoc.h

See also

IPNPXAssociation::Associate

IPNPXDeviceAssociation