信息
您所需的主题如下所示。但此主题未包含在此库中。

WDF_MEMORY_DESCRIPTOR_INIT_HANDLE 函数

The WDF_MEMORY_DESCRIPTOR_INIT_HANDLE function initializes a WDF_MEMORY_DESCRIPTOR structure so that it describes a specified framework memory object.

语法

VOID WDF_MEMORY_DESCRIPTOR_INIT_HANDLE(
  __out     PWDF_MEMORY_DESCRIPTOR Descriptor,
  __in      WDFMEMORY Memory,
  __in_opt  PWDFMEMORY_OFFSET Offsets
);

参数

Descriptor [out]

A pointer to a WDF_MEMORY_DESCRIPTOR structure.

Memory [in]

A handle to a framework memory object.

Offsets [in, optional]

A pointer to a WDFMEMORY_OFFSET structure. This parameter is optional and can be NULL.

返回值

None

评论

The WDF_MEMORY_DESCRIPTOR_INIT_HANDLE function zeros the specified WDF_MEMORY_DESCRIPTOR structure and sets the structure's Type member to WdfMemoryDescriptorTypeHandle. Then it sets the structure's u.HandleType.Memory and u.HandleType.Offsets members to the values that the Memory and Offsets parameters specify, respectively.

示例

The following code example obtains a handle to a framework memory object that represents an I/O request's input buffer. The example uses the memory object handle to initialize a WDF_MEMORY_DESCRIPTOR structure. Then, the example initializes a WDF_USB_CONTROL_SETUP_PACKET structure and sends a USB control transfer request to an I/O target.

WDFMEMORY  memory;
WDF_MEMORY_DESCRIPTOR  memDesc;
WDF_USB_CONTROL_SETUP_PACKET  controlSetupPacket;
NTSTATUS  status;

status = WdfRequestRetrieveInputMemory(
                                       Request,
                                       &memory
                                       );
if (!NT_SUCCESS(status)) {
    break;
}
WDF_MEMORY_DESCRIPTOR_INIT_HANDLE(
                                  &memDesc,
                                  memory,
                                  NULL
                                  );

WDF_USB_CONTROL_SETUP_PACKET_INIT_VENDOR(
                                         &controlSetupPacket,
                                         BmRequestHostToDevice,
                                         BmRequestToDevice,
                                         USBFX2LK_SET_BARGRAPH_DISPLAY,
                                         0,
                                         0
                                         );

status = WdfUsbTargetDeviceSendControlTransferSynchronously(
                                  pDevContext->UsbDevice,
                                  NULL,
                                  NULL,
                                  &controlSetupPacket,
                                  &memDesc,
                                  (PULONG)&bytesTransferred
                                  );

要求

版本

Available in version 1.0 and later versions of KMDF.

标头

Wdfmemory.h (包括Wdf.h)

另请参见

WDF_MEMORY_DESCRIPTOR
WDF_MEMORY_DESCRIPTOR_INIT_BUFFER
WDF_MEMORY_DESCRIPTOR_INIT_MDL
WDFMEMORY_OFFSET

 

 

社区附加资源

显示:
© 2014 Microsoft