os/mm/mmlibs/mmfw/SecureDRM/src/Server/MmfDrmPluginServerStart.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 #include <e32std.h>
    17 #include <ecom/ecom.h>
    18 #include "MmfDrmPluginServerStart.h"
    19 #include "MmfDrmPluginServer.h"
    20 
    21 
    22 // E32Main and a MainL()
    23 LOCAL_C void MainL()
    24 /**
    25  * Much simpler, uses the new Rendezvous() call to sync with the client
    26  */
    27 	{
    28 	// Leave the hooks in for platform security
    29 	RProcess().DataCaging(RProcess::EDataCagingOn);
    30 	RProcess().SecureApi(RProcess::ESecureApiOn);
    31 
    32 	CActiveScheduler* sched=NULL;
    33 	sched=new(ELeave) CActiveScheduler;
    34 	CActiveScheduler::Install(sched);
    35 	CMMFDRMPluginServer* server = NULL;
    36 	TRAPD(err,server = CMMFDRMPluginServer::NewL());
    37 	if(!err)
    38 		{
    39 		// Sync with the client and enter the active scheduler
    40 		RProcess::Rendezvous(KErrNone);
    41 		sched->Start();
    42 		}
    43 	delete server;
    44 	delete sched;		
    45 	}
    46 
    47 
    48 GLDEF_C TInt E32Main()
    49 /**
    50  * @return - Standard Epoc error code on exit
    51  */
    52 	{
    53 	__UHEAP_MARK;
    54 	CTrapCleanup* cleanup = CTrapCleanup::New();
    55 	if(cleanup == NULL)
    56 		{
    57 		return KErrNoMemory;
    58 		}
    59 	TRAPD(err, MainL());
    60 	delete cleanup;
    61 	REComSession::FinalClose();
    62 	__UHEAP_MARKEND;
    63 	return err;
    64     }