次の方法で共有


VirtualFreeEx (Compact 2013)

3/28/2014

This function releases or decommits, or both, a region of pages within the virtual address space of the specified process.

Syntax

BOOL VirtualFreeEx(
  HANDLE hProcess,
  LPVOID lpAddress,
  DWORD dwSize,
  DWORD dwFreeType
);

Parameters

  • hProcess
    [in] Process identifier, or a process handle returned from a call to the OpenProcess function.
  • lpAddress
    [in] Pointer to the base address of the region of pages to be freed.

    If the dwFreeType parameter includes the MEM_RELEASE flag, this parameter must be the base address returned by the VirtualAllocEx function when the region of pages was reserved.

  • dwSize
    [in] Specifies the size, in bytes, of the region to be freed.

    If the dwFreeType parameter includes the MEM_RELEASE flag, this parameter must be zero.

    Otherwise, the region of affected pages includes all pages containing one or more bytes in the range from the lpAddress parameter to (lpAddress + dwSize). This means that a 2-byte range straddling a page boundary causes both pages to be freed.

  • dwFreeType
    [in] Specifies the type of free operation.

    You can specify one of the following flags.

    Value

    Description

    MEM_DECOMMIT

    Decommits the specified region of committed pages.

    An attempt to decommit an uncommitted page does not cause the function to fail. This means that a range of committed or uncommitted pages can be decommitted without being concerned about a failure.

    MEM_RELEASE

    Releases the specified region of reserved pages.

    If this flag is specified, the dwSize parameter must be zero or the function fails.

Return Value

Nonzero indicates success. Zero indicates failure. To get extended error information, call GetLastError.

Remarks

For more information, see VirtualFree.

Requirements

Header

winbase.h

Library

coredll.lib

See Also

Reference

Memory Management Functions
VirtualCopyEx
VirtualAllocEx
VirtualAllocCopyEx
OpenProcess