How to list all dlls loaded by a process with Pyth

2019-03-15 21:49发布

问题:

I want to list all the dlls loaded by a process, like this:

How could I get the information with Python on Windows?

回答1:

Using listdlls:

import os
os.system('listdlls PID_OR_PROCESS_NAME_HERE')


回答2:

Using the package psutil it is (now) even possible to get a portable solution! :-)

# e.g. finding the shared libs (dll/so) our python process loaded so far ...
import psutil, os
p = psutil.Process( os.getpid() )
for dll in p.memory_maps():
  print dll.path