c# - Discover associated files of a certain process through WMI? -


is possible determine process (id), files associated (i.e. executable file files accessed process)?

i have use wmi unless there no other option avoid ntquerysysteminformation. have piece of code can determine file, processes using it. need efficient way opposite direction.

thank much.

i cannot find wmi if process local, can use modules of system.diagnostics.process class.

process[] processesbyname = process.getprocessesbyname("myexe.exe"); foreach (processmodule module in processesbyname[0].modules) {     console.writeline(module.filename); }  

Comments

Popular posts from this blog

ruby - When to use an ORM (Sequel, Datamapper, AR, etc.) vs. pure SQL for querying -

php - PHPDoc: @return void necessary? -

c++ - Convert big endian to little endian when reading from a binary file -