WdfFileObjectWdmGetFileObject function (wdffileobject.h)

[Applies to KMDF only]

The WdfFileObjectWdmGetFileObject method returns the Windows Driver Model (WDM) file object that is associated with a specified framework file object.

Syntax

PFILE_OBJECT WdfFileObjectWdmGetFileObject(
  [in] WDFFILEOBJECT FileObject
);

Parameters

[in] FileObject

A handle to a framework file object.

Return value

WdfFileObjectWdmGetFileObject returns a pointer to the FILE_OBJECT structure that is associated with the specified framework file object, or NULL if there is no WDM file object for the specified framework file object.

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

Remarks

The pointer that the WdfFileObjectWdmGetFileObject method returns is valid until the framework file object is deleted. If the driver provides an EvtCleanupCallback function for the framework file object, the pointer is valid until the callback function returns.

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

Examples

The following code example obtains a handle to the WDM file object that is associated with a specified framework file object.

PFILE_OBJECT  pReturnedFileObject;

pReturnedFileObject = WdfFileObjectWdmGetFileObject(fileObject);

Requirements

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

See also

FILE_OBJECT