Share via


Client Block Hook Functions

If you are interested in validating or reporting the contents of the data that you are storing in _CLIENT_BLOCK blocks, you can write a function specifically for this purpose. The function that you write must have a prototype similar to the following, as defined in CRTDBG.H:

void YourClientDump(void *, size_t)

In other words, your hook function should accept a void pointer to the beginning of the user’s topic of the allocation block, together with a size_t type value indicating the size of the allocation, and return void. Other than that, its contents are up to you.

Once you have installed it using _CrtSetDumpClient, your hook function will be called every time a _CLIENT_BLOCK block is dumped.

The pointer to your function that you pass to _CrtSetDumpClient is of type _CRT_DUMP_CLIENT, as defined in CRTDBG.H:

typedef void (__cdecl *_CRT_DUMP_CLIENT)
   (void *, size_t);