Windows NT 5 0 New Architecture And APIs

  • Slides: 96
Download presentation
Windows NT 5. 0: New Architecture And APIs ® Jeffrey Richter Trainer / Consultant

Windows NT 5. 0: New Architecture And APIs ® Jeffrey Richter Trainer / Consultant / Author

Jeffrey Richter u Author l l l Advanced Windows, 3 rd Edition, Microsoft Press,

Jeffrey Richter u Author l l l Advanced Windows, 3 rd Edition, Microsoft Press, 1996 Windows 95: A Developer’s Guide, M & T Books, 1995 Contributing Editor to Microsoft Systems Journal and Microsoft Interactive Developer u Training: www. Sol. Sem. com u Consulting: www. Jeffrey. Richter. com

Windows NT 5. 0 Feature Overview u u This session offers a brief introduction

Windows NT 5. 0 Feature Overview u u This session offers a brief introduction to many of the new features of Windows NT 5. 0 The purpose is to help you decide which sessions you’d like to attend during the rest of the conference

Windows NT Setup

Windows NT Setup

Setup u u u No questions asked upgrade Can upgrade from Windows® 95/98 Accessibility

Setup u u u No questions asked upgrade Can upgrade from Windows® 95/98 Accessibility Plug and Play detection of hardware Safe boot (F 8) l Safe mode, safe mode w/networking, safe mode w/command prompt, last known good config. , directory services restore mode (DC only), debugging mode, Intelli. Mirror™

Migration DLLs u u u Allows Windows 95/98 -installed app to be fully functional

Migration DLLs u u u Allows Windows 95/98 -installed app to be fully functional when user upgrades to Windows NT 5. 0 Called on Windows 95/98 and Windows NT 5. 0 side of setup Called for every user DLL should fix registry, copy/move files Register the migration DLL l u HKLM/Software/Microsoft/ Current. Version/Setup/Migration DLLs l My. App. Name = C: Migration. Dll. Pathname DLL must be digitally signed

Hardware Support

Hardware Support

General Hardware Support u u u Plug and Play New INF file format for

General Hardware Support u u u Plug and Play New INF file format for device drivers WDM: Windows Driver Model l u Common architecture for Windows 98 and Windows NT 5. 0 Device Manager (similar to Windows 95/98)

Hardware Devices u u u u USB: Universal Serial Bus IEEE 1394: Firewire Fibre

Hardware Devices u u u u USB: Universal Serial Bus IEEE 1394: Firewire Fibre Channel (1 GB/sec transfer) Infrared DVD video/ROM support AGP: Advanced Graphics Port Broadcast PC (TV) Fax

Plug and Play Messages WM_DEVICECHANGE u w. Param (event type) l l l u

Plug and Play Messages WM_DEVICECHANGE u w. Param (event type) l l l u u Add device (DBT_DEVICEARRIVAL) Remove device (DBT_DEVICEQUERYREMOVE, …) Configuration change (dock -> undocked) (DBT_CONFIGCHANGED) l. Param (ptr to event-specific structure) Return TRUE / BROADCAST_QUERY_DENY

Power Management

Power Management

Goals u Conserve battery power l u u u Without data corruption/loss Apps are

Goals u Conserve battery power l u u u Without data corruption/loss Apps are notified of power-related events Apps can retrieve power status Apps can inform Windows of power requirements

System Power Status u Status Notifications l l u AC/battery, low power WM_POWERBROADCAST, PBT_APMPOWERSTATUSCHANGE

System Power Status u Status Notifications l l u AC/battery, low power WM_POWERBROADCAST, PBT_APMPOWERSTATUSCHANGE Get. System. Power. Status() l l Battery or AC Battery power (critical, low, high, charging) Remaining battery life Battery life on full charge

Suspending the Machine Set. System. Power. State() u u Pass RAM/hibernate, force PBT_APMQUERYSUSPEND l

Suspending the Machine Set. System. Power. State() u u Pass RAM/hibernate, force PBT_APMQUERYSUSPEND l u PBT_APMSUSPEND l u TRUE / BROADCAST_QUERY_DENY No UI, save removable drive files On power-up, apps get notification l l l PBT_RESUMEAUTOMATIC (fax arrived) PBT_APMRESUMESUSPEND (user present) PBT_APMRESUMECRITICAL (new battery)

Power State Summary ON Processes running Devices on as needed Set. System. Power. State

Power State Summary ON Processes running Devices on as needed Set. System. Power. State Idle timer Low battery Exit. Windows. Ex Power button SLEEPING Processes suspended Devices off RAM maintained by power HIBERNATING RAM saved to disk Processes suspended No power usage OFF No saved state No power usage User input Waitable timers Device Power button

Multiple Monitor Support

Multiple Monitor Support

Three Methods u Virtual desktop: Each monitor is part of a single desktop l

Three Methods u Virtual desktop: Each monitor is part of a single desktop l l u u User configures size/position of each monitor Windows move between monitors Screen duplication/remote display: Each screen shows the same thing Multiple independent displays: Apps have exclusive access to a display l Games, presentation

Virtual Desktop u u Spans multiple, touching monitors One monitor is primary l l

Virtual Desktop u u Spans multiple, touching monitors One monitor is primary l l u u Used for app compatibility (left, top) = (0, 0) always Other monitors can have negative coordinate System metrics/device caps refer to primary Bounding rectangle is virtual desktop Each monitor has its own work area, resolution, and color depth

Virtual Desktop

Virtual Desktop

Virtual Desktop And Get. System. Metrics (SM_XVIRTUALSCREEN, SM_YVIRTUALSCREEN) Virtual Screen Display 2 (0, 0)

Virtual Desktop And Get. System. Metrics (SM_XVIRTUALSCREEN, SM_YVIRTUALSCREEN) Virtual Screen Display 2 (0, 0) SM_CXSCREEN Display 1 Primary SM_CXVIRTUALSCREEN Display 3 SM_CYVIRTUALSCREEN

Monitor Ownership And Rules u u Owning monitor has most of window Child/owned windows

Monitor Ownership And Rules u u Owning monitor has most of window Child/owned windows stay on same monitor Windows maximize to a single monitor Menus never span across monitors

Functions u Monitor. From. Point/Rect/Window() l u Returns desktop HMONITOR l Flags change default

Functions u Monitor. From. Point/Rect/Window() l u Returns desktop HMONITOR l Flags change default to NULL, nearest, or primary Get. Monitor. Info() returns l l Desktop coordinates (may be negative) Workarea coordinates (may be negative) Flags: primary or secondary Device name (“\. Display 1”) for Create. DC/Change. Display. Settings. Ex

More Functions u Change. Display. Settings. Ex() l u Change resolution, color depth, position

More Functions u Change. Display. Settings. Ex() l u Change resolution, color depth, position on desktop l Normally used by Control Panel l Sends WM_DISPLAYCHANGE Enum. Display. Devices() l Allows app to use a dedicated display

Compatibility Issues u u u Screen savers only cover primary Some apps don’t like

Compatibility Issues u u u Screen savers only cover primary Some apps don’t like negative coordinates Some apps restrict windows to primary Patch GDI or the DISPLAY driver (remote control apps) Some apps require user to disable secondary displays

Microsoft Management Console (MMC)

Microsoft Management Console (MMC)

Microsoft Management Console u MMC simplifies systems management l u “Consoles” contain a set

Microsoft Management Console u MMC simplifies systems management l u “Consoles” contain a set of Snap-Ins l u u Single UI for all management tools Grouping of tools that work well together MMC has Author mode and User Mode Snap-Ins extend the namespace (left pane) l Extend menus, toolbars, and property pages

Index Server

Index Server

Index Server u u Windows NT Service indexing files and their content Allows search

Index Server u u Windows NT Service indexing files and their content Allows search by properties l u Filters parse files for indexer l l u Name, author, content, summary, type, etc. System ships with standard filters l. doc, . xls, . txt, . ppt, html, etc. Extensible to custom file formats by implementing the IFilter interface MMC Management

Index Server Client Example Set Q = Create. Object("ixsso. Query") Q. Catalog = "System"

Index Server Client Example Set Q = Create. Object("ixsso. Query") Q. Catalog = "System" Q. Sort. By = "rank[d]" Q. Columns = "Doc. Title, path, size" Q. Query = "microsoft and not #filename *. vbs " Set RS = Q. Create. Record. Set("nonsequential")

Index Server Client Example sz = "# hits: " & RS. Record. Count &

Index Server Client Example sz = "# hits: " & RS. Record. Count & Chr(10) For i = 1 To RS. Record. Count sz = sz & RS("Path") & Chr(10) RS. Move. Next Msg. Box sz Set RS = Nothing Set Q = Nothing

Active Directory

Active Directory

Active Directory u Mimics the organization of an enterprise l u Search across an

Active Directory u Mimics the organization of an enterprise l u Search across an enterprise l l l u Organize by location and department Find printers/people/machines/etc. Searching is FAST Searching is EASY - through UI and APIs Windows NT ACL security on entries

Active Directory u u u Enterprise wide searchable, extensible, replicated, hierarchical, scalable, distributed namespace

Active Directory u u u Enterprise wide searchable, extensible, replicated, hierarchical, scalable, distributed namespace Exposed to administrators through MMC Snap-in Exposed to apps through Object Model (ADSI), and API’s (LDAP, X. 500, etc. ) Exposed to users through ‘Search…’ Exposed to ISVs for extensibility

AD Printer Publishing

AD Printer Publishing

AD Printer Publishing

AD Printer Publishing

Don’t Use The AD For. . . u Huge data l u u Difficult

Don’t Use The AD For. . . u Huge data l u u Difficult to replicate large objects without increasing latency for small ones a lot Rapidly changing, short useful life Local interest information Needs total consistency between replicas Needs total consistency within a replica l Example: debit-credit

Zero Admin Windows (Clean Apps Initiative)

Zero Admin Windows (Clean Apps Initiative)

Goals u u u u Make customer experience enjoyable Easy for novice to setup/use

Goals u u u u Make customer experience enjoyable Easy for novice to setup/use software Many people use a single machine Single person use multiple machines Machines can be taken on the road Simple to administer Cheap to deploy, maintain, and update software l Less than 5% of ownership cost is app cost today!

Key Problems u Setup problems l l u u Inconsistent; can’t mass deploy (not

Key Problems u Setup problems l l u u Inconsistent; can’t mass deploy (not silent) Requires user be a local administrator DLL conflicts Inability to protect user’s data Hard to replace machine with new one Hard to lockdown a system l Bank tellers, hospitals, kiosk, etc.

State Separation u User-specific settings l l l Don’t initialize at setup Use HKEY_CURRENT_USER

State Separation u User-specific settings l l l Don’t initialize at setup Use HKEY_CURRENT_USER Use single user’s special folders l Documents, pictures, start menu, favorites, send to, templates, temp, app data l SHGet. Special. Folder. Path()

State Separation u Machine-specific settings l l l Do initialize at setup Use HKEY_LOCAL_MACHINE

State Separation u Machine-specific settings l l l Do initialize at setup Use HKEY_LOCAL_MACHINE Use all user’s special folders l Start menu, programs, startup, desktop, app data

Desktop Management u Give admins (parents) full control l u System Policy: OS and

Desktop Management u Give admins (parents) full control l u System Policy: OS and shell behavior l u Create. Process versus Shell. Execute Application Policy: Apps provide admin control over features l u Force standard desktops (reduce futzing) Apps MUST adhere to system policy too! System Security: Admin restricts access to files, folders, and registry

Application Policies u Suggested Application Policies l l l u u Overall Policy On/Off

Application Policies u Suggested Application Policies l l l u u Overall Policy On/Off Default file format Default open/save location Default data population Disable new, high TCO, and advanced features Allow policies to be set per-user/ per-machine Expose policies using ADM file

Group Policy Editor u u MMC Snap-In allowing management of local or Active Directory

Group Policy Editor u u MMC Snap-In allowing management of local or Active Directory policies ADM ‘script’ language lets you put a UI on Registry settings l l l u On/Off (Check box) One of many strings (Combo/List box) User entered strings (Edit box) Settings are stored and applied to user when logged on to domain controller

System Security u u u Don’t assume users are administrators Don’t assume file system/registry

System Security u u u Don’t assume users are administrators Don’t assume file system/registry is writeable Open resources with appropriate permission l l u Ex: Use KEY_READ versus KEY_ALL_ACCESS Handle access-denied errors gracefully Temp dir (%TEMP%) is per-user and writeable

The Windows Installer (MSI) u u u Windows NT Service running with higher privs

The Windows Installer (MSI) u u u Windows NT Service running with higher privs Versions available for Windows NT 4. 0 /Windows 95/98 Setup is ongoing; not a one-time process Protects OS and shared components Offers Admin network deployment, update, and uninstall Missing/damaged files can be reinstalled l Apps tune disk usage to each user’s preferences

Intelli. Mirror u Allows remote install/update l l l u Users are assigned programs

Intelli. Mirror u Allows remote install/update l l l u Users are assigned programs and OS Admin updates server with new versions User gets new version with next logon User’s environment mirrored on server l l l Allows machine reconstruction for hard disk crash or new computer Allows user to roam to other machine You can work off-line and files will automatically synchronize on reconnect

NTFS File System Changes

NTFS File System Changes

Hard Links (Files Only) u Single file with multiple path names l u u

Hard Links (Files Only) u Single file with multiple path names l u u Saves file replication; eases organization All attribs (including data) shared Win 32® function: Create. Hard. Link Increment hardlink count and adds name attribute Delete. File deletes name, decrements count l If 0, MFT entry is deleted

Stream Compression u Stream split into compression units l u 16 clusters long Example:

Stream Compression u Stream split into compression units l u 16 clusters long Example: 120 KB file (2 KB cluster size) Offset 0 32768 65536 98304 Clusters 10 16 12 12 Notes Compressed Not compressed

Stream Compression API u Device. Io. Control l l u Get. File. Attributes l

Stream Compression API u Device. Io. Control l l u Get. File. Attributes l u u FSCTL_SET_COMPRESSION l Dir: new streams/subdirs created compressed FSCTL_GET_COMPRESSION FILE_ATTRIBUTE_COMPRESSED Get. File. Size/Get. Compressed. File. Size Get. Volume. Information l FS_FILE_COMPRESSION

Sparse Streams u Large streams with “holes” l u Example: Queue l l u

Sparse Streams u Large streams with “holes” l u Example: Queue l l u “Holes” don’t require disk space Always write to end (64 -bit offset) Delete read records from beginning 64 -bit file sizes l l 16 billion bytes 1 KB/record, 10 record/second = 57 million years

Sparse Streams u Stream split into compression units l 16 clusters long u Example:

Sparse Streams u Stream split into compression units l 16 clusters long u Example: 120 KB file u Offset Clusters Notes_______ 0 10 Compressed; not sparse 32768 0 Sparse 65536 12 Compressed; not sparse 98304 12 Not compressed/sparse

Sparse Stream API u Device. Io. Control l u Get. File. Attributes l u

Sparse Stream API u Device. Io. Control l u Get. File. Attributes l u u FSCTL_SET_SPARSE FSCTL_SET_ZERO_DATA FSCTL_QUERY_ALLOCATED_RANGES FILE_ATTRIBUTE_SPARSE_FILE Get. File. Size/Get. Compressed. File. Size Get. Volume. Information l FILE_SUPPORTS_SPARSE_FILES

File Encryption/Decryption u Protects files from users with physical access to computer l l

File Encryption/Decryption u Protects files from users with physical access to computer l l u u Boot of other OS floppy Multiple users share a single machine Stolen laptop Unattended desktop systems Encrypt. File/Decrypt. File Open/Close. Encrypted. File. Raw, Read/Write. Encrypted. File. Raw

Reparse Points u u u Execute code when file/dir is opened Code is in

Reparse Points u u u Execute code when file/dir is opened Code is in file system filter Examples l l Directory junction l C: CDROM redirects to CD-ROM (X: ) HSM l Files content relocated to off-line storage l Accessing on-line file faults in off-line content

Reparse Point API u Create. File l l u Device. Io. Control l u

Reparse Point API u Create. File l l u Device. Io. Control l u FSCTL_SET_REPARSE_POINT FSCTL_GET_REPARSE_POINT FSCTL_DELETE_REPARSE_POINT Get. File. Attributes l u FILE_FLAG_OPEN_REPARSE_POINT Open’s file stream ignoring reparse point FILE_ATTRIBUTE_REPARSE_POINT Get. Volume. Information l FILE_SUPPORTS_REPARSE_POINTS

Reliable Change Journal u u Tracks ALL volume changes (by time) Size adjustable (or

Reliable Change Journal u u Tracks ALL volume changes (by time) Size adjustable (or disabled) l l u Single stream accessed by all apps l u u Usual size = 16 MB, record = ~128 bytes, changes = ~4/sec, Time until full= ~8 hours Sparse file used to implement RCJ buffer Avoids volume traverses Saves time, saves code, saves memory Entries get ever-increasing 64 -bit unique sequence number (USN)

Change Reasons (USN_REASON_*) DATA_OVERWRITEDATA_EXTEND DATA_TRUNCATION NAMED_DATA_OVERWRITE NAMED_DATA_EXTEND NAMED_DATA_TRUNCATION FILE_CREATE FILE_DELETE PROPERTY_CHANGE SECURITY_CHANGE RENAME_OLD_NAME RENAME_NEW_NAME

Change Reasons (USN_REASON_*) DATA_OVERWRITEDATA_EXTEND DATA_TRUNCATION NAMED_DATA_OVERWRITE NAMED_DATA_EXTEND NAMED_DATA_TRUNCATION FILE_CREATE FILE_DELETE PROPERTY_CHANGE SECURITY_CHANGE RENAME_OLD_NAME RENAME_NEW_NAME INDEXABLE_CHANGE BASIC_INFO_CHANGE HARD_LINK_CHANGE COMPRESSION_CHANGE ENCRYPTION_CHANGE OBJECT_ID_CHANGE REPARSE_POINT_CHANGE STREAM_CHANGE End of all changes marker: USN_REASON_CLOSE

RCJ API u Create/Query/Destroy RCJ (size, delta) l l l u Read Entry l

RCJ API u Create/Query/Destroy RCJ (size, delta) l l l u Read Entry l l u FSCTL_CREATE_USN_JOURNAL FSCTL_QUERY_USN_JOURNAL FSCTL_DELETE_USN_JOURNAL FSCTL_READ_FILE_USN_DATA (by hfile) Force Write of Close l FSCTL_WRITE_USN_CLOSE_RECORD

Disk Quotas u u Administrators control disk space/user Transparent to users/software l u Get.

Disk Quotas u u Administrators control disk space/user Transparent to users/software l u Get. Volume. Information() l u FILE_VOLUME_QUOTAS Get. Disk. Free. Space. Ex() l u Attempt to exceed quota returns disk full Returns caller/volume’s free bytes Checks on stream extend

File System Services

File System Services

Hierarchical Storage Management (HSM) u u Not on Windows NT® Workstation Administrator sets policy

Hierarchical Storage Management (HSM) u u Not on Windows NT® Workstation Administrator sets policy (per-volume) l l l u Scan copies files to remote storage l u u File types to consider (Ex: No EXEs) # of days since use/minimum file size Desired free disk space on volume File contents deleted; reparse point added Accessing file copies storage back Create. File w/ FILE_FLAG_OPEN_NO_RECALL opens remote file (no local copy)

Native Structured Storage (NSS) u NSS reparse point filter maps COMs IStorage/IStream to NTFS

Native Structured Storage (NSS) u NSS reparse point filter maps COMs IStorage/IStream to NTFS file streams l u u NTFS file can be copied to non-NTFS partition and back without data loss Storage within file is not wasted Deleted objects have space reclaimed More efficient storage Better performance

Distributed File System u u Organizes network resources in tree Junction point (dir) has

Distributed File System u u Organizes network resources in tree Junction point (dir) has alternate paths l l u u u Accessing junction point selects a path Server down, another path is chosen Servers can be added, moved, and removed without affecting user’s access Improves load balancing Only NTFS can have junction points; any file system can have leaf nodes

Kernel Changes

Kernel Changes

Very Large Memory (Vlm) DEC Alpha Only u u Break 2 -GB barrier on

Very Large Memory (Vlm) DEC Alpha Only u u Break 2 -GB barrier on DEC Alpha First step past 32 -bit system Target large database servers Alpha Windows NT 5. 0 Enterprise Server only

32 -Bit x 86 Address Space 0 x. FFFF 2 GB Kernel space 0

32 -Bit x 86 Address Space 0 x. FFFF 2 GB Kernel space 0 x 80000000 0 x 7 FFFFFFF 2 GB User Space 0 x 0000

64 -bit Alpha Address Space 0 x. FFFFFFFF 2 GB Kernel space 0 x.

64 -bit Alpha Address Space 0 x. FFFFFFFF 2 GB Kernel space 0 x. FFFF 80000000 0 x. FFFF 7 FFFFFFF VLM Allocations 0 x 0000 80000000 0 x 0000 7 FFFFFFF 2 GB User Space 0 x 00000000

VLM Functions u u typedef void * __ptr 64 PVOID 64; Functions: l l

VLM Functions u u typedef void * __ptr 64 PVOID 64; Functions: l l l Memory: Move. Memory. Vlm MMF: Map. View. Of. File. Vlm Virtual: Virtual. Alloc. Vlm Process: Read. Process. Memory. Vlm Status: Global. Memory. Status. Vlm File I/O: Read. File. Vlm

Job Object u New kernel object l l u u u Can be named

Job Object u New kernel object l l u u u Can be named Can be secured Group of related processes Manage and track process group System enforces job quotas and security context

Job Object Functions u u u u Create. Job. Object Open. Job. Object Assign.

Job Object Functions u u u u Create. Job. Object Open. Job. Object Assign. Process. To. Job. Object Terminate. Job. Object Query. Information. Job. Object Set. Information. Job. Object User. Handle. Grant. Access

What You Can Set u Basic Limits l u UI Restrictions l u Per-process

What You Can Set u Basic Limits l u UI Restrictions l u Per-process and per-job user time limit, minimum/maximum working set size, # of processes, processor affinity, priority Exit. Window. Ex, access to non-job USER objects, reading/writing clipboard, System. Parameters. Info for change Security Limits l No Administrators token, only restricted token, only specific token, filter token

What You Can Query u Accounting information l u Total user/kernel time, this period

What You Can Query u Accounting information l u Total user/kernel time, this period user/kernel time, total page faults, total processes, active processes, total terminated processes Process ID List l IDs of all running processes in job

Thread Pooling APIs u Register a wait with callback function l u Queue asynchronous

Thread Pooling APIs u Register a wait with callback function l u Queue asynchronous function call l u Register. Wait. For. Single. Object(h. Obj, pfn, pv. Data, dw. Timeout) Query. User. Work. Item(pfn, pv. Data, f. Prefer. IO) Timer Queue l l l Set. Timer. Queue. Timer(h. Queue, pfn, pv. Data, dw. Due. Time, dw. Period, f. Prefer. IO) Change. Timer. Queue. Timer / Cancel. Timer. Queue. Timer Create. Timer. Queue / Delete. Timer. Queue

Miscellaneous u u u Create. Process. With. Logon Tool. Help functions Get. Version. Info

Miscellaneous u u u Create. Process. With. Logon Tool. Help functions Get. Version. Info and OSVERSIONINFOEX l u u Build/service pack info Is. Debugger. Present Is. Processor. Feature. Present l Pentium floating point bug, is floatingpoint emulated in software, MMX available, and more

User/GDI Changes

User/GDI Changes

Message Windows u u Pass HWND_MESSAGE as parent HWND to Create. Window(Ex) Allows send/receive

Message Windows u u Pass HWND_MESSAGE as parent HWND to Create. Window(Ex) Allows send/receive of messages Not visible, no Z-order, not normally enumerated, doesn’t receive broadcast messages Find. Window. Ex l l Finds if hwnd. Parent is HWND_MESSAGE Finds is hwnd. Parent and hwnd. Child are NULL

Layered Windows Alpha Blending u Layered Windows l l u WS_EX_LAYERED BOOL Update. Layered.

Layered Windows Alpha Blending u Layered Windows l l u WS_EX_LAYERED BOOL Update. Layered. Window( HWND h. Wnd, HDC hdc. Dst, PPOINT ppt. Dst, PSIZE psize, HDC hdc. Src, PPOINT ppt. Src, COLORREF cr. Key, PBLENDFUNCTION pblend, DWORD dw. Flags); Alpha Blending l Alpha. Blend function like Stretch. Blt w/BLENDFUNCTION struct

System. Parameters. Info u u u u Mouse hover dims/time (no click selection) X-Mouse

System. Parameters. Info u u u u Mouse hover dims/time (no click selection) X-Mouse behavior Combo. Box/List. Box animations Gradient captions Accessibility Power Management Task switch (disable Alt+Tab/Alt+Esc) Is screensaver running

Miscellaneous u u u u Get. Gui. Resources (see Task Manager) Get. Last. Input.

Miscellaneous u u u u Get. Gui. Resources (see Task Manager) Get. Last. Input. Info (ms since last input) Lock. Work. Station (simulates Ctrl+Alt+Del) Send. Input (simulates input set) Track. Mouse. Event (generates mouse hover/leave msgs) HTML Resource type New common controls

Keyboard Cues u Reduces visual noise from ‘focus indicators’ and ‘access key underlines’

Keyboard Cues u Reduces visual noise from ‘focus indicators’ and ‘access key underlines’

Scheduler Service u u u Task Scheduler UI via Explorer’s My Computer folder Interfaces

Scheduler Service u u u Task Scheduler UI via Explorer’s My Computer folder Interfaces l l l IScheduling. Agent: Creates, destroys, and manages jobs ITask: Defines a task ITask. Trigger: Sets the schedule for a task

Terminal Server

Terminal Server

Terminal Server u u Win 32 apps run on PC/non-PC Thin clients, 100% server-centric

Terminal Server u u Win 32 apps run on PC/non-PC Thin clients, 100% server-centric Clients: Windows, Macintosh, UNIX, etc. Server/client only transmit UI l l u u Screen updates Keyboard and mouse inputs User logs on and has independent session Apps require no change to run

Programming Guidelines u No local data in global locations l l l u u

Programming Guidelines u No local data in global locations l l l u u u All users share HKEY_LOCAL_MACHINE Each user gets HKEY_CURRENT_USER Store user-preference/temp files in home/user-specified dir Use file/database locking Resolve memory leaks Don't use computer name/IP address to ID user l Server has 1 IP address for all users

Optimizations u Remove UI from services l u Client won’t see it Reduce CPU

Optimizations u Remove UI from services l u Client won’t see it Reduce CPU time and network I/O l l l Rework background tasks Reduce splash screens, animation Reduce paints l Create memory images; output once

Windows Scripting Host

Windows Scripting Host

Overview u u u Language-independent scripting host MS provides Visual Basic® Script and Java.

Overview u u u Language-independent scripting host MS provides Visual Basic® Script and Java. Script engines Other companies will provide Active. X® scripting engines for other languages such as Perl, TCL, REXX, and Python GUI-based (WSCRIPT. EXE) CUI-based (CSCRIPT. EXE)

Architecture u Other scripting hosts l l u u Microsoft Internet Explorer Internet Information

Architecture u Other scripting hosts l l u u Microsoft Internet Explorer Internet Information Server (IIS) WSH has smaller footprint than Internet Explorer File extension tells host which engine to use l l Registry settings VBS: Visual Basic, JS: Java. Script Context menus Property page

Supplied Scripting Objects u u u u WScript: create/get/delete Active object Wsh. Arguments: cmd-line

Supplied Scripting Objects u u u u WScript: create/get/delete Active object Wsh. Arguments: cmd-line args Wsh. Shell: Env vars, msg box, spawn, read/write/delete registry settings Wsh. Network: add/enum/remove printers/network drives Wsh. Special. Folders: special folder dir Wsh. Shortcut: Create shortcut Wsh. Url. Shortcut: Create URL shortcut

Win 64

Win 64

Abstract Data Models u u Goal: Single Win 32/Win 64 source base Win 32:

Abstract Data Models u u Goal: Single Win 32/Win 64 source base Win 32: ILP 32 model l l u ints, longs and pointers are all 32 -bit Safe assumption to make for Win 32 Win 64: LLP 64 model l ints, longs are 32 -bit, pointers are 64 -bit Making everything 64 -bit wastes space Communication is much harder l 32<->64 apps require lots of thunking l Structures in files require reworking

BASETSD. H Defined Types u Fixed-precision types l l l u Same size for

BASETSD. H Defined Types u Fixed-precision types l l l u Same size for Win 32/Win 64 INT 32, UINT 32, LONG 32, ULONG 32 INT 64, UINT 64, LONG 64, ULONG 64 Pointer-precision types (ptr-sized ints) l l l Size varies with platform INT_PTR, UINT_PTR, etc l Win 32: sign-extended, Win 64: truncated SIZE_T (unsigned count), SSIZE_T (signed count)

Rules u Don't cast ptrs to int, long, ULONG, DWORD l u Truncate ptrs

Rules u Don't cast ptrs to int, long, ULONG, DWORD l u Truncate ptrs with Ptr. To. Long/Ptr. To. Ulong l l l u Cast to INT_PTR or UINT_PTR Avoid if possible Inline functions Disable pointer truncation warning Beware of polymorphic interfaces l Use PVOID/UINT_PTR instead of DWORD