The Big Picture: Putting It All Together

You have now met every layer one by one. This section stacks them into one map of Windows. Look at it as a building: the hardware is the basement, the kernel is the ground floor with the locked doors, user mode is the open upper floors, and the single staircase between them is the system call.

Keep this page open as a cheat sheet. Later chapters will keep pointing back to it.

9.1 Complete Windows Architecture Visualization

What it is: One picture of the whole of Windows (10 and 11), from your apps down to the hardware.

┌────────────────────────────────────────────────────────────────────────┐
│ USER MODE (ring 3)                                                     │
│ ┌───────────────┐ ┌──────────────┐ ┌──────────────┐ ┌────────────────┐ │
│ │ Applications  │ │ .NET and UWP │ │ Services     │ │ System procs   │ │
│ │ chrome, Word, │ │ apps         │ │ (inside      │ │ smss, csrss,   │ │
│ │ games         │ │              │ │ svchost.exe) │ │ wininit, lsass │ │
│ └───────────────┘ └──────────────┘ └──────────────┘ └────────────────┘ │
│ ┌────────────────────────────────────────────────────────────────────┐ │
│ │ Subsystem DLLs: kernel32, user32, gdi32, advapi32                  │ │
│ └────────────────────────────────────────────────────────────────────┘ │
│ ┌────────────────────────────────────────────────────────────────────┐ │
│ │ ntdll.dll   (Native API: Nt... functions + syscall)                │ │
│ └────────────────────────────────────────────────────────────────────┘ │
╞════════════════════════════════════════════════════════════════════════╡  <- system call (syscall / sysret)
│ KERNEL MODE (ring 0)                                                   │
│ ┌────────────────────────────────────────────────────────────────────┐ │
│ │ EXECUTIVE (ntoskrnl.exe)                                           │ │
│ │ ┌─────────┐        ┌─────────┐       ┌─────────┐       ┌─────────┐ │ │
│ │ │ Object  │        │ Process │       │ Memory  │       │ I/O     │ │ │
│ │ │ Manager │        │ Manager │       │ Manager │       │ Manager │ │ │
│ │ └─────────┘        └─────────┘       └─────────┘       └─────────┘ │ │
│ │ ┌───────────────┐   ┌───────────────┐  ┌─────────┐  ┌────────────┐ │ │
│ │ │ Security Ref. │   │ Configuration │  │ Cache   │  │ PnP and    │ │ │
│ │ │ Monitor       │   │ Manager       │  │ Manager │  │ Power Mgrs │ │ │
│ │ └───────────────┘   └───────────────┘  └─────────┘  └────────────┘ │ │
│ └────────────────────────────────────────────────────────────────────┘ │
│ ┌────────────────────────────────────────────────────────────────────┐ │
│ │ KERNEL (ntoskrnl.exe): scheduler, interrupts, exceptions, locks    │ │
│ └────────────────────────────────────────────────────────────────────┘ │
│ ┌──────────────────────┐                         ┌───────────────────┐ │
│ │ Drivers (.sys)       │                         │ win32k*.sys       │ │
│ │ device, file system, │                         │ windows + drawing │ │
│ │ filter, bus          │                         │ (kernel half)     │ │
│ └──────────────────────┘                         └───────────────────┘ │
│ ┌────────────────────────────────────────────────────────────────────┐ │
│ │ HAL (hal.dll): hides board-level hardware differences              │ │
│ └────────────────────────────────────────────────────────────────────┘ │
└────────────────────────────────────────────────────────────────────────┘
┌────────────────────────────────────────────────────────────────────────┐
│ HARDWARE: CPU, RAM, SSD, GPU, network card, motherboard                │
└────────────────────────────────────────────────────────────────────────┘

How to read it, from top to bottom:

LayerWhat it holdsWhere we studied it
ApplicationsWin32, .NET and UWP programsSections 4.5, 8
Services and system processessvchost.exe, smss.exe, csrss.exe, lsass.exe and othersSections 4.3, 5
Subsystem DLLskernel32, user32, gdi32, advapi32: the Win32 APISections 4.1, 8.1
ntdll.dllNative API and the syscall instructionSections 8.2, 8.5
The wallThe system call, the only legal door from ring 3 to ring 0Section 8.5
ExecutiveThe managers: Object, Process, Memory, I/O, Security, Configuration, Cache, PnP, PowerSections 2.2, 3, 6, 7
KernelScheduler, interrupts, exceptions, locksSection 2.1
Drivers and win32kDevice, file system and filter drivers; windows and drawingSections 2.4, 4.1
HALHides board differencesSection 2.3
HardwareCPU, RAM, disks, GPU, networkChapters 1 to 4

Where the wall is. Notice the double line in the middle. Everything above it can crash without taking Windows with it. Everything below it shares one memory space and has no protection from itself. That is why a bad driver is so dangerous.

9.2 Data Flow Between Components

What it is: A trace of one real action moving through the layers. Here a program saves a file. The same path, with different managers, is used for almost any request: opening a registry key, creating a process or reading from the network.

┌──────────────────────────────────────────────────────────────┐
│ 1. Notepad: user clicks Save, calls WriteFile(...)           │ ring 3
└──────────────────────────────────────────────────────────────┘
                                │
                                ▼
┌──────────────────────────────────────────────────────────────┐
│ 2. kernel32 / kernelbase: checks input, calls NtWriteFile    │ ring 3
└──────────────────────────────────────────────────────────────┘
                                │
                                ▼
┌──────────────────────────────────────────────────────────────┐
│ 3. ntdll: puts service number in EAX, runs 'syscall'         │ ring 3
└──────────────────────────────────────────────────────────────┘
                                │
                                ▼
┌──────────────────────────────────────────────────────────────┐
│ 4. Kernel entry: switch stacks, validate arguments           │ ring 0
└──────────────────────────────────────────────────────────────┘
                                │
                                ▼
┌──────────────────────────────────────────────────────────────┐
│ 5. Object Manager: handle -> file object; SRM check was done │ ring 0
└──────────────────────────────────────────────────────────────┘
                                │
                                ▼
┌──────────────────────────────────────────────────────────────┐
│ 6. I/O Manager: builds an IRP, sends it down the stack       │ ring 0
└──────────────────────────────────────────────────────────────┘
                                │
                                ▼
┌──────────────────────────────────────────────────────────────┐
│ 7. Filter driver -> NTFS driver -> disk driver               │ ring 0
└──────────────────────────────────────────────────────────────┘
                                │
                                ▼
┌──────────────────────────────────────────────────────────────┐
│ 8. HAL / hardware: SSD writes data, raises an interrupt      │ ring 0
└──────────────────────────────────────────────────────────────┘
                                │
                                ▼
┌──────────────────────────────────────────────────────────────┐
│ 9. Interrupt handled; IRP completes; sysret to user mode     │ ring 0
└──────────────────────────────────────────────────────────────┘
                                │
                                ▼
┌──────────────────────────────────────────────────────────────┐
│ 10. WriteFile returns 'success' to Notepad                   │ ring 3
└──────────────────────────────────────────────────────────────┘

What to notice:

  • The request goes down through the layers, then the answer comes back up.
  • Steps 1 to 3 are in user mode. Step 3 ends with the syscall door.
  • Steps 4 to 9 are kernel mode: several managers cooperate (Object Manager, SRM, I/O Manager) and then the drivers.
  • The hardware never talks to your app. It talks to the driver, and the driver answers the I/O Manager.

The same pattern for other requests:

RequestWin32 callKernel managers involved
Read a registry valueRegQueryValueExObject Manager, SRM, Configuration Manager
Start a programCreateProcessProcess Manager, Memory Manager, Object Manager
Allocate memoryVirtualAllocMemory Manager
Send network datasend (Winsock)I/O Manager, network drivers
Draw a windowCreateWindowEx / BitBltwin32k and the graphics driver

A second flow: how the system builds itself at start-up (the "family tree" of Section 5, in order):

┌──────────────────────────────────────────────────────────────┐
│ ntoskrnl.exe + hal.dll + drivers start (boot loader hands over) │ ring 0
└──────────────────────────────────────────────────────────────┘
                                │
                                ▼
┌──────────────────────────────────────────────────────────────┐
│ System process (PID 4) runs the kernel worker threads        │ ring 0
└──────────────────────────────────────────────────────────────┘
                                │
                                ▼
┌──────────────────────────────────────────────────────────────┐
│ smss.exe: first user-mode process, builds sessions           │ ring 3
└──────────────────────────────────────────────────────────────┘
                                │
                                ▼
┌──────────────────────────────────────────────────────────────┐
│ csrss.exe + wininit.exe (session 0); csrss + winlogon (session 1) │ ring 3
└──────────────────────────────────────────────────────────────┘
                                │
                                ▼
┌──────────────────────────────────────────────────────────────┐
│ services.exe -> svchost.exe;  lsass.exe checks your logon    │ ring 3
└──────────────────────────────────────────────────────────────┘
                                │
                                ▼
┌──────────────────────────────────────────────────────────────┐
│ winlogon -> userinit.exe -> explorer.exe: you see the desktop │ ring 3
└──────────────────────────────────────────────────────────────┘

9.3 Which Parts Run in Kernel vs User Mode

What it is: A final sorting table. For every part you learned, is it ring 0 or ring 3?

ComponentModeNotes
ntoskrnl.exe (Kernel + Executive)Kernel (ring 0)The heart of Windows
hal.dllKernelBoard-level hardware layer
Device drivers (.sys)KernelFast but dangerous; a bug can blue-screen the PC
win32k*.sysKernelThe core of windows and drawing
Object, Process, Memory, I/O, Cache managers, SRM, Configuration Manager, PnP, PowerKernelThe Executive managers
System process (PID 4)Kernel threads onlyA "home" for kernel work
ntdll.dllUser (ring 3)Calls the kernel through syscall
kernel32, user32, gdi32, advapi32UserThe Win32 API
smss.exe, csrss.exe, wininit.exe, winlogon.exeUserSystem processes, but still ring 3
services.exe, svchost.exeUserServices and their host
lsass.exeUserLogon checking
explorer.exeUserDesktop and taskbar
Your apps (Win32, .NET, UWP)UserLimited by token and ACLs
User-mode drivers (UMDF)UserSafer drivers that run in a host process

Three rules of thumb:

  1. .exe and .dll files are usually user mode. .sys files are kernel mode. The big exceptions are ntoskrnl.exe and hal.dll, which are kernel mode.
  2. "SYSTEM account" does not mean "kernel mode". Many programs run as the SYSTEM user but still live in ring 3.
  3. The dividing line is the CPU's ring, not how important a program is. lsass.exe is vital but is just a ring 3 program.

Why the split exists. Remember three big ideas from earlier chapters: rings (the CPU enforces who may do what), virtual memory (each process has its own private map), and system calls (the one controlled door). Windows is those three ideas turned into a working design.

Windows tip: In Task Manager's Performance tab, turn on Show kernel times (right-click the CPU graph). The darker line is ring 0 time and the lighter area is ring 3 time. Most of the time, ring 3 should dominate.

Summary

TopicRemember this
The whole pictureHardware → HAL → Kernel, Executive and drivers → (system call) → ntdll → Win32 DLLs → services and apps
The wallThe system call is the only door between ring 3 and ring 0
Data flowRequests go down through the layers and answers come back up
Kernel modentoskrnl.exe, hal.dll, .sys drivers, win32k
User modeEverything else: DLLs, system processes, services, apps
Quick test.sys = kernel; .exe / .dll = user (except ntoskrnl.exe and hal.dll)