|
1 /* |
|
2 * Copyright (c) 2004-2005 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: MPM Client DLL Entry Point |
|
15 * |
|
16 */ |
|
17 |
|
18 /** |
|
19 @file mpmlauncher.cpp |
|
20 Mobility Policy Manager client DLL entry point. |
|
21 */ |
|
22 |
|
23 // INCLUDE FILES |
|
24 #include <e32std.h> |
|
25 #include "mpmlauncher.h" |
|
26 #include "mpmlogger.h" |
|
27 |
|
28 // ============================= LOCAL FUNCTIONS =============================== |
|
29 |
|
30 // ============================ MEMBER FUNCTIONS =============================== |
|
31 |
|
32 // ----------------------------------------------------------------------------- |
|
33 // MPMLauncher::LaunchServer |
|
34 // ----------------------------------------------------------------------------- |
|
35 // |
|
36 TInt MPMLauncher::LaunchServer( |
|
37 const TDesC& aServerFileName, |
|
38 const TUid& aServerUid2, |
|
39 const TUid& aServerUid3) |
|
40 { |
|
41 MPMLOGSTRING("MPMLauncher::LaunchServer") |
|
42 const TUidType serverUid(KNullUid,aServerUid2,aServerUid3); |
|
43 |
|
44 // We just create a new server process. Simultaneous |
|
45 // launching of two such processes should be detected when the second one |
|
46 // attempts to create the server object, failing with KErrAlreadyExists. |
|
47 // |
|
48 MPMLOGSTRING("Create a new server process") |
|
49 RProcess server; |
|
50 TInt r=server.Create(aServerFileName,KNullDesC,serverUid); |
|
51 |
|
52 if ( r != KErrNone ) |
|
53 { |
|
54 MPMLOGSTRING2("Server process creation returned error: %d", r) |
|
55 return r; |
|
56 } |
|
57 TRequestStatus stat; |
|
58 server.Rendezvous(stat); |
|
59 if ( stat != KRequestPending ) |
|
60 { |
|
61 server.Kill(0); // abort startup |
|
62 } |
|
63 else |
|
64 { |
|
65 server.Resume(); // logon OK - start the server |
|
66 } |
|
67 User::WaitForRequest(stat); // wait for start or death |
|
68 // we can't use the 'exit reason' if the server panicked as this |
|
69 // is the panic 'reason' and may be '0' which cannot be distinguished |
|
70 // from KErrNone |
|
71 r = ( server.ExitType() == EExitPanic ) ? KErrGeneral : stat.Int(); |
|
72 server.Close(); |
|
73 return r; |
|
74 } |
|
75 |
|
76 |
|
77 // ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
78 |
|
79 |
|
80 // End of File |
|
81 |