我明白这是做什么的,但是如下所示将 ProcessHandle 设置为 -1 是什么意思?
.text:004011D2 83 EC 20 sub esp, 20h
.text:004011D5 8D 04 24 lea eax, [esp+20h+TokenHandle]
.text:004011D8 50 push eax ; TokenHandle
.text:004011D9 6A 28 push 28h ; DesiredAccess
.text:004011DB 6A FF push 0FFFFFFFFh ; ProcessHandle
.text:004011DD E8 96 04 00 00 call OpenProcessToken
最佳答案
-1 进程句柄是当前进程的句柄。最好调用GetCurrentProcess
相反,按照 MSDN 上的建议:
Retrieves a pseudo handle for the current process.
...
A pseudo handle is a special constant, currently (HANDLE)-1, that is interpreted as the current process handle. For compatibility with future operating systems, it is best to call GetCurrentProcess instead of hard-coding this constant value.
关于windows - 当 processHandle = -1 时,这个 OpenProcessToken 做了什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26772495/