WdfFileObjectGetDevice function (wdffileobject.h)

[Applies to KMDF and UMDF]

The WdfFileObjectGetDevice method returns the framework device object that is associated with a specified framework file object.

Syntax

WDFDEVICE WdfFileObjectGetDevice(
  [in] WDFFILEOBJECT FileObject
);

Parameters

[in] FileObject

A handle to a framework file object.

Return value

WdfFileObjectGetDevice returns a handle to the framework device object that is associated with the specified framework file object.

A bug check occurs if the driver supplies an invalid object handle.

Remarks

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

Examples

The following code example shows how an EvtFileClose callback function can obtain the framework device object that is associated with a specified framework file object.

VOID
MyEvtFileClose(
    IN WDFFILEOBJECT  FileObject
    )
{
    WDFDEVICE device;

    device = WdfFileObjectGetDevice(FileObject);
...
}

Requirements

Requirement Value
Target Platform Universal
Minimum KMDF version 1.0
Minimum UMDF version 2.0
Header wdffileobject.h (include Wdf.h)
Library Wdf01000.sys (KMDF); WUDFx02000.dll (UMDF)
IRQL <=DISPATCH_LEVEL
DDI compliance rules DriverCreate(kmdf), KmdfIrql(kmdf), KmdfIrql2(kmdf), KmdfIrqlExplicit(kmdf)