Fine tuning - Microsoft Windows Embedded Standard 2009 Developer Resource Kit Componentizing Windows xp professional...

Fine tuning
This section provides more information about components that contain configurable features, and discusses some known feature issues.
Hot plugging and hot swapping
For hot plugging and hot swapping detection, make sure the PnP (User Mode) component is included in your runtime build.
Plug and Play Driver considerations
If you want to prevent the Add New Hardware wizard from appearing, remove the Add Hardware Control Panel component. If dependency check complains about a missing dependency when this component is not included, there is a good chance this warning can be ignored.
Alternately, try this registry key, in order to suppress the hardware arrival dialog.
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\PlugPlay\Parameters
Value name: SuppressUI
Type: REG_DWORD
Value: 0x1
If you do not want the user to be able to install new devices, set up the user as a non-Administrator. A small pop up will still appear for a non-admin user and asks the user to provide an admin password if installation is desired. With the above reg key, the small authentication pop up won’t appear.
You can avoid the Found new hardware dialog box if you pre-install the device drivers for a device on the target embedded device before a device is installed and the driver package is digitally signed. This is called "Software First" device installation. The other way is called "Hardware First" device installation, where the device is plugged in first, causing the Found new hardware dialog box to appear asking the user to provide the drivers. It appears only if the system does not have in-box drivers for the device, or if drivers exist but they are not digitally signed. There is no supported way to disable this dialog box.
The windows\Setupapi.log file can be very useful in discovering device driver Plug and Play events.
For additional information, visit the following Microsoft Web site:
Troubleshooting Device Installation with the SetupAPI Log File
How to identify the computer name
Include the Net.exe Utility component. Use the following command:
Net config workstation
How to identify IP settings
Include the TCP/IP Utilities component. Use the following command:
Ipconfig /all
Licensing issues when you install Office on a runtime
It is generally not acceptable or applicable to install Microsoft Office in a Standard 2009 runtime.
Standard 2009 can be licensed for use for line-of-business applications only. The number of other applications that can be used is unlimited, as long as they are required for use as part of the specific OEM embedded role or application. If you have a scenario that requires Microsoft Office, you should use either Windows XP Home or Windows XP Professional to fulfill the licensing and functional requirements of Microsoft Office.
Applying locale settings to a run-time image
To ensure that locale settings are applied to a run-time image (using International Control Panel), use Target Designer to amend the Extra Files section of the root component in your configuration; add the winnls.dll file. Alternately, include the Dos Windows on Windows Support component which owns winnls.dll, although this adds considerably to footprint.
Adding Japanese, Korean, or Chinese IME components
Input Method Editor (IME) components are not automatically added to your run-time image if you choose Japanese, Korean, or Chinese as your default input language. To enable the appropriate IME functionality, you must manually add the IME components that you want.
Using Component Designer to create a Service Resource for a component
Refer to the following Microsoft Knowledge Base article when you create a service resource for a component:
How to Create a Windows Service Using Sc.exe
This article describes how to use the Sc.exe tool to create a service. However, you can transfer Sc.exe and its command-line arguments into Component Designer. The following list describes the Sc.exe Start property and the Type property, and what they translate to in Component Designer.
Type
1
|
Kernel (Driver)
|
2
|
Filesys (File system Driver)
|
16
|
Own
|
32
|
Share
|
288
|
Interactive
|
Start
2
|
Automatic
|
3
|
Manual
|
4
|
Disabled
|
Moving Event Viewer logs to an unprotected volume
This tip is applicable to Enhanced Write Filter (EWF-RAM) users. To move Event Viewer logs to a volume unprotected by EWF, modify the following three registry keys as shown in the following example. The example uses drive D as the unprotected volume.
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\Application
File=D:\\AppEvent.evt
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\Security
File=D:\\SecEvent.evt
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\System
File=D:\\SysEvent.evt
Using Standard 2009 to boot to a USB device
Standard 2009 inherits USB Boot from XP Embedded.
Feature Pack 2007 introduced formal USB Boot Support. However, install Update Rollup 1.0 or later (i.e. Standard 2009) in order to use the latest USB Boot binaries that accommodate the standby/resume power state.
Runtimes and Antivirus Software
The Etrust antivirus tool has been successfully installed and used in Standard 2009 runtimes. For additional information, visit the following Web site:
CA home page (search for XP Embedded)
Also check this out:
Kaspersky Anti Virus sample component for XPe
Check these links:
Sygate Security Agent
http://blogs.msdn.com/embedded/archive/2005/08/06/448602.aspx
http://blogs.msdn.com/embedded/archive/2005/03/23/401377.aspx
Windows XP Embedded Security
It may be difficult to keep antivirus software updated on a runtime. It is common for systems to perform a remote boot from the store master controller, which can lock down the boot image on the master server and make it read-only. Then, each remote boot pulls down the master image.
One possibility is to store the antivirus software in RAM or on the EWF partition.
Another option is to eliminate the need for the antivirus software by removing or disabling components or hardware that would enable infection.
Other considerations:
Is the Windows Firewall/Internet Connection Sharing (ICS) component installed and enabled? You can fine tune its Settings.
What applications are installed and used? For example, what e-mail clients, scripting engines, browsers, and so on are installed and used?
If you had antivirus software, would you be able to update it on a very regular basis? Outdated antivirus signatures are only slightly better than none at all.
Are you using EWF to write protect your media?
Are these systems exposed to the Internet or on an isolated subnet?
You can use FBWF to set the anti-virus signatures folder as an exception so it is updated even when FBWF is enabled.
Check with antivirus companies to determine whether they are creating components of their software for Standard 2009.
Netset tool
Netset.exe is a standalone utility that you can use to add, remove, or change the network configuration of a client computer that has Windows already installed on it. For additional information, view the following article in the Microsoft Knowledge Base:
Description of the Netset.exe tool from the Windows 2000 Resource Kit
How to set the Time Zone offline in Target Designer
You may notice that all your runtimes default to the Coordinated Universal Time (Greenwich Mean Time) time zone. This behavior occurs because registry keys are populated by the NLS: Time Zones component.
Include the Time Zone Settings component in your design to set the default time zone.
Alternately, use one of the following procedures:
To create a component to own these new keys, set your new component Build Order for these registry keys to "1001" so that the registry keys overwrite the default UTC time zone that is added by the NLS: Time Zones component.
To enter this information directly into Target Designer:
Go to the NLS: Time Zones component in Target Designer, click its Registry node to view the registry keys, and then disable each of the values that are listed at the end of this procedure.
At the top of your configuration in the center pane of Target Designer, click the Extra Registry Data node, and then type the appropriate registry data. The following example is for Pacific Standard Time.
Add the time zone information that you require to your configuration with Target Designer by including the correct registry values listed here:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation
"ActiveTimeBias"=DWORD:000001a4
"Bias"=DWORD:000001e0
"DaylightBias"=DWORD:ffffffc4
"DaylightName"="Pacific Daylight Time"
"DaylightStart"=HEX:00,00,04,00,01,00,02,00,00,00,00,00,00,00,00,00
"StandardBias"=DWORD:00000000
"StandardName"="Pacific Standard Time"
"StandardStart"=HEX:00,00,0a,00,05,00,02,00,00,00,00,00,00,00,00,00
You can also view this key in your full version of Windows XP Professional.
Where to turn on paging file support
By default there is no paging file in a Standard 2009 runtime. You can add support for this by checking the configurable settings in your HAL component. Common HAL component names are Standard PC component, ACPI Uniprocessor, Advanced Configuration Power Interface, etc.
How to move or rename your paging file in your runtime
Occasionally, you may want to rename the paging file from Pagefile.sys to Newfilename.sys, where Newfilename is the name you want to give to the renamed file.
Or, you may want to move the paging file to another partition that is not protected by EWF.
To rename or move the paging file, make the appropriate changes to the following registry key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management
Value: PagingFiles
Type: REG_MULT_SZ
Data: C:\pagefile.sys 150 500
In that Data field, you can adjust the name of the paging file, its location, and its minimum and maximum values.
For example, if you decide that you want the paging file to reside on drive D, to be called "Oldpagefile.sys", have a minimum value of 3 MB, and a maximum value of 2 GB, the Data field of the key would look similar to the following:
Data: D:\oldpagefile.sys 3 2000
You can make these changes from within the runtime itself if you have the registry tools installed. Or you can load the System hive offline with Regedit.exe from a full build of Windows, make your changes, and then unload the hive.
How to clear the paging file
See this Support article:
How to Clear the Windows Paging File at Shutdown (KB 314834)
The registry key that is referenced in the above article can be found in the Session Manager (Windows subsystem) component.
Make your runtime behave as if it is installed on drive C even though it is installed on another partition
You can remap the assignment of drive letters to partitions. The Extra Registry Data from Target Designer, enables you to assign drive letters for every volume on the target device. For example, on the target device, from a full build of Windows XP, export the following registry keys to a .reg file:
HKEY_LOCAL_MACHINE\System\MountedDevices
In Target Designer, click Import on the File menu to load registry values from that REG file. Those keys will appear in the center pane in the "Extra Registry Data" node.
Remove any imported keys that begin with
HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices\??\Volume{guid}
For example:
HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices\??\Volume{99a4d6c3-bc54-11d6-81af-fd310b342a24}
Reassign drive letters in registry key names than begin with \DosDevices\. For example, if you want to place the runtime on the G: partition but make the runtime think and behave as if it were on the C: partition, change the registry key setting from \DosDevices\G: to \DosDevices\C:.
Folder settings in Target Designer will all point to drive C. For example:
C:\Windows
C:\Program Files
C:\Documents and Settings
However, the boot Advanced Risc Computing (ARC) path should point to the true location of the runtime.
Insight to the boot process:
During the boot, Windows mounts and assigns drive letters according to following order:
First it uses letters for volumes that have reserved positions saved within entries in the following registry key:
HKEY_LOCAL_MACHINE\System\MountedDevices\\DosDevices
Then it tries to find new volumes that do not have matching IDs in both the Volume, and the DosDevice key groups. If the volume that matches this criteria is found, Standard 2009 assigns the first available drive letter to it, and creates both Volume and DosDevice keys for it.
Insight to volume ID:
The volume ID is a binary value that is 12 or more bytes long. It is unique for every partition on a disk, and is always the same for all installed Standard 2009-based operating systems. The first 4 bytes are disk IDs and are the same as the value that you obtain when you use the DiskPart utility.
The last 8 bytes represent partitions offset on disk. For removable devices, there is a more complex algorithm for creating the volume ID, but it is unique for every device.
Applications:
Easy deployment of a pre-FBA image to a remote hard drive that has Windows XP installed on drive C. This application allows you to use drive C for your Standard 2009 image without bothering about the drive letter order that will be assigned.
To enable RAMDrive. When you make a System Deployment Image (SDI), you need to have Standard 2009 installed on drive C for Windows RAM Disk Driver (RAMDrive) to work.
Testing. In test scenarios, you can have more than one working Standard 2009 environment that differ in some settings. For example, you can test application behavior on drive D while you have MinLogon and Windows Logon builds that you want to boot from drive C.
You can run Shutdown.exe from a command shell to shut down a system that uses WinLogon. Shutdown.exe is owned by the Misc. Command Line Tools component. Run shutdown.exe /? for help regarding shutdown.exe command line arguments.
The APIs for quitting Windows (for example ExitWindowsEx) are specifically tailored to allow you to shut down, power off, or restart the computer. Another choice is InitiateSystemShutdown[Ex], which has a little more flexibility, including a dialog box with the shutdown information.
If you use the MinLogon component, and you want to shut down your computer by means of the power button, you can write a Windows 32-bit program that responds to the WM_POWERBROADCAST message by calling the ExitWindowsEx API.
You typically should not use the Xpepm.exe and Xpepm.dll binary files to initiate a system shutdown. These binary files offer power management features and were originally intended for use in “kernel only” configuration run times. Unfortunately, Xpepm.exe does not fully prepare the system for shut down before it initiates standby or hibernates, in the case of images that use Minlogon or Windows Logon. For example, updates to the registry may fail to be written back from internal system cache memory to your hard disk before the system shuts down. For the safest and most orderly shutdown, use either the ExitWindowsEx API or the InitiateSystemShutdown[Ex] API instead.
Instead of using XPEPM -hibernate to initiate hibernation, use the following to ensure that applications receive hibernation notification before the system goes into hibernation. XPEPM does not notify applications regarding pending hibernation.
rundll32.exe PowrProf.dll,SetSuspendState
Bootvis system boot performance analysis tool
The Bootvis system boot performance analysis tool is useful for analyzing system performance, not for increasing performance. More information about the Bootvis boot-time performance analysis tool is available at the following Web site:
BootVis.exe Tool for System Manufacturers
First Boot Agent
First Boot Agent (FBA) is the Standard 2009 equivalent to Windows XP Professional Setup. It updates the embedded runtime with required information that can only be determined dynamically, such as Plug and Play configuration, dynamic COM server registration, and so on.
The Timeout property used by FBA in FBA Generic Command does not actually kill the thread after a timeout occurs; instead, it reports the timeout to the FBA log and then continues to wait for the thread to complete. The log report can be used for diagnostics purposes, to report threads that run longer than expected.
For more detailed FBA information:
A Deep Dive into First Boot Agent (Standard 2009)
Older links:
First Boot Agent
First Boot Agent: Not Just a Pretty Face
Duplicating images to many Compact Flash and Flash Module devices in a production environment
To duplicate images to many Compact Flash and Flash Module devices in a production environment, consider using a CF Card Duplicator.
From a Windows XP system, Choose Start -> All Programs -> Windows Catalog. This will take you to http://www.windowsmarketplace.com , where Microsoft lists all hardware and software that meet Microsoft's quality and compatibility standards and have earned the Microsoft Windows XP logo (after passing through the WHQL tests).
Does Microsoft support installation of Microsoft SQL Server into my Standard 2009 runtime image?
Standard 2009 offers the following components that fulfill the dependency requirements of the selected SQL Server versions and their installer applications. This allows you to install SQL from the desktop (i.e the SQL installer application) as you would for Windows XP Professional.
Microsoft SQL Express 2005 Macro
Microsoft SQL Server 2000 Desktop Edition
For additional SQL related topics in our embedded blog site:
http://blogs.msdn.com/embedded/search.aspx?q=sql&p=1
Using SQL Server with Standard 2009
SQL Server can be run on a Standard 2009 runtime under the following conditions:
SQL Server is the only application that is running locally on the embedded device.
There are less than or equal to ten concurrent server message block (SMB) connections to the Standard 2009 computer.
How can I edit the Registry of my XP Embedded image, before FBA has run?
You can off-line view and edit the pre-FBA registry hives in your Standard 2009 image, using your development computer. The registry hive files are located in the \WINDOWS\system32\config folder in your Standard 2009 image.
Files with the .SAV extension are pre-FBA. Once FBA completes, the files are saved without the .SAV extension:
DEFAULT.SAV
SOFTWARE.SAV
SYSTEM.SAV
DEFAULT
SAM
SECURITY
SYSTEM
Procedure:
Build your image but do not run FBA yet. Perform an off-line registry hive edit (in windows\system32\config\system.sav) using regedit. The following steps show how to edit the system.sav branch of the registry (which corresponds to HKEY_LOCAL_MACHINE/SYSTEM).
Run Regedit
Click on HKEY_LOCAL_MACHINE
Choose File->Load Hive
Select this file found in your Standard 2009 image: windows\system32\config\system.sav
Choose an arbitrary name for the temporary hive path. For our example we will use FOO.
Make any desired changes to the hive branches, using RegEdit
Click on the FOO key, then use File->Unload Hive in order to unload the registry hive from Regedit
Let your modified XPe image boot, in order to FBA the modified image.
Note that each time you need to rebuild your image, you will need to repeat the above process.
Where can I find useful utility programs for use when developing a Standard 2009 Image?
Review the list of utilities in XPe components, listed in Addenda 1. Table of built-in Windows XP utilities. Alternately, open the " Windows Embedded Standard 2009 Components.xls" companion spreadsheet, and Data->Sort by Debug / Development tools.
Over 71 Windows XP Professional utility programs may be found in the Support folder in the Windows XP Professional SP2 CDROM. Follow the installation instructions.
Windows XP Service Pack 2 Support Tools offers these utilities:
Ipseccmd.exe
Httpcfg.exe
Replmon.exe
Iadstools.dll
Extract.exe
Bitsadmin.exe
Netdom.exe
See Windows Sysinternals for useful development and debugging tools (Filemon, Regmon, Process Explorer, Process Monitor etc.)
How to apply a static IP address to the runtime
To apply a static IP address to your runtime, set a batch file or script to run during RunOnce. Use the following commands to have Netsh.exe configure the IP for you. You must also add the Network Command Shell, Network Command Shell Interface Context, and IP Router Monitor Library components.
A typical batch file/script follows:
netsh interface ip set address name="Local Area Connection" source=static addr=192.168.1.10 255.255.255.0 192.168.1.1 1
netsh interface ip set dns name="Local Area Connection" static 192.168.1.2 primary
netsh interface ip add dns name="Local Area Connection" 192.168.1.3 index=2
netsh interface ip add dns name="Local Area Connection" 192.168.1.4 index=3
|