Bewerken

Delen via


WdfDeviceInitSetFileObjectConfig function (wdfdevice.h)

[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

[in] DeviceInit

A pointer to a WDFDEVICE_INIT structure.

[in] FileObjectConfig

A pointer to a caller-allocated WDF_FILEOBJECT_CONFIG structure.

[in, optional] FileObjectAttributes

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

Requirement Value
Target Platform Universal
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(kmdf), ControlDeviceInitAPI(kmdf), DeviceInitAPI(kmdf), DriverCreate(kmdf), FileObjectConfigured(kmdf), KmdfIrql(kmdf), KmdfIrql2(kmdf), KmdfIrqlExplicit(kmdf), PdoDeviceInitAPI(kmdf)

See also

WDF_FILEOBJECT_CONFIG_INIT

WDF_OBJECT_ATTRIBUTES_INIT

WdfFdoInitSetEventCallbacks

WdfPdoInitSetEventCallbacks