Avatar of nivo_Z
nivo_Z

asked on 

OpenProess fails, Access Denied

Hi,

I need to get a handle to a process that was started by SYSTEM. I have its PID.
My exeutable is started from the command line so I get Access Denied error.

Is there a way around this limitation?

Thanks,
Nivo
C

Avatar of undefined
Last Comment
notb0b
Avatar of Kent Olsen
Kent Olsen
Flag of United States of America image


I'm assuming that you're calling CreateProcess?

What access rights are you requesting in the call?  Start with minimal access and "work up".

PROCESS_QUERY_INFORMATION
or
PROCESS_QUERY_LIMITED_INFORMATION

See if either of these succeed.


Kent
Avatar of Kent Olsen
Kent Olsen
Flag of United States of America image


Sorry.    OpenProcess.    :)

ASKER CERTIFIED SOLUTION
Avatar of notb0b
notb0b

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of notb0b
notb0b

er, my bad. Add a couple of CloseHandle(hToken);'s in there so you don't leave the handle open.
C
C

C is a general-purpose, imperative computer programming language, supporting structured programming, lexical variable scope and recursion, while a static type system prevents many unintended operations. By design, C provides constructs that map efficiently to typical machine instructions, so it has found lasting use in applications that had formerly been coded in assembly language, including operating systems as well as various application software for computers ranging from supercomputers to embedded systems. It is distinct from C++ (which has its roots in C) and C#, and many later languages have borrowed directly or indirectly from C.

23K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo