symbian v9 capabilties with DLLs | how to build static library

Login to reply to this topic.
Wed, 2007-01-24 09:42
Joined: 2004-11-04
Forum posts: 3
Hello,

1) I set PlatSecEnforcement ON in epoc.ini to see, why my app cannot run in
the phone. Launching my app fails with:
"Menu: unable to execute file for security reasons".

On emulator with security ON, I have (epocwind.out):
622.730 *PlatSec* ERROR - Capability check failed - Can't load MyApp.exe
because it links to thirdPartyDll.dll which has the following capabilities
missing: NetworkServices LocalServices

thirdPartyDll.dll (static interface DLL) has CAPABILITY NONE, since it
doesn't need any caps.

My question: if in thirdPartyDll.dll project to set CAPABILITY ALL, will it
help to make my .exe independent of thirdPartyDll.dll caps?
    thirstPartyDll.mmp: CAPABILITY ALL
    MyExe.mmp: CAPABILITY NetworkServices etc.

I cannot ask 3rd party everytime to re-build a DLL evertytime my .exe needs
new capabilities. What am I missing here?

Another question
2) How do we make static libraries on Symbian v9?
I found a document here:
http://sw.nokia.com/id/79242fb7-ec4c-4fba-99b7-06747ef8b799/Symbian_OS_Platform_Independent_Engine_Development_v1_0_en.pdf

However, setting the target and target type to lib does not help:
TARGET staticlib.lib
TARGETTYPE lib

The build process still produces a DLL (and a .lib (static interface DLL))
and the line
/*
  • */ macro __DLL__ SYMBIAN
    is added to .mmp file

    I'm using Visual studio with carbide

    Thanks

    Regards,
    Jevgenij


  • Wed, 2007-01-24 10:43
    Joined: 2005-06-09
    Forum posts: 174
    Re: symbian v9 capabilties with DLLs | how to build static libra
    Capabilities are interpreted differently for DLL:s and EXE:s.  I recommend that you read up on the available documentation at symbiansigned.com (or the platsec book).


    Wed, 2007-01-24 12:24
    Joined: 2004-11-04
    Forum posts: 3
    Re: symbian v9 capabilties with DLLs | how to build static libra
    Quote from: puterman
    Capabilities are interpreted differently for DLL:s and EXE:s.  I recommend that you read up on the available documentation at symbiansigned.com (or the platsec book).


    Documentation:
    "Capabilities are granted to programs (i.e. processes) only. Where a program (an .EXE file)
    loads a library (a .DLL file), the library is loaded only if it is authorised for all the capabilities
    already possessed by the loading program; if not, the program will fail. Capabilities of both
    programs and libraries are assigned in the source code (the .MMP file)...
    If a process that has been assigned specific capabilities calls code inside a DLL, that DLL must
    have been granted the same (or more) capabilities as those given to the calling program. .... Therefore, the DLL must
    contain sufficient capabilities itself in order to ensure that the requirements of all callers are
    fulfilled.
    For example:
    The program P.EXE is linked to the library L1.DLL.
    The library L1.DLL is linked to the library L0.DLL.
    Case 1:
    P.EXE holds Cap1 & Cap2
    L1.DLL holds Cap1 & Cap3
    L0.DLL holds Cap1 & Cap2.
    The load fails because P.EXE cannot load L1.DLL (no Cap2)."

    My situation is:
    Case my:
    P.EXE holds Cap1 & Cap2
    L1.DLL holds no caps

    The load fails because P.EXE cannot load L1.DLL (no Caps1, no Cap2).

    It's a shared DLL, I'm using. And my program will change with the time and will require more capabilities. As fas as I understand, the DLL will have to be rebuilt (with new caps) each time, I add new caps to my exe.
    That's why I was asking if it was possible to give all caps to DLL in advance, so there is no need to rebuild and grant new caps, so it matches (or more) exe's caps.

    Wed, 2007-01-24 12:58
    Joined: 2004-11-04
    Forum posts: 3
    Re: symbian v9 capabilties with DLLs | how to build static libra
    If anyone is interested, I have just received a reply in symbian newsgroup:

    "Capabilities aren't what an app needs, but what they can be trusted with.
    A general DLL needs all the capabilities of every app, and dll, that (may) 
    use it.
    The result is that general purpose DLLs are usually specified as
    CAPABILITY ALL -TCB
    (or CAPABILITY CAP_GENERAL_DLL)"


    Quote from: ogryzok
    Hello,

    1) I set PlatSecEnforcement ON in epoc.ini to see, why my app cannot run in
    the phone. Launching my app fails with:
    "Menu: unable to execute file for security reasons".

    On emulator with security ON, I have (epocwind.out):
    622.730 *PlatSec* ERROR - Capability check failed - Can't load MyApp.exe
    because it links to thirdPartyDll.dll which has the following capabilities
    missing: NetworkServices LocalServices

    thirdPartyDll.dll (static interface DLL) has CAPABILITY NONE, since it
    doesn't need any caps.

    My question: if in thirdPartyDll.dll project to set CAPABILITY ALL, will it
    help to make my .exe independent of thirdPartyDll.dll caps?
        thirstPartyDll.mmp: CAPABILITY ALL
        MyExe.mmp: CAPABILITY NetworkServices etc.

    I cannot ask 3rd party everytime to re-build a DLL evertytime my .exe needs
    new capabilities. What am I missing here?

    Another question
    2) How do we make static libraries on Symbian v9?
    I found a document here:
    http://sw.nokia.com/id/79242fb7-ec4c-4fba-99b7-06747ef8b799/Symbian_OS_Platform_Independent_Engine_Development_v1_0_en.pdf

    However, setting the target and target type to lib does not help:
    TARGET staticlib.lib
    TARGETTYPE lib

    The build process still produces a DLL (and a .lib (static interface DLL))
    and the line
    /*
  • */ macro __DLL__ SYMBIAN
    is added to .mmp file

    I'm using Visual studio with carbide

    Thanks

    Regards,
    Jevgenij


    • Login to reply to this topic.