Initializing a General I/O Target in UMDF
[This topic applies to UMDF 1.x.]
The steps that your driver uses to initialize a general I/O target depend on whether the I/O target is local or remote.
Local I/O targets include a device's default I/O target and file-handle-based I/O targets.
The framework initializes a driver's default I/O target for a device when the driver calls the IWDFDriver::CreateDevice method. To retrieve the IWDFIoTarget interface that enables the driver to access the device's default I/O target, the driver calls the IWDFDevice::GetDefaultIoTarget method.
Most drivers send requests only to their default I/O target.
If a UMDF driver must send I/O requests to a handle-based interface, such as a network socket interface, the driver must create a file-handle-based I/O target object. To create a file-handle-based I/O target object, the driver must do the following:
Obtain a Win32 handle to a file, named pipe, or socket by calling the Win32 CreateFile, CreateNamedPipe, or socket function.
Call the IWDFFileHandleTargetFactory::CreateFileHandleTarget method to create a file-handle-based I/O target object for the file, pipe, or socket.
For a code example that shows how to retrieve the IWDFFileHandleTargetFactory interface, obtain a Win32 handle, and create a file-handle-based I/O target object, see the code example at IWDFFileHandleTargetFactory::CreateFileHandleTarget.
After the driver creates the file-handle-based I/O target, the driver can send I/O requests to the I/O target.
Before your driver can use a remote I/O target, it must create a remote target object and open the target, as follows:
Call IWDFDevice2::CreateRemoteTarget to create a remote target object.