Click here to Skip to main content
15,892,072 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I know how to monitor for a file creation event.
But how can I get the process which created the file?
Posted
Updated 5-Jan-10 4:44am
v3

If the file is already opened, you can see with the process explorer which process owns the file at that time.

Open Process Explorer, select "View Handles" from the toolbar. For each process you see the handles it owns for each resource. This includes file handles too. Of course this gives the current process holding the file handle but does not give info on which process created the file.

I dont think if there is any way to know programatically which process created the file.
If there is a way, I am also intrested to know. :)

By the way, what would be your intention in finding the owner of a file.
 
Share this answer
 
Thank you very much for your help
but that's not what I need, I need to know programatically using VC++
and the intention to do that is I have a virus which writes files on my computer, and I want to know the process to kill this damned virus :)
 
Share this answer
 
I think you have to create a file filter driver if you want to monitor the files created by processes. Process monitor [^]is a typical example of such an aplication.
 
Share this answer
 
Thank you vry much Naveen
It's a very helpful program
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900