Expand Minimize

WdfDeviceInitSetFileObjectConfig method

[Applies to KMDF and UMDF]

The WdfDeviceInitSetFileObjectConfig method registers event callback functions and sets configuration information for the driver's framework file objects.

Syntax


VOID WdfDeviceInitSetFileObjectConfig(
  [in]            PWDFDEVICE_INIT DeviceInit,
  [in]            PWDF_FILEOBJECT_CONFIG FileObjectConfig,
  [in, optional]  PWDF_OBJECT_ATTRIBUTES FileObjectAttributes
);

Parameters

DeviceInit [in]

A pointer to a WDFDEVICE_INIT structure.

FileObjectConfig [in]

A pointer to a caller-allocated WDF_FILEOBJECT_CONFIG structure.

FileObjectAttributes [in, optional]

A pointer to a caller-allocated WDF_OBJECT_ATTRIBUTES structure that contains driver-supplied object attributes for the driver's framework file objects. This parameter is optional and can be WDF_NO_OBJECT_ATTRIBUTES.

Return value

None

Remarks

If a driver calls WdfDeviceInitSetFileObjectConfig, it must do so before it calls WdfDeviceCreate.

By default, each framework file object inherits its synchronization scope and execution level from its parent device object. If the parent device object's synchronization scope and execution level are not WdfSynchronizationScopeNone and WdfExecutionLevelPassive, the driver must set the WdfSynchronizationScopeNone and WdfExecutionLevelPassive values in the WDF_OBJECT_ATTRIBUTES structure that the FileObjectAttributes parameter specifies. Otherwise, WdfDeviceCreate will return an error status code. For more information about synchronization scope and execution level, see Using Automatic Synchronization.

For more information about calling WdfDeviceCreate, see Creating a Framework Device Object.

For more information about framework file objects, see Framework File Objects

Examples

The following code example initializes a WDF_OBJECT_ATTRIBUTES structure and a WDF_FILEOBJECT_CONFIG structure and then calls WdfDeviceInitSetFileObjectConfig.


WDF_OBJECT_ATTRIBUTES  attributes;

WDF_OBJECT_ATTRIBUTES_INIT(&attributes);
attributes.SynchronizationScope = WdfSynchronizationScopeNone;
WDF_FILEOBJECT_CONFIG_INIT(
                           &deviceConfig,
                           MyEvtDeviceFileCreate,
                           MyEvtFileClose,
                           WDF_NO_EVENT_CALLBACK // No cleanup callback function
                           );
WdfDeviceInitSetFileObjectConfig(
                                 DeviceInit,
                                 &deviceConfig,
                                 &attributes
                                 );

Requirements

Minimum KMDF version

1.0

Minimum UMDF version

2.0

Header

Wdfdevice.h (include Wdf.h)

Library

Wdf01000.sys (KMDF);
WUDFx02000.dll (UMDF)

IRQL

<= DISPATCH_LEVEL

DDI compliance rules

ChildDeviceInitAPI, ControlDeviceInitAPI, DeviceInitAPI, DriverCreate, FileObjectConfigured, KmdfIrql, KmdfIrql2, PdoDeviceInitAPI

See also

WDF_OBJECT_ATTRIBUTES_INIT
WDF_FILEOBJECT_CONFIG_INIT
WdfFdoInitSetEventCallbacks
WdfPdoInitSetEventCallbacks

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft. All rights reserved.