Recipe6.9.Viewing the DLLs Being Used by a Process


Recipe 6.9. Viewing the DLLs Being Used by a Process

Problem

You want to view the DLLs being used by a process or find the processes using a specific DLL. This can come in handy if you need to update a DLL and want to find out which programs are actively using it, or if you are trying to delete a DLL, but cannot due to a lock on the file by a process that is using it.

Solution

Using a graphical user interface

To view the DLLs being used by a process, do the following:

  1. Open the Sysinternals Process Explorer tool (procexp.exe).

  2. From the menu, select View

    Click on the process you want to view. In the bottom window, the list of DLLs being used by that process is displayed.

To view the processes using a specific DLL, do the following:

  1. Open the Sysinternals Process Explorer tool (procexp.exe).

  2. From the menu, select Find

    Type the name of the DLL (partial string accepted) and click the Search button.

Using a command-line interface

To view the DLLs being used by a process, use the following command:

> listdlls <ProcessName>

To view the processes using a specific DLL, use the following command:

> listdlls -d <DLLName>

Using VBScript

There are no scripting interfaces available to get this information. To get it programmatically, you must use the Win32 API or .NET Framework, or shell out to the listdlls utility.

Discussion

Ever visited DLL hell? Things aren't as bad as they once were in the early days of Windows NT, but keeping track of DLL versions for certain applications can still be a pain. DLL hell was the term given to the problem where applications would overwrite DLLs with older or incompatible versions. This would cause applications to fail in unexpected ways. Starting with Windows 2000, this problem was reduced with the introduction of the Windows File Protection (WFP). Now, applications can't replace system DLLsonly system updates can, such as when you install a service pack or hotfix.

If you really want to dig down into a process and see what it is doing, check out Recipe 6.10 where I talk about viewing the APIs that a process calls. I'll also show you another way to view the DLLs loaded by a process.

See Also

MS KB 222193 (Description of the Windows File Protection Feature) and MS KB 247957 (SAMPLE: Using DUPS.exe to Resolve DLL Compatibility Problems)



Windows Server Cookbook
Windows Server Cookbook for Windows Server 2003 and Windows 2000
ISBN: 0596006330
EAN: 2147483647
Year: 2006
Pages: 380
Authors: Robbie Allen

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net