WDF_MEMORY_DESCRIPTOR_INIT_HANDLE function (wdfmemory.h)
[Applies to KMDF and UMDF]
The WDF_MEMORY_DESCRIPTOR_INIT_HANDLE function initializes a WDF_MEMORY_DESCRIPTOR structure so that it describes a specified framework memory object.
Syntax
void WDF_MEMORY_DESCRIPTOR_INIT_HANDLE(
[out] PWDF_MEMORY_DESCRIPTOR Descriptor,
[in] WDFMEMORY Memory,
[in, optional] PWDFMEMORY_OFFSET Offsets
);
Parameters
[out] Descriptor
A pointer to a WDF_MEMORY_DESCRIPTOR structure.
[in] Memory
A handle to a framework memory object.
[in, optional] Offsets
A pointer to a WDFMEMORY_OFFSET structure. This parameter is optional and can be NULL.
Return value
None
Remarks
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.
Examples
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
);
Requirements
Requirement | Value |
---|---|
Target Platform | Universal |
Minimum KMDF version | 1.0 |
Minimum UMDF version | 2.0 |
Header | wdfmemory.h (include Wdf.h) |
DDI compliance rules | MemAfterReqCompletedIntIoctlA(kmdf), MemAfterReqCompletedIoctlA(kmdf), MemAfterReqCompletedReadA(kmdf), MemAfterReqCompletedWriteA(kmdf) |