UID | title | description | old-location | tech.root | ms.date | keywords | ms.keywords | req.header | req.include-header | req.target-type | req.target-min-winverclnt | req.target-min-winversvr | req.kmdf-ver | req.umdf-ver | req.ddi-compliance | req.unicode-ansi | req.idl | req.max-support | req.namespace | req.assembly | req.type-library | req.lib | req.dll | req.irql | targetos | req.typenames | f1_keywords | topic_type | api_type | api_location | api_name | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
NF:wdfiotarget.WDF_IO_TARGET_OPEN_PARAMS_INIT_OPEN_BY_FILE |
WDF_IO_TARGET_OPEN_PARAMS_INIT_OPEN_BY_FILE function (wdfiotarget.h) |
The WDF_IO_TARGET_OPEN_PARAMS_INIT_OPEN_BY_FILE function initializes a driver's WDF_IO_TARGET_OPEN_PARAMS structure so the driver can open an I/O target by specifying a filename. |
wdf\wdf_io_target_open_params_init_open_by_file.htm |
wdf |
02/26/2018 |
|
WDF_IO_TARGET_OPEN_PARAMS_INIT_OPEN_BY_FILE, WDF_IO_TARGET_OPEN_PARAMS_INIT_OPEN_BY_FILE function, wdf.wdf_io_target_open_params_init_open_by_file, wdfiotarget/WDF_IO_TARGET_OPEN_PARAMS_INIT_OPEN_BY_FILE |
wdfiotarget.h |
Wdf.h |
Universal |
Windows 8.1 |
2.0 |
Any level |
Windows |
|
|
|
|
|
[Applies to UMDF only]
The WDF_IO_TARGET_OPEN_PARAMS_INIT_OPEN_BY_FILE function initializes a driver's WDF_IO_TARGET_OPEN_PARAMS structure so the driver can open an I/O target by specifying a filename.
A pointer to a driver-allocated WDF_IO_TARGET_OPEN_PARAMS structure, which the function initializes.
A value for the FileName member of the WDF_IO_TARGET_OPEN_PARAMS structure. Most drivers specify NULL here unless the lower target supports Device Namespace Access.
The WDF_IO_TARGET_OPEN_PARAMS_INIT_OPEN_BY_FILE function zeros the specified WDF_IO_TARGET_OPEN_PARAMS structure and sets its Size member. It also sets the structure's Type member to WdfIoTargetOpenLocalTargetByFile and sets the FileName member if the driver supplies a filename.
A driver can explicitly close the I/O target by calling WdfIoTargetClose. If the driver does not explicitly close the target, the framework closes the target automatically when the device is removed (an I/O target is by default parented to the device).
The following code example shows how a UMDF driver can open a local target with a file object as described in WDF_IO_TARGET_OPEN_TYPE:
WDF_OBJECT_ATTRIBUTES ioTargetAttrib;
WDFIOTARGET ioTarget;
WDF_IO_TARGET_OPEN_PARAMS openParams;
//
// Create target
//
WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&ioTargetAttrib, TARGET_DEVICE_INFO);
status = WdfIoTargetCreate(device, &ioTargetAttrib, &ioTarget);
if (!NT_SUCCESS(status)) {
return status;
}
//
// Open target
//
WDF_IO_TARGET_OPEN_PARAMS_INIT_OPEN_BY_FILE(&openParams, NULL);
status = WdfIoTargetOpen(ioTarget, &openParams);
if (!NT_SUCCESS(status)) {
WdfObjectDelete(ioTarget);
return status;
}
//
// create a request
//
//
// Format the request for the above target
//
//
// Send request to above target
//