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:

  1. the handle has process_terminate access right.
  2. 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

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -