Google Answers Logo
View Question
 
Q: how can I find what process hold a specific file ( No Answer,   1 Comment )
Question  
Subject: how can I find what process hold a specific file
Category: Computers > Software
Asked by: sharon_de_salmon-ga
List Price: $5.00
Posted: 27 Nov 2005 07:09 PST
Expires: 28 Feb 2006 10:31 PST
Question ID: 598101
I need to find out from .NET which process holds a specific file.
the reason is that I want to delete this file but i can't because it
is being held by another process (with many possinle instances) and I
want to find that process and kill it .
I don't know the name of the process, my only knowledge is the name of the file.

Request for Question Clarification by sublime1-ga on 27 Nov 2005 13:48 PST
sharon...

I can show you a small utility which will insert an option
when you r-click on the file in Windows Explorer, which will
remove the file when you next reboot your system, before it
is engaged by .NET.

Would that suit your needs?

sublime1-ga

Clarification of Question by sharon_de_salmon-ga on 27 Nov 2005 23:55 PST
this solutions are not suitable for my problem since I need to find the process 
automatically inside a program I wrote in c#.
I can't open or use any other program from this program.
I need a utility that exposes an API.

Request for Question Clarification by bookface-ga on 22 Dec 2005 18:15 PST
I thought this would be an easy search, and you were just missing the
key term "lock" or "locking" in your own searches.

I knew it was possible once I found this:
http://www.skrubbeltrang.com/Tools.aspx?Tool=FreeFile

But I couldn't find the specific API to do this.
Eventually I found some information that may be enough to get you
where you need to go: the key to monitoring open handles is the ROT,
Running Object Table.

Hope this helps!

- bookface-ga

Search Strategy:
://www.google.com/search?q=.net+finding+lock+file
 http://adminfoo.net/node/102
   http://www.skrubbeltrang.com/Tools.aspx?Tool=FreeFile

http://www.lorriman.com/software/rotviewer/rotviewer.htm

http://groups.google.com/groups?q=process+list+file+handle
http://groups.google.com/group/microsoft.public.platformsdk.shell/browse_thread/thread/91b873f5a887a62/52fc297f7a14b61a?lnk=st&q=process+list+file+handle&rnum=4&hl=en#52fc297f7a14b61a

Clarification of Question by sharon_de_salmon-ga on 24 Dec 2005 22:55 PST
it seems like ROT is the way. i didn't look inside the program that use it.
I still need to dig out the relevant code snippet from the code, but
it looks promising.
10x
Answer  
There is no answer at this time.

The following answer was rejected by the asker (they received a refund for the question).
Subject: Re: how can I find what process hold a specific file
Answered By: bookface-ga on 26 Dec 2005 16:07 PST
 
Glad I could help, and thanks for choosing Google! Answers.

- bookface-ga

Request for Answer Clarification by sharon_de_salmon-ga on 27 Dec 2005 00:19 PST
if you want to answer the question so I want a code snippet in c# (or vb.net)
that demonstrates how it is done by code.
I didn't find a sutable .net source in those links to get an example from.
please provide this code snippet example(s)

Clarification of Answer by bookface-ga on 29 Dec 2005 00:17 PST
Just wanted to let you know I'm working on a solution, but I may have
to ask you to repost soon if none of my leads follow through, although
there are quite a few options I'm looking at that may lead to a
complete answer.

It would help if you could tell me the use case for your application,
so I know what behavior is acceptable. For instance, part of the
Microsoft Resource Kit contains OH.exe, which is a command line app
that lists all open handles... but to do so, it needs to set a flag
which requires a reboot to take effect.

Would it be acceptable to take a command line application's output
(not OH.exe, I have a different one in mind) and read it as a LPCSTR
in your application?

Does this need to be fully redistributable, or is it for personal use?

- bookface-ga

Request for Answer Clarification by sharon_de_salmon-ga on 31 Dec 2005 05:11 PST
I am not considering it as an answer yet .
please do not respond to this so the question can be closed without
being considered as answered.
I am re-posting the question so you can have a fair chance to answer it correctly.

Clarification of Answer by bookface-ga on 02 Jan 2006 15:06 PST
Please use this form to request a repost of your question at no
additional fee (or full refund, less the 50 cent posting fee):

http://answers.google.com/answers/refundrequest

I'm sorry I couldn't help you.

- bookface-ga
Reason this answer was rejected by sharon_de_salmon-ga:
I didn't get a suitable answer.
I wanted an answer that include an example in code (c# or vb.net) that
shows how i can find what processes are colding a file in order to
kill them.
instead i got some links which i followed but didn't find it there,
and some reference to programs that do this.
but i didn't want a program , i am looking for a programing framwork.

Comments  
Subject: Re: how can I find what process hold a specific file
From: feldersoft-ga on 27 Nov 2005 15:49 PST
 
This utility may enable you to figure out which process has your file open:

http://www.sysinternals.com/Utilities/Filemon.html

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy