installationservices/swi/source/securitymanager/secutils.cpp
branchRCL_3
changeset 19 7ca52d38f8c3
parent 0 ba25891c3a9e
equal deleted inserted replaced
18:3ba40be8e484 19:7ca52d38f8c3
     1 /*
     1 /*
     2 * Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of the License "Eclipse Public License v1.0"
     5 * under the terms of the License "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 #include "secutils.h"
    19 #include "secutils.h"
    20 #include <hash.h> 
    20 #include <hash.h> 
       
    21 #include <e32property.h>
       
    22 #include <sacls.h>
       
    23 #include "log.h"
    21 
    24 
    22 namespace Swi
    25 namespace Swi
    23 {
    26 {
    24 
    27 
    25 EXPORT_C TBool SecUtils::IsExeL(const TDesC& aFileName)
    28 EXPORT_C TBool SecUtils::IsExeL(const TDesC& aFileName)
    63 		}
    66 		}
    64 
    67 
    65 	CleanupStack::PopAndDestroy(digester);
    68 	CleanupStack::PopAndDestroy(digester);
    66 	return hashBuf;
    69 	return hashBuf;
    67 	}
    70 	}
    68 	
    71 
       
    72 EXPORT_C TInt SecUtils::PublishPackageUid(TUid aUid, TUid (&aUidList)[KMaxUidCount])
       
    73     {
       
    74     TInt i=0;
       
    75     TInt count = aUidList[0].iUid;
       
    76     
       
    77     if (count>=KMaxUidCount-1)
       
    78         return KErrOverflow;
       
    79     
       
    80     aUidList[++count] = aUid;    
       
    81     aUidList[0].iUid++;
       
    82     
       
    83     TInt *tempUidList = (TInt*)aUidList;
       
    84     TBuf<KMaxUidCount*sizeof(TUid)+1> buffer;
       
    85     TInt *bufPtr = (TInt*)buffer.Ptr();
       
    86     buffer.SetLength((count+1)*sizeof(TUid));
       
    87     do        
       
    88         {
       
    89         *bufPtr = *tempUidList;
       
    90         }while(++i<=count && bufPtr++ && tempUidList++);
       
    91 
       
    92     return(RProperty::Set(KUidSystemCategory, KSWIUidsCurrentlyBeingProcessed, buffer));
       
    93     }
       
    94 
       
    95 EXPORT_C TBool SecUtils::IsPackageUidPresent(TUid aUid, const TUid (&aUidList)[KMaxUidCount])
       
    96     {
       
    97     TInt count = aUidList[0].iUid;
       
    98     for(TInt i=1;i<=count;i++)
       
    99         {
       
   100         if(aUidList[i]==aUid)
       
   101             return ETrue;
       
   102         }
       
   103     return EFalse;
       
   104     }
       
   105 
    69 } // namespace Swi
   106 } // namespace Swi