3 App Compat Win7


Published on

TechEd Africa session on Windows 7 applicaiton compatibility and graphics improvements

Published in: Technology, Business
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • Blackhat and recommendation to hijack a utility type service (AV or backup for example).
  • Services IsolationServices will not be able to directly interact with user desktop and applicationsIssuesServices with user interaction may hang as UI will not be visibleTemporary Mitigation: notification sent to current user when there is UI in session 0http://www.msterminalservices.org/faq/WindowsTerminalServices/?page=8 – How to design a service to interact with multiple user sessionsSpawned by service – must track session IdsSimple interaction: Terminal Services APIs (WtsSendMessage) - messagebox type functionalityComplex interaction -spawned by the service: one of the create process as user APIs Client start-up (e.g. run key)Find Session Id - WTSQuerySessionInformation() with WTSSessionId as classPass to service through IPCNamed pipe issuesSpecify FILE_FLAG_FIRST_PIPE_INSTANCE in dwOpenMode parameter to CreateNamedPipe() – prevents “squatting”
  • Performance EnhancementsNotifyServiceStatusChange()XP required query of state through QueryServiceStatusEx() or other APIAllows for callback notification of service status changesLocal or remote clientsShutdownXP – notification (random order from SCM) then 20 sec to shutdownVista pre-shutdown notification for services with more cleanup3 min by default but configurable by serviceRegistration of shutdown dependencies for orderWindows 7 adds Trigger Start:SCM starts or stops registered services when system events triggers.Configuration not accessible via MMC Service Snap-InYou can use the command-line SC.EXE TRIGGERINFO… ChangeServiceConfig2( SERVICE_CONFIG_TRIGGER_INFO )
  • Note: some applications will actively block efforts to shim, so this will not work.
  • Direct 2D – rendering improvementsDirectWrite – cool DirectWrite demoDirect3D - Demo
  • [TDM, DEV][Why - high level overview of Graphics (improvements) in Win7]High-Fidelity Graphics with DirectX Windows application developers have long used DirectX® to provide high-quality, hardware-accelerated, 3D graphics. When the technology debuted in 1995, developers could provide high-quality 3D graphics for games & engineering applications for gamers & professionals willing to pay extra for a 3D-graphics board. Now, even the most inexpensive PCs include capable 3D-graphics hardware.To take advantage of these graphics capabilities, Windows Vista introduced the Windows Display Driver Model (WDDM) infrastructure for DirectX that enabled multiple applications & services to share the resources of the GPU. The Desktop Window Manager (DWM) uses this technology to animate task switching in 3D, provide dynamic thumbnail images of application windows, & to provide Windows® Aero® glass effects for desktop applications.Windows 7 puts even more graphics capability into the h&s of application developers. Through a new set of DirectX APIs, Win32 developers can take advantage of the latest innovations in GPUs to add fast, scalable, high-quality, 2D & 3D graphics, text, & images to their applications. On the latest LCD displays, DirectX APIs can display desktop & window content using color depth greater than 8 bits per color component. With DirectX, Win32 developers can also use the GPU’s parallelism for general-purpose computation such as image processing, & can render to DirectX 10 hardware, DirectX 9 hardware, the CPU, or to a remote Windows computer. These technologies were designed to interoperate with GDI & GDI+, ensuring that developers can easily preserve their existing investments in Win32 code. These enhanced graphics capabilities are provided by the following COM-based APIs:Direct2D for drawing 2D graphics.DirectWrite for arranging & rendering text. Windows Imaging Component for processing & displaying images.Direct3D® 10 for drawing 3D graphics. Direct3D 11 for drawing 3D graphics, & providing access to next-generation GPU technologies, such as tessellation, limited support for texture streaming, & general purpose computing.DirectX Graphics Infrastructure (DXGI) for managing devices & GPU resources, & providing interoperability between DirectX & GDIWindows 7 Usage of the GPUContinues from Windows Vista…Media Center UIVideo Playback Desktop Window Manager (DWM)Windows 7 DWM uses Direct3D10.1 APIScales in performance all the way from low end integrated to high end GPUsShaders are used for blurs in the GlassWindows 7 memory consumption is cut by 50% per windowMore & richer animations of the thumbnails
  • [TDM, DEV][high-level overview of DirectWrite]ClearType is all about drawing text to the screen while preserving maximum fidelity with regards to the character position & shape intended by the font designer.Usability Improvements due to ClearTypeReading perf improvement: 5% faster than non cleartype rendering.  This is normal reading of a document on screen.  Pretty significant (think of 5% of work day).     Word decoding: 17% faster.  When you get flashed a word on a screen really fast & have to figure out what it is. Most importantly – the time you can spend reading on the computer before you get a head-ache is substantially extended. :-)DirectWriteMany of today’s applications need to support high-quality text rendering, resolution-independent outline fonts, & full Unicode text & layout support. DirectWrite, a new DirectX component, provides these features & more:A device-independent text layout system that improves text readability in documents & in UI. High-quality, sub-pixel, ClearType® text rendering that can use GDI, Direct2D, or application-specific rendering technology.Hardware-accelerated text, when used with Direct2D.Support for multi-format text.Support for the advanced typography features of OpenType® fonts.Support for the layout & rendering of text in all supported languages.GDI-compatible layout & rendering.The DirectWrite font system enables ”any font anywhere” font usage, where users don’t have to perform a separate installation step just to use a font, & an improved structural hierarchy of font grouping to help with manual or programmatic font discovery. The APIs support measuring, drawing, & hit-testing of multi-format text. DirectWrite h&les text in all supported languages for global & localized applications, building on the key language infrastructure found in Windows 7. DirectWrite also provides low-level glyph rendering APIs for developers who want to perform their own layout & Unicode-to-glyph processing.
  • [TDM, DEV]The main take away on the Fundamentals it to make sure developer are using Windows 7 as their main dev machine. By running Windows 7 on their machines, they will want to make sure their applications are properly running on Windows 7.
  • Windows 7 & Windows Server 2008 R2 Ecosystem Readiness Program The Windows Ecosystem includes hardware, software, & services partners.  In addition to providing partners with access to the software & tools they need to build & test solutions for Windows 7 & Windows Server 2008 R2, the Ecosystem Readiness Program also facilitates testing multiple components of the ecosystem together to improve the overall user experience. Rather than just focusing on getting a specific OEM product, software application, or hardware device certified, we will be bringing multiple components together to verify a rich user experience that delivers quality, reliability, & performance as well as innovation through new feature adoption. To join the Windows 7 & Windows Server 2008 R2 Ecosystem Readiness Program click here if you are a software developer & here if you develop hardware.herehere
  • 3 App Compat Win7

    1. 1. Windows 7 AppCompat<br />Lynn Langit<br />http://blogs.msdn.com/SoCalDevGal<br />Microsoft – Developer Evangelist<br />
    2. 2. Windows 7 Builds on Windows Vista<br />Few Changes: Most software that runs on Windows Vista® will run on Windows® 7 – exceptions will be low-level code (AV, Firewall, Imaging, etc.). <br />Hardware that runs Windows Vista well will run Windows 7 well.<br />Few Changes: Focus on quality and reliability improvements<br />Deep Changes: New models for security, drivers, deployment, and networking<br />
    3. 3. AppCompat & LightUp<br /><ul><li>from XP to Win 7
    4. 4. User Account Control
    5. 5. Services Isolation
    6. 6. from Vista to Win 7
    7. 7. Version checking
    8. 8. High DPI
    9. 9. Low level binary changes
    10. 10. UX
    11. 11. Taskbar
    12. 12. Libraries
    13. 13. Internals
    14. 14. Trigger Start Services
    15. 15. Timer Coalescence
    16. 16. New hardware
    17. 17. Multi touch
    18. 18. Sensors</li></li></ul><li>From XP to Windows 7<br />http://code.msdn.microsoft.com/XP2Win7<br />
    19. 19. The Application<br />Image Viewer<br />WPF Application <br />Runs on XP, Vista, Win7<br />On XP basic functionality with no special OS features<br />Manually Create album<br />Crawler (expensive) Service searching images<br />Change Skin<br />Reset DB / Reset configuration<br />Lights Up on Windows 7<br />
    20. 20. Application Running on XP<br />
    21. 21. The Application Running on 7<br />Enhancing an existing Windows XP application with Windows 7 features<br />IO Background Priority<br />Libraries <br />Trigger Start Services<br />Power Management<br />Command Links <br />Scheduled Tasks<br />PowerShell 2<br />Windows 7 Multitouch<br />Windows 7 Sensors<br />Other…<br />Application Restart and Recovery<br />Preview Handlers<br />Windows Search<br />Windows 7 Event Tracing<br />User Account Control<br />Windows 7 Taskbar<br />Transactional NTFS<br />Microsoft Management Console Snap-In<br />
    22. 22. Application Running on 7<br />
    23. 23. Demo<br />Photo Viewer on Windows 7<br />
    24. 24. Compat - New Folder Locations<br />“My Documents” folder structure has changed <br />The user data is now stored in: ‘usersusername%’ folder structure<br />Pictures, Music, Documents, Desktop, and Favorites are all new folders directly under this structure<br />The “My “ prefix was dropped from Documents, Music, etc.<br />“All Users” became “Public” and “ProgramData”<br />My Documents still exist as directory junction<br />Use the SHGetKnownFolderPath APIs<br />
    25. 25. Compat - Application Data Best Practices<br />Where to put your data:<br />Place per-user configuration data into %LOCALAPPDATA% (Roaming into %APPDATA%)<br />Place Per-Machine (Shared) configuration data into %ALLUSERSPROFILE% (e.g. c:ProgramData)<br />Per-Machine (Shared) user documents into %PUBLIC%<br />Per user documents go to %USERPROFILE%<br />
    26. 26. Compat - User Account Control <br /><ul><li>Applications run as Standard User by default
    27. 27. Standard User has some permissions
    28. 28. Run most applications
    29. 29. Change per user settings
    30. 30. Standard User can NOT do many things
    31. 31. Install applications
    32. 32. Change system components
    33. 33. Change per machine settings
    34. 34. Admin “privileges”</li></li></ul><li>Windows UAC<br />All users run as Standard User by default<br /><ul><li>Filtered token created during logon</li></ul>Only specially marked apps get the unfiltered token<br />Explicit consent required for elevation<br /><ul><li>Predictable shell elevation paths</li></ul>High application compatibility<br /><ul><li>Data redirection</li></ul>Enabling legacy apps to run as standard user<br /><ul><li>Installer Detection</li></li></ul><li>UAC Architecture<br />Abby<br />Standard User Rights<br />Administrative Rights<br />Admin logon<br />Admin Token<br />“Standard User” Token<br />
    35. 35. UAC Architecture<br /><ul><li>Change Time Zone
    36. 36. Run IT Approved Applications
    37. 37. Install Fonts
    38. 38. Install Printers
    39. 39. Run MSN Messenger
    40. 40. Etc.</li></ul>Abby<br />User Process<br />Standard User Privilege<br />Standard User Rights<br />Administrative Rights<br />Standard User Mode<br />
    41. 41. UAC Architecture<br /><ul><li>Change Time Zone
    42. 42. Run IT Approved Applications
    43. 43. Install Fonts
    44. 44. Install Printers
    45. 45. Run MSN Messenger
    46. 46. Etc.</li></ul>Abby<br />User Process<br />Change Time<br />Standard User Privilege<br />Admin Privilege<br />Admin Privilege<br />Admin Privilege<br />Admin Process<br />Configure IIS<br />Admin Process<br />Install Application<br />Admin Process<br />Standard User Rights<br />Administrative Rights<br />Admin Privileges<br />
    47. 47. Consent UI<br />OS Application<br />Unsigned Application<br />Signed Application<br />
    48. 48. Credential UI<br />
    49. 49. UAC Split Tokens<br /> Demo<br />
    50. 50. Designing for UAC<br />1st Choice: Make application run as Standard User only<br />2nd Choice: Clearly identify Administrative tasks<br />Ensure Standard users can be fully productive<br />Identify tasks that need elevation with a “shield” <br />
    51. 51. UX: The Shield<br />Attached to controls to indicate that elevation is required to use their associated feature<br />Has only one state (i.e. no hover, disabled etc.)<br />Does not remember elevated state<br />Not an unlock operation<br />Can be programmatically set:<br />HICON shieldIcon = LoadIcon(NULL, IDI_SHIELD)<br />SendMessage(button, BCM_SETSHIELD, 0, TRUE) or using the macro in Commctrl.h:<br />Button_SetElevationRequiredState(commandLink, TRUE)<br />
    52. 52. Security Shield UI Examples<br />
    53. 53. Application Manifests<br />Vista-aware applications embed an XML manifest<br />Manifest contains a RequestedExecutionLevel:<br />
    54. 54. Finding/Solving UAC Issues<br />Do you?<br />Write to Program Files, Windows, System32, HKLM/Software, or Root?<br />Create anything “globally”<br />UseWindows messages between isolation levels<br />Try<br />Running the application “As Administrator”<br />Testing with UAC off<br />Tools<br />Process Monitor<br />Standard User Analyzer<br />
    55. 55. Windows Services Basics<br />Started and managed by Service Control Manager<br />Controlled by SCM<br />Starting and stopping services<br />Disabled, Manual and Automatic<br />Managing running services<br />Maintaining service-related state information<br />Started – Stopped - Paused<br />Services can run in their own process or shared hosted process (e.g. svchost.exe)<br />
    56. 56. Services and Security<br />Attractions for malware<br />May be configured to auto start on boot<br />Potential to run from boot without using well known auto-start methods<br />Often run in highly privileged contexts<br />As mentioned, runs outside of UAC and enables app to potentially take control of UAC behavior (e.g. MSI)<br />Services can run in their own process or shared hosted process<br />
    57. 57. Sessions in XP/W2K/WS03<br />Session 0<br />Window Station<br />Desktop<br />Services<br />Shatter Attack<br />1st User’sWindow<br />1st User’sWindow<br />1st User’sWindow<br />Screen Saver<br />Login<br />
    58. 58. Sessions in Win7/Vista/Windows 2008<br />Session 0<br />Session 1<br />Window Station<br />Window Station<br />Desktop<br />Desktop<br />Service<br />1st User’sWindow<br />1st User’sWindow<br />Service<br />1st User’sWindow<br />Screen Saver<br />Login<br />Secure<br />
    59. 59. Session 0 Isolation<br />demo<br />
    60. 60. Service Hardening<br />Windows XP services made great attack vectors:<br />Running in shared session, usually w/high privilege<br />Sometimes w/UI (interactive services)<br />So we had Shatter Attacks<br />good reasons to have Service Isolation in session 0 and Mandatory Integrity Control<br />Windows Vista and 7<br />Services run outside of UAC<br />ISVs may be tempted to circumvent OS security<br />The potential attack surface has lessened so services are a more attractive target<br />
    61. 61. Three Service Hardening Designs<br />Services need to run least privileged<br />Services can now have their own SID<br />This can be used to lock down / sandbox the resources that the Service has access to<br />
    62. 62. Perf Enhance - Trigger Start Service<br />New in Windows 7 - SCM registers for system events via interesting providers:<br />Device arrival<br />IP address<br />Domain join and leave<br />Group policy updates<br />Custom Event Tracing for Windows event<br />SCM starts or stops registered services:<br />TabletInputService started only if digitizer is present<br />StorSvc starts when group policy updates are applied, automatically stops<br />
    63. 63. Trigger Start Examples<br />
    64. 64. Service or Scheduled Task?<br /><ul><li>Continuous activity from boot to shutdown
    65. 65. Service Control Manager (SCM) programming model
    66. 66. Can specify dependency
    67. 67. Short duration action
    68. 68. Idle activity
    69. 69. Take action on user login
    70. 70. Standalone executable or out-of-process COM server
    71. 71. Generally execute in user session</li></ul>Windows Service<br />Scheduled Task<br />
    72. 72. Compat - Operating System Version<br />Windows 7 is … Windows 6.1? (for Vista Compat)<br />dwMajorVersion stays the same<br />dwMinorVersion changes<br />Remediation<br />Check for features, not versions<br />If checking for version, then use the &gt; key (check the OS version as &gt;= so that your app can work on future releases of the OS)<br />Version lies<br />
    73. 73. Compatibility Tab<br />Layers<br />
    74. 74. Shim Application<br />Implements Windows API hooks<br />Shim engine is responsible for applying the shims<br />
    75. 75. How Shims are Loaded<br />Shims are applied per executable<br />Shim engine <br />applies<br /> API hooks <br />Run initialization<br /> routines<br />Loader maps executable and statically linked DLLs <br />into memory<br />
    76. 76. Compat – Misc Regressions<br /><ul><li>Removal of Windows Mail
    77. 77. Removal of Windows Movie Maker
    78. 78. NLS Sorting Changes
    79. 79. Internet Explorer 8 - User Agent String
    80. 80. Removal of Windows Registry Reflection
    81. 81. Removal of WPDUSB.SYS Driver for Windows Portable Devices
    82. 82. Microsoft Message Queuing (MSMQ)</li></li></ul><li>Problem Step Recorder<br />%windir%system32psr.exe<br />Allows testers and users to track, step by step, exactly what an application is doing, creating an .mht file with screenshots illustrating the bug reproduction<br />Creates a .zip file containing an .mht file<br />Integrated with Dr. Watson for Windows<br />
    83. 83. This Was Very Surprising To Us…<br />Users with Max Resolution of 1600X1200<br />Details<br />Almost half of all of users are not configuring their display to maximum resolution (!)<br />Users are lowering their screen resolution to get larger text…<br />
    84. 84. High DPI - Why Do We Care?<br />Non-native resolution negates the value of high fidelity displays<br />Text looks blurry because ClearType requires native resolution<br />Can’t display native high def content<br />720p high definition video requires 1280x720 resolution<br />1080p requires 1920x1080<br />1.9 megapixel photos requires 1600x1200 native<br />Many people accidentally select a non-native aspect ratio<br />Pixilated Content does not take advantage of the display<br />Non-native aspect Ratio Settings “Squishes” Content<br />
    85. 85. High DPI Issues<br />Clipped Text<br />Layout Issues & Image Size Issues<br />WinForms Issues<br />Pixilated Bitmaps<br />Blurry UI<br />Mismatched Font Sizes<br />
    86. 86. Graphics Improvements in Windows 7<br />New<br />
    87. 87. Graphics APIs for Rich Client Applications<br />
    88. 88. DirectX: When the application needs control over features and performance<br />WPF: When the application needs richness but needs to be built quickly and there is no need for fine grained control over hw performance and features<br />GDI: When the application needs to work on all Microsoft OSs and the lowest common denominator functionality is sufficient<br />When to use which API<br />Increasing HW Exploitiveness<br />
    89. 89. Advancing the platform<br />
    90. 90. Direct3D<br />Segoe UI<br />DirectWrite<br />Direct2D<br />Windows 7 DWM memory consumption is cut by 50% per window<br />Take advantage of the GPU’s computation power<br />High-DPI support & High Color<br />Windows 7 DWM uses Direct3D10.1 API<br />DXVA & WIC<br />Graphic Improvements<br />
    91. 91. Direct2D And DirectWrite<br />New APIs in Windows 7 <br />Win32 developers<br />Interoperability<br />Usable in service context<br />Direct2D<br />2D graphics rendering tasks <br />Increased performance and visual quality<br />DirectWrite<br />Vertical stack for text services<br />Fonts, Script Processing, Layout<br />
    92. 92. Direct2D: New in Windows 7<br />Rendering Focused Immediate Mode API: <br />2D Vectors & Geometry, Bitmaps & Text<br />Hardware & Software Pipelines<br />Built for Performance on Direct3D 10.1<br />Interoperable with Direct3D & GDI<br />High Quality Rendering:<br />Per Primitive Anti-Aliasing & MSAA via Direct3D<br />Remoted via Direct3D 10.1<br />Printing support via XPS<br />
    93. 93. Direct2D Performance<br />demo<br />
    94. 94. DirectWrite<br />Modern Typography<br />Enables world-wide applications<br />ClearType advances<br />Works with any rendering technology<br />Hardware accelerated via Direct2D<br />Best reading experience for the PC<br />
    95. 95. Gabriola<br />
    96. 96. DirectWrite<br />demo<br />
    97. 97. Call to Action: Fundamentals<br />
    98. 98. Windows 7 Readiness Programs<br />Make sure your applications work with Windows 7<br />Allow MS to tell our customers about your Apps<br />Publish your support policy for Windows 7<br />List your solutions on the Compatibility Center<br />Get the Windows 7 Logo<br />Focused on Compatible Applications<br />Simple Process – No 3rd party testing required<br />http://connect.microsoft.com/InvitationUse.aspx?ProgramID=2872&SiteID=704&InvitationID=Win7-K86V-HW3G<br />
    99. 99. Resources<br />Cookbooks<br />“Application Compatibility Cookbook”<br />“Windows 7 Application Quality Cookbook” <br />MSDN Application Compatibility: http://msdn.microsoft.com/en-us/windows/aa904987.aspx<br />TechNet Windows Application Compatibility: http://technet.microsoft.com/en-us/desktopdeployment/bb414773.aspx<br />DevReadiness.org<br />Channel 9: http://channel9.msdn.com/tags/Application+Compatibility/<br />
    100. 100. Track Resources<br />Windows 7 RC Training for Developers<br />Windows content on Channel 9  <br />Windows 7 Developer Center on MSDN<br />Windows Application Compatibility Roadmap<br />Windows 7 Blog for Developers<br />My blog series – http://blogs.msdn.com/SoCalDevGal#Win7DevSeries<br />My MSDN show – MSDN geekSpeak<br />My Facebook group ‘Windows 7 Developers’<br />Links, Video & Screencasts<br />
    101. 101. Related Content<br />Breakout Sessions <br />WCL201 Developing for Windows 7 <br />WCL301 Windows Application Readiness for Developers <br />WCL302 Optimizing Your Application for the Windows 7 User Experience<br />Whiteboard Session<br />WTB215 Windows Client Development Discussion<br />Hands-on Lab<br />WCL08-HOL Windows 7: Mitigating Application Issues Using Shims<br />
    102. 102. Tech·Ed Africa 2009 sessions will be made available for download the week after the event from: www.tech-ed.co.za<br />www.microsoft.com/teched<br />International Content & Community<br />www.microsoft.com/learning<br />Microsoft Certification & Training Resources<br />http://microsoft.com/technet<br />Resources for IT Professionals<br />http://microsoft.com/msdn<br />Resources for Developers<br />Resources<br />
    103. 103. Required Slide<br />10 pairs of MP3 sunglasses to be won<br />Complete a session evaluation and enter to win!<br />
    104. 104. © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.<br />The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.<br />