Recipe 6.9. Viewing the DLLs Being Used by a ProcessProblemYou 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. SolutionUsing a graphical user interfaceTo view the DLLs being used by a process, do the following:
To view the processes using a specific DLL, do the following:
Using a command-line interfaceTo 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 VBScriptThere 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. DiscussionEver 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 AlsoMS KB 222193 (Description of the Windows File Protection Feature) and MS KB 247957 (SAMPLE: Using DUPS.exe to Resolve DLL Compatibility Problems) |