Serial Debug Menu

This is a collection of posts about a simple little menu driven application that uses the serial debug port for a user interface.
Windows CE: Using IOCTL_DISK_GET_STORAGEID
A customer approached me recently to ask if I had any code that demonstrated how to use STORAGE_IDENTIFICATION, which is the data structure used to get the Storage ID from a disk. I didn’t have anything, which of course sends me off writing code and blogging about it. Simple enough, right? Go read the documentation for STORAGE_IDENTIFICATION which lead me to IOCTL_DISK_GET_STORAGEID. Except that the documentation for IOCTL_DISK_GET_STORAGEID seems to have a problem. The most obvious problem is that ......

Posted On Sunday, March 21, 2010 10:50 PM | Comments (3)

Platform Builder: Formatting Output with DEBUGMSG and RETAILMSG
For those of you who have done a lot of output using printf the following will be familiar, but I think that there are a lot of programmers who have done most of their user interface code with a GUI. I have been getting questions about the format string in DEBUGMSG and RETAILMSG lately. I will not try to be the full documentation on format strings, but I thought that I would explain a few things about the format string that can be useful. You may have seen some of my examples using %s, %8s and %-*s ......

Posted On Monday, July 14, 2008 10:00 PM | Comments (2)

Windows CE: Loading a Driver with ActivateDeviceEx
In my post about a basic driver shell, I assumed that the driver was built into the system including the registry settings to cause the device manager to load the driver when the system booted. Sometimes there is a reason to load a driver when an application starts. For that there are several functions that can be used including; RegisterDevice, ActivateDevice and ActivateDeviceEx. RegisterDevice is maintained for backward compatibility, but for future compatibility you probably should start using ......

Posted On Monday, July 14, 2008 9:16 PM | Comments (28)

Windows CE: Watching Folders for Changes
It is not uncommon to need to watch a folder for changes to files. It is possible to monitor for changes using FindFirstChangeNotification() and FindNextChangeNotification(). These functions don’t work like FindFirstFile() does, instead FindFirstChangeNotification() returns a HANDLE that can be used in WaitForSingleObject() and WaitForMultipleObjects(). In this post, I will develop a function that will monitor for changes to a list of folders. The function is FolderWatcherThread(). FolderWatcherThread() ......

Posted On Thursday, June 26, 2008 10:38 PM | Comments (3)

Windows CE: Displaying Disk Information
To expand on my Serial Debug Port Menu (Windows CE: Serial Debug Menu Summary), I decided to add a Disk Viewer. The Disk Viewer enumerates the disks and partitions to display information about them. This can be a useful tool if you have a headless system and can’t access the Control Panel. The systems doesn’t really have information about disks, instead it has Stores. To find the stores, use FindFirstStore() and FindNextStore() which function much like the other functions that I have already used, ......

Posted On Wednesday, June 25, 2008 9:55 PM | Comments (4)

Windows CE: Serial Debug Menu Summary
This is a summary of links to my post that describe creating a serial debug port menu for a Windows CE device. Sure, many of you won’t actually use the debug menu, but this includes some sample code that you may be interested in. Windows CE: Using the debug serial port for input is a getting started by reading input from the serial debug port. Windows CE: Displaying a simple menu driven app using serial debug shows how to display a menu based on an array of strings and wait for user input from the ......

Posted On Tuesday, June 10, 2008 1:19 AM | Comments (0)

Windows CE: Listing Running Drivers
I recently posted a sample stream interface driver (Windows CE: A Stream Interface Driver Shell) and claimed that I included enough to cause the driver to be loaded by the device manager. The following code is how I know that it loaded. This code enumerates the running drivers using FindFirstDevice() and FindNextDevice() which are included in the device manager functions. There are several options for enumerating the drivers, this example uses DeviceSearchByLegacyName. I include this function in ......

Posted On Tuesday, June 10, 2008 1:03 AM | Comments (2)

Windows CE: Using ToolHelpAPI to get more information about running processes
In earlier posts, I developed a function that uses ToolHelpAPI to list the currently running processes. That was just the beginning of what can be done with the ToolHelpAPI, so in this post I will extend that to create a Process Viewer. The first thing that I will do is modify my Serial Debug Menu to remove the ShowRunningProcesses() call and replace it with a call to a sub-menu named ProcessViewerMenu(). void MainMenu() { TCHAR *MenuStrings[] = { TEXT( "Get Tick Count"), TEXT( "Process Viewer"), ......

Posted On Monday, May 19, 2008 1:04 PM | Comments (0)

Windows CE: Using ToolHelpAPI to list running processes
In previous post I constructed a menu driven application for use with the serial debug port. In that I called ShowRunningProcess() which I promised to define later. The following defines that and uses the ToolHelpAPI to get the list of running processes. As I review this, it does look like I need to update it for Windows CE 6.0, I will point out where below. ShowRunningProcesses is simple, but that is only because it calls on other functions to do the work of getting the process list. Since it is ......

Posted On Wednesday, May 14, 2008 5:42 PM | Comments (16)

Windows CE: Putting some control behind the serial debug menu
Now we have a way to display a menu on the serial debug port and are getting user input to select from the menu. So it is time to actually do something, like put some control behind the menu. I like to start with a main function, in this case WinMain(). I am going to keep it simple, not parsing command line options and just calling MainMenu() which will handle the menu from here. int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow){ MainMenu();} MainMenu ......

Posted On Monday, May 12, 2008 5:46 PM | Comments (0)

Windows CE: Displaying a simple menu driven app using serial debug
In a previous post, I showed how to read input from the debug serial port on a Windows CE device. As promised then, I will now use that to create a simple menu driven application. When I say simple, I really mean that there are better ways to do it. What I am going to develop here works, but quite frankly it is a little cumbersome to maintain, more on that later. My plan here is to have a generic function that will display the menu and wait for valid user input. It will then return the menu selection ......

Posted On Sunday, May 11, 2008 4:46 PM | Comments (2)

Windows CE: Using the debug serial port for input
I work on a lot of different Windows CE projects. Some of them have a display, while others do not. Sometimes I just have a board laying on my desk with power and a debug serial connection. So I thought it would be handy to have a simple little app that I could use for testing my drivers. Given my constraints, the debug port would be useful for presenting the user interface. Sure I could use a serial driver for this, but would mean using two serial ports, which I don't always have available. Of course ......

Posted On Friday, May 9, 2008 9:39 AM | Comments (5)