Windows Embedded Standard 2009 Prepkit
Total Page:16
File Type:pdf, Size:1020Kb
MCTSi Exam 70-577 Windows Embedded Standard 2009 Preparation Kit Certification Exam Preparation Automation Not for resale. ii Table of Contents Contents at a Glance 1 Creating and Customizing the Configuration 2 Managing the Development Environment 3 Integrating Embedded Enabling Features 4Creating Components 5 Generating and Deploying an Image 6 Adding Windows Functionality Chapter 3 Integrating Embedded Enabling Features This chapter discusses Microsoft® Windows Embedded Standard 2009 Embedded Enabling Features (EEFs), which are components that address scenarios specific to embedded devices, such as deploying run-time images on read-only media, managing and updating your device remotely, and mass deployment. Exam objectives in this chapter: ■ Implement Device Update Agent (DUA) ■ Implement a USB Boot solution ■ Implement Enhanced Write Filter (EWF) ■ Implement File Based Write Filter (FBWF) ■ Implement Message Box Default Reply Before You Begin To complete the lessons in this chapter you need the following: ■ Windows Embedded Studio for Windows Embedded Standard 2009 installed. ■ Completed Chapters 1 and 2. ■ The configuration you created in Chapter 1. 73 74 Chapter 3 Integrating Embedded Enabling Features Lesson 1: Implement DUA The DUA component enables you to remotely update the run-time image of your Windows Embedded Standard 2009 devices. It is a service that runs on your device and processes a script that performs update and maintenance operations. DUA is useful for updating Windows Embedded Standard 2009 images, and is a small component with few dependencies. With DUA, you can update applications or application data, deploy new binaries and device drivers, make registry changes, and automate cleanup and management tasks. After this lesson, you will be able to: ■ Add and configure DUA in your image configuration. ■ Understand and be able to create a device update script. ■ Deploy a DUA run-time image. ■ Reconfigure the DUA engine on a remote device. Estimated lesson time: 30 minutes. Adding the DUA Component to the Configuration DUA is a component that gives your run-time image the ability to remotely update itself. To enable this functionality, you need to add DUA to your configuration and configure it so that it can poll a defined location for updates. Adding the DUA Component To add the DUA component to your configuration, locate the Device Update Agent component in Target Designer’s browser under Software>System>Management> Infrastructure, and add it to your configuration. To test and manage DUA on your device, add the Event Log component that is located under Software>System> Management>Applications in component browser, and the Registry Editor component that is located under Software>System>User Interface>Shells>Windows Shell. At this point check dependencies before you configure DUA settings. Configuring the DUA Component Because DUA runs as a service on your device and polls a specified location for updates, you must configure it to poll the location containing the updates, as well as its startup and runtime parameters. DUA has a number of other configurable settings, for example, specifying user account permissions for the service, poll interval and Lesson 1: Implement DUA 75 jitter (start at random time in the poll interval) for polling a Web site or media, environment variables, and the working directory. Device Update Script DUA uses an executable compiled by the Device Update Script Compiler (Dusc.exe) from a custom script (.dus file) that you create. Before running Dusc.exe, you must register the Duscaut.dll file by running regsvr32 duscaut.dll at a command prompt. These files are located on your development computer under the[drive]\Program Files\Windows Embedded\bin directory. Note that on a Windows Vista system Dusc.exe must be run with administrator permissions. The script itself is composed using a set of 17 predefined commands, as shown in Table 3-1. In the script, you use the command number or its name and an array of arguments. After you create your update command script, run the script compiler to create the command file (.dup file) that is placed in the polling location specified in the DUA settings, along with the files that need to be applied to the image as part of the update. Table 3-1 Device Update Script Commands Command Ordinal Description Reboot 1 Shut down and restart the system Delay 2 Suspend execution Execute 3 Execute new process—specified context CreateDirectory 4 Create a new directory RemoveDirectory 5 Remove an existing directory SetFileAttributes 6 Sets the attributes of a file CopyFile 7 Copy existing file to a new file DeleteFile 8 Delete existing file RegCreateKey 9 Create a key in the registry RegDeleteKey 10 Delete an existing registry key RegSetValue 11 Set data and type for a specified registry value RegDeleteValue 12 Remove a named value from a specified key 76 Chapter 3 Integrating Embedded Enabling Features Table 3-1 Device Update Script Commands (Continued) Command Ordinal Description RegSaveKey 13 Saves a key and sub keys to a specified file RegRestoreKey 14 Restore registry key from a file ExecuteProcess 15 Execute new process HTTPGet 16 Read and retrieve a remote file via HTTP(S) MoveFile 17 Move existing file to a new location Script Editing Use a simple text editor such as notepad.exe to create and modify DUA scripts. You can also use the DUAScriptGen tool from http://www.codeplex.com/duascriptgen. This tool provides a GUI to help you create DUA scripts. It was specifically created to make scripting DUA files for security updates easier. Mike Hall and Aaron Stebner originally created the tool. It has since been published via Codeplex. DUA scripts follow the command syntax described in Table 3-1. For example, to delay 10 seconds, create a c:\UpdatesDUA directory, and restart the system, you can use the following script: 2,0,10 4,,,C:\UpdatesDUA 1,,DAREBOOTOPT_REBOOT To carry out tasks that go beyond the available commands, you can execute additional programs and, if the programs support it, pass command-line parameters by using the DUA Execute command. Runtime Reconfiguration It is possible to initially deploy DUA with default settings and then reconfigure it by using a DUA script. This is useful if you need to change frequency, update source, or other similar settings. For example, to change the polling location, you can use the following script: //Delete existing poll location registry value 10,0,HKEY_LOCAL_MACHINE,,System\CurrentControlSet\Services\DUAgent\Parameters\Config\Session s\0000 //New registry key Lesson 1: Implement DUA 77 9,0,HKEY_LOCAL_MACHINE,,System\CurrentControlSet\Services\DUAgent\Parameters\Config\Sessions \0000,0 //Specify polling location and type 11,0,HKEY_LOCAL_MACHINE,0,SYSTEM\CurrentControlSet\Services\DUAgent\Parameters\Config\Sessio ns\0000,0,Type,4,1 //Set remote host to CustomHost 11,0,HKEY_LOCAL_MACHINE,0,SYSTEM\CurrentControlSet\Services\DUAgent\Parameters\Config\Sessio ns\0000,0,HostName,1,CustomHost //Set the host port to 80 11,0,HKEY_LOCAL_MACHINE,0,SYSTEM\CurrentControlSet\Services\DUAgent\Parameters\Config\Sessio ns\0000,0,HostPort,4,80 //Set the protocol to HTTP (0) 11,0,HKEY_LOCAL_MACHINE,0,SYSTEM\CurrentControlSet\Services\DUAgent\Parameters\Config\Sessio ns\0000,0,Protocol,4,0 Lesson Summary The DUA component enables you to configure updates for your device. The DUA component includes an executable that runs as a service on the device and parses a file that you create by writing a script that outlines the actions it takes to perform the update. After you create the command script, compile it by using the Device Update Script Compiler to produce the executable file, which you then deploy to the device. Quick Check 1. What operations can be performed through the DUA services? 2. How do you reconfigure DUA on a running device? Quick Check Answers 1. Update applications or application data. Deploy new binaries, device drivers, or registry changes. Automate cleanup and management tasks. Change the DUA polling time. 2. Create a script to manipulate the registry on the device and reconfigure DUA by changing its registry values. 78 Chapter 3 Integrating Embedded Enabling Features Lesson 2: Implement a USB Boot Solution USB devices are readily available and provide a cost-effective alternative to various boot media such as compact flash, or even CD or DVD. The high speed capabilities of USB 2.0 opened the door to booting from USB storage for Windows Embedded Standard 2009 devices. Starting from USB in the case of Windows Embedded Standard 2009 means starting from USB mass storage media, popularly known as Disk on Key (DoK), but not from CD or DVD USB drives. After this lesson, you will be able to: ■ Define the requirements for booting your device from a USB storage device. ■ Prepare the USB device. ■ Prepare your image for starting from USB. Estimated lesson time: 15 minutes. USB Boot Requirements First, your device needs to have USB 2.0 high speed support and the BIOS must support INT 13H. Because the NT loader, NTLDR, makes calls to INT 13H to access the disk on your device, the BIOS on your device must support these calls to INT 13H by complying with BIOS Enhanced Disk Drive Services 2 specifications and USB Mass Storage Specification for bootability. Only USB 2.0 high speed storage devices are supported, so make sure your USB device has a minimum write speed of 9 MB/sec and single-level cell not-and (SLC NAND) flash memory, which provides high performance and long time reliability. The USB mass storage media must have a bootable partition and be formatted. There are several caveats with booting from USB mass storage media. Hibernation is not supported; therefore, Enhanced Write Filter Hibernate Once/Resume Many (EWF HORM) is not supported. Crash dumps and pagefiles are also not supported. Lesson 2: Implement a USB Boot Solution 79 Preparing a USB Mass Storage Media for Booting You must prepare your USB storage device (DoK) before you can write an image to it.