How unprotect a handle using MCH
Posted: Fri Dec 14, 2018 1:11 pm
How can i unprotect a protected handle?
high quality low level programming
http://forum.madshi.net/
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);
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
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
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