I've been trying to better understand WinAPIs and the underlying Windows kernel. From what I see so far, HWND (window) handles can be shared among processes.
But what about other handles, can they be shared among processes?
HMODULE, HINSTANCE, ATOM?
As well as window and drawing components:
HMENU, HDC, HICON, HCURSOR, HBRUSH, etc.?
And lastly, if all of the above cannot be shared, are there any user-mode handles that can be?
EDIT: Clarification. By sharing, I meant taking the handle's numerical value from one process and using it in another process.
HMODULEandHINSTANCEis the same thing on 32 and 64-bit Windows. It is the base address of a module and cannot really be shared across processes (except the addresses of ntdll and kernel32 if the other process has the same bitness).ATOMs come in per-process and global forms and the global form can be shared by processes on the same windowstation.The GDI drawing handles cannot be shared (except for maybe
GetStockObject?).USER32 handles (HWND, HMENU, HICON, HCURSOR) can be shared.
DuplicateHandleaccepts desktop and windowstation handles...