The user interface extension DLL functionality lets you provide additional descriptive messaging for displaying with user defined allocations.
The example extension project can be found in the uiExtDLL subdirectory in the directory where Memory Validator was installed.
If the directory is not present, reinstall your software and choose custom or full installation.
There are two project files in the directory:
•uiExtDLL.dsp for Microsoft® Developer Studio® 6.0
•uiExtDLL.vcproj for Microsoft® Visual Studio / .net
A user interface extension DLL needs to provide just two functions:
•getDllID uniquely identifies the user interface extension DLL
Each ui extension DLL must return a different value than any of the other user interface extension DLLs.
A value of -1 returned means that the DLL should not be used as an extension DLL.
•getDescription allocates a buffer to return the description of an object
int getDescription(DWORD userData1,
The function is passed the userData1 and userData2 values that were passed into the API function that reported the object e.g. mvUserCustomAlloc().
The address, size and reference count are also passed in.
The function must allocate a buffer using HeapAlloc() and use it to return the description of the object.
The buffer should be on the program's default Heap as returned by GetProcessHeap().
In the uiExtDLL example, the functions are defined as extern "C" functions which are exported from the DLL.
See the header file uiExtDLL.h for an example way of declaring the functions so that when building the DLL, the functions are exported, but anyone including the header file sees the functions as imported.
The code snippet below is taken directly from the uiExtDLL.cpp implementation file in the uiExtDLL project
Although userData1 and userData2 are not interpreted here, an example use might be to pass indices into a known array of strings or enumerated values used to generate a message.