How unprotect a handle using MCH
How unprotect a handle using MCH
How can i unprotect a protected handle?
Re: How unprotect a handle using MCH
What do you mean "unprotect" a handle, exactly? Do you mean from closing it? If so, see the code below:
Protect
Unprotect
--Iconic
Protect
Code: Select all
SetHandleInformation(hObject, HANDLE_FLAG_PROTECT_FROM_CLOSE, HANDLE_FLAG_PROTECT_FROM_CLOSE);
Code: Select all
SetHandleInformation(hObject, HANDLE_FLAG_PROTECT_FROM_CLOSE, 0);
Re: How unprotect a handle using MCH
i called your routine after:iconic wrote:What do you mean "unprotect" a handle, exactly? Do you mean from closing it? If so, see the code below:
ProtectUnprotectCode: Select all
SetHandleInformation(hObject, HANDLE_FLAG_PROTECT_FROM_CLOSE, HANDLE_FLAG_PROTECT_FROM_CLOSE);
--IconicCode: Select all
SetHandleInformation(hObject, HANDLE_FLAG_PROTECT_FROM_CLOSE, 0);
Code: Select all
if DuplicateHandle(hProcess, StrToInt(InfosHandle[1]), GetCurrentProcess(), @hObject, STANDARD_RIGHTS_REQUIRED, FALSE, DUPLICATE_SAME_ACCESS) then
i'm trying close a protected handle, i can list it fine, but the question is to close if the handle are protected.
Re: How unprotect a handle using MCH
Unprotecting hObject (which you have duplicated from the remote process) in your own process' handle table will not work. You'd need to call SetHandleInformation() in the context of the remote process with the original source object handle, i.e> remote thread creation etc. Each process has its own unique handle table much like their own address space (on NT)
--Iconic
--Iconic
Re: How unprotect a handle using MCH
Can you show me an example of how do it?iconic wrote:Unprotecting hObject (which you have duplicated from the remote process) in your own process' handle table will not work. You'd need to call SetHandleInformation() in the context of the remote process with the original source object handle, i.e> remote thread creation etc. Each process has its own unique handle table much like their own address space (on NT)
--Iconic
Re: How unprotect a handle using MCH
What does (un)protecting an object handle have to do with using MCH? I see no correlation nor do I see a benign use in creating such code. What is your purpose for unprotecting a handle? Is the other process the same bitness as your own process (64 <-> 64, 32 <-> 32 etc.)? Is the other process in a different user session from your own? Many criteria would need to be addressed in writing such a code example. Even if I had more time to write an example for you, how would me writing it for you benefit you in any real way?
--Iconic
--Iconic
Re: How unprotect a handle using MCH
I mean if MCH have some function who do it.iconic wrote:What does (un)protecting an object handle have to do with using MCH? I see no correlation nor do I see a benign use in creating such code. What is your purpose for unprotecting a handle? Is the other process the same bitness as your own process (64 <-> 64, 32 <-> 32 etc.)? Is the other process in a different user session from your own? Many criteria would need to be addressed in writing such a code example. Even if I had more time to write an example for you, how would me writing it for you benefit you in any real way?
--Iconic
Both application are 64 bits and are on the same session.
If you can't help me no problem, i'll try it do it alone
Thanks anyway.
Re: How unprotect a handle using MCH
There isn't any MCH API for this specifically.
--Iconic
--Iconic
Re: How unprotect a handle using MCH
Iconic is perfectly right, as always...