December 2008 Entries

Zune: Workaround Post

There is an "official" word from the Zune Product Team that we should just wait until tommorrow AND let the battery die.  Then all will be right with our Zune 30GB devices.

Amazingly, they seemed surprised that "a large number of which are still actively being used."  Huh, it is an expensive electronic device, of course we are still using them.

Followup:  It worked.  The two Zunes here are working again.

Posted On Wednesday, December 31, 2008 6:10 PM | Comments (2)

Platform Builder: Compiler Optimization and Volatile
Many of you already know about the use of the C/C++ keyword volatile, but I was having a discussion with a colleague this afternoon and the topic came up. The colleague is a bright up and coming engineer who finds himself writing software, but really wanting to design hardware. He was telling me about a test that he wrote to estimate the CPU speed of a board. Simple little application, get the current milliseconds using GetTickCount(), then run a busy loop. When the loop completes call GetTickCount() ......

Posted On Tuesday, December 30, 2008 10:40 PM | Comments (0)

Windows CE: Save and Restore the Registry
In other posts, I have discussed persistent registry (Windows CE: Persisting Registry Changes from an Application) but what if we want to set the registry back to some known point? There are some functions to save the registry, or parts of the registry, and the restore them later. Save and Restore the Entire Registry The functions RegCopyFile() and RegRestoreFile() can be used to save the registry to a file and then restore the registry with that file later. The following are two very simple applications ......

Posted On Tuesday, December 23, 2008 9:05 PM | Comments (7)

Windows CE: LoadLibrary Fails with Error Code 193
Your app is trying to load a DLL either explicitly by calling LoadLibrary or implicitly by linking with the associated static linked library and it fails with error code 193, "The specified module could not be found" or a message that indicates that the app isn't a Windows CE application. The possible causes of this are: The dll isn't a built for Windows CE This happens when taking a dll from Big Windows (NT, XP, Vista) and trying to use it on a Windows CE device. The dll isn't built for the processor ......

Posted On Tuesday, December 23, 2008 7:11 PM | Comments (7)

Platform Builder: Config.bib
In previous posts, I have discussed bib files but focused on the areas that probably are modified the most during platform development, those being the FILES and MODULES sections. In this post I will look deeper into config.bib which typically contains the MEMORY and CONFIG sections. Other posts on bib files include Platform Builder: Using Bib Files to add files to a Windows CE OS Image, Platform Builder: Pulling it all together with Makeimg, Platform Builder: Creating an nk.nb0, Platform Builder: ......

Posted On Monday, December 22, 2008 8:35 PM | Comments (5)

Platform Builder: Handling Noncontiguous RAM
Someone recently posted a question to the Platform Builder newsgroup (microsoft.public.windowsce... on the NNTP server) asking about how to set up noncontiguous RAM. Seemed like the answers were going okay until someone replied with: “Besides OEMGetExtensionDRAM function, you can also map the two separate physical memory sections into single one virtual memory in From system view, it has only one memory section and the only thing you need to do is ......

Posted On Sunday, December 21, 2008 9:06 PM | Comments (6)

Windows CE: Persisting Registry Changes from an Application
Windows CE devices may or may not persist the registry when power is removed or through a hard reset. The decision is up to the OEM to implement a way to persist the registry. So your device may lose your registry settings. The good news is that many Windows CE devices do have a way to persist the registry. Microsoft provides two methods for the OEM to implement registry persistence: 1. Hive based registry – in this method, the Filesys is set up with a non-volatile disk to save the registry. This ......

Posted On Thursday, December 18, 2008 8:43 PM | Comments (0)

Windows CE: Starting Explorer in a Specific Folder
Today, a few people were looking for how to start Explorer in a specific folder. I thought that it was an interesting request for two reasons; seemed like something that could easily be tried and the source code is available with Platform Builder. So first, I tried it. There are several ways to try it, I chose to use Run from the Start menu. In the dialog, I typed in “Explorer \Flash Disk” and there was the answer, Explorer started in the \Flash Disk folder. It took less time than a Google search. ......

Posted On Wednesday, December 17, 2008 9:54 PM | Comments (0)

Windows CE: Adjusting Audio Volume
The volume control panel applet in Windows CE controls the volume by dividing the possible volume by 5 and letting the user index between those settings. So it doesn’t allow for adjustment of to all of the possible volume levels. This makes sense because really the difference between a volume level of 60,000 and 60,001 is not really perceivable by the user. I thought that it would be interesting to replicate this behavior in a function. This function demonstrates how to get the current volume setting ......

Posted On Tuesday, December 16, 2008 10:54 PM | Comments (1)

Windows CE: Enumerating the Registry
There are several ways to export the registry from a Windows CE device including the Remote Registry Editor and third-party registry editors. The Remote Registry Editor requires a connection to the device and third-party registry editors typically require a display. I don’t always have a connection to the device or a display so I thought it would be interesting to enumerate the registry to export the registry to the debug port where I can capture it to a file. I set out to figure this out just based ......

Posted On Monday, December 15, 2008 7:32 PM | Comments (0)

Windows CE: Redirecting RETAILMSG to a File
I was working at home this weekend and I left my USB to Serial adapter at the office. My office is only 4 miles from home, but I didn’t feel like driving all the way there. But I almost did because I needed to capture the RETAILMSG output from an application that I was working on. I wasn’t using them so much for debugging, but instead to output some data. I decided to redirect the output and skip going to the office. The first thing that I did was to modify the application to use printf instead of ......

Posted On Sunday, December 14, 2008 11:10 PM | Comments (0)

Windows CE: Automatically Start Application with Command Line Parameters
I have covered automatically starting applications before (Windows CE: Starting an Application when the System Boots and Windows CE: Programmatically Setting Up an Application to Auto Start ), but I have been getting questions about how to start an application at boot time and pass the application some command line parameters. This usually seems like an odd request to me, but there are some cases where it is necessary, like when the application is from a third-party. HKEY_LOCAL_MACHINE\Init with ......

Posted On Friday, December 12, 2008 11:14 PM | Comments (6)

Windows CE: Dynamic Screen Rotation
Someone asked me today about rotating, or turning, the display on a Windows CE device. MSDN actually has a nice example of how to do this at Creating a Project for the Screen Rotation Application. But the example application takes some study to convert it to something really useful. It rotates the display 90 degrees each time the application is run, handy but not that useful because that isn’t really how applications typically rotate the display. Instead applications tend to know the angle that the ......

Posted On Wednesday, December 10, 2008 10:43 PM | Comments (2)

Windows CE: Stream Interface Driver Registry Settings
If you have looked at my other posts on stream interface drivers, you have seen that the registry settings that I use for Driver Shell are: [HKEY_LOCAL_MACHINE\Drivers... "Dll"="DriverShell.dll" "Order"=dword:4 "Prefix"="XXX" "DeviceArrayIndex"=dword:1 "IClass"="{A32942B7-920C-48... I thought that I would discuss these a little more, and includes some other settings. Let’s start with the key HKEY_LOCAL_MACHINE\Drivers\... The key HKEY_LOCAL_MACHINE\Drivers\... ......

Posted On Monday, December 8, 2008 9:33 PM | Comments (11)

Windows CE: Enumerating CEDB Databases
Someone in the newsgroups recently asked about finding the database that sets up ActiveSync to run when a cable is plugged into a device. My first thought is to simply enumerate the user notifications, which I showed in a recent post, Windows CE: Enumerating User Notifications, and look for the RS232 detected event which launches repllog.exe. But then I thought that it might be interesting to enumerate the databases themselves. The following function, EnumerateDataBases(), will output the CEDB databases, ......

Posted On Saturday, December 6, 2008 3:10 PM | Comments (0)

Platform Builder:Building Multiple Folders
I came across an interesting question today – How can I use a sources file to build multiple sub-folders? Of course the obvious answer is don’t do that. Instead set up a tree something like this: MyDriver |- Dirs (file listing sub-folders) |- Folder1 (Create a static library) |- sources |- makefile |- file.c |- Folder2 (Create a static library) |- sources |- makefile |- file2.c |- BuildDLL (Link the libraries to create a DLL) |- sources |- makefile But the question is still valid, can you use a sources ......

Posted On Thursday, December 4, 2008 6:11 PM | Comments (0)