Compartir a través de


BadMemoryCallbackRoutine callback function

An application-defined function registered with the RegisterBadMemoryNotification function that is called when one or more bad memory pages are detected.

The PBAD_MEMORY_CALLBACK_ROUTINE type defines a pointer to this callback function. BadMemoryCallbackRoutine is a placeholder for the application-defined function name.

Syntax

VOID WINAPI BadMemoryCallbackRoutine(
    VOID
);

typedef VOID (WINAPI *PBAD_MEMORY_CALLBACK_ROUTINE)(
      VOID
);

Parameters

  • VOID

Return value

This callback function does not return a value.

Remarks

The application is not given the addresses of any bad blocks. To determine which blocks are marked as bad, use the QueryWorkingSetEx function to examine the memory in your virtual address space and check to see if the Bad bit flag is set on one or more of the PSAPI_WORKING_SET_EX_BLOCK structures in the PSAPI_WORKING_SET_EX_INFORMATION structures returned. Do not access that page or your application or possibly the system will crash (the specific behavior depends on the hardware.) The memory must be freed; when that happens the system will remove the page from the lists of available pages.

When this function is called the bad page(s) that triggered this notification may not be part of the process and the scan of the address space using QueryWorkingSetEx may not turn up any bad pages.

To compile an application that calls this function, define _WIN32_WINNT as _WIN32_WINNT_WIN8 or higher. For more information, see Using the Windows Headers.

Requirements

Minimum supported client

Windows 8 [desktop apps only]

Minimum supported server

Windows Server 2012 [desktop apps only]

Header

WinBase.h (include Windows.h)

See also

Memory Management Functions

RegisterBadMemoryNotification

UnregisterBadMemoryNotification