IWDFRemoteTarget::OpenRemoteInterface method

The OpenRemoteInterface method opens a device interface so that the driver can send I/O requests to it.

Syntax


HRESULT OpenRemoteInterface(
  [in]            IWDFRemoteInterface *pRemoteInterface,
  [in, optional]  PCWSTR pszRelativeFileName,
  [in]            DWORD DesiredAccess,
  [in, optional]  PUMDF_IO_TARGET_OPEN_PARAMS pOpenParams
);

Parameters

pRemoteInterface [in]

A pointer to a remote interface object that the driver obtained from a previous call to IWDFDevice2::CreateRemoteInterface.

pszRelativeFileName [in, optional]

An optional pointer to a caller-supplied, null-terminated string that the framework appends to the symbolic link name of the device interface.

DesiredAccess [in]

A bitmask that specifies the caller's desired access to the file. For more information about this member, see the DesiredAccess parameter of CreateFile in the Windows SDK.

pOpenParams [in, optional]

A pointer to a caller-allocated UMDF_IO_TARGET_OPEN_PARAMS structure that contains additional parameters. This parameter is optional and can be NULL.

Return value

OpenRemoteInterface returns S_OK if the operation succeeds. Otherwise, the method might return the following value:

Return codeDescription
E_OUTOFMEMORY

The framework's attempt to allocate memory failed.

 

This method might return one of the other values that Winerror.h contains.

The framework's verifier reports an error if the framework cannot open the file.

Remarks

After a driver's IPnpCallbackRemoteInterfaceNotification::OnRemoteInterfaceArrival callback function receives notification that a device interface is available, and after the driver calls IWDFDevice2::CreateRemoteInterface to create a remote interface object, the driver can call OpenRemoteInterface so that it can send I/O requests to the device interface.

The device interface must be accessible by the account that loaded the UMDF-based driver, which is typically the Local Service account. However, if the driver uses impersonation when it calls OpenRemoteInterface, the device interface must be accessible by the impersonated account.

For more information about OpenRemoteInterface and how to use device interfaces in UMDF-based drivers, see Using Device Interfaces in UMDF-based Drivers.

Examples

The following code example shows how an IPnpCallbackRemoteInterfaceNotification::OnRemoteInterfaceArrival callback function can create a remote interface and remote target objects for a device interface and then open the interface for I/O operations.


void 
STDMETHODCALLTYPE
CMyDevice::OnRemoteInterfaceArrival(
    __in IWDFRemoteInterfaceInitialize * FxRemoteInterfaceInit
    )
...
    HRESULT hr;
    CComPtr<IWDFRemoteInterface> fxRemoteInterface;
    CComPtr<IWDFRemoteTarget> m_FxTarget;

    hr = m_FxDevice->CreateRemoteInterface(FxRemoteInterfaceInit, 
                                           NULL, 
                                           &fxRemoteInterface);
    if (FAILED(hr)) goto Error;
    hr = FxDevice->CreateRemoteTarget(unknown,
                                      fxRemoteInterface,
                                      &m_FxTarget);
    if (FAILED(hr)) goto Error;
    hr = m_FxTarget->OpenRemoteInterface(fxRemoteInterface, 
                                         NULL,
                                         GENERIC_READ | GENERIC_WRITE,
                                         NULL);
...
Error:
...

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

IWDFRemoteTarget
IWDFRemoteTarget::OpenFileByName

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft. All rights reserved.