Partager via


DuplicatedBuffer_t (Windows Embedded CE 6.0)

1/6/2010

This class is a wrapper for the CeAllocDuplicateBuffer and the CeFreeDuplicateBuffer functions. It should only be called with API parameters that have already been access-checked and automatically marshaled, if necessary, by the kernel. All other duplication can be done by the MarshalledBuffer_t function.

Methods

Method
DuplicatedBuffer_t();
DuplicatedBuffer_t(
    PVOID  pSrcMarshalled,
    DWORD cbSrc,
    DWORD ArgumentDescriptor
);
DuplicatedBuffer_t(
    PCVOID pSrcMarshalled,
    DWORD cbSrc,
    DWORD ArgumentDescriptor
);
~DuplicatedBuffer_t();
HRESULT Free();
HRESULT Allocate(
    PVOID pSrcMarshalled,
    DWORD cbSrc,
    DWORD ArgumentDescriptor
);
HRESULT Allocate(
    PCVOID pSrcMarshalled,
    DWORD cbSrc,
    DWORD ArgumentDescriptor
);
LPVOID ptr() const;
DWORD size() const;

Remarks

You can either call the constructor to do the duplication, or use the default constructor, and then duplicate using the Allocate method. If an HRESULT is required, use Allocate. Similarly, you can allow the destructor to release the duplicate memory, or use the Free method. If an HRESULT is required, use Free. If Allocate fails, ptr returns NULL, and size returns zero. Otherwise, the duplicated buffer is accessible with ptr and size. Once a DuplicatedBuffer is allocated using the constructor or the Allocate method, it cannot be re-used by calling Allocate until after Free is called. An attempt to do so returns ERROR_ALREADY_EXISTS. If the buffer is not currently allocated, Free fails and returns ERROR_ALREADY_EXISTS. For more information about the operation of the Allocate and Free methods, see CeAllocDuplicateBuffer and CeFreeDuplicateBuffer.

Requirements

Header marshal.hpp
Library coredll.lib
Windows Embedded CE Windows Embedded CE 6.0 and later

See Also

Reference

Kernel Buffer Marshaling Classes
CeAllocDuplicateBuffer
CeFreeDuplicateBuffer
MarshalledBuffer_t

Other Resources

Developing a Device Driver
Kernel Migration
Bringing Up a Hardware Platform