IWDFIoRequest2::GetQueryInformationParameters method

The GetQueryInformationParameters method retrieves parameters that are associated with a WdfRequestQueryInformation-typed I/O request.

Syntax


void GetQueryInformationParameters(
  [out, optional]  WDF_FILE_INFORMATION_CLASS *pInformationClass,
  [out, optional]  SIZE_T *pSizeInBytes
);

Parameters

pInformationClass [out, optional]

A pointer to a driver-allocated variable that receives a WDF_FILE_INFORMATION_CLASS-typed value. This pointer is optional and can be NULL.

pSizeInBytes [out, optional]

A pointer to a driver-allocated variable that receives the size, in bytes, of the file information. This pointer is optional and can be NULL.

Return value

None.

Remarks

Your driver can call GetQueryInformationParameters to obtain the parameters that are associated with an I/O request, if the request type is WdfRequestQueryInformation. The pInformationClass parameter identifies the type of file information that the driver should provide, and the pSizeInBytes parameter specifies the size of the buffer that will receive the information. The driver can call IWDFIoRequest2::RetrieveOutputBuffer to obtain the buffer address.

Your driver must verify that the specified buffer size is large enough to receive the requested file information.

Examples

The following code example is part of an IQueueCallbackDefaultIoHandler::OnDefaultIoHandler callback function. If the callback function receives a query information request, it retrieves the request's parameters. If the driver supports the specified type of information, it copies the information into the request's output buffer.


void
CMyQueue::OnDefaultIoHandler(
    IWDFIoQueue*  pQueue,
    IWDFIoRequest*  pRequest
    )
{
    HRESULT hr;
    WDF_FILE_INFORMATION_CLASS infoClass;
    SIZE_T bufSize;
    PFILE_BASIC_INFORMATION buffer;

 if (WdfRequestQueryInformation==pRequest->GetType())
    {
        //
        // Declare an IWDFIoRequest2 interface pointer and obtain the
        // IWDFIoRequest2 interface from the IWDFIoRequest interface.
        //
        CComQIPtr<IWDFIoRequest2> r2 = pRequest;
        // 
        // Get the I/O request's parameters.
        // 
        r2->GetQueryInformationParameters(&infoClass,
                                          &bufSize);
        // 
        // This driver supports only FileBasicInformation.
        // 
        if (infoClass != FileBasicInformation)
        {
            hr = HRESULT_FROM_NT(STATUS_NOT_SUPPORTED);
            goto exit;
        }
        // 
        // Validate buffer size.
        // 
        if (bufferCb != sizeof(FILE_BASIC_INFORMATION))
        {
            hr = HRESULT_FROM_NT(STATUS_BUFFER_TOO_SMALL);
            goto exit;
        }
        // 
        // Get output buffer.
        // 
        hr = r2->RetrieveOutputBuffer(sizeof(FILE_BASIC_INFORMATION), 
                                      (PVOID*) &buffer,
                                      &bufferCb);
        if (SUCCEEDED(hr))
        {
            // 
            // Copy file information to output buffer.
            // 
            CopyMemory(buffer,
                       &g_FileInfo,
                       sizeof(FILE_BASIC_INFORMATION));
            r2->SetInformation(sizeof(FILE_BASIC_INFORMATION));
        }
 ...
    }
...
exit:
...
}

Requirements

End of support

Unavailable in UMDF 2.0 and later.

Minimum UMDF version

1.9

Header

Wudfddi.h (include Wudfddi.h)

DLL

WUDFx.dll

See also

IWDFIoRequest2
IWDFIoRequest2::GetSetInformationParameters

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft