6.10. Viewing the APIs Called by a Process

Problem

You want to view the application programming interfaces (APIs) that a particular process invokes while running. This is useful for application developers who need to troubleshoot programs, but it can also be useful to system administrators who want to dig into the internals of a troublesome application.

Solution

Using a graphical user interface

  1. Open the API Monitoring tool (apimon.exe) from the Windows 2000 Resource Kit.

  2. From the menu, select File Open (or click the open folder icon).

  3. Browse to the executable you want to monitor and click OK.

  4. From the menu, select Tools Start Monitor (or click the play button). This launches the selected application. Within the API Monitor screen there will be a DLLs In Use window and API Counters window. The API information will continue to be collected until you stop it.

  5. From the menu, select Tools Stop Monitor (or click the stop button).

Discussion

If you have any Unix experience, you may be familiar with the truss utility. With truss, you can view all the system calls and APIs that a particular process is calling. Having this capability can be extremely beneficial when you are trying to debug why a particular application is failing or not behaving correctly. API Monitor provides similar functionality on the Windows platform. It displays the DLLs loaded by the target process, each function it calls, the number of times it calls a function, and the amount of time it took for each function call ...

Get Windows Server Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.