Page 1 of 3

How to close file handle in SYSTEM process?

PostPosted:Wed Dec 26, 2012 10:30 pm
by myid
Close file handle in a general process is easy, use KeStackAttachProcess and ZwClose is feasible.
But how to close handle in SYSTEM process(PID=4)? Method on above is not useful. If direct use NtClose(in a kernel thread) is not useful, too.
Both ZwClose and NtClose return 0xC0000008(STATUS_INVALID_HANDLE).
Tested platform: WIN7 X64 and WIN8 X64.

Re: How to close file handle in SYSTEM process?

PostPosted:Wed Dec 26, 2012 10:33 pm
by Buster_BSA
I did not find any program able to close handles opened by SYSTEM process.

If anyone knows a method, I will be interested to hear of it too.

Re: How to close file handle in SYSTEM process?

PostPosted:Wed Dec 26, 2012 10:52 pm
by myid
Buster_BSA wrote:I did not find any program able to close handles opened by SYSTEM process.

If anyone knows a method, I will be interested to hear of it too.
A software called 360SAFE can unlock/delete file opened by SYSTEM process.
But it is a Chinese software and have no English version.

Re: How to close file handle in SYSTEM process?

PostPosted:Wed Dec 26, 2012 11:14 pm
by Buster_BSA
myid wrote:A software called 360SAFE can unlock/delete file opened by SYSTEM process.
But it is a Chinese software and have no English version.
Good to know it´s possible. Unlocker is unable.

Re: How to close file handle in SYSTEM process?

PostPosted:Thu Dec 27, 2012 3:22 am
by kmd
dont know how you tried. Process Explorer can close handle in System.

Re: How to close file handle in SYSTEM process?

PostPosted:Thu Dec 27, 2012 3:42 am
by myid
kmd wrote:dont know how you tried. Process Explorer can close handle in System.
You are wrong. ProcExp cannot close handle in SYSTEM process on WIN7 X64, too.
If you don't believe me, I can show you the screenshot.

Re: How to close file handle in SYSTEM process?

PostPosted:Thu Dec 27, 2012 3:50 am
by kmd
lmao

want me to show you my screenshot?

Re: How to close file handle in SYSTEM process?

PostPosted:Thu Dec 27, 2012 4:39 am
by myid
kmd wrote:lmao

want me to show you my screenshot?
I just want to solve this problem but not quarrel with somebody.

Re: How to close file handle in SYSTEM process?

PostPosted:Thu Dec 27, 2012 8:23 am
by Buster_BSA
In my experience is not possible to close handles opened by SYSTEM process.

Sometimes Sandboxie´s RegHive can not be deleted. When you check who has the handle opened is SYSTEM (PID 4), and none program, Unlocker and Process Explorer included, can close the handle. The only way is rebooting.

I have confirmed this behavior consistently.

Re: How to close file handle in SYSTEM process?

PostPosted:Fri Dec 28, 2012 12:46 am
by r2nwcnydc
There's a claim that handle (from sysinternals) can do it, but I haven't tested it.

http://www.xpresslearn.com/windows/wind ... ile-handle