1 /* |
1 /* |
2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2005-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 "Eclipse Public License v1.0" |
5 * under the terms of "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". |
21 #include <settingsinternalcrkeys.h> |
21 #include <settingsinternalcrkeys.h> |
22 |
22 |
23 #include "vpncleaner.h" |
23 #include "vpncleaner.h" |
24 |
24 |
25 |
25 |
26 LOCAL_C void setKeysL(); |
26 LOCAL_C void setKeysL(); |
|
27 LOCAL_C TBool vpnOnRom(); |
27 |
28 |
28 |
29 |
29 // The starting point |
30 // The starting point |
30 GLDEF_C TInt E32Main() |
31 GLDEF_C TInt E32Main() |
31 { |
32 { |
32 __UHEAP_MARK; |
33 __UHEAP_MARK; |
|
34 |
33 CTrapCleanup* cleanup = CTrapCleanup::New(); |
35 CTrapCleanup* cleanup = CTrapCleanup::New(); |
34 |
36 |
35 TVpnCleaner vpnc; |
37 if( EFalse == vpnOnRom() ) |
36 vpnc.Clean(); |
38 { |
37 |
39 TVpnCleaner vpnc; |
38 TRAP_IGNORE( setKeysL() ); |
40 vpnc.Clean(); |
|
41 |
|
42 TRAP_IGNORE( setKeysL() ); |
|
43 } |
|
44 |
39 delete cleanup; |
45 delete cleanup; |
|
46 |
40 __UHEAP_MARKEND; |
47 __UHEAP_MARKEND; |
41 return KErrNone; |
48 return KErrNone; |
42 } |
49 } |
43 |
50 |
44 |
51 |
45 LOCAL_C void setKeysL() |
52 LOCAL_C void setKeysL() |
46 { |
53 { |
47 // Connecting and initialization: |
54 // Connecting and initialization: |
48 CRepository* repository = CRepository::NewL( |
55 CRepository* repository = CRepository::NewL( |
49 KCRUidCommunicationSettings ); |
56 KCRUidCommunicationSettings ); |
50 |
57 |
|
58 repository->Set( KSettingsVPNSupported, 0 ); |
|
59 repository->Delete( KSettingsVPNImplementation ); |
|
60 |
|
61 delete repository; |
|
62 } |
|
63 |
|
64 |
|
65 LOCAL_C TBool vpnOnRom() |
|
66 { |
|
67 TBool ret = EFalse; |
|
68 |
51 TUint fileAttr; |
69 TUint fileAttr; |
52 RFs fs; |
70 RFs fs; |
53 TInt err = fs.Connect(); |
71 TInt err = fs.Connect(); |
54 |
72 |
55 if ( KErrNone == err ) |
73 if ( KErrNone == err ) |
56 { |
74 { |
57 _LIT( KRomPath, "z:\\sys\\bin\\kmdserver.exe" ); |
75 _LIT( KRomPath, "z:\\sys\\bin\\kmdserver.exe" ); |
58 |
76 |
59 if ( KErrNone != fs.Att( KRomPath, fileAttr ) ) |
77 if ( KErrNone == fs.Att( KRomPath, fileAttr ) ) |
60 { |
78 { |
61 repository->Set( KSettingsVPNSupported, 0 ); |
79 ret = ETrue; |
62 repository->Delete( KSettingsVPNImplementation ); |
|
63 } |
80 } |
64 } |
81 } |
65 |
82 |
66 fs.Close(); |
83 fs.Close(); |
67 |
84 |
68 delete repository; |
85 return ret; |
69 } |
86 } |
70 |
87 |
71 |
88 |
72 // End of File |
89 // End of File |