Is HANDLE similar to file descriptor in Linux?

Amumu picture Amumu · Nov 1, 2011 · Viewed 19.1k times · Source

Is HANDLE similar to file descriptor in Linux? As far as I know, HANDLE is used for handling every resources on Windows, such as font, icons, files, devices..., which in essence is just a void pointer point to a memory block holding data of a specific resource

Answer

Mark Seaborn picture Mark Seaborn · May 24, 2015

Yes, Windows handles are very similar to Unix file descriptors (FDs).

Note that a HANDLE is not a pointer to a block of memory. Although HANDLE is typedef'd as void *, that's just to make it more opaque. In practice, a HANDLE is an index that is looked up in a table, just as an FD number is.

This blog post explores some of the similarities and differences: http://lackingrhoticity.blogspot.com/2015/05/passing-fds-handles-between-processes.html