×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Sep 2008
    Posts
    13

    KErrPermissionDenied when RPositionServer::GetNumModules()

    I am back with more problems...

    My program ends normally but with a -46 error (KErrPermissionDenied, An operation cannot be performed due to a potential security violation.) when I try to get the number of available positioning modules.

    I used Symbian Signed's "Open Signed Online" to sign the SIS file. I checked all possible capabilities (LocalServices, Location, NetworkServices, PowerMgmt, ProtServ, ReadDeviceData, ReadUserData, SurroundingsDD, SwEvent, TrustedUI, UserEnvironment, WriteDeviceData, WriteUserData), although I think I only need "Location".

    Is there something else I'm missing?

    Code:
    #include "Test.h"
    #include <e32base.h>
    #include <e32std.h>
    #include <e32cons.h>			
    #include <lbs.h>
    
    _LIT(KTextConsoleTitle, "Test");
    _LIT(KTextFailed, " failed, leave code = %d");
    _LIT(KTextPressAnyKey, "\n [press any key]\n");
    
    LOCAL_D CConsoleBase* console;
    
    LOCAL_C void MainL()
    	{
    	console->Write(_L("Test\n----\n\n"));
    
    	RPositionServer server;
    	RPositioner positioner;
    	User::LeaveIfError(server.Connect());
    	CleanupClosePushL(server);
    	TUint numModules = 0;
    	User::LeaveIfError(server.GetNumModules(numModules));
    	console->Printf(_L("\nNumber of modules: %d\n"), numModules);
    
    	CleanupStack::PopAndDestroy();
    	}
    
    LOCAL_C void DoStartL()
    	{
    	CActiveScheduler* scheduler = new (ELeave) CActiveScheduler();
    	CleanupStack::PushL(scheduler);
    	CActiveScheduler::Install(scheduler);
    
    	MainL();
    
    	CleanupStack::PopAndDestroy(scheduler);
    	}
    
    GLDEF_C TInt E32Main()
    	{
    	__UHEAP_MARK;
    	CTrapCleanup* cleanup = CTrapCleanup::New();
    
    	// Create output console
    	TRAPD(createError, console = Console::NewL(KTextConsoleTitle, TSize(KConsFullScreen,KConsFullScreen)))
    	;
    
    	if (createError)
    		return createError;
    
    	TRAPD(mainError, DoStartL())
    	;
    
    	if (mainError)
    		console->Printf(KTextFailed, mainError);
    	console->Printf(KTextPressAnyKey);
    	console->Getch();
    
    	delete console;
    	delete cleanup;__UHEAP_MARKEND;
    	return KErrNone;
    	}

  2. #2
    Nokia Developer Moderator
    Join Date
    Sep 2004
    Location
    Tampere, Finland
    Posts
    11,355

    Re: KErrPermissionDenied when RPositionServer::GetNumModules()

    It is one thing to declare a capability on the site, for signing purposes, and another thing altogether to declare it in the MMP file and thus set it as a security attribute in the binary.

    So, does your binary have the Location capability (and others that might be relevant)?

    Use the dedicated tools from Carbide.c++ or directly the logs from %temp%\epocwind.out to analyze your platform security issues.
    -- Lucian

    If you are not yet a DVLUP member it is time to correct that mistake :) Click here to join: http://www.dvlup.com/lucian/Invite

  3. #3
    Registered User
    Join Date
    Sep 2008
    Posts
    13

    Re: KErrPermissionDenied when RPositionServer::GetNumModules()

    I didn't have "CAPABILITY Location" in my MPP. Now that I have it runs fine in the emulator but on the phone I get an "Update error". I'll investigate that some more but at least I'm on the right track.


    Thanks for the swift response.

Similar Threads

  1. KErrPermissionDenied with getCallInfo
    By adinkesp in forum Symbian
    Replies: 9
    Last Post: 2010-04-14, 03:10
  2. Publish&Subscribe problem: RProperty:Set returns KErrPermissionDenied
    By mrtj in forum Symbian Signed Support, Application Packaging and Distribution and Security
    Replies: 8
    Last Post: 2008-08-05, 00:43
  3. KErrPermissionDenied from KPropertyKeyBluetoothSetDeviceClass
    By andrewbe in forum Symbian Networking & Messaging (Closed)
    Replies: 9
    Last Post: 2008-01-24, 21:10
  4. KErrPermissionDenied from MProEngProfile.CommitChangeL
    By jellinek in forum Symbian Media (Closed)
    Replies: 2
    Last Post: 2008-01-22, 23:44
  5. RComm::Open() returns KErrPermissionDenied
    By themikeman in forum Symbian Signed Support, Application Packaging and Distribution and Security
    Replies: 0
    Last Post: 2006-10-20, 15:39

Posting Permissions

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