Share via


CeVirtualSharedAlloc (Windows CE 5.0)

Send Feedback

This function is used to allocate read/write memory to the caller and to allocate read-only memory to other processes.

LPVOIDCeVirtualSharedAlloc( LPVOID lpvAddr,DWORD cbSize,DWORD fdwAction);

Parameters

  • lpvAddr
    [in] Starting address of the shared memory to be committed, or NULL if reserving shared memory.

  • cbSize
    [in] Size, in bytes, of the memory reservation or allocation.

  • fdwAction
    [in] Value that specifies the action.

    This value must be a combination of MEM_RESERVE and MEM_COMMIT.

    Value Description
    MEM_RESERVE Reserves a region in the shared read-only area. lpvAddr must be NULL.
    MEM_COMMIT Commits the memory specified by lpvAddr and cbSize, where lpvAddr must be an address previously reserved by CeVirtualSharedAlloc.

    This value can also be NULL, which reserves and commits a region of size cbSize. This behaves like MEM_RESERVE|MEM_COMMIT.

Return Values

A pointer to the memory region that was reserved or committed is returned to indicate success. NULL indicates failure.

To get extended error information, call GetLastError.

If the caller is not fully trusted, the call fails with the error code ERROR_ACCESS_DENIED.

Remarks

You can free the memory region that was reserved or committed by CeVirtualSharedAlloc using the VirtualFree function.

Freeing the memory allocated by CeVirtualSharedAlloc is similar to freeing memory allocated by the VirtualAlloc function.

Requirements

OS Versions: Windows CE 5.0 and later.
Header: Pkfuncs.h.
Link Library: Coredll.lib.

See Also

HeapCreate | VirtualAlloc | VirtualFree

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.