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 my Serial Debug Menu, but I will leave it to you to add it to the menu. The function is EnumerateRunningDrivers():
#include <windows.h>
#include "bldver.h"
void EnumerateRunningDrivers( void )
                HANDLE hDriver;
                DeviceSearchType DeviceSearch = DeviceSearchByLegacyName;
                DEVMGR_DEVICE_INFORMATION DeviceInfo;
                DeviceInfo.dwSize = sizeof( DEVMGR_DEVICE_INFORMATION );
                hDriver = FindFirstDevice(DeviceSearch, L"*", &DeviceInfo);
                if( hDriver != INVALID_HANDLE_VALUE )
                                RETAILMSG( 1, (TEXT("Legacy     Key      Name   BUS\n")));
                                                RETAILMSG( 1, (TEXT("%s %s %s %s\n"),
                                                                DeviceInfo.szBusName ));
                                } while( FindNextDevice( hDriver, &DeviceInfo ) );
                                FindClose( hDriver );
                RETAILMSG( 1, (TEXT("Cannot find drivers Windows CE Version doesn't support function\n")));
FindFirstDevice() and FindNextDevice() were not available until Windows CE 5.0, so this includes bldver.h and uses the major version to include the code if the version is greater than 4.
Copyright © 2008 – Bruce Eitman
All Rights Reserved