Symbian OS
read last symbian news on www.newlc.com read last symbian reviews on www.newlc.com
read last symbian tutorial on www.newlc.com read last symbian download on www.newlc.com
21 Apr 2008 - 06:52
Keywords :

Thanks for srivivek for asking me to post this Tutorial.

UID1-First UID (Type)

UID1-Indicates whether this is an executable file or data file.

UID valueNumeric value (Hex)Meaning
KExecutableImageUid0x1000007AIndicates this an .exe executable file
KDaynamicLibraryUid0x10000079Indicates this a DLL(executable) There are various types, with different extension(.dll, .app, .ldd, .pdd)
KDirectFileStoreLayoutUid0x10000037Indicates this is a direct file store (data, not executable)Bracketed values from header files
KPermanentFileStoreLayoutUid0x10000050Indicates this is a permanent file store(data, not executable)

UID2-Second UID (Subtype)
UID2-The meaning of this Uid depends on the value of UID1.
  • If UID1 was KExecutableImageUid, UID2 isn’t used.
  • If UID1 was KDaynamicLibraryUid, UID2 will be

UID valueNumeric value (Hex)Meaning
KSharedLibraryUid0x1000008DIndicates this is a static interface DLL (.dll)
KUidApp0x100039CEIndicates an application conforming to APPARC(includes all Qikon apps, .app)
KLogicalDeviceDriverUid0x100000AFIndicates his is a logical decive driver (.ldd)
KPhysicalDeviceDriverUid0x100039D0Indicates this is a physical device driver(.pdd)
  • If UID1 was KDirectFileStoreLayoutUid or KPermanentFileStoreLayoutUid, then UID2 can be:
UID valueNumeric value (Hex)Meaning
KUidAppDllDoc0x10003A12Indicates this is a file store created by an .app to store user data (i.e, a document)
KUidAppInfoFile0x10003A38Indicates this is an AIF file (a type of file store)
[/]

Secure ID – UID3-Third UID (sub-subType) (Subtype)
UID3-This UID has a unique value for each individual application program and is also used as the Secure ID. For UIKON applications it is used to associate data files with programs
  • For .dll and .exe’s , it identifies the particular binary.
  • For .apps (UIKON applications) it identifies the particular application program.
  • For file stores that were created by .apps, it identifies the application program associated with this file.
  • For other file stores, It’s not typically used (but you could use it for anything you want).

The SecureID for a binary is not specified explicitly, instead it is taken to be the same as the third UID. If an application has a secureID of zero, this mean ‘undefined’ , and has several consequences, including lack of privacy for data used by application.

Tutorial posted April 21st, 2008 by er.khalid

Submitted by tote on Mon, 2008-04-21 21:23.

Funnily enough, you can statically link to a DLL without any UID specified in its MMP file. Please note that this does not apply to polymorphic DLL and other (e.g. ECOM) plug-ins.


Submitted by alh on Tue, 2008-04-22 08:37.

how do you statically link to a dll?
static libraries of course do not need any uid, since they are no a file of their own on the phone, but part of the executable they are linked to.


Submitted by tote on Tue, 2008-04-22 09:20.

I meant mentioning the corresponding LIB file in the EXE's MMP file. That is static linkage. As opposed to dynamic linking, where you use RLibrary to locate and load (and unload) the DLL at any given time during the life-cycle.


Submitted by alh on Tue, 2008-04-22 09:29.

I think you are confused.

If you build a dll, you specify TARGETTYPE dll and you you get a lib and dll pair.
You have to specify a UID.

You can then either specify the lib in the mmp or your exe, or use RLibrary.

BOTH ways are dynamic linking, in the first case though, it is done automatically for you when executing your exe, but it still is dynamic linking (using a dynamically loadable library).

Then there is also "static linking" but this is quite different, then you specify "TARGETTYPE lib" in your mmp file, and you end up with only a lib file, containing all code. You don't have to specify a UID.

Then you have to specify the lib file in the mmp of your exe, and it will be linked into your exe at compile time.

The main difference isn't that you can load and unload code, that is more into the "plugin" domain, the point is that the code is not statically included in the binary, but can be shared between several executables.


Submitted by tote on Tue, 2008-04-22 10:21.

I think I'm not confused at all, however, admit that might have been not too accurate.

First of all, I confirm that TARGETTYPE LIB does exist and even more it is called static linkage. I was wrong and you were right, alh. Smiling

The other way, called dynamic linking, offers two ways for loading a DLL:

  • Importing a LIB file in your MMP file indicates that the DLL will always be loaded into the context of your executable (OR the executable in which your component is running), during executable start-up. All required information is known build-time that allows 1: the loader to load your DLL, 2: the code to use your DLL. Please note that I did not mention how demand-paging might affect DLL loading on purpose.
  • You don't have to import the LIB file in the MMP file, but you can locate and load it run-time as well (using RLibrary class). In practice, it means that as long as you don't load the DLL in question, it won't be loaded in the process context (unless another component has already loaded it), thus the process will load faster (don't have to load your DLL) and require less memory throughout the whole life-cycle.

Finally, please note that you don't have to specify a UID in your DLL's MMP file if you import its LIB file. We have tried it out and it worked well without any UIDs. I can't locate the section in SDK help, where it was described that UIDs are really necessary for polymorphic DLLs only. At that time (when I read it years ago) ECOM plug-ins did not exist at all, so I now presume that it applies to polymorphic DLLs + ECOM plug-ins.


Submitted by alh on Tue, 2008-04-22 10:56.

Thanks for the clarification, I didn't know it was possible to omit the uid3 when automatically loading your dlls.

So it sounded very confused/confusing when you called the automatic loading for static linking, when static linking is something different entirely and that doesn't need any uid at all. (I assume you still need uid1 and uid2 for your dll:s you autoload)

But I guess it makes sense... Its not strictly needed in this scenario, and doesn't provide any extra identification from the name of the file now when all dll:s have to be in /sys/bin

BTW, a good example of how excessive dll-usage can slow down the start of your application, take a look at the N-Gage first-access pack... it has 165(!) dlls that all are likely loaded on startup.


Submitted by tote on Tue, 2008-04-22 11:02.

Please note that there is no UID statement in the MMP file of my DLL at all. I assume that based on the targettype the system assigns default UIDs (1 and 2) to it automagically, but not a UID3.

And gosh, how slowly N-Gage starts!!! Sad


Submitted by dennis_george on Tue, 2008-04-22 06:15.

SecureID is not always same as UID3. You can explicitly specify SecureID in your mmp file.
And if it is not specified in your mmp then UID3 is taken as the SecureID.

And if both of them are not specified then SecureID will take the value KNullUID.


Submitted by Genesis P on Tue, 2008-04-22 08:07.

I'm not sure I would call this piece of information a "tutorial". It looks more like a short reference material, a short compilation made of reference material. I do not (and, of course, can not) object to this material being published here but then I do not feel like I've been actually 'taught' to do something after reading this. So they have all these varieties of UIDs, big deal. In practice, isn't it the opposite: you've been told to implement such and such exe (dll, device driver or whatever) you have a hell of headache with your implementation but it's difficult to imagine that you've chosen a wrong UID or have a lot of headache with UIDs at all. Teach me something applicable to my job, please. Oh, and actually the only might-be-interesting place - about SecureId - wasn't explained correctly as was noticed before. Oh, and shouldn't there have been very briefly explained UID ranges and very briefly outlined a process of acquiring an UID from Symbian (as opposed to using a development UID).- this is an important thing indeed. And who is srivivek anyway.



copyright 2003-2009 NewLC SARL