Table of Contents

About

A handle is a pointer to a resource.

For example, if a process wants to use a particular service offered by a particular object, the process asks the object for a handle to that service.

Inside the kernel, Windows maintains a table of all the different objects that the kernel is responsible for:

  • Windows,
  • buttons,
  • icons,
  • mouse pointers,
  • menus,
  • an open file ?,
  • or a pipe (stream) ?
  • and so on,

All get an entry in the table, and each entry is assigned a unique identifier known as a HANDLE.

A HANDLE in the Win32 APIs is a:

  • token
  • abstract reference
  • identifiant

that represents a resource that is managed by the Windows kernel. An HANDLE can be seen an instance of a class with no methods who's state is only modifiable by other functions.

They provide encapsulation and abstraction from internal Win32 resources which hides a real memory address from the API user, allowing the system to reorganize physical memory transparently to the program.

The HANDLE itself is just an integral type.

Documentation / Reference