General memory functions
The following functions are used in memory management.
Function |
Description |
Copymemory |
Copies a block of memory from one location to another. Copy the memory. The first parameter is the destination address, the second parameter is the source address, and the third parameter is the size of the copied data, in bytes. |
Creatememoryresourcenotification |
Creates a memory resource notification object. |
Fillmemory |
Fills a block of memory with a specified value. Fill in the memory, fill a piece of memory into the same value. |
Getlargepageminimum |
Retrieves the minimum size of a large page. |
Getsystemfilecachesize |
Retrieves the current size limits for the working set of the system cache. |
Getwritewatch |
Retrieves the addresses of the pages that have been written to in a region of virtual memory. |
Globalmemorystatus |
Obtains information about the system's current usage of both physical and virtual memory. |
Globalmemorystatusex |
Obtains information about the system's current usage of both physical and virtual memory. |
Movememory |
Moves a block of memory from one location to another. The function class is copymemory, but the source address and destination address can be the same. |
Querymemoryresourcenotification |
Retrieves the state of the specified memory resource object. |
Resetwritewatch |
Resets the write-tracking State for a region of virtual memory. |
Securezeromemory |
Fills a block of memory with zeros. |
Setsystemfilecachesize |
Limits the size of the working set for the file system cache. |
Zeromemory |
Fills a block of memory with zeros. clears the specified memory area. |
Data Execution Prevention functions
The following functions are used with Data Execution Prevention (DEP ).
Function |
Description |
Getprocessdeppolicy |
Retrieves Dep settings for a process. |
Getsystemdeppolicy |
Retrieves Dep settings for the system. |
Setprocessdeppolicy |
Changes Dep settings for a process. |
File mapping functions
The following functions are used in file mapping.
Function |
Description |
Createfilemapping |
Creates or opens a named or unnamed file mapping object for a specified file. |
Createfilemappingnuma |
Creates or opens a named or unnamed file mapping object for a specified file, and specifies the NUMA node for the physical memory. |
Flushviewoffile |
Writes to the disk a byte range within a mapped view of a file. |
Getmappedfilename |
Checks whether the specified address is within a memory-mapped file in the address space of the specified process. If so, the function returns the name of the memory-mapped file. |
Mapviewoffile |
Maps a view of a file mapping into the address space of a calling process. |
Mapviewoffileex |
Maps a view of a file mapping into the address space of a calling process. A caller can optionally specify a suggested memory address for the view. |
Mapviewoffileexnuma |
Maps a view of a file mapping into the address space of a calling process, and specifies the NUMA node for the physical memory. |
Openfilemapping |
Opens a named file mapping object. |
Unmapviewoffile |
Unmaps A mapped view of a file from the calling process's address space. |
Awe Functions
The following are the awe functions.
Function |
Description |
Allocateuserphysicalpages |
Allocates physical memory pages to be mapped and unmapped within any awe region of the process. |
Freeuserphysicalpages |
Frees physical memory pages previously allocatedAllocateuserphysicalpages. |
Mapuserphysicalpages |
Maps previusly allocated physical memory pages at the specified address within an awe region. |
Mapuserphysicalpagesscatter |
Maps previusly allocated physical memory pages at the specified address within an awe region. |
Heap Functions
The following are the heap functions.
Function |
Description |
Getprocessheap |
Obtains a handle to the heap of the calling process. Obtain a heap of the current process and return a heap handle. |
Getprocessheaps |
Obtains handles to all of the heaps that are valid for the calling process. Get all the heap in the process, including the number of heap and the handle of each heap. |
Heapalloc |
Allocates a block of memory from a heap. allocate memory blocks from the specified heap. |
Heapcompact |
Attempts to compact a specified heap. |
Heapcreate |
Creates a heap object. Creates a heap for the process and returns a heap handle. |
Heapdestroy |
Destroys the specified heap object. Destroy the memory allocated by heapalloc and heaprealloc |
Heapfree |
Frees a memory block allocated from a heap. release memory allocated by heapcreate |
Heaplock |
Attempts to acquire the lock associated with a specified heap. Set the memory block allocated by globalalloc and globrealloc as fixed |
Heapqueryinformation |
Retrieves information about the specified heap. |
Heaprealloc |
Reallocates a block of memory from a heap. re-allocate the memory and change the size of the allocated heap memory block. |
Heapsetinformation |
Sets heap information for the specified heap. |
Heapsize |
Retrieves the size of a memory block allocated from a heap. Gets the size of the specified heap and returns the heap size in bytes. |
Heapunlock |
Releases ownership of the lock associated with a specified heap. |
Heapvalidate |
Attempts to validate a specified heap. |
Heapwalk |
Enumerates the memory blocks in a specified heap. |
Virtual Memory Functions
The following are the virtual memory functions.
Function |
Description |
Virtualalloc |
Reserves or commits a region of pages in the virtual address space of the calling process. "retain" or "Submit" Memory Page, change "idle" Memory Page to "Reserved" or "submitted ", change the "retained" page to "submitted ". |
Virtualallocex |
Reserves or commits a region of pages in the virtual address space of the specified process. Similar to the virtualalloc function, you can allocate memory for other processes. |
Virtualallocexnuma |
Reserves or commits a region of memory within the virtual address space of the specified process, and specifies the NUMA node for the physical memory. |
Virtualfree |
Releases or decommits a region of pages within the virtual address space of the calling process. change the memory status from "submitted" to "Reserved", or change "Reserved" to "idle", or at the same time. |
Virtualfreeex |
Releases or decommits a region of memory within the virtual address space of a specified process. Release the memory allocated by virtualallocex. The function and usage are similar to virtualfree. |
Virtuallock |
Locks the specified region of the process's virtual address space into physical memory. |
Virtualprotect |
Changes the access protection on a region of committed pages in the virtual address space of the calling process. Change the protection attribute of the specified Virtual Memory Page. |
Virtualprotectex |
Changes the access protection on a region of committed pages in the virtual address space of the calling process. |
Virtualquery |
Provides information about a range of pages in the virtual address space of the calling process. |
Virtualqueryex |
Provides information about a range of pages in the virtual address space of the calling process. |
Virtualunlock |
Unlocks a specified range of pages in the virtual address space of a process. |
Global and local functions
The following are the global and local functions. these functions are slower than other memory management functions and do not provide as your features. therefore, new applications shocould use the heap functions. however, the global functions are still used with DDE and the clipboard functions.
Function |
Description |
Globalalloc |
Allocates the specified number of bytes from the heap. |
Globaldiscard |
Discards the specified global memory block. |
Globalflags |
Returns information about the specified global memory object. |
Globalfree |
Frees the specified global memory object. |
Globalhandle |
Retrieves the handle associated with the specified pointer to a global memory block. |
Globallock |
Locks a global memory object and returns a pointer to the first byte of the object's memory block. |
Globalrealloc |
Changes the size or attributes of a specified global memory object. |
Globalsize |
Retrieves the current size of the specified global memory object. |
Globalunlock |
Decrements the lock count associated with a memory object. |
Localalloc |
Allocates the specified number of bytes from the heap. |
Localdiscard |
Discards the specified local memory object. |
Localflags |
Returns information about the specified local memory object. |
Localfree |
Frees the specified local memory object. |
Localhandle |
Retrieves the handle associated with the specified pointer to a local memory object. |
Locallock |
Locks a local memory object and returns a pointer to the first byte of the object's memory block. |
Localrealloc |
Changes the size or the attributes of a specified local memory object. |
Localsize |
Returns the current size of the specified local memory object. |
Localunlock |
Decrements the lock count associated with a memory object. |
Obsolete Functions
The following functions are provided only for compatibility with 16-bit versions of Windows:
·IsbadcodeptrDetermines whether the calling process has read permission on the memory of the specified address.
·IsbadreadptrDetermines whether the calling process has read permission on the memory of the specified address segment
·IsbadstringptrDetermines whether the calling process has the read permission on the specified string pointer.
·IsbadwriteptrDetermines whether the calling process has write permission on the memory of the specified address segment
Build Date: 8/15/2007
[Thank you for your reference]
1. From msdn2008 local