<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Where are we going, and what's with the handbasket? : platform builder</title><link>http://blogs.msdn.com/dcook/archive/tags/platform+builder/default.aspx</link><description>Tags: platform builder</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Introduction to the Catalog Object Model</title><link>http://blogs.msdn.com/dcook/archive/2007/12/18/introduction-to-the-catalog-object-model.aspx</link><pubDate>Wed, 19 Dec 2007 00:03:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6800374</guid><dc:creator>dcook</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/dcook/comments/6800374.aspx</comments><wfw:commentRss>http://blogs.msdn.com/dcook/commentrss.aspx?PostID=6800374</wfw:commentRss><description>&lt;P&gt;Today's post will&amp;nbsp;provide a&amp;nbsp;basic introduction to the&amp;nbsp;Windows Embedded CE Platform Builder Catalog. If you don't know what that is, consider yourself lucky. If you do have to deal with the catalog data, today's post might be helpful.&amp;nbsp;We'll write a quick C# utility that demonstrates the catalog object model and also provides some useful diagnostic information that might be helpful to catalog file authors.&amp;nbsp;The tool will display any errors or warnings that PB encounters while loading the catalog. It will also list all of the catalog files that it was able to load.&lt;/P&gt;
&lt;P&gt;I don't really know how it happened, but somehow about 5 years ago, through no fault of my own, I ended up owning the PB "catalog". For those who don't know, the catalog is a repository for information about the CE operating system, and PB uses this information to help developers customize their CE builds. For example, if you have the environment variable "SYSGEN_AUDIO" set when you build a CE operating system, your operating system will include sound system support. The catalog has a list of these "features", along with a friendly title, description, and some metadata that helps PB ensure that the environment variable is properly exposed to the developer.&lt;/P&gt;
&lt;P&gt;There were some significant issues with the catalog's design, and maintaining the catalog data was not a fun experience. CEC files were not &amp;nbsp;Maintaining the code that worked with the catalog was also problematic. For PB 6.0, I finally had the opportunity to start from scratch with a new catalog format. While a certain amount of backwards compatibility was required (the new catalog needed to essentially provide the same data as the old one, and there would need to be an upgrade path). So I designed a new catalog system, written in C# and based on XML files. While it isn't perfect, I think it is an improvement.&lt;/P&gt;
&lt;P&gt;From a development perspective, one thing that is nice about the new catalog is that it has a pretty clean object model (an interface for developers who want to use the catalog). While we've never published the interface for the object model, we don't support it for external use, and everything I say here comes without warrantee or guarrantee of future compatibility, it isn't too hard to get started with basic tasks using the catalog object model. The reflection and metadata included in every managed assembly make this possible.&lt;/P&gt;
&lt;P&gt;Before I go too far, I want to be clear that the design for the catalog object model&amp;nbsp;emphasized the most common use of the catalog as a read-only repository. Loading and reading data from the catalog is (hopefully) reasonably simple and efficient. Using the object model to create or edit catalog files is a bit more of a challenge and not quite as efficient.&lt;/P&gt;
&lt;P&gt;Loading a catalog means parsing about 2 megabytes of XML and loading the data into memory. While this happens in less than 1/10 of a second, we don't want to do this too often. In addition, we don't usually need (or want)&amp;nbsp;multiple copies of the catalog in memory. To help with this, the catalog object model provides a cache of read-only loaded catalogs. When loading a catalog via the object model, you can choose to get your own copy of the catalog or you can ask for a read-only copy, which may come from the cache. (The cache is based on the .NET garbage collector via weak references. As long as anybody is using a catalog, it won't be evicted from the cache. As soon as nobody is using it, it becomes eligible for garbage collection. If it re-enters use before it is collected, it is no longer eligible for collection.)&lt;/P&gt;
&lt;P&gt;The first step in using the catalog from your own code is to reference the catalog library. This code is in the Microsoft.PlatformBuilder.Catalog assembly, which (assuming you've installed Platform Builder 6 into C:\Program Files)&amp;nbsp;can be found in C:\Program Files\Microsoft Platform Builder\6.00\cepb\idevs\Microsoft.PlatformBuilder.Catalog.dll. In Visual Studio, add a reference to this file. For convenience, you can add a "using" declaration to the top of your code to import the Catalog's namespace:&lt;/P&gt;
&lt;DIV style="FONT-SIZE: 10pt; FONT-FAMILY: Monospace; BACKGROUND-COLOR: white"&gt;&lt;SPAN style="COLOR: blue"&gt;using&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt; Microsoft.PlatformBuilder.Catalog;&lt;/SPAN&gt; &lt;/DIV&gt;
&lt;P&gt;Next, to load a catalog, you use the CatalogManager class. The CatalogManager is a collection of catalog files. It handles searching through a winceroot for catalog files to load, loading all of the catalog files into memory, and maintaining the organization of the data in the catalog. It "flattens" the contents of the files, merging the data from all of the catalog files into a single collection of catalog elements. It also groups the data by type (so I can get a list of BSPs without going through all elements in the whole catalog), and generates indexes (so I can quickly look up a BSP by name).&lt;/P&gt;
&lt;P&gt;When creating a CatalogManager, you can either create your own (writable) copy or you can load a read-only cached copy that might be shared by other components in the same process. To create a writable copy, just use the CatalogManager's constructor:&lt;/P&gt;&lt;FONT size=3&gt;
&lt;P&gt;&lt;FONT face=Monospace size=-1&gt;&lt;FONT color=#2b91af&gt;CatalogManager&lt;/FONT&gt;&lt;FONT color=black&gt; catalog = &lt;/FONT&gt;&lt;FONT color=blue&gt;new&lt;/FONT&gt;&lt;FONT color=black&gt; &lt;/FONT&gt;&lt;FONT color=#2b91af&gt;CatalogManager&lt;/FONT&gt;&lt;FONT color=black&gt;();&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;The default constructor for the CatalogManager will load only the "Global" catalog files. These are the catalog files in C:\Program Files\Microsoft Platform Builder\6.00\Catalog, and need to be available to PB whether or not it is working with a CE OS tree. To load the catalog files from an OS tree as well as the global catalog files, just add the winceroot path to the constructor call:&lt;/P&gt;&lt;SPAN style="COLOR: #2b91af"&gt;
&lt;DIV style="FONT-SIZE: 10pt; FONT-FAMILY: Monospace; BACKGROUND-COLOR: white"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;CatalogManager&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt; catalog = &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;CatalogManager&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;@"C:\wince600"&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;P&gt;&lt;/SPAN&gt;If you don't need to make changes to the catalog manager's data and don't need precise control over the load sequence, you can use the CatalogManager factory method. This will return a cached catalog if one is available, so it is&amp;nbsp;usually more efficient for repeated use&amp;nbsp;than creating and loading a new catalog each time.&lt;/P&gt;&lt;FONT color=#2b91af size=3&gt;&lt;FONT color=#000000 size=2&gt;
&lt;DIV style="FONT-SIZE: 10pt; FONT-FAMILY: Monospace; BACKGROUND-COLOR: white"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;CatalogManager&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt; catalog = &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;CatalogManager&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt;.GetCatalogManager(&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;@"C:\wince600"&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/FONT&gt;&lt;/FONT&gt;
&lt;P&gt;Next, we want to know if the catalog manager had any trouble while loading the catalog. For normal operation,&amp;nbsp;developers generally&amp;nbsp;don't want a defective catalog file to prevent PB from working correctly, so the catalog manager will silently catch catalog load errors. However, when working on catalog files, it is helpful to know what PB really thinks about your catalog. The catalog manager keeps track of warnings and errors generated during catalog load. You can access the errors via the catalog manager's Messages property, which is a read-only collection of CatalogMessage objects.&lt;/P&gt;
&lt;P&gt;The catalog manager also provides a utility method to format the error or warning messages. It will then write the messages to any TextWriter (i.e. a StreamWriter or&amp;nbsp;StringWriter). For example, to print all error or warning messages to stdout, you could do this:&lt;/P&gt;
&lt;DIV style="FONT-SIZE: 10pt; FONT-FAMILY: Monospace; BACKGROUND-COLOR: white"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;CatalogManager&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt;.WriteCatalogMessages(catalog.Messages, &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;Console&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt;.Out);&lt;/SPAN&gt; &lt;/DIV&gt;
&lt;P&gt;Finally, we want to access some of the data in the catalog. Let's print out a list of all of the catalog files that were successfully loaded:&lt;/P&gt;
&lt;DIV style="FONT-SIZE: 10pt; FONT-FAMILY: Monospace; BACKGROUND-COLOR: white"&gt;&lt;SPAN style="COLOR: blue"&gt;foreach&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt; (&lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;CatalogFile&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt; file &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;in&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt; catalog.Files)&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;Console&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt;.WriteLine(&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;"CatalogFile: {0} - \"{0}\""&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt;,&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;file.FileInformation.Title, file.FullName);&lt;BR&gt;}&lt;BR&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;P&gt;&lt;SPAN style="COLOR: blue"&gt;&lt;SPAN style="COLOR: black"&gt;Similar collections exist for the BSPs, CPUs, and "Items" in the catalog.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="COLOR: blue"&gt;&lt;SPAN style="COLOR: black"&gt;Here is a simple command-line program that pulls this all together. You can build this via a Visual Studio C# command-line app project, or you can compile this at the command line with the csc.exe C# compiler. The only trick is to add a reference to the Microsoft.PlatformBuilder.Catalog.dll assembly (from C:\Program Files\Microsoft Platform Builder\6.00\cepb\idevs).&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="COLOR: blue"&gt;&lt;SPAN style="COLOR: black"&gt;Have fun!&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;SPAN style="COLOR: blue"&gt;&lt;SPAN style="COLOR: black"&gt;
&lt;DIV style="FONT-SIZE: 10pt; FONT-FAMILY: Monospace; BACKGROUND-COLOR: white"&gt;&lt;SPAN style="COLOR: blue"&gt;using&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt; System;&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;using&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt; System.IO;&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;using&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt; Microsoft.Win32;&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;using&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt; Microsoft.PlatformBuilder.Catalog;&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;namespace&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt; CatalogErrors&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;class&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;Program&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;static&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt; Main(&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt;[] args)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;try&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt; winceroot = &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;null&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt;;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt; (args.Length &amp;gt; 0)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt; arg0 = args[0].ToLowerInvariant();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt; (arg0 != &lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;"/?"&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt; &amp;amp;&amp;amp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;arg0 != &lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;"-?"&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt; &amp;amp;&amp;amp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;arg0 != &lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;"/h"&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt; &amp;amp;&amp;amp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;arg0 != &lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;"-h"&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt; &amp;amp;&amp;amp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;arg0 != &lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;"--help"&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt;)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;winceroot = args[0];&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;else&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;winceroot = GetDefaultWinceroot();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt; (winceroot != &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;null&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt; &amp;amp;&amp;amp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;!&lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;Directory&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt;.Exists(winceroot))&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;Console&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt;.Error.WriteLine(&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;"ERROR: Winceroot \"{0}\" not found."&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt;,&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;winceroot);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;winceroot = &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;null&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt;;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt; (winceroot == &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;null&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt;)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;Console&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt;.Error.WriteLine(&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;"Usage: CatalogErrors [winceroot]"&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt;);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;Console&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt;.Error.WriteLine(&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;"Displays any CE catalog load warnings and errors."&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt;);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;Console&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt;.Error.WriteLine(&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;"If winceroot is not specified, uses default from registry."&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt;);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;else&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Run(winceroot);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;catch&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt; (&lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;Exception&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt; ex)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;Console&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt;.Error.WriteLine(&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;"ERROR: {0}: {1}{2}"&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt;,&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ex.GetType().FullName,&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ex.Message,&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ex.StackTrace);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ex = ex.InnerException;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;while&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt; (ex != &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;null&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt;)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;Console&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt;.Error.WriteLine(&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;"&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : {0}: {1}{2}"&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt;,&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ex.GetType().FullName,&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ex.Message,&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ex.StackTrace);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;private&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;static&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt; GetDefaultWinceroot()&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt; winceroot = &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;null&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt;;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;using&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt; (&lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;RegistryKey&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt; localDir = &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;Registry&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt;.CurrentUser.OpenSubKey(&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;@"Software\Microsoft\Platform Builder\6.00\Directories"&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt;))&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt; (localDir != &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;null&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt;)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;winceroot = localDir.GetValue(&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;"OS Install Dir"&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt;) &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;as&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt;;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt; (winceroot == &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;null&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt;)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;using&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt; (&lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;RegistryKey&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt; globalDir = &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;Registry&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt;.CurrentUser.OpenSubKey(&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;@"Software\Microsoft\Platform Builder\6.00\Directories"&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt;))&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt; (globalDir != &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;null&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt;)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;winceroot = globalDir.GetValue(&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;"OS Install Dir"&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt;) &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;as&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt;;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;return&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt; winceroot;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;private&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;static&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt; Run(&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt; winceroot)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;CatalogManager&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt; catalog =&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;CatalogManager&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt;.GetCatalogManager(&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;@"C:\wince600"&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt;);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;CatalogManager&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt;.WriteCatalogMessages(catalog.Messages, &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;Console&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt;.Out);&lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;foreach&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt; (&lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;CatalogFile&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt; file &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;in&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt; catalog.Files)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;Console&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt;.WriteLine(&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;"CatalogFile: {0} - \"{0}\""&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt;,&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;file.FileInformation.Title, file.FullName);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;}&lt;BR&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=6800374" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/dcook/archive/tags/pb/default.aspx">pb</category><category domain="http://blogs.msdn.com/dcook/archive/tags/ce/default.aspx">ce</category><category domain="http://blogs.msdn.com/dcook/archive/tags/platform+builder/default.aspx">platform builder</category><category domain="http://blogs.msdn.com/dcook/archive/tags/pbcxml/default.aspx">pbcxml</category><category domain="http://blogs.msdn.com/dcook/archive/tags/catalog/default.aspx">catalog</category></item><item><title>Missing OS Design View tab in PB 5.0</title><link>http://blogs.msdn.com/dcook/archive/2007/09/11/missing-os-design-view-tab-in-pb-5-0.aspx</link><pubDate>Wed, 12 Sep 2007 01:41:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4872119</guid><dc:creator>dcook</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/dcook/comments/4872119.aspx</comments><wfw:commentRss>http://blogs.msdn.com/dcook/commentrss.aspx?PostID=4872119</wfw:commentRss><description>&lt;P&gt;A common complaint about PB 5.0 is that&amp;nbsp;the OS Design View tab will sometimes mysteriously&amp;nbsp;disappear. The best answer I have is that&amp;nbsp;people should be using PB 6.0. Unfortunately, that answer tends to make people want to punch me. In the interest of my own safety, here is what I know about alternative methods of resolving the problem.&lt;/P&gt;
&lt;P&gt;The OS Design View tab is one of the places where the old PB shell code (VS 6.0 vintage 1998) meets up with the new PB object model (totally re-written and designed for integration with the VS 2005 shell).&amp;nbsp;So this&amp;nbsp;is more evidence that you can't put new wine in old bottles -- you'll almost always end up with leaks.&lt;/P&gt;
&lt;P&gt;In the case of the OS Design View, most of the issues I've resolved were due to an exception leaking. Exception handling is a great thing, but it has the good/bad quality that it is often easy to forget that you're calling a function that can throw an exception (good when you don't need to handle it, bad when you do...).&lt;/P&gt;
&lt;P&gt;Ideally, the exception will be caught by PB and PB will properly recover and/or display a useful error message, but this doesn't always happen, in which case PB just silently fails or crashes. Luckily, the exception type we use does a little bit of logging. The exception constructor will send a quick message to the system debug stream. Sometimes this message is useless, but every once in a while, the exception has enough information to help you track down the problem.&lt;/P&gt;
&lt;P&gt;There are several utilities that can monitor the debug stream. DBMon.exe is a simple console tool that is part of the Microsoft Platform SDK. &lt;A class="" href="http://www.microsoft.com/technet/sysinternals/Miscellaneous/DebugView.mspx" mce_href="http://www.microsoft.com/technet/sysinternals/Miscellaneous/DebugView.mspx"&gt;DebugView&lt;/A&gt; can be downloaded from the &lt;A class="" href="http://www.microsoft.com/technet/sysinternals/default.mspx" mce_href="http://www.microsoft.com/technet/sysinternals/default.mspx"&gt;SysInternals&lt;/A&gt; website. If you run cepb.exe under a debugger such as &lt;A class="" href="http://www.microsoft.com/whdc/devtools/debugging/installx86.mspx" mce_href="http://www.microsoft.com/whdc/devtools/debugging/installx86.mspx"&gt;WinDbg&lt;/A&gt; or Visual Studio, you'll also see the messages from the debug stream.&lt;/P&gt;
&lt;P&gt;In the case of Missing OS Design View tabs, I have occasionally been able to track down the problem by monitoring the system debug stream while opening an OS Design (pbxml). For example, I saw an "Access Denied" exception that occurred while trying to open a file in&amp;nbsp;an OS Design. The exception message included the file name. Removing the "Read Only" attribute from the file allowed me to successfully open the OS Design.&lt;/P&gt;
&lt;P&gt;Obviously, this is a problem with PB. PB should probably be able to do its job with read-only access to the file. And if it fails, it should at least pop up a useful error message indicating what the problem was. Hopefully, we'll do better in the future. In the meantime, you can try to identify the file that is causing trouble for PB and remove the read-only attribute. While this might cause trouble for your source control system, you'll hopefully at least be able to get back to work.&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Start&amp;nbsp;a debug stream monitor utility such as DbMon.exe or DebugView, then start cepb.exe. Alternatively, launch cepb.exe under a debugger such as Visual Studio or WinDbg.&lt;/LI&gt;
&lt;LI&gt;Recreate the scenario that is causing trouble. For example, if the OS Design View tab is missing when you&amp;nbsp;open&amp;nbsp;a particular OS Design, open that OS Design.&lt;/LI&gt;
&lt;LI&gt;Examine the messages logged to the debug output stream.&lt;/LI&gt;
&lt;LI&gt;If you find any messages that look interesting, try to resolve the problem they indicate. For example, if you see that one of the messages refers to an access denied failure when opening a particular file, verify that the file exists and that you can access the file. If the file is read-only, try removing the read-only attribute from the file using Explorer (right-click on the file and select "Properties") or the DOS Attrib command.&lt;/LI&gt;
&lt;LI&gt;Leave a comment below or &lt;A class="" title="Contact Doug" href="http://blogs.msdn.com/dcook/contact.aspx" mce_href="http://blogs.msdn.com/dcook/contact.aspx"&gt;contact me&lt;/A&gt; to let me know if this does or does not work for you!&lt;/LI&gt;&lt;/OL&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=4872119" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/dcook/archive/tags/pb/default.aspx">pb</category><category domain="http://blogs.msdn.com/dcook/archive/tags/ce/default.aspx">ce</category><category domain="http://blogs.msdn.com/dcook/archive/tags/platform+builder/default.aspx">platform builder</category><category domain="http://blogs.msdn.com/dcook/archive/tags/os+design+view/default.aspx">os design view</category></item><item><title>PbcXml: Metadata in PB</title><link>http://blogs.msdn.com/dcook/archive/2007/09/08/pbcxml-metadata-in-pb.aspx</link><pubDate>Sun, 09 Sep 2007 02:57:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4836830</guid><dc:creator>dcook</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/dcook/comments/4836830.aspx</comments><wfw:commentRss>http://blogs.msdn.com/dcook/commentrss.aspx?PostID=4836830</wfw:commentRss><description>&lt;P&gt;When Platform Builder interacts with a CE OS build tree ("winceroot", i.e. C:\WINCE600), it needs to know a little bit about the contents of that build tree. For example, it needs to know what SYSGEN variables are available and what they mean. It needs to know what BSPs are available and what options they provide. It needs to know what CPUs have been installed. We refer to this information as the winceroot metadata.&lt;/P&gt;
&lt;P&gt;This data is either hardcoded into PB, or encoded into the "catalog". The catalog was&amp;nbsp;historically used when data changed so often that code changes for the data got to be annoying. In any case, the data was still&amp;nbsp;essentially hardcoded into PB since the&amp;nbsp;catalog lived in PB's&amp;nbsp;Program Files directory.&lt;/P&gt;
&lt;P&gt;As PB has matured, we've tried to move in the direction of decoupling PB from the winceroot. One consequence of this is that we try to move as much metadata out of PB and into the winceroot itself. The first step was to move the catalog from PB's Program Files directory into the winceroot. Then we moved some of the hardcoded information into various metadata files in the winceroot or figured out some way to dynamically infer that metadata from existing files in the winceroot. Finally, in PB 6.0, we rewrote the "catalog" system using XML instead of "CEC" files. One of the&amp;nbsp;goals was&amp;nbsp;to make it usable with all kinds of new metadata. We consolidated a few of the other metadata files into the catalog as well as including all of the metadata from the old catalog. The next version of PB will have many additional metadata types in the catalog.&lt;/P&gt;
&lt;P&gt;One&amp;nbsp;immediate disadvantage of this is that while we want PB to be decoupled from the winceroot, we have immediately created a hard break between PB 5.0's metadata format and PB 6.0's metadata format. This is why PB 6.0 doesn't work with the CE 5.0 build tree as shipped. Since PB&amp;nbsp;n had never really worked well with the&amp;nbsp;CE n-1 build tree before, we didn't consider this to be a particularly significant problem. (PB 6.0 includes a tool called "CecImport.exe" that can be used to extract the bare-bones 5.0-format metadata from a CE 5.0 build tree and write it in the 6.0 format. This is unsupported, but it may work if you really want to use PB 6.0 tools with a CE 5.0 tree. Additional tweaking beyond the automatic conversion may be required for best results.)&lt;/P&gt;
&lt;P&gt;Another disadvantage is that PB n will choke on the metadata from PB n+1. This probably could have been avoided had we used a somewhat more relaxed mechanism for parsing the metadata files. We decided that we wanted the schema to be as tight as possible so that catalog authoring errors would show up quickly. Instead of ignoring unrecognized metadata, we raise an error.&lt;/P&gt;
&lt;P&gt;The new format brings several advantages. As XML, it is a lot easier to manipulate with general development tools (Visual Studio's XML editor, XmlSpy, or even Notepad) than the old catalog database. The schema (PbcXml600.xsd, which may or may not be renamed for future versions) contains documentation for each element and attribute type (aka "what in the world was Doug thinking when he invented this element?"). Adding new data to the catalog is as easy as dropping a new XML file into&amp;nbsp;the appropriate&amp;nbsp;Catalog directory in the winceroot.&lt;/P&gt;
&lt;P&gt;The manipulation of the catalog is managed by a C# assembly named "Microsoft.PlatformBuilder.Catalog.dll". This includes the object model for the catalog (classes corresponding to each XML element), helper functions for loading and querying the data, a system for determining where a catalog element should show up if the catalog "tree" is shown, a "catalog control" displaying the catalog as a tree view, and classes that know how to parse some of the CE 5.0 metadata and turn it into PB 6.0 catalog data. (While we don't publish this object model, we might do so in the future if there is sufficient demand. In the meantime, you are welcome to examine it with ILdasm or Reflector.)&lt;/P&gt;
&lt;P&gt;We also included a rudimentary catalog editor with PB. This editor does not allow editing of the full range of metadata supported by the catalog, but it hopefully handles the most common tasks for component and BSP developers. To be honest, I never use it -- I just open the catalog files in Visual Studio's XML editor. Visual Studio finds the PbcXml600.xsd schema and that provides all the editing help I need.&lt;/P&gt;
&lt;P&gt;When loading the catalog, the catalog's client generally requests "please give me a catalog for this winceroot". The catalog loader then enumerates all *.PbcXml files from the following locations and all subdirectories:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;PB's Program Files "catalog" folder. This folder contains metadata about the current PB installation that is specific to PB and not winceroot-dependent.&lt;/LI&gt;
&lt;LI&gt;winceroot\PUBLIC\*\Catalog&lt;/LI&gt;
&lt;LI&gt;winceroot\PLATFORM\*\Catalog&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;I think there are actually one or two more places that the system checks for catalog files, but the exact list escapes me at the moment, and the locations listed above are the ones most commonly containing catalog files.&lt;/P&gt;
&lt;P&gt;All subdirectories of&amp;nbsp;the listed location&amp;nbsp;are checked. If there is a "Catalog" directory, then all *.PbcXml files from that directory and all subdirectories are loaded. For example, if there is a C:\WINCE600\public\ie\catalog folder with subdirectories 1033 and 1041, then the loader will load catalog\*.pbcxml, catalog\1033\*.pbcxml, and catalog\1041\*.pbcxml.&lt;/P&gt;
&lt;P&gt;The CE 6.0 catalog includes metadata for the following (as far as I remember -- I don't have access to the schema right now):&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;WinceRoot. Basic metadata about the current winceroot, such as the version of CE it contains.&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;Core OSes. There is one CoreOS element for each Core OS (_TGTPLAT) supported by the winceroot.&lt;/LI&gt;
&lt;LI&gt;BSPs. There is one Bsp element for each BSP installed in the winceroot. The PB catalog editor contains support for editing BSPs.&lt;/LI&gt;
&lt;LI&gt;CPUs. There is once Cpu element for each CPU supported by PB. There is one CpuInstalled element for each CPU for which support has been installed.&lt;/LI&gt;
&lt;LI&gt;OS Design Templates. There is one element for each OS Design Template. The OS Design Template is what drives the "New OS Design Wizard". It contains information about what features should be enabled by default for the new OS Design and what features should be shown in the series of option screens in the wizard.&lt;/LI&gt;
&lt;LI&gt;Catalog Items. There is one&amp;nbsp;Item element&amp;nbsp;for each independent "feature" or "driver" in the catalog. The PB catalog editor contains support for editing catalog items.&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;A class="" title="Email Doug" href="http://blogs.msdn.com/dcook/contact.aspx" mce_href="http://blogs.msdn.com/dcook/contact.aspx"&gt;Let me know&lt;/A&gt; if you have specific questions about the catalog or if there are areas you would like me to blog about.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=4836830" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/dcook/archive/tags/platform+builder/default.aspx">platform builder</category><category domain="http://blogs.msdn.com/dcook/archive/tags/metadata/default.aspx">metadata</category><category domain="http://blogs.msdn.com/dcook/archive/tags/pbcxml/default.aspx">pbcxml</category><category domain="http://blogs.msdn.com/dcook/archive/tags/catalog/default.aspx">catalog</category></item></channel></rss>