Which ones are global and which ones are local ?
- System Handles (such as files, sections,
mutexes, semaphores, processes, threads, jobs, ...) are bound to a
process and are only valid in it's scope. They may be inherited with
CreateProcess() (depends on how the handles were created) to other
processes or - as you mentioned - duplicated into the scope of another
process. In kernel mode attaching to another process makes it's handle
table available.
- User Handles (HWND, HICON/HCURSOR, HACCEL, ...)
are global for all processes that share the same window station. They
don't need to and can't be marshalled. However, system security may
prevent access to objects belonging to threads of other desktops or
when other restrictions are active (such as UI restrictions by jobs)
-
GDI Handles are session-global. However, it's only possible to access
global GDI handles, such as stock objects, and GDI objects created by
the process itself. But the handles are unique, so it's impossible that
there are same handles for different processes that are assigned to two
different objects.
Description found here.