IWDFDevice2::RegisterRemoteInterfaceNotification method

The RegisterRemoteInterfaceNotification method registers a driver to receive a notification when a specified device interface becomes available.

Syntax


HRESULT RegisterRemoteInterfaceNotification(
  [in]  LPCGUID pDeviceInterfaceGuid,
  [in]  BOOL IncludeExistingInterfaces
);

Parameters

pDeviceInterfaceGuid [in]

A pointer to a GUID that identifies a device interface.

IncludeExistingInterfaces [in]

A Boolean value. If the driver sets this value to TRUE, the framework notifies the driver if the specified device interface becomes available after the driver calls RegisterRemoteInterfaceNotification, and it also notifies the driver if the device interface was available before the driver called RegisterRemoteInterfaceNotification.

If the driver sets this value to FALSE, the framework notifies the driver only if the device interface becomes available after the driver calls RegisterRemoteInterfaceNotification.

Return value

RegisterRemoteInterfaceNotification returns S_OK of the operation succeeds. Otherwise, this method returns another value that Winerror.h contains.

Remarks

Your driver can call RegisterRemoteInterfaceNotification only if the callback interface that the driver previously passed to IWDFDriver::CreateDevice supports the IPnpCallbackRemoteInterfaceNotification interface.

For more information, see Using Device Interfaces in UMDF-based Drivers.

Examples

The following code example shows how an IDriverEntry::OnDeviceAdd callback function can register for notification of the arrival of a device interface.


HRESULT
CMyDriver::OnDeviceAdd(
    __in IWDFDriver  *FxDriver,
    __in IWDFDeviceInitialize  *FxDeviceInit
    )
{
    CComPtr<IWDFDevice> fxDevice;
    HRESULT hr;

    //
    // Create a device object and obtain the IWDFDevice interface.
    //
    hr = FxDriver->CreateDevice(FxDeviceInit,
                                MyDeviceIUnknown,
                                &fxDevice);
    if (FAILED(hr)) goto Error;

    //
    // Obtain the IWDFDevice2 interface from IWDFDevice.
    //
    CComPtr<IWDFDevice2> fxDevice2;
    if (FAILED(hr)) goto Error;
    hr = fxDevice->QueryInterface(IID_PPV_ARGS(&fxDevice2));
    if (S_OK != hr) goto Error;
    //
    // Register for notification when a device interface
    // arrives.
    //
    hr = fxDevice2->RegisterRemoteInterfaceNotification(&GUID_DEVINTERFACE_TOASTER,
                                                        true);
...
}

Requirements

End of support

Unavailable in UMDF 2.0 and later.

Minimum UMDF version

1.9

Header

Wudfddi.h (include Wudfddi.h)

DLL

WUDFx.dll

See also

IWDFDevice2
IPnpCallbackRemoteInterfaceNotification::OnRemoteInterfaceArrival

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft. All rights reserved.