windows - How to determine whether a process handle is of the current process? -
i have handle
process, might, or might not, handle of running process. following known handle object:
- the handle has
process_terminate
access right. - the handle not pseudo-handle, i.e. not return value of
getcurrentprocess
.
is there way know whether handle of current process?
i thought using getprocessid
, unfortunately fails access denied error, because handle doesn't have process_query_limited_information
access right.
if have sufficient access target process, can create new handle process_query_limited_information
access right using duplicatehandle(). can use handle process id.
unless process modifies own security permissions, should have (at least) process_query_limited_information
access itself, if duplicating handle fails access denied error unlikely handle points process.
if want make absolutely certain, can try opening handle process process id - if fails messing acl , bets off. :-)
Comments
Post a Comment