How to close an file in an running process from another process?

  • Thread starter Thread starter xhy_China
  • Start date Start date
X

xhy_China

How to close an file in an running process from another
process?
For example:
There are two running processes,named procIn and
procFrom. A file
named needCloseFile was opened in procIn. Now I want to
close the
needCloseFile from procFrom by programming,but left
procIn running normally.
What can I do???


Thx for your reply!!
 
What is the motive for that? I guest that would you like to open the file
from procFrom, and the system says it's begin used by other process, no? if
this is the case you can share the file between the 2 processes.

Regards,

Bela Istok
 
What is the motive for that? I guest that would you like to open the file
from procFrom, and the system says it's begin used by other process, no? if
this is the case you can share the file between the 2 processes.


No, I only want to know how to close ! !
 
|
| > What is the motive for that? I guest that would you like to open the
file
| > from procFrom, and the system says it's begin used by other process, no?
if
| > this is the case you can share the file between the 2 processes.
| >
|
|
| No, I only want to know how to close ! !
|

The simple answer is - you can't close a file you don't own, only the
process that has opened the file can close it.

Willy.
 
"Willy Denoyette [MVP] дµÀ£º
| > What is the motive for that? I guest that would you like to open the
file
| > from procFrom, and the system says it's begin used by other process, no?
if
| > this is the case you can share the file between the 2 processes.
| >
| No, I only want to know how to close ! !

The simple answer is - you can't close a file you don't own, only the
process that has opened the file can close it.


but what does the software unlocker do after press the unlock button ?
It makes the file in using can be delete or move. how does it realize
this function???
 
"Willy Denoyette [MVP] дµÀ£º
| > What is the motive for that? I guest that would you like to open the
file
| > from procFrom, and the system says it's begin used by other process,
no?
if
| > this is the case you can share the file between the 2 processes.
| >
| No, I only want to know how to close ! !

The simple answer is - you can't close a file you don't own, only the
process that has opened the file can close it.


but what does the software unlocker do after press the unlock button ?
It makes the file in using can be delete or move. how does it realize
this function???

Well, "Unlockers" are tools that need high privileges (SeDebugPrivilege) to
run and inject DLL's into the external process, they attach a filesystem
driver to delete the file under the other process feet.
Not something you can't (and should) do in managed code.

Willy.
 
Back
Top