Skip to content

07: Chapter 4 | Win32 APIs

VirtualAllocEx edited this page Aug 3, 2023 · 2 revisions

Win32-APIs

Windows APIs (Application Programming Interfaces), often referred to as Win32 APIs, are a collection of functions and procedures provided by Microsoft that allow developers to interact with the Windows operating system. They are the cornerstone of application development for Windows and form the backbone of most applications running on the platform. The role of Windows APIs is to provide an interface - a contract - between applications and the operating system. They expose a set of services that developers can use to create applications. These services include creating and managing windows, handling user input (such as mouse clicks and keystrokes), managing memory, interacting with hardware devices, and accessing the file system. The reason Windows APIs are necessary is that they abstract away the complexity and variance of working directly with hardware. Instead of writing code to communicate directly with each type of hardware (which would be more complex and unfeasible given the variety of hardware on the market), developers write code that interacts with the APIs. The operating system then handles the interaction with the hardware on behalf of the application. This allows developers to write applications that can run on any hardware configuration that supports Windows, without having to know the specific details of that hardware.

The functions provided by the Windows APIs are located in several dynamic link library (DLL) files that come with the operating system. Some of the most important DLLs are:

DLL Name DLL Tasks
User32.dll This library contains functions for creating windows, handling messages and processing user input.
Kernel32.dll This library provides access to a variety of essential system services such as memory management, I/O operations, and process and thread creation.
Gdi32.dll This library contains functions for drawing graphics and displaying text.
Comdlg32.dll This library provides common dialogues such as open and save dialogues.
Advapi32.dll This library provides functions for working with the Windows registry and managing user accounts.

Using these DLLs and the functions they provide, developers can create a wide variety of applications, from simple command line tools to full-featured graphical user interfaces, that take full advantage of the Windows operating system. In this workshop we will focus on the Win32 APIs that can be accessed through the kernel32.dll.