Win32 Subsystem Server
What is it?
This roadmap plans the Win32 subsystem server, the Impossible OS counterpart of Windows csrss.exe and the window-manager half of win32k: per-thread message queues, a window class registry, window procedure dispatch with DefWindowProc(), the device-context painting model, accelerators, subclassing, cross-process messages, common dialogs and the Windows 11 visual opt-in calls such as DwmSetWindowAttribute(). It is the architecture that the planned user32 and gdi32 stubs delegate to. None of its nine sections has shipped.
How does it work?
Today. The native desktop has its own window manager and controls, which the subsystem will wrap rather than replace:
- Windows.
wm_create_window()inwm.hcreates a compositor window. - Controls.
controls.hdefines four control types:CTRL_BUTTON,CTRL_LABEL,CTRL_TEXTBOXandCTRL_SCROLLBAR. The list box and combo box the roadmap expects as built-in classes do not exist yet. - IPC. Pipes (
SYS_PIPE) and shared memory (SYS_SHMEM_CREATE,SYS_SHMEM_MAP) are insyscall.h, and ALPC ports are inalpc_port.h.
There is no message queue, no HWND table, no class registry and no RegisterClassExA(), DefWindowProc() or BeginPaint() anywhere in the tree. The syscall numbers 60 to 77 this roadmap assigns to message calls are not defined.
Planned design.
- Architecture and queues. A server thread, later a user-mode process, holds a 1000-entry
MSGring per thread;GetMessage()blocks on a wait call. - Classes and dispatch. 256 global and 64 per-process classes, built-in classes backed by the native controls, and
DefWindowProc()for the standard messages. - Painting. An
HDCmaps to agfx_surface_t;InvalidateRect()accumulates a dirty region andBeginPaint()clips to it. - Filters, subclassing and properties. Accelerator tables, message filters,
SetWindowLongPtr()subclassing andSetProp(). - Cross-process messages and dialogs.
SendMessage()andWM_COPYDATAacross processes with a five-second timeout, thenChooseColor(),ChooseFont()and the file dialogs. - Windows 11 opt-in.
dwmapianduxthemecalls that map to the native renderer, and a personalization broadcast.
flowchart LR
A[user32 stub] --> S[subsystem server]
S --> Q[per-thread MSG queue]
S --> C[class registry]
S --> P[HDC to gfx surface]
P --> W[native window manager]
What are its interfaces?
| Interface | Status |
|---|---|
wm_create_window(), CTRL_* controls |
Shipped (native desktop) |
| Pipes, shared memory, ALPC ports | Shipped (kernel) |
GetMessage(), PostMessage(), SendMessage() and the message queue |
Planned in section 1 |
RegisterClassExA(), built-in classes |
Planned in section 2 |
DefWindowProc() |
Planned in section 3 |
BeginPaint(), EndPaint(), InvalidateRect() |
Planned in section 4 |
ChooseColor(), ChooseFont(), GetOpenFileNameA() |
Planned in section 8 |
DwmSetWindowAttribute() and uxtheme calls |
Planned in section 9 |
How do I use it?
Nothing in this roadmap can be called yet. Native desktop programs use the window manager and control calls directly; Win32 GUI programs have no path to the screen until the subsystem and the user32 stubs land.
Who owns what?
Several roadmaps meet here, and this file states that it does not re-specify the others:
- The
user32andgdi32stubs are the Win32 API Surface roadmap's sections 10 and 11, and the Win32 GDI and USER32 stubs roadmap (08-graphics-ui/TODO-14) owns the GDI object table in its section 2. - The dialogs themselves are
08-graphics-ui/TODO-06section 8; this file only adapts the Win32 structures. - The ALPC and Message Ports roadmap's section 10 defines the CSRSS ApiPort bootstrap and places the server at
src/apps/csrss/csrss.c, talking over ALPC. This file sayssrc/user/csrss/over pipes and shared memory. That is filed as a reconcile item in section 1.
What is not implemented yet?
- Win32 Subsystem Architecture and Message Queue
- Window Class Registry and Built-in Classes
- WndProc Dispatch and DefWindowProc
- Win32 Painting Model
- Message Filters and Accelerator Tables
- Window Subclassing and Property Store
- Inter-Process Window Messaging
- Common Dialog Boxes
- Win11 Visual Opt-In Surface
How does it compare with Windows 11 and Linux?
Windows keeps message queues, window classes and device contexts in win32k.sys, with csrss.exe handling console and process bookkeeping, and exposes Windows 11 styling through DwmSetWindowAttribute(). Linux has no single equivalent: X11 delivers expose events and Wayland delivers damage, and toolkits such as GTK and Qt supply classes and dispatch. Impossible OS plans the Windows programming model on top of its own compositor, so a Win32 program's WM_PAINT draws into the same surfaces native windows use and picks up the same theme.