WerRegisterMemoryBlock function (werapi.h)

Registers a memory block to be collected when Windows Error Reporting (WER) creates an error report.

Syntax

HRESULT WerRegisterMemoryBlock(
  [in] PVOID pvAddress,
  [in] DWORD dwSize
);

Parameters

[in] pvAddress

The starting address of the memory block.

[in] dwSize

The size of the memory block, in bytes. The maximum value for this parameter is WER_MAX_MEM_BLOCK_SIZE bytes.

Return value

This function returns S_OK on success or an error code on failure, including the following error codes.

Return code Description
WER_E_INVALID_STATE The process state is not valid. For example, the process is in application recovery mode.
HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER) The number of registered memory blocks and files exceeds the limit.

Remarks

Memory registered with this function is only added to heap or larger dump files. This memory is never added to mini dumps or smaller dump files.

For crashes and no response, the operating system automatically provides error reporting (you do not need to provide any error reporting code in your application). If you use this function to register a memory block, the operating system will add the memory block information to the dump file at the time of the crash or non-response. The memory block is added to the dump file for the report only when additional data is requested by the server.

For generic event reporting, the application has to call the WER generic event reporting functions directly. To add the memory block to a generic report, call the WerReportAddDump function and then call the WerReportSubmit function and specify the WER_SUBMIT_ADD_REGISTERED_DATA flag.

To remove the block from this list, call the WerUnregisterMemoryBlock function.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps | UWP apps]
Minimum supported server Windows Server 2008 [desktop apps | UWP apps]
Target Platform Windows
Header werapi.h
Library Kernel32.lib
DLL Kernel32.dll

See also

WerUnregisterMemoryBlock, Windows Error Reporting