WdfDeviceInitSetFileObjectConfig - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
// wdfdevice.h

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

View the official Windows Driver Kit DDI reference

NtDoc

No description available.

Windows Driver Kit DDI reference (nf-wdfdevice-wdfdeviceinitsetfileobjectconfig)

WdfDeviceInitSetFileObjectConfig function

Description

[Applies to KMDF and UMDF]

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

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.

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

See also

WDF_FILEOBJECT_CONFIG_INIT

WDF_OBJECT_ATTRIBUTES_INIT

WdfFdoInitSetEventCallbacks

WdfPdoInitSetEventCallbacks