contextframework/cfw/src/cfserver/CFUtils.cpp
changeset 0 2e3d3ce01487
equal deleted inserted replaced
-1:000000000000 0:2e3d3ce01487
       
     1 /*
       
     2 * Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  CFUtils methods.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "cfutils.h"
       
    20 #include "cftrace.h"
       
    21 
       
    22 //-----------------------------------------------------------------------------
       
    23 // CFUtils::RequestFromSameProcess
       
    24 //-----------------------------------------------------------------------------
       
    25 //
       
    26 TBool CFUtils::RequestFromSameProcess( const RThread& aClientThread )
       
    27     {
       
    28     FUNC_LOG;
       
    29     
       
    30     TBool sameProcess = EFalse;
       
    31     RThread cfMainThread;
       
    32     RProcess cfProcess;
       
    33     TInt err = cfMainThread.Process( cfProcess );
       
    34     if( err == KErrNone )
       
    35         {
       
    36         RProcess clientProcess;
       
    37         err = aClientThread.Process( clientProcess );
       
    38         if( err == KErrNone )
       
    39             {
       
    40             // Client runs in cf process -> secure
       
    41             if( cfProcess.Id() == clientProcess.Id() )
       
    42                 {
       
    43                 sameProcess = ETrue;
       
    44                 }
       
    45             }
       
    46         clientProcess.Close();
       
    47         }
       
    48     cfMainThread.Close();
       
    49     cfProcess.Close();
       
    50     return sameProcess;
       
    51     }