vpnengine/vpncleaner/src/vpncleanerexe.cpp
changeset 0 33413c0669b9
child 3 2df28d7a2299
equal deleted inserted replaced
-1:000000000000 0:33413c0669b9
       
     1 /*
       
     2 * Copyright (c) 2005-2009 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:   Cleans VPN data from device
       
    15 *
       
    16 */
       
    17 
       
    18 #include <e32base.h>
       
    19 #include <f32file.h>
       
    20 #include <centralrepository.h> // link against centralrepository.lib
       
    21 #include <settingsinternalcrkeys.h>
       
    22 
       
    23 #include "vpncleaner.h"
       
    24 
       
    25 
       
    26 LOCAL_C void setKeysL();
       
    27 
       
    28 
       
    29 // The starting point
       
    30 GLDEF_C TInt E32Main()
       
    31     {
       
    32     __UHEAP_MARK;
       
    33     CTrapCleanup* cleanup = CTrapCleanup::New();
       
    34     
       
    35     TVpnCleaner vpnc;
       
    36     vpnc.Clean();
       
    37     
       
    38     TRAP_IGNORE( setKeysL() );
       
    39     delete cleanup;
       
    40     __UHEAP_MARKEND;
       
    41     return KErrNone;
       
    42     }
       
    43 
       
    44 
       
    45 LOCAL_C void setKeysL()
       
    46     {
       
    47     // Connecting and initialization:
       
    48     CRepository* repository = CRepository::NewL( 
       
    49         KCRUidCommunicationSettings );
       
    50     
       
    51     TUint fileAttr;
       
    52     RFs fs;
       
    53     TInt err = fs.Connect();
       
    54     
       
    55     if ( KErrNone == err )
       
    56         {
       
    57         _LIT( KRomPath, "z:\\sys\\bin\\kmdserver.exe" ); 
       
    58         
       
    59         if ( KErrNone != fs.Att( KRomPath, fileAttr ) )
       
    60             {
       
    61             repository->Set( KSettingsVPNSupported, 0 );
       
    62             repository->Delete( KSettingsVPNImplementation );
       
    63             }
       
    64         }
       
    65 
       
    66     fs.Close();
       
    67 
       
    68     delete repository;
       
    69     }
       
    70 
       
    71 
       
    72 // End of File