How to enumerate opened files?

D

DoB

Hi,

I would like to get the list of full paths of all files that are currently
opened by any process in the system.
Is this possible?

In short:
my program moves a bunch of directories and I want to warn the user BEFORE
he/she tries to start the whole process if any directory cannot be moved.
The ideal situation is to tell the user the name of the process that
prevents the move so that the user can close it.

I suspect that I should search for open handles. I know I can enumerate
processes and get the number of handles opened by each process. But how to
enumerate those handles and gather more informations by them?

Regards,
DoB
 
D

DoB

Yes, but is far from being a question related to C# or .NET. You'll have
to use p/invoke, assuming it can be done in C# at all, and your first step
will be to find out how to do it using the unmanaged API.

OK, so the functionality is not directly available in .NET and I have to use
API, right?

Are there any helper tools for generating the code that maps API functions
and data structures?
I used API calls long time ago and mapped everything manually which was not
very comfortable.

DoB.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top