The Hooked DLLs tab allows you to specify hooks for functions that Memory Validator does not initially know about.
The default settings are shown below:
Read on, or click on a setting in the picture below to find out more.
By default, Memory Validator will try to hook all DLLs and .EXEs used by your application, but you can choose to list only those which should be included or excluded
•Hook all DLLs hook everything - ignoring the settings in the list
•Hook the enabled DLLs in the list hook only the ticked modules listed
•Do not hook the enabled DLLs in the list ignore all the ticked modules in the list, and hook everything else
The process modules list should specify the following items to be included or excluded from hooking in the target application
•DLLs
•.EXEs
•folders containing DLLs and .EXEs
Initially the list is empty as the default option is to hook all DLLs and ignore the list. You can add modules to the list by:
•automatically adding modules on which your application is dependent
•manually adding modules or folders
•editing modules or folders already in the list
modules whose inclusion is controlled by this list will override the hook insertion settings on the Data Collection > Collect tab.
You can automatically populate the list with all the dependent modules for your application:
•Choose Exe... navigate to your application and click Open all the process modules appear in the list
You can also manually add one or more modules or a folder to the list.
•Add Module navigate to the DLL or EXE and click Open all the selected items are added
•Add Folder navigate to the folder and click OK the folder is added to the list
Manual addition might be useful for example if you use LoadLibrary() to load a DLL rather than linking it, as this would not be picked up automatically by the Choose Exe... method.
By default, all the modules are ticked in the yellow checkboxes.
Note that ticked modules or folders are either included or excluded depending on the hooking rule above
Although you can't add blank entries to the list and edit them, you can edit existing items in the list by double clicking on an entry:
•enter only the module name, not the path
•you can use wildcards like MFC*.dll, but only for DLLs, not folders
The usual controls apply for removing or changing the enabled state of items in the list:
•Remove removes selected items in the list
•Remove All removes all items, clearing the list
•Enable All ticks all items in the list for applying to the hooking rule
•Disable All unticks all items in the list, meaning they won't apply to the hooking rule
Alternatively, press to delete selected items, and + to select all items in the list first.
Since the list of hooked DLLs (and the rule being applied) can be quite complicated to set up and optimise, you can export the settings to a file and import them again later. This is useful when switching between different target applications.
•Export... choose or enter a filename Save outputs the hooking rule and the list of modules to the file
•Import... navigate to an existing *.mvx file Open loads the hooking rule and the list of modules
The exported file can be used with the -dllHookFile command line option.
•Don't hook delay loaded DLLs prevents hooking of delay loaded DLLs. The default is to hook these.
When specifying DLLs to hook, and launching different applications, it can be quite easy to forget to change the hooked DLLs for the new program. This might be the case when performing unit tests, for example.
Using the wrong list of hooked DLLs for a program will likely cause incorrect coverage results, so you can opt to be warned about the DLLs being hooked whenever the target application changes between sessions (using the dialog below).
The choices in the drop down list are only applicable when the application changes:
•Ask about DLLs to Hook settings if some DLLs defined
You'll only be asked about the settings if you defined some DLLs in the list and if the hooking rule is not set to hook all DLLs
•Always ask about DLLs to Hook settings
You'll always be asked about the settings - whatever the other settings are.
•Never ask about DLLs to Hook settings
You can update the settings; ignore them and launch anyway, or just cancel the launch:
•Update Settings and Launch edit the settings click OK the application will be launched
•Ignore Settings and Launch the application will be launched without updating the settings
•Cancel won't launch the application
To change when you are asked this question, just choose the appropriate option in the dialog.
Reset All - Resets all global settings, not just those on the current page. This includes removing any process modules added here.
Reset - Resets the settings on the current page. This includes removing any process modules added here.