Hi, I have a hooked function, NtTerminateProcess. I am trying to get the full path to the process handle passed to TerminateProcess. The injected app is taskmgr and GetProcessImageFileName is returning ERROR_ACCESS_DENIED. I even tried opening another handle to the process to ensure I have the required access rights, like this: HANDLE proc = OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, FALSE, GetProcessId(ProcessHandle)); Even after that, GetProcessImageFileName still returns 5. I tried GetModuleFileNameExW and even that is returning ERROR_ACCESS_DENIED. I'm at a loss here. I'm doing this to protect my process from being closed in case you're wondeirng. I guess I could try an alternative method and set a Registry value of the process ID I want to protect and just check against that, but I would still like to know why this isn't working.
Werwerwerw 0 Newbie Poster
Werwerwerw 0 Newbie Poster
Werwerwerw 0 Newbie Poster
Werwerwerw 0 Newbie Poster
Werwerwerw 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.