|
1 // Copyright (c) 2002-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 // Server entry points |
|
15 // EKA1 & EKA2 |
|
16 // EKA1 & WINS is a DLL. All others are exe's |
|
17 // |
|
18 // |
|
19 |
|
20 /** |
|
21 @file Main.cpp |
|
22 */ |
|
23 #include <test/rfilelogger.h> |
|
24 #include "server.h" |
|
25 |
|
26 // Emulator EKA1 is the only DLL case |
|
27 |
|
28 // EKA2 all variats & EKA1 target only |
|
29 // E32Main calls MainL() |
|
30 LOCAL_C void MainL() |
|
31 /** |
|
32 * Secure variant |
|
33 * Much simpler, uses the new Rendezvous() call to sync with the client |
|
34 */ |
|
35 { |
|
36 // Leave Platform security hooks in place |
|
37 #if (defined __DATA_CAGING__) |
|
38 RProcess().DataCaging(RProcess::EDataCagingOn); |
|
39 RProcess().SecureApi(RProcess::ESecureApiOn); |
|
40 #endif |
|
41 CActiveScheduler* sched=NULL; |
|
42 sched=new(ELeave) CActiveScheduler; |
|
43 CActiveScheduler::Install(sched); |
|
44 CLogServer* server = NULL; |
|
45 // Create the sever |
|
46 TRAPD(err,server = CLogServer::NewL()); |
|
47 if(!err) |
|
48 { |
|
49 // Client Synchronisation different for EKA1 and EKA2 |
|
50 // EKA2 really simple. Client blocks on reciprocal Rendezvous call |
|
51 RProcess::Rendezvous(KErrNone); |
|
52 // Go into the Active scheduler |
|
53 sched->Start(); |
|
54 } |
|
55 // Free the server class |
|
56 delete server; |
|
57 delete sched; |
|
58 } |
|
59 |
|
60 GLDEF_C TInt E32Main() |
|
61 /** |
|
62 * @return - Standard Epoc error code on process exit |
|
63 * Process entry point. Called by client using RProcess API |
|
64 */ |
|
65 { |
|
66 __UHEAP_MARK; |
|
67 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
68 if(cleanup == NULL) |
|
69 { |
|
70 return KErrNoMemory; |
|
71 } |
|
72 TRAPD(err,MainL()); |
|
73 delete cleanup; |
|
74 __UHEAP_MARKEND; |
|
75 return KErrNone; |
|
76 } |