Share via


VirtualAllocEx (Windows Embedded CE 6.0)

1/6/2010

This function reserves or commits a region of pages in the virtual address space of the process specified by the hProcess parameter. Memory allocated by VirtualAllocEx is initialized to zero.

Syntax

LPVOID VirtualAllocEx(
  HANDLE hProcess,
  LPVOID lpAddress,
  DWORD dwSize,
  DWORD flAllocationType,
  DWORD flProtect
);

Parameters

  • hProcess
    [in] Process identifier, or a process handle returned from a call to the OpenProcess function.
  • lpAddress
    [in] Long pointer to the specified starting address of the region to be allocated.

    If the memory is being reserved, the specified address is rounded down to the next 64-KB boundary.

    If the memory is reserved and is being committed, the address is rounded down to the next page boundary.

    To determine the size of a page on the host computer, use the GetSystemInfofunction.

    If this parameter is NULL, the system determines where to allocate the region.

  • dwSize
    [in] Specifies the size, in bytes, of the region. It is an error to set this parameter to zero.

    If the lpAddress parameter is NULL, this value is rounded up to the next page boundary.

    Otherwise, the allocated pages include all pages containing one or more bytes in the range from lpAddress to (lpAddress plus dwSize). This means that a 2-byte range straddling a page boundary causes both pages to be included in the allocated region.

  • flAllocationType
    [in] Specifies the type of allocation.

    For information about the accepted values for this parameter, see VirtualAlloc.

  • flProtect
    [in] Specifies the type of access protection.

    If the pages are being committed, you can specify any of the following flags, along with the PAGE_GUARD and PAGE_NOCACHE protection modifier flags.

    For information about the accepted values for this parameter, see VirtualAlloc.

Return Value

The base address of the allocated region of pages indicates success. NULL indicates failure. To get extended error information, call GetLastError.

Remarks

For information about this function, see VirtualAlloc.

Requirements

Header winbase.h
Library coredll.lib
Windows Embedded CE Windows Embedded CE 6.0 and later

See Also

Reference

Memory Management Functions
GetSystemInfo
VirtualFreeEx
VirtualAlloc
VirtualCopyEx
VirtualAllocCopyEx
OpenProcess

Other Resources

Kernel Migration