-
October 28th, 2008, 12:20 AM
#1
how to get parent process information
Hi Friends,
I want to delete all the files in the given directory, i did that.
But while deleting some files it shows error like 'This file is used by another program'. So i want to kill the process which holding this file..
I can get the parent ID if i know the child id or child name, but here I know only file name...If i get the parent process id i can kill that process and delete the file...
Give me the idea to get the parent id by giving file name or deleting the busy file
Please help me,
Thanks,
Riyas.B
Growing Developer
-
October 28th, 2008, 08:14 AM
#2
Re: how to get parent process information
Jut enumerate the handles , get the pid and close remotely the handle
-
October 29th, 2008, 12:51 AM
#3
Re: how to get parent process information
How to enumerate handles?
If i enumerate all the handles, how can i identify the handle of the parent process?, here i know only the child file name
-
October 29th, 2008, 04:33 AM
#4
Re: how to get parent process information
I can think of 2 options.
The first option may be to use the MoveFileEx API with the MOVEFILE_DELAY_UNTIL_REBOOT Flag.
Another option, is outlined in the article ( yes, right here on CodeGuru ) :
http://www.codeguru.com/cpp/w-p/file...icle.php/c1287
But, I never could actually see the whole logic in deleting a file which is "currently busy" - what if it's a system file ¿
-
August 17th, 2009, 09:48 PM
#5
Re: how to get parent process information
Just use ProcExp (http://technet.microsoft.com/en-us/s.../bb896653.aspx) instead. It finds out which process is holding up your files/dlls - handles in general.
-
August 18th, 2009, 04:57 AM
#6
Re: how to get parent process information
Originally Posted by piyush_soni
Just use ProcExp
No.
By programming.
You enumerate the handles and close the one you want from the matching PID
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|