Windows 2000 System Architecture (continued) Computing Department, Lancaster University, UK.

Slides:



Advertisements
Similar presentations
Windows Operating System Internals - by David A. Solomon and Mark E. Russinovich with Andreas Polze CSE 5343/7343 Fall 2006 Case Studies Windows XP Structure/Processes.
Advertisements

Operating System Security : David Phillips A Study of Windows Rootkits.
Chapter 6 Security Kernels.
1 Module 1 The Windows NT 4.0 Environment. 2  Overview The Microsoft Operating System Family Windows NT Architecture Overview Workgroups and Domains.
计算机系 信息处理实验室 Leture1 concepts and tools 2005 Spring 陈香兰.
Slide 6-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 6 Implementing Processes, Threads, and Resources.
Home: Phones OFF Please Unix Kernel Parminder Singh Kang Home:
Process Management. External View of the OS Hardware fork() CreateProcess() CreateThread() close() CloseHandle() sleep() semctl() signal() SetWaitableTimer()
Figure 1.1 Interaction between applications and the operating system.
Chapter 6 Implementing Processes, Threads, and Resources.
Slide 6-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 6.
Chapter 6 - Implementing Processes, Threads and Resources Kris Hansen Shelby Davis Jeffery Brass 3/7/05 & 3/9/05 Kris Hansen Shelby Davis Jeffery Brass.
Slide 3-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 3 Operating System Organization.
© Neeraj Suri EU-NSF ICT March 2006 Budapesti Műszaki és Gazdaságtudományi Egyetem Méréstechnika és Információs Rendszerek Tanszék Zoltán Micskei
计算机系 信息处理实验室 Lecture 2 System architecture
Introduction to Windows System Internals part II by Tim Shelton Black Security
Stack Management Each process/thread has two stacks  Kernel stack  User stack Stack pointer changes when exiting/entering the kernel Q: Why is this necessary?
Slide 6-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 6.
Windows 2000 Memory Management Computing Department, Lancaster University, UK.
Chapter 8 Windows Outline Programming Windows 2000 System structure Processes and threads in Windows 2000 Memory management The Windows 2000 file.
MODERN OPERATING SYSTEMS Third Edition ANDREW S. TANENBAUM Chapter 11 Case Study 2: Windows Vista Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 2: System Structures.
Protection and the Kernel: Mode, Space, and Context.
ICOM Noack Operating Systems - Administrivia Prontuario - Please time-share and ask questions Info is in my homepage amadeus/~noack/ Make bookmark.
Kernel, processes and threads Windows and Linux. Windows Architecture Operating system design Modified microkernel Layered Components HAL Interacts with.
Architecture Support for OS CSCI 444/544 Operating Systems Fall 2008.
Introduction to Operating Systems Chapter 1. cs431 -cotter2 Lecture Objectives Understand the relationship between computing hardware, operating system,
 Create an abstract machine environment  A nicer environment than bare hardware  Consists of multiple, autonomous abstract components  Components.
Operating Systems ECE344 Ashvin Goel ECE University of Toronto OS-Related Hardware.
April 2000Dr Milan Simic1 Network Operating Systems Windows NT.
Chapter 2 Operating System Overview
Windows 2000 Course Summary Computing Department, Lancaster University, UK.
Windows 2000 System Mechanisms Computing Department, Lancaster University, UK.
Advanced Design and System Patterns The Microkernel Pattern.
Ihr Logo Operating Systems Internals & Design Principles Fifth Edition William Stallings Chapter 2 (Part II) Operating System Overview.
Operating Systems Lecture November 2015© Copyright Virtual University of Pakistan 2 Agenda for Today Review of previous lecture Hardware (I/O, memory,
Processes Introduction to Operating Systems: Module 3.
© 2004, D. J. Foreman 1 Implementing Processes and Threads.
UNIX Unit 1- Architecture of Unix - By Pratima.
System Components ● There are three main protected modules of the System  The Hardware Abstraction Layer ● A virtual machine to configure all devices.
Hardware process When the computer is powered up, it begins to execute fetch-execute cycle for the program that is stored in memory at the boot strap entry.
2 Processor(s)Main MemoryDevices Process, Thread & Resource Manager Memory Manager Device Manager File Manager.
Overview of Windows Driver Development Reference: us/gstart/hh/gstart/gs_intro_031j.asp.
MiM Project Progress Report Slides by Jonathan Leach.
S ALVATORE DI G IROLAMO (TA) Networks and Operating Systems: Exercise Session 1.
Introduction to Operating Systems Concepts
Hardware and OS Design and Layout.
Windows API.
Protection of System Resources
Operating Systems: A Modern Perspective, Chapter 6
Unit OS2: Operating System Principles
KERNEL ARCHITECTURE.
Threads and Locks.
System Structure and Process Model
Chapter 3: Windows7 Part 1.
System Structure and Process Model
Chapter 3: Windows7 Part 2.
Windows Internals Brown-Bag Seminar Chapter 1 – Concepts and Tools
OS Organization.
More examples How many processes does this piece of code create?
Chapter 3: Windows7 Part 2.
Mid Term review CSC345.
B.Ramamurthy Chapter 2 : Appendix
Operating Systems Lecture 3.
Operating Systems: A Modern Perspective, Chapter 3
Implementing Processes, Threads, and Resources
CS510 Operating System Foundations
Outline Operating System Organization Operating System Examples
Operating Systems Structure
Interrupts and System Calls
Presentation transcript:

Windows 2000 System Architecture (continued) Computing Department, Lancaster University, UK

Overview Goals Goals –Highlight the “undocumented” functions of the Windows 2000 Executive/Kernel –Review system processes and system start-up procedure

Peering into the Unknown

NTOSKRNL.EXE Core operating system image Core operating system image –Contains Executive and Kernel –Functions exposed to user mode via NtDll.Dll and environment subsystems –Four retail variations: NTOSKRNL.EXEUniprocessor NTOSKRNL.EXEUniprocessor NTKRNLMPMultiprocessor NTKRNLMPMultiprocessor NTKRNLPAUniprocessor with PAE* NTKRNLPAUniprocessor with PAE* NTKRPAMPMultiprocessor with PAE* NTKRPAMPMultiprocessor with PAE* *PAE stands for Physical Address Extensions

Naming Convention for Internal Windows 2000 Routines Two/three letter component code in beginning of function name Two/three letter component code in beginning of function name PrefixComponent Cc Cache Manager Ex Executive Support Routines Hal Hardware Abstraction Layer Io I/O Subsystem KeKernel Lsa Security Authentication Mm Memory Manager Ps Process support Rtl Run-time library

Listing Undocumented Functions Dump the export/import tables of an image using Dependency Walker (depends.exe) Dump the export/import tables of an image using Dependency Walker (depends.exe) –Contained in Windows 2000 Support Tools & Platform SDK View functions in Ntdll.dll View functions in Ntdll.dll –Lists system functions available to user-mode subsystems Contrast with those actually available within the subsystem Contrast with those actually available within the subsystem

Invoking System Functions from User Mode Kernel-mode functions are invoked from user mode via a protected mechanism Kernel-mode functions are invoked from user mode via a protected mechanism –x86: INT 2E –On a call to an OS service from user mode, the last thing that happens in user mode is the “change mode to kernel” instruction –Causes an interrupt, handled by the system service dispatcher in kernel mode –Return to user mode is done by dismissing the interrupt

Invoking a Win32 Kernel API Call WriteFile(…) Call NtWriteFile Return to caller Int 2E Return to caller Call NtWriteFile Dismiss interrupt Do the operation Return to caller User Kernel Win32 application WriteFile in Kernel32.dll NtWriteFile in NTDll.dll KiSystemService in NtosKrnl.exe NtWriteFile in NtosKrnl.exe Win32-specific Used by all subsystems software interrupt

Invoking System Functions from User Mode Desired system function is selected by the “system service number” Desired system function is selected by the “system service number” –Every function exported to user mode has a unique number –This is pushed onto the stack just before the “change mode” instruction –System service numbers are undocumented “Wrapped up” by procedures in NTDLL.DLL, USER32.DLL and GDI32.DLL “Wrapped up” by procedures in NTDLL.DLL, USER32.DLL and GDI32.DLL

API Differences Win32 vs. NtDll.Dll Win32 vs. NtDll.Dll –Win32 “kernel” APIs exported by Kernel32.dll are different from the “native API” in NtDll.Dll Different arguments (but similar) Different arguments (but similar) –Routines in Kernel32.dll rearrange arguments and call routines in NtDll.dll –NtDll.dll uses change mode mechanism (INT 2E) to transfer to kernel mode

Where is the Code? FilenameComponents NTOSKRNL.EXE Executive and Kernel HAL.DLL Hardware Abstraction Layer WIN32K.SYS Kernel-mode part of the Win32 subsystem NTDLL.DLL Internal support functions / system service dispatch stubs to executive functions KERNEL32.DLL, ADVAPI32.DLL, USER32.DLL, GDI32.DLL Core Win32 subsystem DLLs Export Win32 Entry Points

Executive Services API I/O System Security Monitor Processes/ Threads Object Services Memory Mgmt Win32 GDI Exec. RTL Device Drivers Hardware Abstraction Layer (HAL) Kernel Object Management File Systems I/O Devices DMA/Bus Control Cache Control Clocks/ Timers Privileged Architecture Interrupt Dispatch Windows 2000 Architecture User Kernel System Processes ServicesUser Apps Environment Subsystems Subsystem DLLInterface DLL Session Mgr WinLogon Replicator Alerter Event Log Win32 POSIX OS/2 NTOSKRNL.EXE

System Processes

Process-Based Windows 2000 Code Pieces of Windows 2000 that run in separate executables (.exe’s) in their own processes Pieces of Windows 2000 that run in separate executables (.exe’s) in their own processes –Started by system –Not tied to a user logon Three types: Three types: –Environment Subsystems –System start-up processes –Win32 Services

Process Creation Hierarchy tlist.exe /t tlist.exe /t If parent not alive, left justifies process If parent not alive, left justifies process –Cannot see creator if creator is gone! e.g. explorer.exe’s parent is dead e.g. explorer.exe’s parent is dead

System Start-up Processes (1) First two processes are not real processes! First two processes are not real processes! –Not running a user mode.EXE –No user-mode address space (Idle)Process id 0 Part of the loaded system image Home for idle threads Also called “System Process” in many displays (System)Process id 8 Part of the loaded system image Home for kernel-defined threads Thread 0 launches the first “real” process, by running smss.exe (Session Manager)

System Start-up Processes (2) winlogon.exeLogon process: Launches services & lsass.exe; Presents first login prompt. When someone logs in, launches Userinit services.exeService Controller; Starts/stops Windows 2000 services (e.g. Event Log) lsass.exeLocal Security Authentication Server userinit.exeStarted after logon; starts explorer.exe and exits explorer.exeand its children are the creators of all interactive apps smss.exeSession Manager The first “created” process Launches required subsystems (csrss) and then winlogon csrss.exeWin32 subsystem