|
1 /* |
|
2 * Copyright (c) 2004-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: Launches a server |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #include "clistatic.h" |
|
21 |
|
22 |
|
23 TInt Launcher::LaunchServer(const TDesC& aServerName, |
|
24 const TDesC& aServerFileName, |
|
25 const TUid& aServerUid3, |
|
26 const TUint aWinsMinHeapSize, |
|
27 const TUint aWinsMaxHeapSize, |
|
28 const TUint aWinsStackSize) |
|
29 { |
|
30 const TUidType serverUid(KNullUid,KNullUid,aServerUid3); |
|
31 |
|
32 // |
|
33 // EPOC and EKA2 is easy, we just create a new server process. Simultaneous |
|
34 // launching of two such processes should be detected when the second one |
|
35 // attempts to create the server object, failing with KErrAlreadyExists. |
|
36 // |
|
37 RProcess server; |
|
38 TInt r=server.Create(aServerFileName,KNullDesC,serverUid); |
|
39 (void)aServerName; |
|
40 (void)aWinsMinHeapSize; |
|
41 (void)aWinsMaxHeapSize; |
|
42 (void)aWinsStackSize; |
|
43 |
|
44 |
|
45 if (r!=KErrNone) |
|
46 return r; |
|
47 TRequestStatus stat; |
|
48 server.Rendezvous(stat); |
|
49 if (stat!=KRequestPending) |
|
50 server.Kill(0); // abort startup |
|
51 else |
|
52 server.Resume(); // logon OK - start the server |
|
53 User::WaitForRequest(stat); // wait for start or death |
|
54 // we can't use the 'exit reason' if the server panicked as this |
|
55 // is the panic 'reason' and may be '0' which cannot be distinguished |
|
56 // from KErrNone |
|
57 r=(server.ExitType()==EExitPanic) ? KErrGeneral : stat.Int(); |
|
58 server.Close(); |
|
59 return r; |
|
60 } |
|
61 |