The Big Picture: From Keystroke to Desktop
You press a key, type a password, press Enter, and a second later your desktop appears. It feels like one step. Under the hood, about ten parts of Windows pass your request along, like runners in a relay race. Each runner does one job and hands the baton to the next.
This section ties together everything in Chapter 24: accounts (Section 1), tokens (Section 3), SIDs (Section 4), protocols (Section 6) and credentials (Section 7).
Here is the whole chain on one page:
┌──────────────────────────────────────────────────────────────────┐
│ 1. KEYBOARD (interrupt, then the keyboard driver) │
│ Keystrokes travel through the kernel input path │
└──────────────────────────────────────────────────────────────────┘
│
▼
┌──────────────────────────────────────────────────────────────────┐
│ 2. WINLOGON.EXE (Secure Attention Sequence: Ctrl+Alt+Del) │
│ Switches to the secure sign-in desktop │
└──────────────────────────────────────────────────────────────────┘
│
▼
┌──────────────────────────────────────────────────────────────────┐
│ 3. LOGONUI.EXE (draws the sign-in screen) │
│ Loads the credential providers: password, PIN, Hello, card │
└──────────────────────────────────────────────────────────────────┘
│
▼
┌──────────────────────────────────────────────────────────────────┐
│ 4. CREDENTIAL PROVIDER (packages what you typed) │
│ Hands the credentials back to Winlogon │
└──────────────────────────────────────────────────────────────────┘
│
▼
┌──────────────────────────────────────────────────────────────────┐
│ 5. LSASS.EXE (Local Security Authority) receives them │
│ Chooses an authentication package │
└──────────────────────────────────────────────────────────────────┘
│
▼
┌──────────────────────────────────────────────────────────────────┐
│ 6. AUTHENTICATION PACKAGE │
│ MSV1_0 (local / NTLM) or Kerberos (domain) │
└──────────────────────────────────────────────────────────────────┘
│
▼
┌──────────────────────────────────────────────────────────────────┐
│ 7. ACCOUNT DATABASE │
│ Local: SAM (hashes) or Domain: domain controller (AD) │
└──────────────────────────────────────────────────────────────────┘
│
▼
┌──────────────────────────────────────────────────────────────────┐
│ 8. LSASS BUILDS: logon session + ACCESS TOKEN │
│ user SID, group SIDs, privileges, integrity level │
└──────────────────────────────────────────────────────────────────┘
│
▼
┌──────────────────────────────────────────────────────────────────┐
│ 9. WINLOGON starts USERINIT.EXE with that token │
│ userinit sets up your profile, then starts the shell │
└──────────────────────────────────────────────────────────────────┘
│
▼
┌──────────────────────────────────────────────────────────────────┐
│ 10. EXPLORER.EXE = your desktop, running with your token │
│ Every program you start gets a copy of the token │
└──────────────────────────────────────────────────────────────────┘
Now let us walk through it, step by step.
8.1 Winlogon Captures Input (Secure Attention Sequence)
What it is: Winlogon (winlogon.exe) is the Windows program that manages sign-in and sign-out. It runs as SYSTEM, from the moment the PC boots, and it owns a separate, protected desktop just for sign-in.
Before you type anything:
- The keyboard sends an interrupt (Chapter 4). The keyboard driver reads the key and passes it up through the kernel.
- On a PC set to require it, you press Ctrl + Alt + Del. This special key combination is called the Secure Attention Sequence (SAS).
- Windows treats the SAS as a direct line to Winlogon. No normal program can intercept or fake it.
Why a special key combination? Imagine a thief puts a fake sign-in screen on top of the real one, to steal your password. The SAS defeats this: when you press Ctrl+Alt+Del, Windows itself (not any app) answers and shows the real screen on the protected desktop. A program cannot draw on that desktop.
Hedge: home PCs usually skip the SAS requirement and go straight to the sign-in screen. Company PCs often require it. The protected desktop is used in both cases.
LogonUI and credential providers. Winlogon does not draw the screen itself. It starts LogonUI (LogonUI.exe), a helper that draws the sign-in screen and loads the credential providers.
A credential provider is a small plug-in that offers one way to sign in and collects the proof:
| Credential provider | What it collects |
|---|---|
| Password | User name and password |
| PIN | Your Windows Hello PIN |
| Fingerprint / Face | A biometric scan (Windows Hello) |
| Smart card | A card or security key plus its PIN |
The icons you see under "Sign-in options" are exactly these providers. When you type, the provider packages the credentials and gives them back to Winlogon.
Windows tip: You can see winlogon.exe (and LogonUI.exe while the sign-in screen shows) in Task Manager → Details. Winlogon always runs with user name SYSTEM.
8.2 LSASS Receives Credentials
What it is: Winlogon does not check your password. It forwards the credentials, by an internal call, to LSASS (lsass.exe). LSASS is the Local Security Authority Subsystem Service, the central "security office" of Windows.
LSASS has many jobs:
| Job | Meaning |
|---|---|
| Checks sign-ins | Passes credentials to authentication packages |
| Builds tokens | Creates the logon session and access token |
| Applies security policy | For example password rules, which accounts get which privileges |
| Writes security audit events | For example the Security log entries for sign-in success and failure |
Why is LSASS so important (and protected)? It holds the facts that prove identity for signed-in users. For this reason Windows protects it heavily: it runs as SYSTEM, and recent Windows versions can run it as a protected process (a process that even administrators cannot freely inspect) and with extra isolation features. Hedge: which protections are on depends on your Windows version and settings.
A sign you must never ignore: lsass.exe should exist once, in C:\Windows\System32, run as SYSTEM. A second copy, a different folder, or a similar-looking name such as lsas.exe is a warning sign worth investigating with your antivirus.
8.3 Authentication Package Validates (Local SAM or Domain Controller)
What it is: LSASS now hands the credentials to the right authentication package (Section 6) and waits for a yes or no.
| Account type | Package | Who gives the final answer |
|---|---|---|
| Local account | MSV1_0 (the NTLM-style package) | The SAM database on this PC |
| Domain account | Kerberos (or NTLM as a fallback) | The domain controller (Active Directory) |
| Microsoft account | Online path through cloud authentication packages | Microsoft's online service (or a cached verifier offline) |
| PIN / fingerprint / face | Windows Hello path, which uses a device key in the TPM | The device key signature is checked (local or online) |
The local-account check in simple words:
LSASS ──► MSV1_0 ──► hashes what you typed
│
▼
compare with the stored hash in the SAM
(HKLM\SAM, protected, hashes only)
│
match ───┴─── no match
│ │
"valid user" "wrong password" (login fails)
The domain check in simple words: your PC contacts the domain controller, using Kerberos. It proves you know the password, and receives a TGT (Section 6.2). If the PC cannot reach the DC (for example you are on a laptop away from the office), Windows may allow a sign-in using a cached copy of your earlier successful sign-in, so laptops still work offline.
If the check fails: LSASS reports the failure to Winlogon, which shows an error such as "The password is incorrect." LSASS also writes an audit event (see below). Windows may also count failed attempts, and some accounts lock out after too many wrong guesses (a safety feature set by policy).
Windows tip (needs administrator rights, hedge: depends on audit settings): In Event Viewer → Windows Logs → Security, sign-in success is event 4624 and failure is event 4625. Reading these is a good way to see sign-ins on your own PC.
8.4 Access Token Generated
What it is: If the check succeeds, LSASS creates the user's identity for this session, as described in Section 3.2.
LSASS:
- Looks up your user SID and all group SIDs (local groups, and domain groups if any).
- Adds the privileges your account is granted.
- Sets the integrity level (Medium for standard users; administrators get a filtered Medium token, plus a linked full token for UAC).
- Creates a logon session with a unique ID.
- Creates the access token tied to that session.
- Returns the token to Winlogon.
success ──► LSASS collects: SID + groups + privileges + integrity
│
▼
[ LOGON SESSION ]──►[ ACCESS TOKEN ]──► back to Winlogon
Remember (Section 3.2): the token is a snapshot. Group changes made later do not appear until your next sign-in.
8.5 Explorer.exe Launched with That Token
What it is: With the token in hand, Winlogon builds your desktop.
- Winlogon loads your user profile (your settings and files from
C:\Users\<you>, and your own part of the registry, calledHKEY_CURRENT_USER). - It starts userinit.exe, a short-lived program that runs logon scripts and policy items, then starts the shell.
- The shell is explorer.exe. It draws the taskbar, Start menu and desktop icons.
userinit.exethen exits, which is why you seeexplorer.exesitting with no visible parent in Task Manager.
The vital point: explorer.exe runs with your token. In Task Manager's Details tab, the User name column for explorer.exe shows you, not SYSTEM.
Winlogon (SYSTEM) ──► userinit.exe (your token) ──► explorer.exe (your token)
│
└─ exits after starting the shell
Services, by contrast, start earlier in the boot, belong to other logon sessions (SYSTEM, LOCAL SERVICE and so on), and do not wait for you to sign in.
8.6 Every Subsequent Process Inherits or Derives from That Token
What it is: From now on, everything you start is a child of something that has your token.
explorer.exe (your token)
├─ chrome.exe (a copy of your token; its tabs get RESTRICTED copies)
├─ notepad.exe (a copy of your token)
└─ cmd.exe (a copy of your token)
└─ ping.exe (a copy again)
Rules to remember:
| Event | Token result |
|---|---|
| You double-click a program | New process gets a copy of your token |
| A program starts another | Child inherits the parent's token |
| You choose Run as administrator and accept UAC | New process gets the elevated token |
| A sandboxed app (such as a browser tab) starts | Gets a restricted token (less than yours) |
| You choose Run as a different user | A new logon and a new token are created |
| You open a file | Kernel compares this token with the file's DACL (Section 5) |
The full story in a sentence: You prove who you are once; Winlogon, LogonUI and LSASS check it; LSASS builds a token; and every program you run carries that token, so Windows can quickly decide what each program may touch.
Sign out and what happens: When you sign out, Winlogon ends your processes, LSASS closes the logon session, and the token is discarded. The next sign-in creates a fresh, new one.
Lock vs sign out vs switch user:
| Action | Your programs | Token / session |
|---|---|---|
Lock (Win + L) | Keep running | Session stays; screen is hidden behind the sign-in screen |
| Switch user | Keep running | Your session stays alive; another user gets a new one |
| Sign out | Closed | Session and token are destroyed |
Summary
| Step | Who | What happens |
|---|---|---|
| Input | Keyboard + driver | Keystrokes reach the kernel |
| 8.1 | Winlogon + LogonUI | Secure screen, credential provider gathers proof |
| 8.2 | LSASS | Receives credentials, picks a package |
| 8.3 | MSV1_0 or Kerberos | Checks the SAM or asks the domain controller |
| 8.4 | LSASS | Builds logon session and access token |
| 8.5 | Winlogon, userinit.exe | Starts explorer.exe with the token |
| 8.6 | Every process | Inherits or derives from the token |
| Audit | LSASS | Writes events 4624 (success) / 4625 (failure) |