Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    Regular Contributor
    Join Date
    Apr 2007
    Posts
    233

    failed to load library

    Hi all,

    I have created a plugin which loads a library using RLibrary::Load function. It is working correctly in emulator (Symbian 9.2 Series 60 FP1), but doesn't in device. I have logged the error being that a -46 (KErrPermissionDenied). The capabilities are correct, so I don't know what could be the problem...

  2. #2
    Super Contributor
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    9,968

    Re: failed to load library

    Quote Originally Posted by felixksp
    Hi all,

    I have created a plugin which loads a library using RLibrary::Load function. It is working correctly in emulator (Symbian 9.2 Series 60 FP1), but doesn't in device. I have logged the error being that a -46 (KErrPermissionDenied). The capabilities are correct, so I don't know what could be the problem...
    for using RLibrary::Load() you req. ALLFILES capability.
    Try using ECOM

  3. #3
    Regular Contributor
    Join Date
    Apr 2007
    Posts
    233

    Re: failed to load library

    My plugin has the following capabilities:

    CAPABILITY ReadDeviceData WriteDeviceData ProtServ NetworkControl NetworkServices SwEvent LocalServices ReadUserData WriteUserData UserEnvironment

    and the dll:

    capability NetworkServices ReadUserData


    Why do I need ALLFILES? I have used some times RLibrary::Load in my applications, and I have never needed this capability.

  4. #4
    Super Contributor
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    9,968

    Re: failed to load library

    With those capabilities can you access \sys\bin\

  5. #5
    Super Contributor
    Join Date
    Nov 2004
    Location
    Wiltshire, UK
    Posts
    3,644

    Re: failed to load library

    You don't need "all files" to load the library. You cannot however get a list of dll's which is a different problem.

    Your dll must have at least or more capabilties than your process which is where you have gone wrong.

    What do you mean by plugin? Capabiltiies are enforced by exe, not the dll

  6. #6
    Regular Contributor
    Join Date
    Apr 2007
    Posts
    233

    Re: failed to load library

    A plugin is a plugin.... (TARGETTYPE plugin) . It is a dll loaded by browser in some cases. So imagine that I have two dlls, A and B.

    If A loads B using RLibrary, does B need to have at least the same capabilities than A? Or is A which needs to have at least the same capabilities than B?

  7. #7
    Regular Contributor
    Join Date
    May 2007
    Posts
    463

    Re: failed to load library

    Well, that's a wrinkle you didn't mention in your original post, you're loading this DLL from a plugin?

    My guess is that the DLL doesn't have the requisite capabilities to be loaded in to the executable you're loading it in to.

    Remember, DLL capabilities basically mean "This is a list of capabilities I can be trusted not to leak", if an executable has a capability, any DLL it tries to load must have it too.

    Nokia have been idiots, in that they've turned off platsec enforcement on the emulator. This confuses an awful lot of people. It's best to either turn platsec enforcement back on, or at least get in to the habit of checking epocwind.out for platsec errors.

    BTW, you don't need ALLFILES to use RLibrary::Load, but Mr. Rao is right about one thing, use ECOM. That's what it's for.
    Get Resolvr - The Zeroconf framework for Symbian OS free today. Make your IP networking applications fun and easy to use. http://www.novelinteractions.com/resolvr/
    Proud to be the only autorickshaw owner in Cambridge - http://blog.novelinteractions.com/images/tuktuk.jpg

  8. #8
    Super Contributor
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    9,968

    Re: failed to load library

    Quote Originally Posted by felixksp
    A plugin is a plugin.... (TARGETTYPE plugin) . It is a dll loaded by browser in some cases. So imagine that I have two dlls, A and B.

    If A loads B using RLibrary, does B need to have at least the same capabilities than A? Or is A which needs to have at least the same capabilities than B?
    Sorry my mistake you donot req. ALLFiles for RLibray::Load
    From Docs
    http://forum.nokia.com/document/Foru...m_security.htm
    P.EXE holds Cap1 & Cap2

    L1.DLL holds Cap1 & Cap2 & Cap3

    L0.DLL holds Cap1 & Cap2

    The load succeeds because P.EXE can load L1.DLL and L0.DLL. Rule 1 does apply, but here the loading executable is the process P.EXE, not the library L1.DLL: the Rlibrary::Load request that the loader processes is sent by the process P.EXE. Here, the fact that the call is within L1.DLL is irrelevant. Rule 2 applies as before and P.EXE does not acquire Cap3 by loading L1.DLL.

  9. #9
    Regular Contributor
    Join Date
    Apr 2007
    Posts
    233

    Re: failed to load library

    I have achieved it! I have granted the same capabilities in the dll than in the plugin and it works. My doubt now is that I have an application that uses the same dll, but this has less capabilities than the plugin.... Will be able to load now the dll my application?

  10. #10
    Regular Contributor
    Join Date
    May 2007
    Posts
    463

    Re: failed to load library

    Yes, executables that load DLLs HAVE to have capabilities sets less than or equal to the DLLs they load.

    Like I said, think of DLL capabilities as a set of capabilities the DLL is trusted not to leak.
    Get Resolvr - The Zeroconf framework for Symbian OS free today. Make your IP networking applications fun and easy to use. http://www.novelinteractions.com/resolvr/
    Proud to be the only autorickshaw owner in Cambridge - http://blog.novelinteractions.com/images/tuktuk.jpg

  11. #11
    Regular Contributor
    Join Date
    Apr 2007
    Posts
    233

    Re: failed to load library

    P.EXE holds Cap1 & Cap2

    L1.DLL holds Cap1 & Cap2 & Cap3

    L0.DLL holds Cap1 & Cap2


    Could load in this case L1 to L0?

  12. #12
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,808

    Re: failed to load library

    Yes. And all three objects are going to execute with capabilities of the .exe file (cap1 & cap2).

  13. #13
    Regular Contributor
    Join Date
    Apr 2007
    Posts
    233

    Re: failed to load library

    And other question, if the libraries were statically linked dlls (lib + dll), it doesn't load, no? Then, how do people develop statically linked dlls to be able to be loaded by any exe? Do the set all capabilities?

  14. #14
    Registered User
    Join Date
    Jun 2005
    Posts
    42

    Re: failed to load library

    Here, a question comes up to my mind. Let's think on this scenario:

    Company A develops an API (DLL + LIB) that holds capability 1
    Company B develops an API (DLL + LIB) that holds capability 2

    I want to use both API's from my EXE, so:

    P1.EXE needs to hold Capability 1 to load Company A API, but then i will not be able to use Company B API as P1.EXE will hold Cap 1 and Cap 2.

    Is this true?

    Ger

  15. #15
    Regular Contributor
    Join Date
    May 2007
    Posts
    463

    Re: failed to load library

    static libraries don't have capabilities, they just inherit whatever they're link in to.

    And yes, ggomeze, in your simplified scenario what you say is true. People who distribute DLLs should give them all the capabilities they can be trusted with.
    Get Resolvr - The Zeroconf framework for Symbian OS free today. Make your IP networking applications fun and easy to use. http://www.novelinteractions.com/resolvr/
    Proud to be the only autorickshaw owner in Cambridge - http://blog.novelinteractions.com/images/tuktuk.jpg

Similar Threads

  1. GoogleIt
    By deepika.mangla in forum Symbian
    Replies: 5
    Last Post: 2011-05-28, 11:04
  2. S60 2nd to 3rd/ PlatformSecurity / Capabilities
    By jarkoos in forum Symbian Signed Support, Application Packaging and Distribution and Security
    Replies: 4
    Last Post: 2007-04-14, 14:08
  3. SyExpat + problem + memmove + Carbide Express
    By pearman in forum Symbian
    Replies: 2
    Last Post: 2006-10-14, 22:21
  4. Compilation series 60 3rd edition
    By asmobease in forum Symbian Tools & SDKs
    Replies: 32
    Last Post: 2006-09-13, 09:46
  5. Can’t launch application on 6630
    By kaffemannen in forum Symbian
    Replies: 8
    Last Post: 2005-06-29, 10:49

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×