About pseudo handle and the handle

https://www.cnblogs.com/zpcdbky/p/4652151.html

Added: handle, it is used to maintain an identity in the process or system-wide. For example, we go to access a file, the same time, only one process accesses can not have the other, this is the file handle lock. The handle is a dynamic address allocation is used to record the current object, it is clear that there is only one. Any object has a handle.

About pseudo handle :
Official explanation: the pseudo-handle is a special constant current is (HANDLE) -1, which is interpreted as a handle for the current process. For compatibility with future operating system, it is best to call GetCurrentProcess, rather than hard-coded This constant value. Whenever required process handle, you can use the calling process to specify its own pseudo-handle process. Pseudo handles help the child to inherit.

Popular understanding:
the so-called pseudo-handle, they do not reflect the true handle table information, only to act on the current thread \ process itself
when we call GetCurrentThread () and GetCurrentProcess (), which always returns the value 0xfffffffe (-2 ), 0xffffffff (-1)
pseudo-handle only acts on the current thread \ process. Beyond the current thread \ process it would not make any sense.

Published 43 original articles · won praise 8 · views 3918

Guess you like

Origin blog.csdn.net/MaYang_/article/details/103390379
Recommended