Skip to content

Latest commit

 

History

History
147 lines (120 loc) · 6.08 KB

nf-wudfddi-iwdfiorequest2-getqueryinformationparameters.md

File metadata and controls

147 lines (120 loc) · 6.08 KB
UID title description old-location tech.root ms.date keywords ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames f1_keywords topic_type api_type api_location api_name
NF:wudfddi.IWDFIoRequest2.GetQueryInformationParameters
IWDFIoRequest2::GetQueryInformationParameters (wudfddi.h)
The GetQueryInformationParameters method retrieves parameters that are associated with a WdfRequestQueryInformation-typed I/O request.
wdf\iwdfiorequest2_getqueryinformationparameters.htm
wdf
02/26/2018
IWDFIoRequest2::GetQueryInformationParameters
GetQueryInformationParameters, GetQueryInformationParameters method, GetQueryInformationParameters method,IWDFIoRequest2 interface, IWDFIoRequest2 interface,GetQueryInformationParameters method, IWDFIoRequest2.GetQueryInformationParameters, IWDFIoRequest2::GetQueryInformationParameters, UMDFRequestObjectRef_595d2b4c-1286-4243-b440-0efaae03980d.xml, umdf.iwdfiorequest2_getqueryinformationparameters, wdf.iwdfiorequest2_getqueryinformationparameters, wudfddi/IWDFIoRequest2::GetQueryInformationParameters
wudfddi.h
Wudfddi.h
Desktop
1.9
Unavailable in UMDF 2.0 and later.
WUDFx.dll
Windows
IWDFIoRequest2::GetQueryInformationParameters
wudfddi/IWDFIoRequest2::GetQueryInformationParameters
APIRef
kbSyntax
COM
WUDFx.dll
IWDFIoRequest2::GetQueryInformationParameters

IWDFIoRequest2::GetQueryInformationParameters

-description

[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.

-parameters

-param 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.

-param 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.

-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:
...
}

-see-also

IWDFIoRequest2

IWDFIoRequest2::GetSetInformationParameters