How to use unpublicized APIs in Symbian

1. Why are these APIs unpublicized?

You can usually find the unpublicized APIs in four ways:

  1. APIs are written in SDK document, but marked as “Published Partner” or “Internal”.
  2. APIs are declared in header file with corresponding linkable library, but not documented.
  3. APIs are dumped from linkable library, but nowhere declared.
  4. APIs are exported from dynamic libraries without corresponding linkable library.

* “Linkable library” is a stub library which hold the information required for the linker to link client programs to the correct ordinals to the real dll. In emulator build or Symbian pre-9 toolchain, the linkable library is appeared as .lib file, but in target build of Symbian 9 onwards, it is actually a dummy dynamic library of ELF format with extension .dso.

继续阅读How to use unpublicized APIs in Symbian

Find the UIDs and Capabilities of Symbian EXE/DLL

(1) Emulator Build (Win32 PE)

First, find the start address of section “.SYMBIAN” by typically using “dumpbin /section:.SYMBIAN <Excutable File>”.

The output looks like:

SECTION HEADER #6
.SYMBIAN name
30 virtual size
17000 virtual address (00417000 to 0041702F)
1000 size of raw data
17000 file pointer to raw data (00017000 to 00017FFF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
C0000040 flags
Initialized Data
Read Write

According to the line containing “virtual address”, section “.SYMBIAN” starts at address 0x00017000.

Now, use any hex-editor to view the content at this address:

00017000h: 7A 00 00 10 00 00 00 00 B2 97 1F 10 5E 01 00 00
00017010h: B2 97 1F 10 57 B6 1F 10 B6 E1 0F 00 00 00 00 00

The first 3 dwords are UIDs: 0x1000007A stands for “Symbian EXE”, 0x101F97B2 is the unique UID of this file. (no UID2 for Symbian EXE, but this field is essential for DLL to indicate the framework, eg. 0x10009D8D for ECOM)

The capabilities field at offset 0x18h holds all the capabilities for this executive in the form of bitmask. Thus, 0x000FE1B6 is translated to the following capabilities: (see enumerator TCapability in Symbian SDK)

CommDD PowerMgmt ReadDeviceData WriteDeviceData TrustedUI ProtServ NetworkServices LocalServices ReadUserData WriteUserData Location SurroundingsDD UserEnvironment

(2) Target Build (Symbian PE)

3 UIDs located at the very beginning of the executive file, and the capabilities field is at fixed offset 0x88h. (same meaning as described for emulator build)

Open Font Rasterizer in Symbian 9

In the great changes of Symbian 9, most plug-in interfaces have been migrated to ECOM framework, Open Font Rasterizer (OFS for short) interface is just one of them.

Even from the newest SDK document of Symbian 9.2, the OFS related contents are still only for implementation before version 9. The following changes must be considered if you are writing OFS plug-in or porting it to Symbian 9.
继续阅读Open Font Rasterizer in Symbian 9

How to use font in Symbian

1. Forget about the stupid “Swiss”.

As you may have already read the section “How to select a font” in Symbian SDK documents, the follow example code snippet show us the way of selecting a font.

// Get an alternative font
_LIT(KMyFontName,"Swiss");
CFont* myFont;
TFontSpec myFontSpec(KMyFontName,1); // to get smallest Swiss font
CGraphicsDevice* screenDevice=iCoeEnv->ScreenDevice();
screenDevice->GetNearestFontInTwips(myFont,myFontSpec);
...

Before getting closer to the font mechanism and typeface design of Symbian, some guys have tried the code in their application and things work well. That’s why I saw this typeface name “Swiss” appear even in many commercial applications. In fact, there is no typeface named “Swiss” built-in with S60 phones, so what you get from the code above is the most closely approximate font, but may not the font really suitable. For instance, “Swiss” will make your application not compatible with East-Asian phones. To grab a better view of “How to select a font”, just read on.
继续阅读How to use font in Symbian

Explore and Hack the Server Heap in Symbian

One of the most important design in Symbian is the well-known server/client framework. As the server and client are in different process spaces, hacking the server is generally difficult to achieve by means of normal application. But another important framework provided by Symbian give us a chance, the Plug-in framework, which is also merged into the ECOM framework in newer Symbian OS.

继续阅读Explore and Hack the Server Heap in Symbian