Home > Articles > Operating Systems, Server

Integrating New Components into the Image

We can use the rapid development scenario described in earlier sections until we finish all basic development of welcome.exe. We made changes to the Welcome application so that it displays a message greeting on startup. We also added a caption and a system menu so that the window can be conveniently closed. The text now appropriately welcomes users to the first Windows CE platform in this book. Welcome will be started every time Adam boots so that the welcome message is the first message users see. Let's see how to add this somewhat concocted example to the image and automatically start Welcome on startup.

To add welcome.exe to the operating system image, we will need to modify a file in the parameter view of the platform workspace. Figure 3.14 shows the parameters view window for Adam. The files displayed in this window are used to specify how the operating system image will be built.

Figure 3.14 Parameter view

We'll delve into the specifics of each file elsewhere throughout the book, so a brief overview will suffice for now. The parameter view is organized into a set of files in three different categories. The option Common Files refers to files that are provided by Microsoft to specify how the operating system must be built with Microsoft-supplied components. You should not modify these files. Any modifications you make will affect all platforms and projects you create.


Note - To make sure that the compiler can find the file windev.h, you must add the include path in the CESYSGEN directory of Adam to the list of additional include directories in which the compiler may find included header files. CESYSGEN is the directory in which header files generated for the specific platform are placed. To add this directory to the include path for the compiler, you must click on the Project | Settings... menu item and then click on the C/C++ tab. Next, select Preprocessor in the Category: combobox. In the Additional include directories: edit box, type in "$(_WINCEROOT)\PUBLIC\ADAM\CESYSGEN\OAK\INC". This directory path will be passed to the compiler with the /I flag, which instructs the compiler to search the specified directory for the include path after looking in the standard include paths.


Different types of files contain different types of information:

  • BIB files contain information about which files, executables, and libraries should be included in the operating system image.

  • DAT files contain a directory map for the file system on Windows CE.

  • DB files contain information on how the Windows CE database should be initialized.

  • REG files contain a map of the system registry on startup.

The option Hardware Specific Files refers to files that specify configuration and initialization when you're building the platform.

Files specified by the option Project Specific Files contain additional information in each of these categories that is specific to the project being created. The word project in this case does not refer to Welcome, although that's what we've been telling you all along. Here the term project is a confusing throwback to the old days of the EDK. Under the terminology used then (and still reflected in the Platform Builder directory and file structure), CEPC is our platform and Adam is our project. This clarifies the role of these categories. Platform-specific files typically contain information regarding platform-specific drivers and modules. Project-specific files contain information about platform-independent modules. All the files are used by the set of Windows CE build tools when the image is being created.

If you have been following along closely, you might have already identified the BIB file as the one we must modify to integrate welcome.exe in the final operating system image. The first question, of course, is, To which BIB file should we add welcome.exe? The answer is simple enough: Since welcome.exe is platform-independent, it should be added to the BIB file project.bib in the Project Specific Files category.

Listing 3.3 shows the line that needs to be added to the BIB file to integrate the executable in the image. This line instructs the appropriate build tool to add the file $(_FLATRELEASEDIR)\welcome.exe to the image, where it will be called welcome.exe. The file must be loaded into the NK section of memory in ROM and must be uncompressed (type U). Sections of memory are set up in the file config.bib. We'll say more about this later in the book. Leaving the executable uncompressed gives the operating system the option of running the program in place in ROM. This avoids the work that the loader would normally do of uncompressing a file from ROM into RAM before executing it. In addition to the time gained because the file does not need to be uncompressed, precious RAM is made available for other programs.

Listing 3.3  Adding welcome.exe to project.bib

MODULES
; Name      Path                      Memory Type
; -------------- --------------------------------------------- -----------
  welcome.exe   $(_FLATRELEASEDIR)\Welcome.exe         NK   U

Now that Welcome is part of the operating system image, it will be transferred to the target platform by CESH. PPFS will no longer be required to load it on demand because the loader will find the file in the local file system on the target platform.

We still need to make Welcome execute automatically on startup. The kernel looks for a special registry entry after starting the file system to look for modules to load during startup. Since the REG file allows us to specify the contents of the system registry when the target platform is initialized, we can zero in on the platform-independent registry file project.reg. To automatically execute Welcome on startup, we must add the following lines to the registry initialization file project.reg:

[HKEY_LOCAL_MACHINE]\Init
"Launch80"="Welcome.exe"
"Depends80"=hex:1E,00

The Launch80 registry entry tells the kernel to launch the program welcome.exe. The function performed by the Depends80 line is not immediately obvious. This registry entry lists a hex number (001E) as its value. To discover the significance of this number, we must take a peek at the common registry file, common.reg. This file has its own init section that is used to specify programs to launch on startup. An excerpt of this file is shown in Listing 3.4.

Listing 3.4  The init registry key in common.reg

 [HKEY_LOCAL_MACHINE\init]
; @CESYSGEN IF CE_MODULES_SHELL
	"Launch10"="shell.exe"
; @CESYSGEN ENDIF
; @CESYSGEN IF CE_MODULES_DEVICE
	'Launch20"="device.exe"
; @CESYSGEN ENDIF
; @CESYSGEN IF CE_MODULES_GWES
IF NOGUI !
   "Launch30"="gwes.exe"
   "Depend30"=hex:14,00
ENDIF
; @CESYSGEN ENDIF

The hex number 001E corresponds to 30. The Launch30 registry item in the listing is the module gwes.exe. The entries related to gwes.exe instruct the kernel to launch gwes.exe on startup. The Depends80 line simply tells the kernel to wait until gwes.exe has been launched before launching welcome.exe, because welcome.exe uses the windows and message support made available by gwes.exe. Finally, the number 80 was chosen at random from among numbers higher than 30. This number indicates the sequence in which the registry entries must be processed. We need a number higher than that corresponding to the last entry in the common.reg file.

However, this dependency only synchronizes the launch sequence of different modules. It does not guarantee that gwes.exe will have fully initialized its services before welcome.exe is executed. To make sure that the window manager is available, Welcome must call IsAPIReady with its lone argument set to the constant SH_WMGR.

...
#include "windev.h"
...
While (!IsAPIReady (SH_WMGR))
    Sleep (1000);

The IsAPIReady call will return a value of TRUE if the API specified by the constant is available. If a value of FALSE is returned, the API is not yet ready for use and Welcome must wait in a loop for the API to initialize before it executes the remainder of its code.

Note the inclusion of the header file windev.h. This file contains the function prototype for IsAPIReady. Welcome loops and checks the value returned by this call to see if the window manager API is available. If the API is not available, Welcome sleeps for one second before checking again.

Now that we are ready with all the changes, we can test out the build by selecting the Platform | Build | Build Platform menu item after switching to the platform view. To confirm that welcome.exe has been included in the image, sift through the final output of the build process that lists all the files included in the image. The entry for welcome.exe, if included in the image, should look like Listing 3.5.

Listing 3.5  Output from the build process

MODULES Section
Module    Section Start   Length psize  vsize  Filler
------------ -------- --------- ------- ------- ------- ------
...
welcome.exe .text  80a6f000h  8192  5632  5508 o32_rva=1000h
welcome.exe .rdata  80a71000h  4096   512   289 o32_rva=3000h
welcome.exe .idata  80a72000h  4096  1024   565 o32_rva=5000h
welcome.exe .rsrc  80a73000h  4096  2560  2254 o32_rva=6000h
...
welcome.exe .data  8024ffdbh    0    0  2584 FILLER
...
welcome.exe E32   8052b55ch   100         FILLER
welcome.exe O32   8052b5c0h   120         FILLER

The next time you download the new image and boot the CEPC, Welcome should pop up as it did before on startup, welcoming the user to our new platform, Adam.

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020