<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	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:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Enterprise Mobile &#187; Development</title>
	<atom:link href="http://blog.enterprisemobile.com/category/development/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.enterprisemobile.com</link>
	<description>Blogging about enterprise mobility, mobile devices, security, management and deployments.</description>
	<lastBuildDate>Tue, 17 Jan 2012 19:13:30 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>iPhone Line of Business Application Deployment</title>
		<link>http://blog.enterprisemobile.com/2009/12/iphone-line-of-business-application-deployment/</link>
		<comments>http://blog.enterprisemobile.com/2009/12/iphone-line-of-business-application-deployment/#comments</comments>
		<pubDate>Wed, 09 Dec 2009 18:17:39 +0000</pubDate>
		<dc:creator>dfield</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Enterprise mobility]]></category>
		<category><![CDATA[iphone]]></category>

		<guid isPermaLink="false">http://blog.enterprisemobile.com/?p=226</guid>
		<description><![CDATA[A lot of people don&#8217;t know it, but there is a way to deploy Enterprise Line of Business (LOB) applications to employee iPhones without using the Apple appstore.  It definitely has its caveats.  But, it&#8217;s worth knowing about.
If your company has 500 or more employees, you can buy an iPhone &#8220;Enterprise&#8221; developer license.  It&#8217;s a [...]]]></description>
			<content:encoded><![CDATA[<p>A lot of people don&#8217;t know it, but there is a way to deploy Enterprise Line of Business (LOB) applications to employee iPhones without using the Apple appstore.  It definitely has its caveats.  But, it&#8217;s worth knowing about.</p>
<p>If your company has 500 or more employees, you can buy an iPhone &#8220;Enterprise&#8221; developer license.  It&#8217;s a bit more then the &#8220;Standard&#8221; individual and company licenses, but not much.  For more on developer licenses, go <a title="iPhone Developer Licensing" href="http://developer.apple.com/iphone/program/" target="_blank">here</a>.</p>
<p>Once you have the license, you can sign your LOB apps with your certificate and provision them to company devices.  &#8220;Enterprise&#8221; developer licensing allows what is called &#8220;Universal&#8221; application provisioning.  This is the same type of provisioning that is granted to applications deployed through the Apple Appstore and allows deployment of the application to any iPhone on the face of the Earth.</p>
<p>Wow, so with a developer license, you can deploy an app to any iPhone out there without going through the appstore&#8230;.WRONG!  The &#8220;Enterprise&#8221; developer license EULA that you accepted dicatates that you are only allowed to deploy apps to iPhones operated by employees of your company.  Deployment to any other iPhones is illegal.  And, I&#8217;m absolutely sure that Apple is not going to stand by and let you break the law.</p>
<p>Well, you can deploy your LOB app to your company users and that&#8217;s the important thing, right?  At this point, you may be wondering how you go about deploying the application to the employee-operated iPhone.  There are currently two ways to do it.  Use the <a title="iPCU Download" href="http://www.apple.com/support/iphone/enterprise/" target="_blank">iPhone Configuration Utility (iPCU)</a> or use <a title="Apple iTunes Download" href="http://www.apple.com/itunes/download/" target="_blank">Apple iTunes</a>.  Both methods are described in the <a title="iPhone Enterprise Deployment Guide" href="http://manuals.info.apple.com/en_US/Enterprise_Deployment_Guide.pdf" target="_blank">Apple iPhone Enterprise Deployment Guide</a>.</p>
<p>The caveat here is that neither iPCU or iTunes app deployment can be performed directly between the iPhone and a server.  Both iPCU and iTunes are desktop applications that run on either a Mac or Windows machine.  But, they do support two different scenarios.  iPCU is best if you want to setup a bulk number of iPhones with your LOB before giving them to the user.  iTunes is better for deployment of the app or on-going updates when the iPhone is already in the user&#8217;s hands.</p>
<p>When deploying the LOB app, you have to get your Enterprise Developer License .mobileprovision file installed on the iPhone before you can install a .app file.  You can deploy the .mobileprovision file using desktop management that you may have deployed in your network to offload this task from the user.  When the iPhone is connected to the desktop running iTunes, the .mobileprovision file will be deployed.  Then the user must add the .app to their app library and select to install it on their iPhone.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.enterprisemobile.com/2009/12/iphone-line-of-business-application-deployment/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windows Mobile Troubleshooting &#8211; How to log like a developer</title>
		<link>http://blog.enterprisemobile.com/2009/03/windows-mobile-troubleshooting-how-to-log-like-a-developer/</link>
		<comments>http://blog.enterprisemobile.com/2009/03/windows-mobile-troubleshooting-how-to-log-like-a-developer/#comments</comments>
		<pubDate>Fri, 20 Mar 2009 22:22:34 +0000</pubDate>
		<dc:creator>mnielsen</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Windows Mobile]]></category>

		<guid isPermaLink="false">http://blog.enterprisemobile.com/2009/03/windows-mobile-troubleshooting-how-to-log-like-a-developer/</guid>
		<description><![CDATA[After writing up my last blog article about Windows Mobile troubleshooting and logging utilities (see it again here), I was more closely at the lookout for other tools and tricks that might help assist in a similar fashion.. Of course I found some more good additional information and have included it in this round..  [...]]]></description>
			<content:encoded><![CDATA[<p>After writing up my last blog article about Windows Mobile troubleshooting and logging utilities (see it again <a href="http://blog.enterprisemobile.com/2009/02/windows-mobile-troubleshooting-how-to-log-like-an-expert/">here</a>), I was more closely at the lookout for other tools and tricks that might help assist in a similar fashion.. Of course I found some more good additional information and have included it in this round.. <img src='http://blog.enterprisemobile.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> &#160; Especially the memory management information I don&#8217;t think has been that well communicated in the past..</p>
<p><strong>.NET Compact Framework Logging</strong></p>
<p>On Steve Hegenderfer and Reed Robinson&#8217;s excellent <a href="http://blogs.msdn.com/hegenderfer">blog</a> Reed posted a <a href="http://blogs.msdn.com/hegenderfer/archive/2008/12/29/using-netcf-loader-logs-to-solve-start-issues.aspx">great article</a> about how to enable .NET CF loader logs and what to look out for. Specifically referencing this MSDN information on how to enable the logging: <a title="http://msdn.microsoft.com/en-us/library/ms229650.aspx" href="http://msdn.microsoft.com/en-us/library/ms229650.aspx">http://msdn.microsoft.com/en-us/library/ms229650.aspx</a>. It is all controlled in specific registry keys on the device to enable 6 different flavors of .NET CF logging: &quot;Interop&quot;, &quot;Error&quot;, &quot;Loader&quot;, &quot;Network&quot;, &quot;Finalizer&quot;, or &quot;Trace&quot;. </p>
<p>The <a href="http://www.microsoft.com/downloads/details.aspx?familyid=C8174C14-A27D-4148-BF01-86C2E0953EAB&amp;displaylang=en">Power Toys for .NET Compact Framework v3.5</a> download gives you additional tools to make this easier. One is the Remote Logging Configuration Tool:</p>
<p><a href="http://blog.enterprisemobile.com/wp-content/uploads/2009/03/image.png" rel="lightbox"><img style="0px" border="0" alt="image" src="http://blog.enterprisemobile.com/wp-content/uploads/2009/03/image-thumb.png" width="285" height="331" /></a> </p>
<p>So the most interesting for non-developers trying to troubleshoot .NET CF applications is probably the &quot;Loader&quot; logging. This is where you can see if the application even makes it off the ground and why. As Reed suggests in the <a href="http://blogs.msdn.com/hegenderfer/archive/2008/12/29/using-netcf-loader-logs-to-solve-start-issues.aspx">article I mentioned</a> it could be referencing a .NET assembly not present on the device for whatever reason..</p>
<p>Additional details on how to read the &quot;Loader&quot; logging can be found here: <a title="http://msdn.microsoft.com/en-us/library/ms229667.aspx" href="http://msdn.microsoft.com/en-us/library/ms229667.aspx">http://msdn.microsoft.com/en-us/library/ms229667.aspx</a>.</p>
<p><strong>File System Logging</strong></p>
<p>This is a type of extreme logging that can really slow down a working operating system. But it can also show you exactly what is going on at the file I/O level. Specifically what files are being accessed or written to. This could be useful to trace back missing files or folders, or figuring out the last file access a specific application did before failing. </p>
<p>I only recently found a tool called MobileMon v0.5 by Brian Dunn. His website, <a title="http://www.mobilmon.com/" href="http://www.mobilmon.com/">http://www.mobilmon.com/</a>, has more information and you can download the .CAB file there.</p>
<p>Basically you can install and run it in the background while it logs file activity.</p>
<p><a href="http://blog.enterprisemobile.com/wp-content/uploads/2009/03/image7.png" rel="lightbox"><img style="0px" border="0" alt="image" src="http://blog.enterprisemobile.com/wp-content/uploads/2009/03/image-thumb7.png" width="219" height="219" /></a><a href="http://blog.enterprisemobile.com/wp-content/uploads/2009/03/image31.png" rel="lightbox"><img style="0px" border="0" alt="image" src="http://blog.enterprisemobile.com/wp-content/uploads/2009/03/image3-thumb.png" width="220" height="220" /></a></p>
<p>Once you are done you can save it to a log file. Be aware however that the file name &quot;mobilmon.log&quot; may be hard to open on the device itself unless you install a tool (Like <a href="http://www.hfrmobile.com/app_Voyager_T1/index.htm">Voyager</a> or <a href="http://www.ghisler.com/pocketpc.htm">Total Commander</a>) to rename the file to mobilmon.txt. Then you can open it with the native Word Mobile.</p>
<p><a href="http://blog.enterprisemobile.com/wp-content/uploads/2009/03/image61.png" rel="lightbox"><img style="0px" border="0" alt="image" src="http://blog.enterprisemobile.com/wp-content/uploads/2009/03/image6-thumb.png" width="219" height="219" /></a><a href="http://blog.enterprisemobile.com/wp-content/uploads/2009/03/image9.png" rel="lightbox"><img style="0px" border="0" alt="image" src="http://blog.enterprisemobile.com/wp-content/uploads/2009/03/image9-thumb.png" width="220" height="220" /></a> </p>
<p><strong>Memory Management and Monitoring</strong></p>
<p>Another important area of concern for current Windows Mobile troubleshooting is available memory on the device.&#160; Memory leaks, multiple running applications, and garbage heaps can all attribute to doing frequent soft-reboots to get a device functional again. A little known fact that I wasn&#8217;t fully aware of is that only 32 applications (actually processes) can run at the same time and each can at a maximum access 32mb of virtual memory..</p>
<p>An excellent resource of a virtual memory management overview is William Blanke&#8217;s article: <a title="http://www.codeproject.com/KB/mobile/VirtualMemory.aspx" href="http://www.codeproject.com/KB/mobile/VirtualMemory.aspx">http://www.codeproject.com/KB/mobile/VirtualMemory.aspx</a></p>
<p>In it he also has a small (12Kb) Virtual Memory tool (must register to download, the compiled .exe in included with the source code) you can run and visually see available memory (in red) for each of the 32 process slots. </p>
<p><a href="http://blog.enterprisemobile.com/wp-content/uploads/2009/03/image71.png" rel="lightbox"><img style="0px" border="0" alt="image" src="http://blog.enterprisemobile.com/wp-content/uploads/2009/03/image7-thumb.png" width="219" height="219" /></a><img style="0px" border="0" alt="image" src="http://blog.enterprisemobile.com/wp-content/uploads/2009/03/image4-thumb.png" width="219" height="219" /></p>
<p>Issue #1: One key thing apart from seeing how many of the slots are being used and if they are full, is finding the &#8220;device.exe&#8221; process. This process is responsible for loading up all the device drivers and William points out the potential issues if memory is low for this slot. Specific device features may simply not work.</p>
<p>Issue #2: Another area of concern could be applications that load up .DLL files. These can be loaded up in *any* processing slot and can be accessed by any process. This can be bad if your process or application running in the slot needs the memory and doesn&#8217;t use the particular DLL. </p>
<p>However William doesn&#8217;t address that in Windows Mobile 6.1 specific changes were made to better accommodate DLL files over 64Kb. These will now be loaded into specific slots higher and away from the process slots. Thus freeing up application space and reducing this potential worry. Please see more information on this 6.1 feature from Doug Boling <a href="http://bolingconsulting.com/blog/?p=4">here</a>.</p>
<p>How sure if anything has/will change in Windows Mobile 6.5 as of yet. What we can look forward to is Windows Mobile 7.0 (which is based upon Windows CE 6.0) and it&#8217;s larger scale advanced memory management, explained in more detail <a href="http://msdn.microsoft.com/en-us/library/bb331824.aspx">here</a> or <a href="http://www.addlogic.se/articles/articles/windows-ce-6-memory-architecture.html">here</a>. But basically a little like Windows XP, and a limit of 32K processes and 2GB per process, compared to 32 and 32Mb per process. <img src='http://blog.enterprisemobile.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Issue #3: Careful on the usage of storage cards to install or run applications from. If the device goes into hibernation or sleep mode, it could power down the storage card and render any application housed there non-functional. See more tips <a href="http://www.smartphonemag.com/cms/blogs/28/memory_management_on_windows_mobile_devi">here</a>.</p>
<p>Some older reference links on Windows Mobile memory management:&#160; <br />- <a href="http://hadrys.wordpress.com/2008/05/03/ram-rom-and-task-managers">RAM, ROM and Task Managers</a>&#160; <br />- <a href="http://blogs.msdn.com/windowsmobile/archive/2006/08/16/702746.aspx">How WM 5.0 Shell Handles Low Memory Situations</a>&#160; <br />- <a href="http://www.simonrhart.com/2008/05/memory-management-on-windows-mobile-61.html">Memory Management on WM 6.x</a>&#160; <br />- <a href="http://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032402032&amp;Culture=en-US">MSDN Webcast: Memory Management for Windows Mobile</a>     <br />- <a href="http://support.microsoft.com/default.aspx/kb/326164">DumpMem Utility</a></p>
<p>If you are using a Motorola/Symbol ruggedized device you also may want to ask your Motorola rep about their &#8220;Private SDK&#8221; and a tool called the &#8220;Remote Memory Viewer&#8221;. It may also be beneficial as <a href="http://blogs.msdn.com/raffael">Raffaele Limosani</a> states <a href="http://blogs.msdn.com/raffael/archive/2008/11/24/troubleshooting-memory-issues-on-windows-mobile.aspx">here</a>..</p>
<p>Hope this article further assists in troubleshooting Windows Mobile issues you might run into!</p>
<p>|\\arco..    <br /><a href="http://marco.blogsite.org">http://marco.blogsite.org</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.enterprisemobile.com/2009/03/windows-mobile-troubleshooting-how-to-log-like-a-developer/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Secrets of the Windows Mobile Home Screen API</title>
		<link>http://blog.enterprisemobile.com/2008/07/the-dirty-tricks-of-the-windows-mobile-home-screen-api/</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>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>VC Project Template for Smart Device CE Setup DLLs</title>
		<link>http://blog.enterprisemobile.com/2008/07/vc-project-template-for-smart-device-ce-setup-dlls/</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>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using HTC Diamond&#8217;s Accelerometer/Sensor SDK from Managed Code</title>
		<link>http://blog.enterprisemobile.com/2008/07/using-htc-diamonds-sensor-sdk-from-managed-code/</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>
		<slash:comments>54</slash:comments>
		</item>
		<item>
		<title>Automating Build Versioning and Publishing of Smart Device Projects with Team Foundation Build</title>
		<link>http://blog.enterprisemobile.com/2008/07/automating-build-versioning-and-publishing-smart-device-projects-with-team-foundation-build/</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>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Why Device Lock PIN/Password must be configured with Windows Mobile 6.1 Device Encryption</title>
		<link>http://blog.enterprisemobile.com/2008/06/why-device-lock-pinpassword-must-be-configured-with-windows-mobile-61-device-encryption/</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>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Fun with Anonymous Methods</title>
		<link>http://blog.enterprisemobile.com/2008/05/fun-with-anonymous-delegates/</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>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

