Freigeben über


HeapValidate (Compact 2013)

3/28/2014

This function validates the specified heap. HeapValidate scans all the memory blocks in the heap and verifies that the heap control structures maintained by the heap manager are in a consistent state. The HeapValidate function can also be used to validate a single memory block within a specified heap without checking the validity of the entire heap.

Syntax

BOOL HeapValidate(
  HANDLE hHeap,
  DWORD dwFlags,
  LPCVOID lpMem 
);

Parameters

  • hHeap
    [in] Handle to the heap to be validated.

    This parameter is a handle returned by the HeapCreate or GetProcessHeap function.

  • dwFlags
    [in] Heap access options.

    HEAP_NO_SERIALIZE is ignored. The heap is always serialized.

  • lpMem
    [in] Valid pointer to a memory block within the specified heap. This parameter may be NULL.

    If this parameter is NULL, the function attemptions to validate the entire heap specified by hHeap.

    If this parameter is not NULL, the function attempts to validate the memory block pointed to by lpMem. It does not attempt to validate the rest of the heap.

Return Value

Nonzero indicates that the specified heap or memory block is valid. Zero indicates that the specified heap or memory block is invalid. On a system set up for debugging, the HeapValidate function displays debugging messages that describe the part of the heap or memory block that is invalid, and stops at a hard-coded breakpoint so that you can examine the system to determine the source of the invalidity. The HeapValidate function does not set the thread's last error value.

Remarks

There are heap control structures for each memory block in a heap and for the heap as a whole. When you use the HeapValidate function to validate a complete heap, it checks all of these control structures for consistency.

When you use HeapValidate to validate a single memory block within a heap, it checks only the control structures pertaining to that element. HeapValidate can only validate allocated memory blocks. Calling HeapValidate on a freed memory block returns FALSE because there are no control structures to validate.

Requirements

Header

winbase.h

Library

coredll.lib

See Also

Reference

Memory Management Functions
GetProcessHeap
GetLastError
HeapCreate