Windows 2000 (NT 5.0, febbraio 2000) è il **spartiacque tra l'era NT enterprise e l'era consumer moderna**. Costruito su NT 4.0 (kernel 4.0), introduce: Active Directory, MMC, Group Policy, DFS, EFS, Kerberos, LDAP, DHCP/DNS/WINS integrati, Plug & Play, USB, FireWire, DirectX 7, Windows Installer, WMI, WSH, recupero sistema, hibernation, driver signing, WFP. Ecco l'architettura interna.
1. Kernel Mode: Executive + Kernel + HAL + Driver
Architettura **monolitica modulare**: la maggior parte dei servizi OS gira in kernel mode (Ring 0) per performance, ma strutturata in componenti distinti con interfacce formali.
Kernel (ntoskrnl.exe) — nucleo non-paginabile, non-preemptible (mostly)
- Dispatcher: Scheduler (priority-based, 32 livelli real-time + 16 variabili), dispatcher database (ready queues per CPU, wait queues), context switch, DPC (Deferred Procedure Call), APC (Asynchronous Procedure Call), timer (absolute, relative, periodic).
- Trap/Exception/Interrupt handling: IDT, trap frames, exception dispatching (KiDispatchException), bug check (KeBugCheckEx → BSOD).
- Synchronization: Spinlock (queued, in-stack), mutex (kernel mutant), fast mutex, pushlock (Vista+), ERESOURCE (shared/exclusive), interlocked operations (atomic), memory barriers.
- Memory management (core): PFN database (page frame number), working set manager, balance set manager, modified page writer, mapped page writer, page fault handler (demand zero, copy-on-write, transition, prototype, paged pool).
- Object Manager (core types): Object header, type descriptors (Process, Thread, File, Section, Port, Event, Mutant, Semaphore, Timer, Token, Job, Device, Driver, Controller, Adapter, Arc, SymbolicLink, Directory, Key, Callback, IoCompletion, WaitCompletion, EtwRegistration, DxgkSharedResource, etc.), namespace (\ObjectTypes, \Directory, \SymbolicLink, \Device, \Driver, \File, \Global??, \KernelObjects, \KnownDlls, \Nls, \ObjectTypes, \Registry, \Security, \Sessions, \Windows).
Executive Services (in ntoskrnl.exe, esportati come routine di sistema)
| Componente | Funzione | Strutture chiave | |
|---|---|---|---|
| I/O Manager | IRP (I/O Request Packet) lifecycle: create, read, write, device control, fsctl, cleanup, close, pnp, power, query/set info. Driver stack (device objects, driver objects, filter drivers). Completion routines. Cancel-safe queues. Asynchronous I/O (event, APC, IOCP). | IRP, DEVICE_OBJECT, DRIVER_OBJECT, FILE_OBJECT, VPB, FCB/CCB | |
| Memory Manager | Virtual address space (per process, system, session), section objects (mapped files, shared memory, images), page file management, memory mapped I/O, large pages, AWE (Address Windowing Extensions), working set tuning, prototype PTEs, clone (fork-like via section copy-on-write). | VAD (Virtual Address Descriptor), PTE, PFN, SECTION, CONTROL_AREA, SUBSECTION | |
| Process/Thread Manager | Process creation (PspCreateProcess → NtCreateProcessEx), thread creation, job objects (resource limits, accounting), protected process (DRM, anti-cheat), fiber (user-mode scheduling), UMS (User-Mode Scheduling, 7+). Token (access token, privileges, groups, integrity level, claims, restricted SIDs, capabilities, AppContainer). | EPROCESS, ETHREAD, EJOB, TOKEN, KPROCESS, KTHREAD | |
| Security Reference Monitor (SRM) | Access validation (SeAccessCheck), DACL/SACL evaluation, privilege check (SeSinglePrivilegeCheck), mandatory integrity control (MIC, Vista+ backport?), audit generation, token filtering, impersonation, restricted tokens, capability SIDs. | SECURITY_DESCRIPTOR, ACL, ACE, SID, TOKEN, PRIVILEGE_SET, GENERIC_MAPPING | |
| Cache Manager | File system cache (system cache, not per-file). Read-ahead, write-behind (lazy writer), purge, mapped file I/O (section objects), pinning (fast I/O), BCB (Buffer Control Block), VACB (Virtual Address Control Block). Coherency con filesystem (FSRTL). | VACB, BCB, SHARED_CACHE_MAP, PRIVATE_CACHE_MAP | |
| Configuration Manager (Registry) | Hive files (SYSTEM, SOFTWARE, SAM, SECURITY, DEFAULT, user NTUSER.DAT, USRCLASS.DAT). Cell-based allocation (bins, cells). Transactional (log + base). Key control blocks (KCB), delayed close, notify (RegNotifyChangeKeyValue). | HBIN, HCELL, KCB, CM_KEY_BODY, CM_KEY_CONTROL_BLOCK | |
| Plug & Play Manager | Device enumeration (bus drivers: PCI, ACPI, USB, PCMCIA, ISAPNP, 1394), resource allocation (IRQ, I/O port, memory, DMA, bus number), device tree (\Device\...), driver loading (AddDevice, StartDevice), surprise removal, eject, device relations (bus, ejection, power, target, removal). | DEVICE_OBJECT, DEVICE_NODE, PNP_IRP (IRP_MN_START_DEVICE, QUERY_RESOURCES, QUERY_RESOURCE_REQUIREMENTS, FILTER_RESOURCE_REQUIREMENTS, STOP_DEVICE, REMOVE_DEVICE, SURPRISE_REMOVAL, EJECT, QUERY_INTERFACE, QUERY_CAPABILITIES, QUERY_ID, QUERY_PNP_DEVICE_STATE, QUERY_LEGACY_BUS_INFORMATION) | |
| Power Manager | System power states (S0, S1, S2, S3, S4, S5), device power states (D0-D3), processor power states (C0-C3, P-states), wake capabilities, idle detection, policy (user, admin, system), hibernation (S4) — memory image to hiberfil.sys, resume. | POP_POLICY, DEVICE_CAPABILITIES, SYSTEM_POWER_STATE, DEVICE_POWER_STATE |
| Sottosistema | Processo server | Client API | Ruolo |
|---|---|---|---|
| Win32 (Primary) | csrss.exe (Client/Server Runtime SubSystem) + win32k.sys (kernel-mode GUI/GDI/USER) | Win32 API (kernel32.dll, user32.dll, gdi32.dll, advapi32.dll, shell32.dll, comctl32.dll, comdlg32.dll, version.dll, winmm.dll, winspool.drv, ole32.dll, oleaut32.dll, rpcrt4.dll, msvcrt.dll, ntdll.dll) | Finestre, messaggi, GDI, controlli, menu, clipboard, shell, processo/thread, file, registry, sicurezza, memoria, I/O, tempo, DLL, COM, RPC, multimedia, stampa. 99% applicazioni Windows. |
| POSIX | psxss.exe | POSIX.1 API (IEEE 1003.1) — subset limitato | Portabilità app UNIX conformi. Deprecato (rimosso in XP/2003). Interix / SFU (Services for UNIX) forniva implementazione completa separata. |
| OS/2 | oso2ss.exe | OS/2 1.x API (subset) | Legacy. Rimosso in XP. |
| Security (LSA) | lsass.exe (Local Security Authority SubSystem Service) | Security API (secur32.dll, msv1_0.dll, kerberos.dll, schannel.dll, negotiate.dll, pku2u.dll, wdigest.dll, cloudap.dll) | Autenticazione (logon, NTLM, Kerberos, TLS/SSL, PKU2U, Cloud AP), autorizzazione, token, credenziali (cached, DPAPI), policy (account, password, audit, kerberos),/packages (Negotiate, NTLM, Kerberos, Schannel, Digest, PKU2U, CloudAP). |