Required permissions of process handle for InjectLibrary

c++ / delphi package - dll injection and api hooking
Post Reply
dcsoft
Posts: 380
Joined: Sat Dec 11, 2004 2:11 am
Location: San Francisco Bay Area, CA USA
Contact:

Required permissions of process handle for InjectLibrary

Post by dcsoft »

What are the required permissions of the process handle passed to InjectLibrary() and UninjectLibrary()?

So far I've been getting the process handle by calling OpenProcess(PROCESS_ALL_ACCESS) but wish to use only the permissions that are absolutely required, to improve the chances that OpenProcess() will succeed. Is SYNCRONIZE or PROCESS_QUERY_INFORMATION, for example, enough?

Thanks,
David
madshi
Site Admin
Posts: 10753
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

You need quite a lot of access rights, namely those:

PROCESS_CREATE_THREAD
PROCESS_DUP_HANDLE
PROCESS_QUERY_INFORMATION
PROCESS_VM_OPERATION
PROCESS_VM_READ
PROCESS_VM_WRITE

Seeing all those I think they're not more difficult to get than PROCESS_ALL_ACCESS...
dcsoft
Posts: 380
Joined: Sat Dec 11, 2004 2:11 am
Location: San Francisco Bay Area, CA USA
Contact:

Post by dcsoft »

madshi wrote:You need quite a lot of access rights, namely those:

PROCESS_CREATE_THREAD
PROCESS_DUP_HANDLE
PROCESS_QUERY_INFORMATION
PROCESS_VM_OPERATION
PROCESS_VM_READ
PROCESS_VM_WRITE

Seeing all those I think they're not more difficult to get than PROCESS_ALL_ACCESS...
Thanks Madshi, I'll stick with PROCESS_ALL_ACCESS for now.

-- David
Post Reply