130 likes | 341 Views
Top Five Ways To Ensure… …your application will be incompatible. All the way from the home office in Redmond, WA The five best ways to ensure your application doesn’t work on the next OS release. Number Five Ignore Window sessions. Sessions separate multiple logons Terminal Server
E N D
Top Five Ways To Ensure……your application will be incompatible • All the way from the home office in Redmond, WA • The five best ways to ensure your application doesn’t work on the next OS release
Number FiveIgnore Window sessions • Sessions separate multiple logons • Terminal Server • Fast User Switching • Windows Vista: • Services run in session 0 • First user will log into session 1! • Session 0 is not an interactive session – No UI • When using named objects • ALWAYS specify Global\ or Local\ namespace • FindWindow/SendMessage doesn’t work across sessions
Number FourIgnore newer hardware • 16 bit components not supported on 64 bit OS • Many older installers use 16 bit setup.exe • 32 bit drivers not supported on 64 bit OS • WIN64 architecture does support x86 code • GetNativeSystemInfo returns true system info • GetSystemInfo returns info relative to WOW emulated environment
Number ThreeHardcode your file and directory locations • ALWAYS use SHGetFolderPath • Environment.GetFolderPath for managed code • Store application data in CSIDL_APPDATA • Do not store user files and settings in the exe directory • Documents and Settings is being renamed • Will be called “Users” in Windows Vista • Directory layout being flattened
Number TwoPretend the registry is your private playground • DO NOT read undocumented registry values • Current REG_SZ types may be converted to REG_EXPAND_SZ • New routines for reading registry • Both expand REG_EXPAND_SZ if desired • SHRegGetValue >= XP SP2 • RegGetValue >= Srv03 SP1
Number OneChoose not to run on the OS • Most common “incompatibility” problem • Application almost always works • Poor customer experience • Check against minimally supported OS • If (osVersion >= 6) printf(“Windows Vista and newer”); • Better yet determine if your required feature exists: • OpenService(hScm,“CiSvc”,GENERIC_READ); • GetProcAddress(hShell32, “SHRegGetValue”);
OS Version CheckUsing VerifyVersionInfo BOOL IsVistaOrNewer() { ULONGLONG osVersionCondition; OSVERSIONINFOEX osVersion; // Note using the VER_GREATER_EQUAL comparison osVersion.dwOSVersionInfoSize = sizeof(osVersion); osVersion.dwMajorVersion = 6; osVersionCondition = VerSetConditionMask(0, VER_MAJORVERSION, VER_GREATER_EQUAL); if (VerifyVersionInfo(&osVersion, VER_MAJORVERSION, osVersionCondition)) { return TRUE;// Vista } else if (GetLastError() != ERROR_OLD_WIN_VERSION) { // Handle API error } return FALSE; }
OS Version CheckUsing GetVersionEx BOOL IsVistaOrNewer() { OSVERSIONINFOEX osVersion; osVersion.dwOSVersionInfoSize = sizeof(osVersion); if (GetVersionEx((LPOSVERSIONINFO)&osVersion)) { // Determine if this is Windows Vista or newer // Note the >= check if (osVersion.dwMajorVersion >= 6) { // Vista return TRUE; } } else { // Handle API error } return FALSE; }
OS Version CheckUsing InstallShield script Dlg_SdWelcome: szTitle = "Welcome"; // Avoid using SYSINFO.WINNT.bWinXP // Note usage of >= comparison if (SYSINFO.nOSMajor >= 6) then szMsg = "Windows Vista or newer"; else szMsg = "Older than Vista"; endif; //{{IS_SCRIPT_TAG(Dlg_SdWelcome) nResult = SdWelcome( szTitle, szMsg ); //}}IS_SCRIPT_TAG(Dlg_SdWelcome) if (nResult = BACK) goto Dlg_Start;
Summary • Check OS version numbers with care • Treat the registry with respect • Use SHGetFolderPath • Pay attention to newer hardware • Pay attention to windows sessions
Most Applications Just Work! • Our in-house .NET Framework compatibility suites have pass rates of over 90% • Windows compatibility rates have historically been in the same range, and we do not expect any changes for Windows Vista • We are providing you with this information now to drive that number even higher in the next release
Most Apps Just Work! Quake II.NET: A Managed C++ app built on v1.0 of the .NET FX
© 2006 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. 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.