Bewerken

Delen via


IWDFIoRequest2::GetQueryInformationParameters method (wudfddi.h)

[Warning: UMDF 2 is the latest version of UMDF and supersedes UMDF 1. All new UMDF drivers should be written using UMDF 2. No new features are being added to UMDF 1 and there is limited support for UMDF 1 on newer versions of Windows 10. Universal Windows drivers must use UMDF 2. For more info, see Getting Started with UMDF.]

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

[out, optional] pInformationClass

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

[out, optional] pSizeInBytes

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

Requirement Value
End of support Unavailable in UMDF 2.0 and later.
Target Platform Desktop
Minimum UMDF version 1.9
Header wudfddi.h (include Wudfddi.h)
DLL WUDFx.dll

See also

IWDFIoRequest2

IWDFIoRequest2::GetSetInformationParameters