WdfRequestGetFileObject - NtDoc

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

WDFFILEOBJECT WdfRequestGetFileObject(
  [in] WDFREQUEST Request
);

View the official Windows Driver Kit DDI reference

NtDoc

No description available.

Windows Driver Kit DDI reference (nf-wdfrequest-wdfrequestgetfileobject)

WdfRequestGetFileObject function

Description

[Applies to KMDF and UMDF]

The WdfRequestGetFileObject method retrieves the framework file object that is associated with a specified I/O request.

Parameters

Request [in]

A handle to a framework request object.

Return value

WdfRequestGetFileObject returns a handle to the framework file object, if the framework has created a file object for the specified request. Otherwise, this method returns NULL. (A driver typically tests for a NULL return value only if it sets the WdfFileObjectCanBeOptional bit flag in the WDF_FILEOBJECT_CONFIG structure.)

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

Remarks

The WdfRequestGetFileObject method returns NULL if either:

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

Examples

The following code example obtains an I/O request's file object and then calls a driver-defined routine that obtains a pointer to the file object's context space.

VOID
MyEvtIoWrite(
    IN WDFQUEUE  Queue,
    IN WDFREQUEST  Request,
    IN size_t  Length
    )
{
    WDFFILEOBJECT  fileObject;
    PFILE_OPEN_CONTEXT  pOpenContext;

    fileObject = WdfRequestGetFileObject(Request);
    pOpenContext = GetFileObjectContext(fileObject)->OpenContext;
}

See also

WDF_FILEOBJECT_CLASS

WdfDeviceInitSetFileObjectConfig