all groups > visual studio .net general > march 2004 >
You're in the

visual studio .net general

group:

File in use by another process - which process?


Re: File in use by another process - which process? John Phillips
3/26/2004 2:37:04 PM
visual studio .net general: Check out Process Explorer from www.sysinternals.com. View all the handles
of "File" type for the currently running processes, and you'll have your
answer.

--
John Phillips
MVP - Windows SDK



[quoted text, click to view]

Re: File in use by another process - which process? alfps NO[at]SPAM start.no
3/26/2004 6:56:53 PM
* Viviana Vc <vcotirlea@hotmail.com> schriebt:
[quoted text, click to view]

oh.exe from the Windows 2000 resource kit, download from Microsoft (it
is documented as being also in XP Tools and works well in XP but is not
actually included with XP).

--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
File in use by another process - which process? Viviana Vc
3/26/2004 7:36:58 PM
Hi all,

I have an application that at one points has to delete a file, which is
actually it's log file.
The problem is that when the unlink(file) function is called I get:
"The process can not access the file because it is being used by another
process".
As my app runs also some additional application, it might be that one of
those keeps the file open, but I don't know which one. Is there any way
to find out which process if keeping a file opened?

Thanks in advance,
Re: File in use by another process - which process? Jochen Kalmbach
3/29/2004 3:03:03 AM
[quoted text, click to view]

MoveFileEx(szFileName, NULL, MOVEFILE_DELAY_UNTIL_REBOOT);


--
Greetings
Jochen

Do you need a memory-leak finder ?
http://www.codeproject.com/tools/leakfinder.asp


Do you need daily reports from your server ?
Re: File in use by another process - which process? Alexander Grigoriev
3/29/2004 6:38:17 AM
Use FILE_SHARE_DELETE in exe.b (not supported in Win9x)

[quoted text, click to view]

Re: File in use by another process - which process? Viviana Vc
3/29/2004 1:01:24 PM
Thanks a lot! I found the info I needed.

btw, is there any way to 'force' the deleting of a file? I mean even if
the file is opened by another process, I still would like to succesfully
delete it.

Thx,
Viv

On Fri, 26 Mar 2004 18:56:53 GMT, alfps@start.no (Alf P. Steinbach)
wrote :

[quoted text, click to view]
Re: File in use by another process - which process? Viviana Vc
3/29/2004 2:35:59 PM
Hi all,

Now that I found out what is the problem I have another question.
I have my main application let's name it a.exe that launches the second
app let's name it b.exe.
The a.exe is opening a log file at the begining, and when this file
exceeds a specific limit that file should be deleted. The deletion fails
because the b.exe is having the same file open.

Seems that the problem is that the a.exe uses the spawnv() function to
start the b.exe: spawnv(_P_NOWAIT, cvec.argv[0], cvec.argv);

In MSDNL is stated:
"Files that are open when a _spawn call is made remain open in the new
process."
but later it's also stated:
"You can control whether the open file information of a process is
passed to its spawned processes. The external variable _fileinfo
(declared in STDLIB.H) controls the passing of C_FILE_INFO information.
If _fileinfo is 0 (the default), the C_FILE_INFO information is not
passed to the new processes. If _fileinfo is not 0, C_FILE_INFO is
passed to new processes."

So, as I understood if _fileinfo is 0, which is the default the files
opened by a.exe should nopt be opened in the b.exe process right? Still
looks like they are opened.

How can I do, so that the files that are opened in the a.exe process,
not to be opened in b.exe process, using the spawnv function?

Thanks in advance,
Viv

On Fri, 26 Mar 2004 14:37:04 -0500, "John Phillips"
<jjphillipsREMOVE@REMOVEhotmail.com> wrote :

[quoted text, click to view]
Re: File in use by another process - which process? Gary Chanson
3/29/2004 2:47:29 PM

[quoted text, click to view]

If you use CreateFile to open the file, you can pass NULL for the
lpSecurityAttributes parameter. The resulting handle will not be inherited
by your child process.

--
-GJC [MS Windows SDK MVP]
-Software Consultant (Embedded systems and Real Time Controls)
- http://www.mvps.org/ArcaneIncantations/consulting.htm
-gchanson@mvps.org
Re: File in use by another process - which process? Viviana Vc
3/30/2004 12:20:33 PM
Thanks to all of you for answerings.
I actually have changed my spawn call to CreateProcess and this is how I
solved the problem.

Thx,
Viv

On Mon, 29 Mar 2004 14:47:29 -0500, "Gary Chanson"
<gchanson@No.Spam.TheWorld.net> wrote :

[quoted text, click to view]
AddThis Social Bookmark Button