27
Where Developers Matter Vista Enable Your Applications Fredrik Haglund, Regional Developer Evangelist [email protected]

Where Developers Matter Vista Enable Your Applications Fredrik Haglund, Regional Developer Evangelist [email protected]

Embed Size (px)

Citation preview

Page 1: Where Developers Matter Vista Enable Your Applications Fredrik Haglund, Regional Developer Evangelist fhaglund@codegear.com

Where Developers Matter

Vista Enable Your Applications

Fredrik Haglund, Regional Developer [email protected]

Page 2: Where Developers Matter Vista Enable Your Applications Fredrik Haglund, Regional Developer Evangelist fhaglund@codegear.com

Agenda

What is User Account Control in Vista?

Other Compatibility Issues on Vista

Running as Standard User

User Interface Changes in Vista

Demo – Migration BDE

COM and COM with Elevation

Signing

Page 3: Where Developers Matter Vista Enable Your Applications Fredrik Haglund, Regional Developer Evangelist fhaglund@codegear.com

Vista Enable Your Applications

Page 4: Where Developers Matter Vista Enable Your Applications Fredrik Haglund, Regional Developer Evangelist fhaglund@codegear.com

What is User Account Control in Vista?

Why?

How?

Page 5: Where Developers Matter Vista Enable Your Applications Fredrik Haglund, Regional Developer Evangelist fhaglund@codegear.com

UAC – Elevation Demo

Over the Shoulder elevation prompt:

Elevation prompt:

Page 6: Where Developers Matter Vista Enable Your Applications Fredrik Haglund, Regional Developer Evangelist fhaglund@codegear.com

UAC – Architecture

Access Token Split at Login

Elevation Prompt

Secure Desktop

Installer Detection

User Interface Privilege Isolation

Virtualization/Redirection

Page 7: Where Developers Matter Vista Enable Your Applications Fredrik Haglund, Regional Developer Evangelist fhaglund@codegear.com

UAC – Virtualization (Redirection)

Page 8: Where Developers Matter Vista Enable Your Applications Fredrik Haglund, Regional Developer Evangelist fhaglund@codegear.com

Other Compatibility Issues on Vista

Services Isolation

IE – Protected Mode

Windows Resource Protection

64-bit Windows Vista

Networking

Version Checking

Shell changes

Removed components – (WinHelp)

Page 9: Where Developers Matter Vista Enable Your Applications Fredrik Haglund, Regional Developer Evangelist fhaglund@codegear.com

Running as Standard User

Do not assume user is an Admin!

Follow Guidelines

A Standard User can not:• Change files in Program Files folders• Change files in Windows or System32 folders• Change registry under HKLM\Software• Change the local machines date and time• Install or uninstall Services• Register COM Server (globally)

Page 10: Where Developers Matter Vista Enable Your Applications Fredrik Haglund, Regional Developer Evangelist fhaglund@codegear.com

User Interface Changes in Vista

DWM – Desktop Window Manager

Glass, Thumbnail and Flip 3D

Rendering - Black borders, High Dpi, UI themes

New UI elements:Shield, FileDialogs, TaskDialog, etc

Page 11: Where Developers Matter Vista Enable Your Applications Fredrik Haglund, Regional Developer Evangelist fhaglund@codegear.com

New in C++/Delphi 2007 for Vista

Enable Runtime Theme option

Component: TTaskDialog, TFileOpenDialog, TFileSaveDialog

Property TCustomForm.GlassFrame

Property Application.MainFormOnTaskBar

Function TaskMessageDlg

Global var UseLatestCommonDialogs

Page 12: Where Developers Matter Vista Enable Your Applications Fredrik Haglund, Regional Developer Evangelist fhaglund@codegear.com

Enable runtime theme

Page 13: Where Developers Matter Vista Enable Your Applications Fredrik Haglund, Regional Developer Evangelist fhaglund@codegear.com

Manifest - requierdExecutionLevel

asInvoker – (Default in D2007)

highestAvailable

requireAdministrator

Page 14: Where Developers Matter Vista Enable Your Applications Fredrik Haglund, Regional Developer Evangelist fhaglund@codegear.com

Manifest content

Page 15: Where Developers Matter Vista Enable Your Applications Fredrik Haglund, Regional Developer Evangelist fhaglund@codegear.com

Redesign

Do not open files or registry keys with Write flag

Save data, log files, etc. in the right location using SHGetFolderPath

• CSIDL_PERSONAL { My Documents }

• CSIDL_APPDATA { Application Data, new for NT4 }

• CSIDL_LOCAL_APPDATA { non roaming, user\Local Settings\Application Data }

• CSIDL_COMMON_APPDATA { All Users\Application Data }

• CSIDL_MYPICTURES { My Pictures, new for Win2K }

• CSIDL_COMMON_DOCUMENTS { All Users\Documents }

Page 16: Where Developers Matter Vista Enable Your Applications Fredrik Haglund, Regional Developer Evangelist fhaglund@codegear.com

SHGetFolderPath

Page 17: Where Developers Matter Vista Enable Your Applications Fredrik Haglund, Regional Developer Evangelist fhaglund@codegear.com

RunAsAdmin

Launch application running as administrator

Use Application.Handle to delay elevation if app is minimized.

No handle always gives direct foreground elevation.

Page 18: Where Developers Matter Vista Enable Your Applications Fredrik Haglund, Regional Developer Evangelist fhaglund@codegear.com

RunAsAdmin

Page 19: Where Developers Matter Vista Enable Your Applications Fredrik Haglund, Regional Developer Evangelist fhaglund@codegear.com

Using COM class for Admin tasksCOM Server must be an EXE

EXE must have requireAdministrator to install COM objects correctly

Registration of COM Class must • add value LocalizedString (and resource string in executable)• add key Elevation and value Enabled = 1

Page 20: Where Developers Matter Vista Enable Your Applications Fredrik Haglund, Regional Developer Evangelist fhaglund@codegear.com

Elevated COM calls

Use Moniker to create elevated CoClass from User Process

Page 21: Where Developers Matter Vista Enable Your Applications Fredrik Haglund, Regional Developer Evangelist fhaglund@codegear.com

The Shield - SetElevationRequiredState

Call function with Button as parameter to add Shield symbol

Page 22: Where Developers Matter Vista Enable Your Applications Fredrik Haglund, Regional Developer Evangelist fhaglund@codegear.com

Test your application – identify problems

Classify your application as Standard User, Admin or Mixed.

Add application Manifest

Redesign functionality

• User apps should write data to correct locations

• Split out admin stuff into a separate executable

Redesign user interface

• Add shield to buttons

Redesign installer

Test again

Optionally sign application (Authenticode)

Determine whether to pursue the Windows Vista Logo program

Page 23: Where Developers Matter Vista Enable Your Applications Fredrik Haglund, Regional Developer Evangelist fhaglund@codegear.com

Case Exampel: BDE Application

Location of Database Files

Virtualization

Risk of Database Corruption

Alias and BdeAdmin – Config Files

TDatabase andTSession

Page 24: Where Developers Matter Vista Enable Your Applications Fredrik Haglund, Regional Developer Evangelist fhaglund@codegear.com

Vista Enable Your Applications Demonstrations

Page 25: Where Developers Matter Vista Enable Your Applications Fredrik Haglund, Regional Developer Evangelist fhaglund@codegear.com

Summary

Page 26: Where Developers Matter Vista Enable Your Applications Fredrik Haglund, Regional Developer Evangelist fhaglund@codegear.com

Summary

What is User Account Control in Vista?

Other Compatibility Issues on Vista

Running as Standard User

User Interface Changes in Vista

Migration

Page 27: Where Developers Matter Vista Enable Your Applications Fredrik Haglund, Regional Developer Evangelist fhaglund@codegear.com

Thank you