Writing a Shim for the Application Verifier Tool

Other versions of this page are also available for the following:

Windows Mobile Not SupportedWindows Embedded CE Supported

8/27/2008

A shim includes the following code sections:

  • Generated code
    The source file specified in the Shim source box, as seen in the following procedure, contains all the redirected functions. These functions can either replace the functionality, or pass the call on to the original library, and monitor the input/output of that function. To pass the call on to the original function, call the function; the application verifier engine ensures that no functions imported by your shim will be redirected to another shim (or back to itself). You are not required to pass the call on to the original DLL.
  • DllMain.c
    This file contains the implementation for DllMain. You can customize this file to perform any initialization or termination tasks required.
  • OptionsDlg.c
    To add a pane for this shim, in the Options dialog box of Settings Manager, implement and export GetOptionsDialogProc. This function must return a dialog procedure and resource template to be used in the property sheet. Customize the dialog resource and procedure for your specific shim.
  • ParseCommand.c
    To add a custom command to the CE Target Control in Platform Builder,, implement and export the ParseCommand function.
  • QueryShimInfo.c
    The function QueryShimInfo is a required entry point of a shim dll. Do not make any changes to this file; instead, customize ShimInfo.rc described in the following.
  • RemoteUI.c
    Get/Set/FreeShimSettings are not required entry points for a shim DLL. Implement these only if you want to send application-specific run-time settings to the device.
  • ShimInfo.rc
    Customize this file with strings that describe your shim. The friendly name displays in the right pane of Settings Manager, and the description displays in the lower pane.

The following procedure specifies how to create and implement a shim for Application Verifier.

Creating and implementing a shim for Application Verifier

  1. Determine which functions you want to shim, and then implement those functions in a DLL.

  2. Start ShimGenUI.exe. The following figure displays Application Verifier Shim Generator.

  3. In the Original DLL box, type the full path to the DLL that implements the functions you want to include in the shim.

    -OR-

    Click on the ellipsis button (**...)**to browse for the DLL.

    When the DLL is selected, the left pane populates with the functions exported by that DLL.

  4. In the Shim Source box, type the full path to the C/C++ file containing your shim's implementation of these functions.

    -OR-

    Click on the ellipsis button (...) to browse for the source file.

    From the left pane, select the functions to be implemented in the shim, and then click Add. You can also select the API Filter box to apply a case-sensitive filter to the function.s

  5. When all the functions to be implemented are selected, click on the Generate Code button. The framework code that generates displays in your code editor.

See Also

Other Resources

Using Shims with the Application Verifier Tool