次の方法で共有


CeVirtualSharedAlloc (Compact 2013)

3/28/2014

This function allocates read/write memory to the caller and read-only memory to other processes. This function is callable only in kernel mode.

Syntax

LPVOID CeVirtualSharedAlloc(
  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_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.

    MEM_RESERVE

    Reserves a region in the shared read-only area. lpvAddr must be NULL.

Return Value

A pointer to the memory region that was reserved or committed indicates 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

Header

pkfuncs.h

Library

coredll.lib

See Also

Reference

Kernel Functions
HeapCreate
VirtualAlloc
VirtualFree