ResetWriteWatch function (memoryapi.h)
Resets the write-tracking state for a region of virtual memory. Subsequent calls to the GetWriteWatch function only report pages that are written to since the reset operation.
64-bit Windows on Itanium-based systems: Due to the difference in page sizes, ResetWriteWatch is not supported for 32-bit applications.
Syntax
UINT ResetWriteWatch(
[in] LPVOID lpBaseAddress,
[in] SIZE_T dwRegionSize
);
Parameters
[in] lpBaseAddress
A pointer to the base address of the memory region for which to reset the write-tracking state.
This address must be in a memory region that is allocated by the VirtualAlloc function with MEM_WRITE_WATCH.
[in] dwRegionSize
The size of the memory region for which to reset the write-tracking information, in bytes.
Return value
If the function succeeds, the return value is 0 (zero).
If the function fails, the return value is a nonzero value.
Remarks
The ResetWriteWatch function can be useful to an application such as a garbage collector. The application calls the GetWriteWatch function to retrieve the list of written pages, and then writes to those pages as part of its cleanup operation. Then the garbage collector calls ResetWriteWatch to remove the write-tracking records caused by the cleanup.
You can also reset the write-tracking state of a memory region by specifying WRITE_WATCH_FLAG_RESET when you call GetWriteWatch.
If you use ResetWriteWatch, you must ensure that no threads write to the region during the interval between the GetWriteWatch and ResetWriteWatch calls. Otherwise, there may be written pages that you not detect.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows XP [desktop apps | UWP apps] |
Minimum supported server | Windows Server 2003 [desktop apps | UWP apps] |
Target Platform | Windows |
Header | memoryapi.h (include Windows.h, Memoryapi.h) |
Library | onecore.lib |
DLL | Kernel32.dll |