IWDFMemory::CopyFromMemory method

[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 CopyFromMemory method safely copies data from the specified source buffer and prevents overruns that the copy operation might otherwise cause.


HRESULT CopyFromMemory(
  [in]           IWDFMemory        *pSource,
  [in, optional] PWDFMEMORY_OFFSET pSourceOffset


pSource [in]

A pointer to the IWDFMemory interface for the memory object that is the source of the copy operation.

pSourceOffset [in, optional]

A pointer to a WDFMEMORY_OFFSET structure that describes the information that is copied from a memory block. This parameter is optional. The driver can pass NULL if the entire source buffer is copied.

The BufferOffset member of the WDFMEMORY_OFFSET structure, if not NULL, indicates the offset into the source buffer to start the copy operation from.

The BufferLength member should be set to 0; the framework ignores this member because the amount of data that is copied depends on the length and offset combination of the current destination buffer.

Return value

CopyFromMemory returns S_OK if the operation succeeds. Otherwise, this method returns one of the error codes that are defined in Winerror.h.


Target platform


End of support

Unavailable in UMDF 2.0 and later.

Minimum UMDF version



Wudfddi.h (include Wudfddi.h)



See also




Send comments about this topic to Microsoft