// 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
No description available.
[Applies to KMDF and UMDF]
The WdfDeviceInitSetFileObjectConfig method registers event callback functions and sets configuration information for the driver's framework file objects.
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.
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
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
);