Skip to content

Latest commit

 

History

History
121 lines (89 loc) · 4.37 KB

nf-wdfiotarget-wdf_io_target_open_params_init_open_by_file.md

File metadata and controls

121 lines (89 loc) · 4.37 KB
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 function
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
WDF_IO_TARGET_OPEN_PARAMS_INIT_OPEN_BY_FILE
wdfiotarget/WDF_IO_TARGET_OPEN_PARAMS_INIT_OPEN_BY_FILE
APIRef
kbSyntax
HeaderDef
wdfiotarget.h
WDF_IO_TARGET_OPEN_PARAMS_INIT_OPEN_BY_FILE

WDF_IO_TARGET_OPEN_PARAMS_INIT_OPEN_BY_FILE function

-description

[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.

-parameters

-param Params [out]

A pointer to a driver-allocated WDF_IO_TARGET_OPEN_PARAMS structure, which the function initializes.

-param FileName [in, optional]

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.

-remarks

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).

Examples

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
//

-see-also

WDF_IO_TARGET_OPEN_PARAMS

WDF_IO_TARGET_OPEN_TYPE