Search code examples
c#processpinvoke

Delete file used by another process and get its info


I'm writing a program that searches for some files and deletes them. I desire to implement two things (probably using PInvoke): - find all the processes that use "found file", kill it and delete file, - get info about that process (its name should be fine - for log). Do you know any useful PInvoke methods? Thx in advance.


Solution

  • See:

    Specifically, the functions that will likely come in handy are:

    Also, bear in mind that you need a good C++ knowledge when developing a program to operate on files and processes. I learnt this the hard way while I was developing an anti-malware tool.