<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/rss2full.xsl" type="text/xsl" media="screen"?><?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/itemcontent.css" type="text/css" media="screen"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Enterprise Mobile</title>
	
	<link>http://blog.enterprisemobile.com</link>
	<description>Blogging about Windows Mobile, mobile devices, security, management and deployments.</description>
	<pubDate>Wed, 29 Oct 2008 22:02:54 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/EnterpriseMobileBlog" type="application/rss+xml" /><item>
		<title>New Microsoft Technology at PDC2008</title>
		<link>http://feeds.feedburner.com/~r/EnterpriseMobileBlog/~3/436294461/</link>
		<comments>http://blog.enterprisemobile.com/2008/10/new-microsoft-technology-at-pdc2008/#comments</comments>
		<pubDate>Wed, 29 Oct 2008 22:02:54 +0000</pubDate>
		<dc:creator>dfield</dc:creator>
		
		<category><![CDATA[Windows Mobile]]></category>

		<guid isPermaLink="false">http://blog.enterprisemobile.com/?p=58</guid>
		<description><![CDATA[Hello from sunny LA.  Yes, all the natives thought they had seen a pre-halloween ghost when this seattle native hit the streets for the Microsoft Professional Developers Conference 2008 (PDC2008).  As usual, Microsoft has some new, cool products and technologies in the developer space that hit in a big way.  You&#8217;ve probably been seeing headlines [...]]]></description>
			<content:encoded><![CDATA[<p>Hello from sunny LA.  Yes, all the natives thought they had seen a pre-halloween ghost when this seattle native hit the streets for the Microsoft Professional Developers Conference 2008 (PDC2008).  As usual, Microsoft has some new, cool products and technologies in the developer space that hit in a big way.  You&#8217;ve probably been seeing headlines covering Windows 7 and Microsoft &#8220;Azure&#8221;. </p>
<p>Here is my very short, sweet summary of this new stuff.  First, Windows 7:</p>
<ul>
<li>Winows 7 will fix all that stuff that caused negative reviews on Vista. </li>
<li>It also has a lot of great, new shell features that will positively impact the experience for the everyday user.  Just the taskbar improvements alone are pretty cool.</li>
<li>UAC will still be there, but in a more flexible format for configuration and they have decided to except more operations from prompting.  However, Microsoft continues to be hardcore about forcing all apps to the do the right thing and operate under &#8220;standard user&#8221;.  The stats do show that most developers are getting the message and a lot of progress has been made.  As a user, UAC drives me up the wall.  As a security person, it&#8217;s the right thing to do.</li>
</ul>
<p>The more exciting (to me) and new technology has to do with the new Microsoft services strategy which includes &#8220;Azure&#8221; and the &#8220;Geneva&#8221; server.  This technology will catalyze  two, important business scenarios that really need to get over the hump:  (1) B2B connectivity in which there are many enmeshed partners sharing a workflow and (2) hosted services for enterprises (not just small orgs).</p>
<p>Microsoft has a big cloud in the sky and plays traffic cop for all services that register to the Microsoft &#8220;Services bus&#8221;.  But, the bus supports some serious authentication and authorizatio through use of WS federation and SAML tokens.  And, part of the offering is SQL services which equates to a SQL DB that is up in the cloud and protected by the aforementioned authentication and authorization.  So, you can support some great B2B scenarios:</p>
<ul>
<li>Partners that all need access to a workflow, but need a slightly different type of data for the same workflow transactions</li>
<li>Partners that all use a different directory or authentication type can still positively identify into one cloud</li>
<li>Eventing enables store and forward of transactions when one particular partner connectes to the service.</li>
</ul>
<p>If you are a small company and you are interested in advertising your service, click into the Microsoft service bus and you just go a free advertisement to services consumers.</p>
<p>But&#8230;that&#8217;s not all.  The biggie is Geneva because it creates a super easy to setup and configure Enterprise Service connector for Active Directory.  This could enable hosting of an internet-based service to a company with an internal Active Directory.  There is a question here of whether the company will accept the Microsoft EULA for connecting to the Services bus and whether their security policy will accept their authentication getting proxied through the Microsoft Federation Gateway in the cloud.  But, the good news is that all the authentication against the hosted service is handled by the Microsoft Service Connector which is located on the company premises.  It reminds me a little bit of ADSI, but better.  If the company doesn&#8217;t want to accept the Microsoft EULA, they can set up a B2B direct to their partner ( the hosting provider) who will have the Federation Gateway  (Geneva) handling &#8220;claims&#8221;.</p>
<p>We still have 1.5 more days here, but I think all the big news has already popped.</p>
<p>Dave Field, CISSP, MCP</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.enterprisemobile.com/2008/10/new-microsoft-technology-at-pdc2008/feed/</wfw:commentRss>
		<feedburner:origLink>http://blog.enterprisemobile.com/2008/10/new-microsoft-technology-at-pdc2008/</feedburner:origLink></item>
		<item>
		<title>Windows Mobile 6.1 Upgrades Now Available - Oct 16, 2008</title>
		<link>http://feeds.feedburner.com/~r/EnterpriseMobileBlog/~3/415453005/</link>
		<comments>http://blog.enterprisemobile.com/2008/10/windows-mobile-6-1-upgrades-now-available/#comments</comments>
		<pubDate>Thu, 16 Oct 2008 17:30:52 +0000</pubDate>
		<dc:creator>mnielsen</dc:creator>
		
		<category><![CDATA[Windows Mobile]]></category>

		<guid isPermaLink="false">http://blog.enterprisemobile.com/2008/09/windows-mobile-6-1-upgrades-now-available-aug-17-2008/</guid>
		<description><![CDATA[I&#8217;ve compiled a running alphabetical list of which devices now have official supported upgrades available for them. This may be useful for many of you as well. I will keep this list updated, new entries in red. Sorted by mobile operator/OEM:
Alltel HTC PPC8600 [Posted 10/10/2008]
Alltel HTC Touch [Posted 10/10/2008]
ASUS PDA Phone P527 (Released by country): [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve compiled a running alphabetical list of which devices now have <strong>official supported upgrades</strong> available for them. This may be useful for many of you as well. I will keep this list updated, new entries in <span style="color: #ff0000;"><strong>red</strong></span>. Sorted by mobile operator/OEM:</p>
<p><a href="http://www.htc.com/us/SupportDownload.aspx?p_id=63&amp;cat=2&amp;dl_id=114">Alltel HTC PPC8600</a> [Posted 10/10/2008]<br />
<a href="http://www.htc.com/us/SupportDownload.aspx?p_id=64&amp;cat=2&amp;dl_id=115">Alltel HTC Touch</a> [Posted 10/10/2008]</p>
<p><a href="http://support.asus.com/download/download.aspx?model=P527&amp;f_name=v4237_wwe_na_ext_v204.zip&amp;SLanguage=en-us">ASUS PDA Phone P527</a> (Released by country): [Posted 9/16/2008]<br />
<a href="http://support.asus.com/download/download_item_4.aspx?product=12&amp;model=P750&amp;SLanguage=en-us&amp;os=28">ASUS PDA Phone P750</a> (Released by country): [Posted 9/18/2008]</p>
<p><a href="http://direct.motorola.com/hellomoto/motosupport/source/SoftwareUpdateSelect.asp?country=USA&amp;language=ENS ">AT&amp;T Motorola Q9h</a><br />
<a href="http://www.htc.com/us/SupportDownload.aspx?p_id=67&amp;cat=2&amp;dl_id=94">AT&amp;T Tilt</a> [Reposted 8/26/2008]<br />
<a href="http://www.pantechusa.com/html/images/software/download.htm">AT&amp;T Pantech C810 Duo</a> [Posted 10/8/2008]<br />
<a href="http://www.samsung.com/us/i617/windowsupgrade ">AT&amp;T BlackJack II (SGH-i617)</a> <span style="color: #000000;">[Posted 9/2/2008]</span></p>
<p><a href="http://www.htc.com/us/SupportDownload.aspx?p_id=70&amp;cat=2&amp;dl_id=98">Bell HTC Touch</a> [Posted 8/23/2008]</p>
<p><a href="http://www.samsung.com/ca/function/populartag/populartagClickCountUpdate.do?tag_seq=794&amp;sitecd=ca">Fido BlackJack (SGH-i616)</a> [Posted 10/8/2008]</p>
<p><a href="http://www.htc.com/europe/SupportDownloadList.aspx?p_id=13&amp;cat=all ">HTC TyTN II</a> (unlocked)<br />
<a href="http://www.htc.com/www/SupportDownload.aspx?p_id=59&amp;cat=2&amp;dl_id=113 ">HTC Touch Cruise</a> [Posted 9/30/2008]<br />
<a href="http://www.htc.com/www/SupportDownload.aspx?p_id=44&amp;cat=2&amp;dl_id=116">HTC Touch Dual</a> [Posted 10/10/2008]</p>
<p><a href="http://home.intermec.com/eprise/main/GSS/Service/Content/Downloads/Show_DownloadSearchResults?Product=CMPTRCN3">Intermec CN3</a> [Posted 9/26/2008]</p>
<p><a href="http://www.my-xda.com/software_updates.jsp">O2 XDA Stellar</a> [Posted 9/19/2008]<br />
<a href="http://www.my-xda.com/software_updates.jsp">O2 XDA Orbit 2</a> [<a href="http://www.o2online.de/nw/support/downloads/software/xda/xdaorbit2/index.html">German</a>] [Posted 9/19/2008]</p>
<p><a href="http://www1.orange.co.uk/download/htc/RUU_Kaiser_ORANGE_UK_3.28.61.0R_radio_sign_25.83.40.02_1.65.16.25_Ship.exe">Orange HTC TyTN II</a><br />
<a href="http://www.coolsmartphone.com/news4172.html">http://www.coolsmartphone.com/news4172.html</a></p>
<p><a href="http://www.samsung.com/ca/function/populartag/populartagClickCountUpdate.do?tag_seq=794&amp;sitecd=ca">Rogers BlackJack (SGH-i616)</a> [Posted 10/8/2008]</p>
<p><a href="http://www.samsung.com/us/i760/windowsupgrade">Samsung SCH-i760</a><br />
<a href="http://www.samsungmobile.com/promotion/omnia/index.jsp">Samsung Omnia SCH-i900</a> [Posted 8/9/2008]</p>
<p><a href="http://direct.motorola.com/hellomoto/NSS/update_my_software.asp">Sprint Motorola Q9c</a><br />
<a href="http://www.htc.com/us/FAQ_Detail.aspx?p_id=75&amp;act=sd">Sprint Mogul</a> [Posted 8/6/2008]<br />
<a href="http://www.htc.com/us/faq_detail.aspx?p_id=76&amp;act=sd">Sprint HTC Touch</a> [Posted 8/6/2008]<br />
<a href="http://www.samsungmobileusa.com/i325/upgrade/">Sprint Samsung Ace (SPH-i325)</a> <span style="color: #ff0000; font-size: x-small;"><strong>[Posted 10/16/2008]</strong></span></p>
<p><a href="http://www.htc.com/us/FAQ_Detail.aspx?p_id=80&amp;act=sd">Telus HTC Touch</a> [Posted 8/6/2008]<br />
<a href="http://www.htc.com/us/SupportDownload.aspx?p_id=79&amp;cat=2&amp;dl_id=106">Telus HTC S720</a> [Posted 9/12/2008]<br />
<a href="http://www.htc.com/us/SupportDownload.aspx?p_id=77&amp;cat=2&amp;dl_id=71">Telus HTC P4000</a> [Posted 8/6/2008]</p>
<p><a href="http://www.samsung.com/us/i760/windowsupgrade">Verizon Samsung SCH-i760</a><br />
<a href="http://www.pcdphones.com/phone_downloads.aspx?bid=89&amp;cid=1&amp;mid=287&amp;carrier=Verizon%20Wireless">Verizon UStarcom XV6800</a> [Posted 8/27/2008]<br />
Verizon XV6900 [Pending ???]<br />
<a href="http://direct.motorola.com/hellomoto/motosupport/source/SoftwareUpdateSelect.asp?country=USA&amp;language=ENS">Verizon Motorola Q9c</a> [Posted 9/18/2008]</p>
<p><a href="http://devicehelp.vodafone.co.uk/v1615upgrade.php">Vodafone v1615</a> [Posted 6/27/2008]</p>
<p>If you know of others, or corrections, please let me know!</p>
<p>|\\arco..<br />
mnielsen(at)enterprisemobile.com<br />
<a href="http://marco.blogsite.org">http://marco.blogsite.org</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.enterprisemobile.com/2008/10/windows-mobile-6-1-upgrades-now-available/feed/</wfw:commentRss>
		<feedburner:origLink>http://blog.enterprisemobile.com/2008/10/windows-mobile-6-1-upgrades-now-available/</feedburner:origLink></item>
		<item>
		<title>Picking the Right SSL Server Certicate for Windows Mobile</title>
		<link>http://feeds.feedburner.com/~r/EnterpriseMobileBlog/~3/419975096/</link>
		<comments>http://blog.enterprisemobile.com/2008/10/picking-the-right-ssl-server-certicate-for-windows-mobile/#comments</comments>
		<pubDate>Mon, 13 Oct 2008 23:19:31 +0000</pubDate>
		<dc:creator>dfield</dc:creator>
		
		<category><![CDATA[Authentication]]></category>

		<category><![CDATA[Device Management]]></category>

		<category><![CDATA[Mobile IE]]></category>

		<category><![CDATA[Windows Mobile]]></category>

		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://blog.enterprisemobile.com/?p=55</guid>
		<description><![CDATA[A lot of Enterprise Software for Mobile devices utilizes SSL for security.  SSL is the de facto choice because it can traverse NATs and routers whereas many VPNs cannot.
So, you&#8217;ll need to purchase an SSL certificate for your web server and any Windows Mobile clients should have the root of your SSL certificate in the device&#8217;s root certificate store. 
The [...]]]></description>
			<content:encoded><![CDATA[<p>A lot of Enterprise Software for Mobile devices utilizes SSL for security.  SSL is the de facto choice because it can traverse NATs and routers whereas many VPNs cannot.</p>
<p>So, you&#8217;ll need to purchase an SSL certificate for your web server and any Windows Mobile clients should have the root of your SSL certificate in the device&#8217;s root certificate store. </p>
<p>The problem comes when the root certificate is not already in the device root certificate store by default.  You can add certificates to the root store (this got a lot easier in Windows Mobile 6.0).  But, this will likely require a user trying to perform the task or the support tech will need to &#8220;touch&#8221; the device.  And, if the device is cold reset, you have to perform this task all over again.  It is much easier just to use an SSL server certificate from a Public Certificate Authority  that chains to a root certificate that&#8217;s already resident on the device.</p>
<p>Unfortunately, Windows Mobile has no root certificate updating service as included in Windows XP and Windows Vista.  With Windows Mobile, you get the root certifcates that were added when the image was built.</p>
<p>If you are using Windows Mobile 5.0 devices, you should not use GoDaddy or Comodo root certificates for the most part.   Here is a table showing which versions of Windows Mobile includes which Public CA certificates:</p>
<p><a href="http://blog.enterprisemobile.com/wp-content/uploads/2008/10/certauthorities.jpg"><img class="alignnone size-medium wp-image-57" title="Windows Mobile Root Certificates" src="http://blog.enterprisemobile.com/wp-content/uploads/2008/10/certauthorities.jpg" alt="Windows Mobile Root Certificates" width="689" height="573" /></a><a href="http://blog.enterprisemobile.com/wp-content/uploads/2008/10/certauthorities.jpg"></a></p>
<p>Another consideration is the use of wildcard certificates.  As you probably already know if you are reading this, a wildcard certificate allows the use of a wildcarded DNS name prefix such as &#8220;*.acme.com&#8221;.  You can use the same SSL certificate for many different web servers that all have assigned DNS names that end in &#8220;.acme.com&#8221;.  It is important for SSL security that the server&#8217;s internet DNS name matches the subj or subj alt name on the certificate.  So, if you wildcard th prefix in the certificate, you can use one cert for a lot of servers.</p>
<p>Windows Mobile started supporting wildcard certificates in Windows Mobile 6.0.  If you have Windows Mobile 5.0 devices, you should take a look at the offering from Digicert.  They allow you to pre-populate the subj alt name of the certificate with a list of server names.  This ends up giving you something approaching wildcard certificate features.  However, you do need to know the internet DNS names of all the web servers you&#8217;ll be using.  See more details on the <a title="Digicert Wildcard cert page" href="http://www.digicert.com/wildcard-ssl-certificates.htm">Digicert site</a>. Note that digicert is not shown on the list above because they actually chain back to the Entrust root.</p>
<p>Dave Field, CISSP, MCP<br />
Device Management and Security Architect<br />
Enterprise Mobile, Inc.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.enterprisemobile.com/2008/10/picking-the-right-ssl-server-certicate-for-windows-mobile/feed/</wfw:commentRss>
		<feedburner:origLink>http://blog.enterprisemobile.com/2008/10/picking-the-right-ssl-server-certicate-for-windows-mobile/</feedburner:origLink></item>
		<item>
		<title>Writing custom GPOs for SCMDM 2008</title>
		<link>http://feeds.feedburner.com/~r/EnterpriseMobileBlog/~3/410652869/</link>
		<comments>http://blog.enterprisemobile.com/2008/10/writing-custom-gpos-for-scmdm-2008/#comments</comments>
		<pubDate>Fri, 03 Oct 2008 22:33:25 +0000</pubDate>
		<dc:creator>mnielsen</dc:creator>
		
		<category><![CDATA[Mobile IE]]></category>

		<category><![CDATA[SCMDM]]></category>

		<category><![CDATA[Windows Mobile]]></category>

		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://blog.enterprisemobile.com/2008/10/writing-custom-gpos-for-scmdm-2008/</guid>
		<description><![CDATA[UPDATED: Oct 5, 2008: Updated v1.1 .ADM file with corrections and additional settings. Download here.
One of the most powerful things about Microsoft System Center Mobile Device Manager (SCMDM) is the ability to manage all of your Windows Mobile 6.1 or above devices through Active Directory (AD) Group Policy Objects (GPOs). A large percentage of the [...]]]></description>
			<content:encoded><![CDATA[<p>UPDATED: Oct 5, 2008: Updated v1.1 .ADM file with corrections and additional settings. <a href="http://blog.enterprisemobile.com/wp-content/uploads/2008/10/enterprise-mobile-adm.zip">Download here</a>.</p>
<p>One of the most powerful things about Microsoft System Center Mobile Device Manager (SCMDM) is the ability to manage all of your Windows Mobile 6.1 or above devices through Active Directory (AD) Group Policy Objects (GPOs). A large percentage of the corporate market is already using GPOs to manage their desktop, notebook and server environments.</p>
<p>The GPO technology was introduced in Windows 2000 Server. Before that there were System Policies in Windows NT 4.0. There is already a fair amount of documentation and knowledge around extending GPOs to your own needs. But here I will go into some aspects more important around making use of SCMDM and supporting Windows Mobile in an enterprise running AD.</p>
<p>In this article I will go through how you can extend your own GPOs to have additional settings not available out of the box in the default Windows Mobile GPO template supplied by Microsoft in SCMDM 2008. I will expect that you already know how to access and use the default SCMDM GPO settings.</p>
<p><strong>Windows Mobile Registry Keys</strong></p>
<p>GPOs work by manipulating how registry keys are changed and written on the client machines. This is no different on Windows Mobile, compared to other Windows platforms at this point in time.</p>
<p>I will save the discussion on where to find and research Windows Mobile registry locations. But will point out that many are bound to specific OS levels, OEM and hardware requirements. So what works on one WM device may not work on another. So I can&#8217;t stress enough the aspect of testing such settings before a larger deployment to end-users.</p>
<p>For this article I have asked my colleague, <a href="http://www.pocketpcfaq.com/">Chris De Herrera</a>, to suggest some registry keys to use:</p>
<p>Improve text rendering performance by increasing the GLYPH Cache to 32k (decimal):</p>
<blockquote><p>[HKEY_LOCAL_MACHINE\System\GDI\GLYPHCACHE]<br />&#8220;limit&#8221;=dword:00008000</p>
</blockquote>
<p>Internet Explorer Mobile homepage settings:</p>
<blockquote><p>[HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\AboutURLs]<br />&#8220;home_0409&#8243;=&#8221;<a href="///\\windows\default_0409.htm">file://\\windows\\default_0409.htm</a>&#8220;<br />&#8220;version_0409&#8243;=&#8221;<a href="///\\windows\about_0409.htm">file://\\windows\\about_0409.htm</a>&#8220;<br />&#8220;blank&#8221;=&#8221;res://webview.dll/blank.htm&#8221;</p>
</blockquote>
<p>Configure Communicator Mobile:</p>
<blockquote><p>[HKEY_CURRENT_USER\Software\Microsoft\Communicator\System Settings]<br />&#8220;ServerInternal&#8221;=&#8221;sip.yourcompany.com&#8221;<br />&#8220;Server&#8221;=&#8221;sip.yourcompany.com:443&#8243;</p>
</blockquote>
<p>Furthermore I have also researched the following registry keys which may be helpful in corporate environments:</p>
<p>ClearType Activation:</p>
<blockquote><p>[HKEY_LOCAL_MACHINE\System\GDI\ClearType][HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings] <br />&#8220;ClearTypeText&#8221;=dword:1[HKEY_LOCAL_MACHINE\System\GDI\ClearTypeSettings] <br />&#8220;OffOnRotation&#8221;=dword:0</p>
</blockquote>
<p>Browser History:</p>
<blockquote><p>[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main] <br />&#8220;DaysToKeep&#8221;=dword:00001E</p>
</blockquote>
<p>Default Search Page:</p>
<blockquote><p>[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main] <br />&#8220;Search Page&#8221;=<a title="http://m.live.com/search/Results.aspx?q=%&amp;mid=8001" href="http://m.live.com/search/Results.aspx?q=%&amp;mid=8001">http://m.live.com/search/Results.aspx?q=%&amp;mid=8001</a></p>
</blockquote>
<p>Internet Explorer User Agent:</p>
<blockquote><p>[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Internet Settings\5.0\User Agent]<br />&#8220;Default&#8221;=&#8221;Mozilla/4.0&#8243;<br />&#8220;Platform&#8221;=&#8221;Windows CE&#8221;<br />&#8220;Version&#8221;=&#8221;MSIE 6.0&#8243;</p>
</blockquote>
<p>Menu Animations:</p>
<blockquote><p>[HKEY_LOCAL_MACHINE\SYSTEM\GWE\Menu]<br />&#8220;AniType&#8221;=dword:0</p>
</blockquote>
<p>Windows Animations:</p>
<blockquote><p>[HKEY_LOCAL_MACHINE\SYSTEM\GWE]<br />&#8220;Animate&#8221;=dword:0</p>
</blockquote>
<p>Error Reporting:</p>
<blockquote><p>[HKEY_LOCAL_MACHINE\System\ErrorReporting\DumpSettings]<br />&#8220;DumpEnabled&#8221;=dword:0<br />[HKEY_LOCAL_MACHINE\System\ErrorReporting\UploadSettings]<br />&#8220;DontUpload&#8221;=dword:1[HKEY_LOCAL_MACHINE\System\ErrorReporting\UploadSettings]<br />&#8220;ConnectionFlags&#8221;=dword:0</p>
</blockquote>
<p>Today Screen Text:</p>
<blockquote><p>[HKEY_LOCAL_MACHINE\Software\Microsoft\Shell\DeviceBeta]<br />&#8220;Today&#8221;=&#8221;EnterpriseMobile&#8221;</p>
</blockquote>
<p>Display Time/Date in Taskbar or disable for battery indicator:</p>
<blockquote><p>[HKEY_LOCAL_MACHINE\Software\Microsoft\Shell]<br />&#8220;TBOpt&#8221;=dword:3<br />&#8220;ShowTitleBarClock&#8221;=dword:1</p>
</blockquote>
<p>Permit Bluetooth and IrDA File Transfer:</p>
<blockquote><p>[HKEY_LOCAL_MACHINE\Software\Microsoft\Obex]<br />&#8220;IsEnabled&#8221;=dword:1</p>
</blockquote>
<p>Please be aware that most of these settings require a soft reboot of the device before they become effective. The SCMDM policy agent should prompt you for a reboot of the device when an updated policy is synchronized from the Device Management Server.<br /><strong><br />Creating .ADM Files</strong></p>
<p>Using the information published <a href="http://technet.microsoft.com/en-us/library/cc135570.asp">here</a> about the correct registry key prefix to use for GPOs on Windows Mobile I created my own .ADM file with my sample registry keys listed above and a few other samples currently available. </p>
<p>You can <a href="http://blog.enterprisemobile.com/wp-content/uploads/2008/10/enterprise-mobile-adm.zip">download it here</a>. I have noted in my sample the references used. </p>
<p>Look for a new folder called &#8220;Windows Mobile Settings-Extended&#8221; in the Computer Configuration section of the Group Policy Object Editor.</p>
<p><a href="http://blog.enterprisemobile.com/wp-content/uploads/2008/10/gpo-policies-v11.jpg"><img style="0px" height="406" alt="GPO-Policies-v1.1" src="http://blog.enterprisemobile.com/wp-content/uploads/2008/10/gpo-policies-v11-thumb.jpg" width="443"/></a>&nbsp;<br />The single main trick was to prefix the native Windows Mobile registry keys with the &lt;SOFTWARE\Policies\Microsoft\Windows Mobile Settings\Registry&gt; path. </p>
<p>So the native:<br />&lt;<strong>HKEY_LOCAL_MACHINE</strong>\Software\Microsoft\Internet Explorer\AboutURLs&gt; became the longer:<br />&lt;SOFTWARE\Policies\Microsoft\Windows Mobile Settings\Registry\<strong>HKLM</strong>\Software\Microsoft\Internet Explorer\AboutURLs&gt;. </p>
<p>Note the collapsed HKEY_LOCAL_MACHINE hive into the named HKLM. This also works for the HKEY_CURRENT_USER hive into HKCU.</p>
<p><strong>Further Information on .ADM Files</strong></p>
<p>Please see the reference links below for more details on the syntax used in the example .ADM file. The syntax and commands are not the easiest in the world of IT.</p>
<p>I also found a ADM file editor, called ADM Template Editor from a small company in Australia that may be useful if you are planning to write and manage a large number of custom .ADM/.ADMX files.</p>
<p>Again, please test the policies on the OS platform, level, and hardware you wish to broadly deploy your Windows Mobile settings out to. </p>
<p>Look for more articles soon on useful Windows Mobile registry keys and GPOs!</p>
<p><strong>References:</strong></p>
<ul>
<li>Microsoft articles on writing GPOs:
<ul>
<li><a title="How to Write a Simple .Adm File for Registry-based Group Policy" href="http://technet.microsoft.com/en-us/library/cc738443.aspx">How to Write a Simple .Adm File for Registry-based Group Policy</a></li>
<li>KB225087: <a title="Writing Custom ADM Files for System Policy Editor" href="http://support.microsoft.com/kb/225087">Writing Custom ADM Files for System Policy Editor</a></li>
<li>KB816662: <a href="http://support.microsoft.com/kb/816662">Recommendations for managing Group Policy administrative template (.adm) files</a></li>
</ul>
</li>
<li><a title="http://technet.microsoft.com/en-us/library/cc135570.aspx" href="http://technet.microsoft.com/en-us/library/cc135570.aspx">Creating a New Group Policy Object for (Windows Mobile) Devices</a></li>
<li><a title="http://technet.microsoft.com/en-us/library/cc664624.aspx#DeployingConfiguring" href="http://technet.microsoft.com/en-us/library/cc664624.aspx#DeployingConfiguring">SCMDM Technical Article: Deploying and Configuring Communicator Mobile with MDM</a></li>
<li><a title="http://technet.microsoft.com/en-us/library/cc678152.aspx#NameResolutionConsiderations" href="http://technet.microsoft.com/en-us/library/cc678152.aspx#NameResolutionConsiderations">SCMDM Technical Article: Name Resolution Considerations for Company Web Site Access</a></li>
<li><a title="http://www.sysprosoft.com/adm_download.shtml" href="http://www.sysprosoft.com/adm_download.shtml">ADM Template Editor: (Recommended, one of the few I believe out there!)</a></li>
</ul>
<p>|\\arco..<br />mnielsen(at)enterprisemobile.com<br /><a href="http://marco.blogsite.org">http://marco.blogsite.org</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.enterprisemobile.com/2008/10/writing-custom-gpos-for-scmdm-2008/feed/</wfw:commentRss>
		<feedburner:origLink>http://blog.enterprisemobile.com/2008/10/writing-custom-gpos-for-scmdm-2008/</feedburner:origLink></item>
		<item>
		<title>Secrets of the Windows Mobile Home Screen API</title>
		<link>http://feeds.feedburner.com/~r/EnterpriseMobileBlog/~3/341710518/</link>
		<comments>http://blog.enterprisemobile.com/2008/07/the-dirty-tricks-of-the-windows-mobile-home-screen-api/#comments</comments>
		<pubDate>Thu, 10 Jul 2008 09:28:14 +0000</pubDate>
		<dc:creator>kdutta</dc:creator>
		
		<category><![CDATA[C#]]></category>

		<category><![CDATA[Development]]></category>

		<category><![CDATA[Home Screen]]></category>

		<category><![CDATA[Interop]]></category>

		<category><![CDATA[Windows Mobile]]></category>

		<guid isPermaLink="false">http://blog.enterprisemobile.com/2008/07/the-dirty-tricks-of-the-windows-mobile-home-screen-api/</guid>
		<description><![CDATA[One of my recent projects at Enterprise Mobile was creating a custom home screen (see above) for the new MotoQ9h and Blackjack II devices. The top row is the standard Windows Mobile &#8220;Icon Bar&#8221;. The second row has the clock, messaging center (SMS, Mail, Voicemail), and current profile. Below that is the status text and [...]]]></description>
			<content:encoded><![CDATA[<p>One of my recent projects at <a href="http://www.enterprisemobile.com/">Enterprise Mobile</a> was creating a custom home screen (see above) for the new MotoQ9h and Blackjack II devices. The top row is the standard Windows Mobile &#8220;Icon Bar&#8221;. The second row has the clock, messaging center (SMS, Mail, Voicemail), and current profile. Below that is the status text and the application bar. (Everything below the icon bar is a single full screen plug-in.)</p>
<p align="center"><img src="http://blog.enterprisemobile.com/wp-content/uploads/2008/07/homescreen-thumb.png" border="0" alt="homescreen" width="334" height="254" /></p>
<p>At first glance, I assumed this would be a breeze. I have a powerful layout, key handling, and paint framework that I use in every project I work on, and thought that creating a home screen leveraging that would make it trivial. Sadly I was sorely mistaken.<span id="more-37"></span></p>
<p>Those of you familiar with WM Home Screen development know that there are actually two APIs: the <a href="http://msdn.microsoft.com/en-us/library/aa457653.aspx">Home Screen API</a> (Smartphone) and the <a href="http://msdn.microsoft.com/en-us/library/aa458908.aspx">Today Screen API</a> (Pocket PC). I was only interested in the prior. Smartphone Home Screen development is considerably more difficult: you don&#8217;t have nearly as much control. The developer must implement <a href="http://msdn.microsoft.com/en-us/library/ms858261.aspx">IHomePlugin</a> which only receives paint events (the plug-in is supplied only an HDC) and some key events (left and right only). On Pocket PC, you get an HWND and all the good things that go along with it.</p>
<p>That didn&#8217;t phase me too much. My plan of action was to implement this IHomePlugin interface in managed code and then let the magic happen. Easy enough. I implement a dummy plug-in in C#, and try to register the COM object&#8230; and it doesn&#8217;t work. It refused to register, the error claiming it was an invalid DLL. I poked at it for a while before finally giving up and checking to see if Google would know why I could not register a C# COM object on Windows Mobile.</p>
<p>I searched for a while, and found plenty of examples of how to invoke unmanaged code from managed code. Then I noticed, not a single site showed how to invoke managed from unmanaged. I began searching explicitly for that, and <a href="http://blogs.msdn.com/netcfteam/archive/2005/07/24/442612.aspx">found</a> my <a href="http://msdn.microsoft.com/en-us/library/kfzsfkz3.aspx">answer</a>:</p>
<blockquote><p><em>The .Net Compact Framework does not support hosting the runtime from native code. This means that you will not be able to call CoCreateInstace to instantiate a managed object, or register managed objects as COM objects on the system. You will also not be able to call CorBindToRuntime or ClrCreateManagedInstance. In order to call managed functions from native code, you must first use the runtime to marshal a managed interface or a delegate down to native code. This means you must always start out in managed code (with a .net executable) in order to expose .net components to native code.</em></p></blockquote>
<p>This was news to me. And pretty devastating; the thought of creating a fairly complex home screen from scratch in unmanaged code was daunting. If it is not obvious, I&#8217;m primarily a .NET developer. Don&#8217;t get me wrong, I have grass roots in C, but, the facts of life are that the lower level your programming language, the higher the development time and bug count.</p>
<p>So I quickly thought of a workaround though: create a managed service executable that hosts the UI framework. And using a combination of <a href="http://msdn.microsoft.com/en-us/library/microsoft.windowsce.forms.messagewindow.aspx">MessageWindows</a> and <a href="http://msdn.microsoft.com/en-us/library/aa914748.aspx">sharing memory between processes</a>, I could construct a bridge from unmanaged to managed code:</p>
<p>Implement IHomePlugin in unmanaged code and add that plug-in to the home screen. The <strong>unmanaged</strong> plug-in will do the following:</p>
<ol>
<li>Create a pool of shared memory.</li>
<li>Create a back buffer HDC. This back buffer is what painted whenever the home screen requests a repaint. The managed code will write to this back buffer across process boundaries.</li>
<li>Whenever the <a href="http://msdn.microsoft.com/en-us/library/aa457640.aspx">PE_DATACHANGE</a> event is received, invalidate the plug-in.</li>
<li>In the shared memory, write the HDC value, system colors, and plug-in dimensions.</li>
<li>Start my managed executable.</li>
</ol>
<p>Once started, the <strong>managed</strong> executable does the following:</p>
<ol>
<li>Gets the back buffer HDC and other relevant values from the shared memory pool.</li>
<li>Paint to the back buffer HDC.</li>
<li>Notifies the Home Screen API that a plug-in has had a data change event using <a href="http://msdn.microsoft.com/en-us/library/ms838117.aspx">SHOnPluginDataChange</a>. This in turn causes the plug-in to invalidate and repaint from the back buffer.</li>
</ol>
<p>That solves the painting issue, but the plug-in still needed to get key events from the Home Screen API and deliver them to managed code. Easy enough: the managed executable can create a <a href="http://msdn.microsoft.com/en-us/library/microsoft.windowsce.forms.messagewindow.aspx">MessageWindow</a> and the unmanaged can <a href="http://msdn.microsoft.com/en-us/library/aa931932.aspx">deliver</a> the key events provided by the Home Screen API. The managed code can then process the key event, repaint the back buffer, and invalidate the plug-in to refresh the screen.</p>
<p>This works great, but the catch with the API is that it delivers <em>only</em> left and right key presses. It won&#8217;t send up and down key events (because then the user can&#8217;t navigate to another plug-in on the home screen). However, since my plug-in was full screen, I did not matter. I needed a way to navigate vertically between elements laid out in my single full screen plug-in.</p>
<p>The solution to capturing all key events is a neat trick that native Win32 API developers are familiar with. Have the unmanaged plug-in <a href="http://msdn.microsoft.com/en-us/library/aa926164.aspx">subclass</a> the home screen window (DesktopExplorerWindow as found in the VS Remote Spy++ tool) proc to steal the key presses and send them off to the managed code.</p>
<p>And there you go, a fully functional &#8220;managed&#8221; Home Screen Plug-In. My initial worry was that performance would suffer terribly from the cross process communication, but the home screen was actually very responsive. Users reported that the UI was quite &#8220;snappy&#8221;.</p>
<p>Unfortunately I don&#8217;t have any sample code to provide (yet), since this is all company IP. But maybe it will be released in the future!</p>
<p>Note: I should mention that Home Screen development actually gets <em>easier</em> with this interprocess communication. Developing a purely unmanaged plug-in means that the entire home.exe process needs to be stopped and started with <strong>every</strong> little change made to the plug-in. This can grow to be quite tedious. With the two-process model, starting and stopping the second managed process leaves the home.exe undisturbed.</p>
<p>Koushik Dutta<br />
Software Engineer<br />
<a href="http://www.koushikdutta.com">www.koushikdutta.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.enterprisemobile.com/2008/07/the-dirty-tricks-of-the-windows-mobile-home-screen-api/feed/</wfw:commentRss>
		<feedburner:origLink>http://blog.enterprisemobile.com/2008/07/the-dirty-tricks-of-the-windows-mobile-home-screen-api/</feedburner:origLink></item>
		<item>
		<title>VC Project Template for Smart Device CE Setup DLLs</title>
		<link>http://feeds.feedburner.com/~r/EnterpriseMobileBlog/~3/341710519/</link>
		<comments>http://blog.enterprisemobile.com/2008/07/vc-project-template-for-smart-device-ce-setup-dlls/#comments</comments>
		<pubDate>Tue, 08 Jul 2008 11:12:03 +0000</pubDate>
		<dc:creator>kdutta</dc:creator>
		
		<category><![CDATA[Development]]></category>

		<category><![CDATA[Windows Mobile]]></category>

		<guid isPermaLink="false">http://blog.enterprisemobile.com/2008/07/vc-project-template-for-smart-device-ce-setup-dlls/</guid>
		<description><![CDATA[It&#8217;s pretty annoying to have to create a CE Setup DLL cpp and def file every time I make a new CAB. So I finally got around to creating a VC Template to handle that for me. You can download it here.
Sadly, I did not create an installer for this template.
Installation instructions (adjust your installation [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s pretty annoying to have to create a CE Setup DLL cpp and def file every time I make a new CAB. So I finally got around to creating a VC Template to handle that for me. You can <a href="http://blog.enterprisemobile.com/wp-content/uploads/2008/07/cesetupdll.zip">download it here</a>.</p>
<p>Sadly, I did not create an installer for this template.</p>
<p>Installation instructions (adjust your installation directory accordingly):</p>
<ol>
<li>Unzip the contents onto your drive.</li>
<li>Copy CESetupDLL.ico, CESetupDLL.vsdir, and CESetupDLL.vsz to C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcprojects\smartdevice</li>
<li>Copy the Scripts and Templates folders into C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\VCWizards\SmartDeviceAppWiz\CESetupDLL</li>
<li>Edit CESetupDLL.vsz and edit the ABSOLUTE_PATH value to whatever you supplied in Step 3.</li>
</ol>
<p>And that should do it! You will now find the new project template in Visual Studio under the Smart Device folder in Visual C++.</p>
<p>Koushik Dutta<br />
Software Engineer<br />
<a href="http://www.koushikdutta.com">www.koushikdutta.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.enterprisemobile.com/2008/07/vc-project-template-for-smart-device-ce-setup-dlls/feed/</wfw:commentRss>
		<feedburner:origLink>http://blog.enterprisemobile.com/2008/07/vc-project-template-for-smart-device-ce-setup-dlls/</feedburner:origLink></item>
		<item>
		<title>Using HTC Diamond’s Accelerometer/Sensor SDK from Managed Code</title>
		<link>http://feeds.feedburner.com/~r/EnterpriseMobileBlog/~3/341710520/</link>
		<comments>http://blog.enterprisemobile.com/2008/07/using-htc-diamonds-sensor-sdk-from-managed-code/#comments</comments>
		<pubDate>Mon, 07 Jul 2008 07:02:24 +0000</pubDate>
		<dc:creator>kdutta</dc:creator>
		
		<category><![CDATA[Development]]></category>

		<category><![CDATA[HTC]]></category>

		<category><![CDATA[Windows Mobile]]></category>

		<category><![CDATA[accelerometer]]></category>

		<category><![CDATA[g sensor]]></category>

		<guid isPermaLink="false">http://blog.enterprisemobile.com/?p=24</guid>
		<description><![CDATA[When I first got my HTC Touch Diamond a while ago, one of the first things I tried to do was reverse engineer the Sensor API found in HTCSensorSDK.dll. However, anyone who has tried to reverse engineer DLL arguments knows how tedious and painful it can be to create a dummy DLL to intercept valid [...]]]></description>
			<content:encoded><![CDATA[<p>When I first got my HTC Touch Diamond a while ago, one of the first things I tried to do was reverse engineer the Sensor API found in HTCSensorSDK.dll. However, anyone who has tried to reverse engineer DLL arguments knows how tedious and painful it can be to create a dummy DLL to intercept valid arguments, parse through assembly, and inspect random memory pointers. Luckily, I did discover a registry key: HKEY_LOCAL_MACHINE\Software\HTC\HTCSensor\GSensor\EventChanged which let me figure out what the general orientation of the device was; and that was good enough for what I was trying to do.</p>
<p>However Scott, from <a href="http://scottandmichelle.net/scott/comments.html?entry=784">scottandmichelle.net</a>, successfully reverse engineered the HTCSensorSDK.dll. This allows developers to use the g-sensor that is available on the device. Very impressive work on the part of Scott!</p>
<p>Anyhow, I spent a portion of today writing a managed wrapper for HTC&#8217;s Sensor API. You can <a href="http://blog.enterprisemobile.com/wp-content/uploads/2008/07/htcsensorsdk.zip">download it here</a>. The code also includes a sample Teeter-esque type application which allows you to roll a ball around the screen.<span id="more-24"></span></p>
<p>The managed API exposes the HTCGSensor class which allows you to hook to query the state of the g-sensor on the device. It exposes the following methods, properties, and events:</p>
<p><strong>GetGVector</strong><br />
Returns a vector that desribes the direction of gravity/acceleration in relation to the device screen.</p>
<ul>
<li> When the device is face up on a flat surface, this method would return 0, 0, -9.8. The Z value of -9.8 would mean that the acceleration in the opposite direction of the orientation of the screen.</li>
<li> When the device is held standing up, this method would return 0, -9.8, 0. The Y value of -9.8 would mean that the device is accelerating in the direction of the bottom of the screen.</li>
<li> Conversely, if the device is held upside down, this method would return 0, 9.8, 0.</li>
</ul>
<p>The vector returned will have a length measured in the unit meters per second square.</p>
<p>Ideally the when the device is in a motionless state, the vector would be of length 9.8 (the gravitational constant). However, the sensor is not extremely accurate, so this almost never the case.</p>
<p align="center"><a title="Device held standing up" rel="lightbox" href="http://blog.enterprisemobile.com/wp-content/uploads/2008/07/portrait1.jpg"><img src="http://blog.enterprisemobile.com/wp-content/uploads/2008/07/portrait-thumb1.jpg" border="0" alt="portrait" width="204" height="204" /></a> <a title="Device face up on a flat surface" rel="lightbox" href="http://blog.enterprisemobile.com/wp-content/uploads/2008/07/faceup1.jpg"><img src="http://blog.enterprisemobile.com/wp-content/uploads/2008/07/faceup-thumb1.jpg" border="0" alt="faceup" width="204" height="204" /></a></p>
<p><strong>Orientation<br />
</strong>Retrieves the current orientation of the device, returning one of the following enums: Landscape, ReverseLandscape, Portrait, ReversePortrait, FaceDown, FaceUp.</p>
<p><strong>OrientationChanged<br />
</strong>This event fires whenever the device&#8217;s orientation changes.</p>
<p>Enjoy, and let me know if you find any bugs!</p>
<p>Koushik Dutta<br />
Software Engineer<br />
<a href="http://www.koushikdutta.com">www.koushikdutta.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.enterprisemobile.com/2008/07/using-htc-diamonds-sensor-sdk-from-managed-code/feed/</wfw:commentRss>
		<feedburner:origLink>http://blog.enterprisemobile.com/2008/07/using-htc-diamonds-sensor-sdk-from-managed-code/</feedburner:origLink></item>
		<item>
		<title>Automating Build Versioning and Publishing of Smart Device Projects with Team Foundation Build</title>
		<link>http://feeds.feedburner.com/~r/EnterpriseMobileBlog/~3/341710522/</link>
		<comments>http://blog.enterprisemobile.com/2008/07/automating-build-versioning-and-publishing-smart-device-projects-with-team-foundation-build/#comments</comments>
		<pubDate>Sun, 06 Jul 2008 19:41:53 +0000</pubDate>
		<dc:creator>kdutta</dc:creator>
		
		<category><![CDATA[Development]]></category>

		<category><![CDATA[Team Foundation System Build]]></category>

		<category><![CDATA[Windows Mobile]]></category>

		<guid isPermaLink="false">http://blog.enterprisemobile.com/?p=23</guid>
		<description><![CDATA[A few months ago I sent out an email describing the process of setting up the Team Foundation Build System to play nicely with Smart Device Projects. This mail included: setting up the build machine to work with Smart Device Projects, account permissions, publish location, versioning, and also a workaround to making Smart Device CAB [...]]]></description>
			<content:encoded><![CDATA[<p>A few months ago I sent out an email describing the process of setting up the Team Foundation Build System to play nicely with Smart Device Projects. This mail included: setting up the build machine to work with Smart Device Projects, account permissions, publish location, versioning, and also a workaround to making Smart Device CAB projects buildable by TFS. I’m sure other developers have had to or will have to go through the same pains of figuring this out, so I decided to publish it a la blog.<span id="more-23"></span></p>
<style type="text/css">
<!--
#wp_codebox { height:auto; }
-->
</style>
<p>I hit 3 snags while working on this:</p>
<ol>
<li>Build Service Setup and Permissions</li>
<li>Automatic versioning in the standard Major.Minor.Build.Revision style</li>
<li>Smart Device CAB files are not supported by MSBuild</li>
</ol>
<p><strong>Build Service Setup and Permissions</strong></p>
<ol>
<li>Set up Team Build on the Build machine (BuildMachine)
<ol type="a">
<li>Install Team Build</li>
<li>Install Visual Studio 2008 on the machine as well, otherwise Compact Framework projects will not compile.</li>
<li>Install the Windows Mobile 6 Professional and Standard SDKs, Visual Studio 2008 only ships with Windows Mobile 5 SDKs.</li>
</ol>
</li>
<li>Make sure the Build Service account (TFSBuild) has full access and permissions to the share you are publishing (\\PublishMachine\Builds\&#8230;).</li>
<li>Create a Build Agent (only needs to be done once per server, and then is accessible to everyone). In Visual Studio, click Build, and type the server name (BuildMachine).</li>
<li>Create a Build Definition for your project
<ol type="a">
<li>In Team Explorer, under Builds, create a new Build definition. The wizard is very straightforward. Choose a location in the source tree, and choose a build configuration (Release). This will create a tfsbuild.proj file in the location you specified in the source tree. You will need to edit this file later on.</li>
<li>Right click the build definition and perform a build. Verify it succeeded. You will notice that the build number is Ole Automation dated. Not very easy on the eyes.</li>
</ol>
</li>
</ol>
<p><strong>Automatic Versioning</strong></p>
<p>Microsoft has some generic MSBuild tasks available that can be used to handle this. They are a separate download from Visual Studio however. Here’s the relevant links:</p>
<ul>
<li><a href="http://www.tfsbuild.com/Default.aspx?Page=Increment%20Build%20Numbers%20(major,%20minor,%20build,%20etc)&amp;AspxAutoDetectCookieSupport=1">TFSBuild</a></li>
<li><a href="http://www.codeplex.com/sdctasks">SDCTasks</a></li>
</ul>
<ol>
<li><strong>Setting up your Solution</strong>
<ol type="a">
<li>Add the Microsoft.Sdc.Common.tasks and Microsoft.Sdc.Tasks.dll to the root of your solution. Using the ones provided by Microsoft actually caused me build errors for whatever reason. Some of the tasks they included were the cause. I have commented out all the tasks but those necessary to accomplish versioning. I have attached the <a href="http://blog.enterprisemobile.com/wp-content/uploads/2008/07/microsoftsdccommon.zip">.dll and the edited .tasks</a> file to this blog.</li>
</ol>
</li>
<li><strong>Preparing the Version.xml File</strong>
<ol type="a">
<li>I have attached a sample <a href="http://blog.enterprisemobile.com/wp-content/uploads/2008/07/version.xml">Version.xml</a> to this blog. Save this to a network share (preferably the same as the one being used when the Build definition was created). The task will reference this file to retrieve the current version, increment it, and save the new version back to the file.</li>
<li>The build service account (TFSBuild) needs to have full permissions to this file. This file must not be read only.</li>
</ol>
</li>
<li><strong>Modifying the TFSBuild.proj</strong>
<ol type="a">
<li>Check the tfsbuild.proj file out for edit</li>
<li>Add the following XML blob before the ending <code>&lt;/Project&gt;</code> tag:

<div id="wp_codebox"><table width="100%" ><tr id="p233"><td width="1%" class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
</pre></td><td class="code" id="p23code3"><pre class="xml"><span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- This will retrieve and increment a version number from a file on a network share --&gt;</span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;import</span> <span style="color: #000066;">Project</span>=<span style="color: #ff0000;">&quot;$(MSBuildProjectDirectory)\Microsoft.Sdc.Common.tasks&quot;</span> <span style="font-weight: bold; color: black;">/&gt;</span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;target</span> <span style="color: #000066;">Name</span>=<span style="color: #ff0000;">&quot;BuildNumberOverrideTarget&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>
  <span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- Now update the version number --&gt;</span></span>
  <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;versionnumber</span> .Update <span style="color: #000066;">VersionNumberConfigFileLocation</span>=<span style="color: #ff0000;">&quot;\\emsea100\path\to\Version.xml&quot;</span>
                        <span style="color: #000066;">SkipSourceControl</span>=<span style="color: #ff0000;">&quot;true&quot;</span>
                        <span style="color: #000066;">OnlyIncrementRevision</span>=<span style="color: #ff0000;">&quot;true&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>
    <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;output</span> <span style="color: #000066;">TaskParameter</span>=<span style="color: #ff0000;">&quot;VersionNumber&quot;</span> <span style="color: #000066;">PropertyName</span>=<span style="color: #ff0000;">&quot;BuildNumber&quot;</span> <span style="font-weight: bold; color: black;">/&gt;</span></span>
  <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/versionnumber<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/target<span style="font-weight: bold; color: black;">&gt;</span></span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- This will replace all version numbers in the assemblyinfo.cs files with the one from the share --&gt;</span></span>
<span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- This target is called after Team build gets all the source files from TFS. --&gt;</span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;target</span> <span style="color: #000066;">Name</span>=<span style="color: #ff0000;">&quot;AfterGet&quot;</span> <span style="color: #000066;">DependsOnTargets</span>=<span style="color: #ff0000;">&quot;VersionAssemblies&quot;</span> <span style="font-weight: bold; color: black;">/&gt;</span></span>
&nbsp;
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;target</span> <span style="color: #000066;">Name</span>=<span style="color: #ff0000;">&quot;VersionAssemblies&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>
  <span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- Get the Assembly Info files.--&gt;</span></span>
  <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;createitem</span> <span style="color: #000066;">Include</span>=<span style="color: #ff0000;">&quot;$(SolutionRoot)\**\AssemblyInfo.cs;&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>
    <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;output</span> <span style="color: #000066;">TaskParameter</span>=<span style="color: #ff0000;">&quot;Include&quot;</span> <span style="color: #000066;">ItemName</span>=<span style="color: #ff0000;">&quot;AssemblyInfos&quot;</span><span style="font-weight: bold; color: black;">/&gt;</span></span>
  <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/createitem<span style="font-weight: bold; color: black;">&gt;</span></span></span>
&nbsp;
  <span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- Update the version numbers --&gt;</span></span>
  <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;file</span> .Replace <span style="color: #000066;">Force</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000066;">Path</span>=<span style="color: #ff0000;">&quot;%(AssemblyInfos.FullPath)&quot;</span> <span style="color: #000066;">NewValue</span>=<span style="color: #ff0000;">&quot;AssemblyVersion(&amp;quot;$(BuildNumber)&amp;quot;)&quot;</span> <span style="color: #000066;">regularExpression</span>=<span style="color: #ff0000;">&quot;AssemblyVersion\(\&amp;quot;(\d+.\d+.\d+.\d+)\&amp;quot;\)&quot;</span> <span style="color: #000066;">ignoreCase</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="font-weight: bold; color: black;">/&gt;</span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/target<span style="font-weight: bold; color: black;">&gt;</span></span></span></pre></td></tr></table></div>

</li>
<li>Edit the <code style="color: navy;">VersionNumberConfigFileLocation</code> value to be configured for your publish machine and directory. You can also change the <code style="color: navy;">OnlyIncrementRevision</code> to false so that the build number also gets autoincremented.</li>
</ol>
</li>
</ol>
<p><strong>Building a Smart Device CAB Project Using MSBuild</strong></p>
<p>There is no “good” way to do this. I did this by creating a standard Smart Device CAB project, and then building it on my development machine. If your project is called SmartDeviceCab, in the SmartDeviceCab\Debug folder, there is a SmartDeviceCab.inf file. That file can be used as input to CabWiz.exe to create the file from a command prompt. I will be using the INF file of our recently released tool, Device IP Utility, as an example.</p>
<ol>
<li><strong>Solution Setup</strong>
<ol type="alpha">
<li>Copy the EMIPUtil.inf file to the solution root folder.</li>
<li>Right click the solution and add existing file: %SolutionRoot%\ EMIPUtil.inf</li>
</ol>
</li>
<li><strong>Modifying the INF file</strong>
<ol type="a">
<li>The INF file will contain a section of absolute paths to the location of the binaries on the development machine. This needs to be changed to absolute paths on the build machine. Note that all the binaries on the build machine will be dumped into the same directory, making it relative easy to edit. The first INF file shows what the file may look on your development machine, and the second will show how it should look on your build server.
<ol>
<li><strong>Old Paths Local to Your Development Machine</strong>
<pre id="wp_codebox" style="height: auto;">
<div>
1=,”Common1″,,”C:\Users\kdutta\Documents\Visual Studio 2008\Projects\Device IP Utility\Device IP Utility - Production\EnterpriseMobile.WindowsMobile.IPUtil\bin\Release\”
2=,”Common2″,,”C:\Users\kdutta\Documents\Visual Studio 2008\Projects\Device IP Utility\Device IP Utility - Production\EnterpriseMobile.WindowsMobile.IPUtil\obj\Release\”
3=,”Common3″,,”C:\Users\kdutta\Documents\Visual Studio 2008\Projects\Device IP Utility\Device IP Utility - Production\EnterpriseMobile.WindowsMobile.Utilities\bin\Release\”
4=,”Common4″,,”C:\Users\kdutta\Documents\Visual Studio 2008\Projects\Device IP Utility\Device IP Utility - Production\EnterpriseMobile.WindowsMobile.Utilities\obj\Release\”
5=,”Common5″,,”C:\Users\kdutta\Documents\Visual Studio 2008\Projects\Device IP Utility\Device IP Utility - Production\WMIPUtil\obj\Release\”
6=,”Common6″,,”C:\Users\kdutta\Documents\Visual Studio 2008\Projects\Device IP Utility\Device IP Utility - Production\WindowlessControls\bin\Release\”
7=,”Common7″,,”C:\Users\kdutta\Documents\Visual Studio 2008\Projects\Device IP Utility\Device IP Utility - Production\WindowlessControls\obj\Release\”
8=,”Common8″,,”c:\Users\kdutta\Documents\Visual Studio 2008\Projects\Device IP Utility\Device IP Utility - Production\EnterpriseMobile.WindowsMobile.IPUtil.Interop\Windows Mobile 5.0 Smartphone SDK (ARMV4I)\Release\”</div>
</pre>
</li>
<li><strong>New Paths on Build Machine</strong>
<pre id="wp_codebox" style="height: auto;">
<div>
1=,”Common2″,,”C:\Documents and Settings\TFSBuild\Local Settings\Temp\Device IP Utility\Device IP Utility - Production\Binaries\Release\”
2=,”Common3″,,”C:\Documents and Settings\TFSBuild\Local Settings\Temp\Device IP Utility\Device IP Utility - Production\Binaries\Release\”
3=,”Common4″,,”C:\Documents and Settings\TFSBuild\Local Settings\Temp\Device IP Utility\Device IP Utility - Production\Binaries\Release\”
4=,”Common5″,,”C:\Documents and Settings\TFSBuild\Local Settings\Temp\Device IP Utility\Device IP Utility - Production\Binaries\Release\”
5=,”Common6″,,”C:\Documents and Settings\TFSBuild\Local Settings\Temp\Device IP Utility\Device IP Utility - Production\Binaries\Release\”
6=,”Common7″,,”C:\Documents and Settings\TFSBuild\Local Settings\Temp\Device IP Utility\Device IP Utility - Production\Binaries\Release\”
7=,”Common8″,,”C:\Documents and Settings\TFSBuild\Local Settings\Temp\Device IP Utility\Device IP Utility - Production\Binaries\Release\”
8=,”Common9″,,”C:\Documents and Settings\TFSBuild\Local Settings\Temp\Device IP Utility\Device IP Utility - Production\Binaries\Release\”</div>
</pre>
</li>
</ol>
</li>
</ol>
</li>
<li><strong>Making MSBuild call CabWiz.exe</strong>
<ol type="a">
<li>Check out and edit the tfsbuild.proj file</li>
<li>Before the ending <code>&lt;/Project&gt;</code> tag, insert the following:

<div id="wp_codebox"><table width="100%" ><tr id="p234"><td width="1%" class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code" id="p23code4"><pre class="xml"><span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- This will build a CAB file from an .inf file --&gt;</span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;target</span> <span style="color: #000066;">Name</span>=<span style="color: #ff0000;">&quot;BeforeDropBuild&quot;</span> <span style="color: #000066;">DependsOnTargets</span>=<span style="color: #ff0000;">&quot;MakeCAB&quot;</span><span style="font-weight: bold; color: black;">/&gt;</span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;target</span> <span style="color: #000066;">Name</span>=<span style="color: #ff0000;">&quot;MakeCAB&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>
  <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;message</span> <span style="color: #000066;">Text</span>=<span style="color: #ff0000;">&quot;Building a CAB file&quot;</span> <span style="color: #000066;">Importance</span>=<span style="color: #ff0000;">&quot;normal&quot;</span><span style="font-weight: bold; color: black;">/&gt;</span></span>
  <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;exec</span> <span style="color: #000066;">Command</span>=<span style="color: #ff0000;">&quot;&amp;quot;C:\Program Files\Microsoft Visual Studio 9.0\SmartDevices\SDK\SDKTools\cabwiz.exe&amp;quot; &amp;quot;C:\Documents and Settings\TFSBuild\Local Settings\Temp\Device IP Utility\Device IP Utility - Production\Sources\EMIPUtil.inf&amp;quot; /compress /dest &amp;quot;C:\Documents and Settings\TFSBuild\Local Settings\Temp\Device IP Utility\Device IP Utility - Production\Binaries&amp;quot;&quot;</span><span style="font-weight: bold; color: black;">/&gt;</span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/target<span style="font-weight: bold; color: black;">&gt;</span></span></span></pre></td></tr></table></div>

</li>
<li>Modify the following Command Attribute to be set up specifically for your build machine. This defines the path to CabWiz.exe, the path to your INF file, and the output directory of the CAB file.</li>
<li>This XML insert calls the CabWiz.exe prior to publishing the binaries. CabWiz.exe adds the CAB file to the binaries folder, which in turn gets published with everything else.</li>
</ol>
</li>
</ol>
<p>Sadly there is somewhat poor support for Smart Device Projects in TFSBuild, so making it work isn’t exactly elegant, but it works!</p>
<p>Koushik Dutta<br />
Software Engineer<br />
<a href="http://www.koushikdutta.com">www.koushikdutta.com</a><a href='http://blog.enterprisemobile.com/wp-content/uploads/2008/07/microsoftsdccommon.zip'>microsoftsdccommon</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.enterprisemobile.com/2008/07/automating-build-versioning-and-publishing-smart-device-projects-with-team-foundation-build/feed/</wfw:commentRss>
		<feedburner:origLink>http://blog.enterprisemobile.com/2008/07/automating-build-versioning-and-publishing-smart-device-projects-with-team-foundation-build/</feedburner:origLink></item>
		<item>
		<title>Why Device Lock PIN/Password must be configured with Windows Mobile 6.1 Device Encryption</title>
		<link>http://feeds.feedburner.com/~r/EnterpriseMobileBlog/~3/341710523/</link>
		<comments>http://blog.enterprisemobile.com/2008/06/why-device-lock-pinpassword-must-be-configured-with-windows-mobile-61-device-encryption/#comments</comments>
		<pubDate>Tue, 24 Jun 2008 00:31:27 +0000</pubDate>
		<dc:creator>dfield</dc:creator>
		
		<category><![CDATA[Development]]></category>

		<category><![CDATA[Windows Mobile]]></category>

		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://blog.enterprisemobile.com/2008/06/why-device-lock-pinpassword-must-be-configured-with-windows-mobile-61-device-encryption/</guid>
		<description><![CDATA[It is a well know fact that a lot of enteprise IT pros require data encryption for mobile devices.  The Windows Mobile operating system has included support for the Data Protection API (DPAPI) since Windows Mobile 2003.  And DPAPI forms the basis for Windows Mobile file encryption used with removable storage cards (Windows Mobile 6.0) and [...]]]></description>
			<content:encoded><![CDATA[<p>It is a well know fact that a lot of enteprise IT pros require data encryption for mobile devices.  The Windows Mobile operating system has included support for the Data Protection API (DPAPI) since Windows Mobile 2003.  And DPAPI forms the basis for Windows Mobile file encryption used with removable storage cards (Windows Mobile 6.0) and main memory (Windows Mobile 6.1). </p>
<p>DPAPI provides easy-to-use functions for encryption and decryption.  A number of applications use DPAPI.  The thing that makes DPAPI easy to use for developers is that they don&#8217;t have to wite all the key generation and key management code that typically goes with any encryption solution.  DPAPI uses a master key that is stored in the memory of the device.  When an application calls DPAPI, the same master key is used to generate symmetric keys for all encryption and decryption operations.  In this way, the application does not have to generate or manage the encryption key used.  For a thorough description of DPAPI see the MSDN article covering <a href="http://msdn.microsoft.com/en-us/library/ms995355.aspx">Windows Data Protection</a></p>
<p>Of course, this begs the question, &#8220;How is the master key protected?&#8221;<span id="more-21"></span> The master key is encrypted itself at the time it is generated.  And, it is decrypted at system boot time.  It must be decrypted for use during boot in case an encrypted file is loaded during the boot process. The key used to decrypt the master key is derived from a password and used during boot.  In Windows Mobile, there are 2 master keys, the &#8220;user&#8221; master key and the &#8220;system&#8221; master key.  The &#8220;system&#8221; master key is encrypted using a key derived from the system &#8220;password&#8221; which is a mixture of system information.  The &#8220;user&#8221; master key is typically derived from a user password. </p>
<p>The &#8220;user&#8221; master key is considered more secure then the &#8220;system&#8221; master key because the entropy used to encrypt it includes information only the user knows (i.e., their password).  The &#8220;system&#8221; master key is more flexible though because the system does not need to go get input from the user.</p>
<p>The &#8220;user&#8221; master key on WM 6.1 is derived from the Windows Mobile device lock PIN or password that is entered by the user during device boot.  Therefore, when you enable encryption on a device, the user must configure a PIN/Password, if not already configured. </p>
<p>Note that the encryption of data written to storage cards in Windows Mobile 6.0 and later also uses DPAPI, but with the &#8220;system&#8221; master key rather then the &#8220;user&#8221; master key.  This is a lot less of an issue for removable storage card encryption then for main memory file encryption.  The primary attack on the &#8220;system&#8221; master key requires access to the system used to create it and typically,the attack on the removable storage card is mounted from a different computer that the lost or stolen removable storage card is inserted into.</p>
<p>btw, the default encryption algorithm used since Windows Mobile 6.0 for DPAPI is AES-128.  Prior to Windows Mobile 6.0, DPAPI utilized RC4.</p>
<p>Dave Field, CISSP, MCP<br />
Device Management and Security Architect<br />
Enterprise Mobile, Inc.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.enterprisemobile.com/2008/06/why-device-lock-pinpassword-must-be-configured-with-windows-mobile-61-device-encryption/feed/</wfw:commentRss>
		<feedburner:origLink>http://blog.enterprisemobile.com/2008/06/why-device-lock-pinpassword-must-be-configured-with-windows-mobile-61-device-encryption/</feedburner:origLink></item>
		<item>
		<title>Fun with Anonymous Methods</title>
		<link>http://feeds.feedburner.com/~r/EnterpriseMobileBlog/~3/341710524/</link>
		<comments>http://blog.enterprisemobile.com/2008/05/fun-with-anonymous-delegates/#comments</comments>
		<pubDate>Fri, 23 May 2008 14:44:10 +0000</pubDate>
		<dc:creator>kdutta</dc:creator>
		
		<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://blog.enterprisemobile.com/2008/05/fun-with-anonymous-delegates/</guid>
		<description><![CDATA[A few months ago I wrote some code that really made me appreciate the new language feature in C#: Anonymous Methods. I decided to turn it into a sample application that creates a web request to www.google.com and downloads it when you push a button&#8230; asynchronously (that means the UI does not hang while the [...]]]></description>
			<content:encoded><![CDATA[<p>A few months ago I wrote some code that really made me appreciate the new language feature in C#: Anonymous Methods. I decided to turn it into a sample application that creates a web request to <a href="http://www.google.com">www.google.com</a> and downloads it when you push a button&#8230; asynchronously (that means the UI does not hang while the application is downloading). Prior to C# 2.0, doing a web request and download the content asynchronously was several hundred lines of sloppy spaghetti code: you need to implement callbacks, cleanup, error handling, state maintenance, etc. A lot of developers, myself included, would &#8220;cheat&#8221; and wrap synchronous calls in a thread to fake asynchronous requests (this is not ideal for performance).</p>
<p>The beauty of anonymous methods is that the compiler’s syntactic sugar handles a lot of the aforementioned for the developer very elegantly in the background.<span id="more-16"></span></p>
<p>Here’s what a fully asynchronous download looks like now, with error handling and cleanup and all (5 anonymous methods in total):</p>

<div id="wp_codebox"><table width="100%" ><tr id="p166"><td width="1%" class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
</pre></td><td class="code" id="p16code6"><pre class="csharp">HttpWebRequest req <span style="color: #008000;">=</span> WebRequest.<span style="color: #0000FF;">Create</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;http://www.google.com&quot;</span><span style="color: #000000;">&#41;</span> <span style="color: #0600FF;">as</span> HttpWebRequest<span style="color: #008000;">;</span>
MemoryStream memStream <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> MemoryStream<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
HttpWebResponse resp <span style="color: #008000;">=</span> null<span style="color: #008000;">;</span>
&nbsp;
<span style="color: #008080; font-style: italic;">// anonymous method to handle cleanup</span>
EventHandler Cleanup <span style="color: #008000;">=</span> <span style="color: #000000;">&#40;</span>s, ev<span style="color: #000000;">&#41;</span> <span style="color: #008000;">=&gt;</span>
    <span style="color: #000000;">&#123;</span>
        <span style="color: #0600FF;">using</span> <span style="color: #000000;">&#40;</span>resp<span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
        <span style="color: #000000;">&#125;</span>
        resp <span style="color: #008000;">=</span> null<span style="color: #008000;">;</span>
        <span style="color: #0600FF;">using</span> <span style="color: #000000;">&#40;</span>memStream<span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
        <span style="color: #000000;">&#125;</span>
        memStream <span style="color: #008000;">=</span> null<span style="color: #008000;">;</span>
    <span style="color: #000000;">&#125;</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #008080; font-style: italic;">// anonymous method to handle errors</span>
EventHandler Error <span style="color: #008000;">=</span> <span style="color: #000000;">&#40;</span>s, ev<span style="color: #000000;">&#41;</span> <span style="color: #008000;">=&gt;</span>
<span style="color: #000000;">&#123;</span>
    MessageBox.<span style="color: #0000FF;">Show</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>s <span style="color: #0600FF;">as</span> Exception<span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">Message</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
    Cleanup<span style="color: #000000;">&#40;</span><span style="color: #0600FF;">null</span>, <span style="color: #0600FF;">null</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #000000;">&#125;</span><span style="color: #008000;">;</span>
&nbsp;
req.<span style="color: #0000FF;">BeginGetResponse</span><span style="color: #000000;">&#40;</span>responseResult <span style="color: #008000;">=&gt;</span>
    <span style="color: #000000;">&#123;</span> <span style="color: #008080; font-style: italic;">// anonymous method that waits for a response from the web server</span>
        Thread.<span style="color: #0000FF;">Sleep</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">1000</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span> <span style="color: #008080; font-style: italic;">// for asynchronous testing</span>
        <span style="color: #0600FF;">try</span>
        <span style="color: #000000;">&#123;</span>
            resp <span style="color: #008000;">=</span> req.<span style="color: #0000FF;">EndGetResponse</span><span style="color: #000000;">&#40;</span>responseResult<span style="color: #000000;">&#41;</span> <span style="color: #0600FF;">as</span> HttpWebResponse<span style="color: #008000;">;</span>
            Stream responseStream <span style="color: #008000;">=</span> resp.<span style="color: #0000FF;">GetResponseStream</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #FF0000;">byte</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> buffer <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> <span style="color: #FF0000;">byte</span><span style="color: #000000;">&#91;</span><span style="color: #FF0000;">1024</span><span style="color: #000000;">&#93;</span><span style="color: #008000;">;</span>
            AsyncCallback rc <span style="color: #008000;">=</span> null<span style="color: #008000;">;</span>
            rc <span style="color: #008000;">=</span> readResult <span style="color: #008000;">=&gt;</span>
                <span style="color: #000000;">&#123;</span> <span style="color: #008080; font-style: italic;">// anonymous method that waits to read a some data from the web server</span>
                    Thread.<span style="color: #0000FF;">Sleep</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">1000</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span> <span style="color: #008080; font-style: italic;">// for asynchronous testing</span>
                    <span style="color: #0600FF;">try</span>
                    <span style="color: #000000;">&#123;</span>
                        <span style="color: #FF0000;">int</span> read <span style="color: #008000;">=</span> responseStream.<span style="color: #0000FF;">EndRead</span><span style="color: #000000;">&#40;</span>readResult<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
                        <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>read <span style="color: #008000;">&gt;</span> <span style="color: #FF0000;">0</span><span style="color: #000000;">&#41;</span>
                        <span style="color: #000000;">&#123;</span>
                            memStream.<span style="color: #0000FF;">Write</span><span style="color: #000000;">&#40;</span>buffer, <span style="color: #FF0000;">0</span>, read<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
                            responseStream.<span style="color: #0000FF;">BeginRead</span><span style="color: #000000;">&#40;</span>buffer, <span style="color: #FF0000;">0</span>, buffer.<span style="color: #0000FF;">Length</span>, rc, <span style="color: #0600FF;">null</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
                        <span style="color: #000000;">&#125;</span>
                        <span style="color: #0600FF;">else</span>
                        <span style="color: #000000;">&#123;</span>
                            <span style="color: #008080; font-style: italic;">// We finished downloading! Invoke the UI thread to print the data!</span>
&nbsp;
                            <span style="color: #008080; font-style: italic;">// anonymous method to handle completion</span>
                            EventHandler Done <span style="color: #008000;">=</span> <span style="color: #000000;">&#40;</span>s, ev<span style="color: #000000;">&#41;</span> <span style="color: #008000;">=&gt;</span>
                            <span style="color: #000000;">&#123;</span>
                                memStream.<span style="color: #0000FF;">Seek</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">0</span>, SeekOrigin.<span style="color: #0000FF;">Begin</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
                                <span style="color: #FF0000;">string</span> blob <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> StreamReader<span style="color: #000000;">&#40;</span>memStream<span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">ReadToEnd</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
                                Cleanup<span style="color: #000000;">&#40;</span><span style="color: #0600FF;">null</span>, <span style="color: #0600FF;">null</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
                                MessageBox.<span style="color: #0000FF;">Show</span><span style="color: #000000;">&#40;</span>blob<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
                            <span style="color: #000000;">&#125;</span><span style="color: #008000;">;</span>
&nbsp;
                            Invoke<span style="color: #000000;">&#40;</span>Done<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
                        <span style="color: #000000;">&#125;</span>
                    <span style="color: #000000;">&#125;</span>
                    <span style="color: #0600FF;">catch</span> <span style="color: #000000;">&#40;</span>Exception ex<span style="color: #000000;">&#41;</span>
                    <span style="color: #000000;">&#123;</span>
                        Invoke<span style="color: #000000;">&#40;</span>Error, ex<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
                    <span style="color: #000000;">&#125;</span>
                <span style="color: #000000;">&#125;</span><span style="color: #008000;">;</span>
            responseStream.<span style="color: #0000FF;">BeginRead</span><span style="color: #000000;">&#40;</span>buffer, <span style="color: #FF0000;">0</span>, buffer.<span style="color: #0000FF;">Length</span>, rc, <span style="color: #0600FF;">null</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #000000;">&#125;</span>
        <span style="color: #0600FF;">catch</span> <span style="color: #000000;">&#40;</span>Exception ex<span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
            Invoke<span style="color: #000000;">&#40;</span>Error, ex<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #000000;">&#125;</span>
    <span style="color: #000000;">&#125;</span>,
    <span style="color: #0600FF;">null</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.enterprisemobile.com/2008/05/fun-with-anonymous-delegates/feed/</wfw:commentRss>
		<feedburner:origLink>http://blog.enterprisemobile.com/2008/05/fun-with-anonymous-delegates/</feedburner:origLink></item>
	</channel>
</rss>
