visual c++ - How to find & close all open file handles on a removable drive (before ejecting) -


I am trying to remove a (virtual) removable drive, and it fails because some file handles Are open, perhaps Explorer windows What is the best way to get all the open handles on files on that drive and turn it off?

Is it also possible (in user mode) to find any process that runs from that drive, so I can warn with the name of the user name process?

Ideally I want to do this in the user-mode app instead of requiring admin privileges.

I am using VC ++ in Visual Studio 2005, in an MFC app, but any language samples will be welcomed!

The utility can search for open handles, but I do not know if it is possible without high privileges Or can not. I am able to collect it, it uses the "display counter" API.

I think this article what you need, tell the running processes, calculate the handle for each one, look for a file refers to a path on the drive in question:


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -