How many APIs are exposed on CE 6.0 ? (and how do you find out?)

CE 6.0 is a componentized operating system, made up of roughly 700 components, which is fine, but which APIs are exposed on the operating system, and how do you find out what those APIs are ? (and why is this useful?).

I guess the first question to ask is why you would want to know how many APIs are exposed on CE 6.0, surely all of the API documentation is available on MSDN, right? - sure, you can lookup any of the APIs on MSDN, look at the parameters and return types - what becomes interesting is using the method I will explain shortly gives you the ability to look at CE 6.0, CE 5.0, Windows Mobile (if you are a Windows Mobile licensee), pull the list of exposed APIs and then do a delta across versions! (yeah, now that becomes interesting...) - so you could determine what the new APIs are that shipped in CE 6.0 compared with CE 5.0, and also potentially look for APIs that have been deprecated in the CE 6.0 release (such as SetKMode, and SetProcPermissions).

The operating system is made up of a series of components, components are DLLs, and DLLs expose their functions through a .DEF file - so all we need to do is walk the \WINCE600\PUBLIC\ folders, look for .DEF files, and walk the list of exposed functions - simple!

Let's examine one of the components that ships with CE 6.0, CELLCORE - I have two builds on my laptop, one for ARMV4I, and one for x86 - looking in the ARMV4I Debug folder C:\WINCE600\PUBLIC\CELLCORE\OAK\LIB\ARMV4I\DEBUG shows a number of .DEF files.

ccoreutl.def
cellcore.def
cellcoreeventlogmsgs.def
celltsp.def
mux07_10.def
ril.def
rillog.def
sim.def
simdrv.def
simtkituice.def
simtkit_smartfon.def
simtkit_wpc.def
sms.def
smsdrv.def
sms_providers.def
wap.def
wapdrv.def
wwan.def

Here's some of the content of RIL.DEF - You can see that exposed APIs are listed after the EXPORTS keyword, ignore everything before EXPORTS.

LIBRARY ril

EXPORTS
RIL_Initialize @1
RIL_InitializeEmergency @2
RIL_Deinitialize @3
RIL_EnableNotifications @4
RIL_DisableNotifications @5
RIL_GetSerialPortHandle @6
RIL_GetSerialPortStatistics @7
RIL_GetSubscriberNumbers @8
RIL_GetOperatorList @9

Some of the .DEF files contain comments, which start with a semi-colon (see below), these should also be ignored.

    IDE_Close
IDE_IOControl
; @CESYSGEN IF ATAPI_ATAPI_PCIO
GenericConfig
CreatePCIHD

There are also a number of function names that are marked as PRIVATE (see below for an example) - the (optional) PRIVATE keyword prevents the function name being added to the .LIB file for the DLL, this in effect makes the API hidden from application developers - I also skip PRIVATE functions.

; @CESYSGEN IF BTD_AVCTP
AVCT_EstablishDeviceContext
AVCT_CloseDeviceContext
; @CESYSGEN ENDIF

    DebugOut PRIVATE
DumpBuff PRIVATE

There are some APIs you will probably want to skip when walking the list, these include some of the standard COM and DLL exports (DllRegisterServer, DllUnRegisterServer, DllMain), I also skipped decorated APIs.

Walking the CE 6.0 Public tree, de-duplicating API names, ignoring standard COM and DLL entry points, and decorated names gives me the full list of public exposed CE 6.0 APIs.

Anyone want to take a guess at the number of exposed APIs on CE 6.0?

- Mike