|
1 // Copyright (c) 2007-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 // For the Winscw Emulator only, selects between NGA and Non-NGA version of wsgraphicdrawer. |
|
15 // The default is the non-GCE based version. |
|
16 // To select the NGA version do one of: |
|
17 // 1. Add a line to the epoc.ini file in \epoc32\data like this: |
|
18 // symbian_graphics_use_gce ON |
|
19 // or |
|
20 // 2. Start epoc.exe with these parameters, (the "--" IS necessary): |
|
21 // -Dsymbian_graphics_use_gce=ON -- |
|
22 // or |
|
23 // 3. epoc.exe can be told to switch to a different initialisation file than epoc.ini, with the -M parameter. |
|
24 // Progress chaining to the real Wserv is logged in epocwind.out. |
|
25 // |
|
26 // |
|
27 |
|
28 #include <e32svr.h> |
|
29 #include <u32hal.h> |
|
30 |
|
31 |
|
32 _LIT(KProcessName, "WservSwitch"); |
|
33 |
|
34 |
|
35 TInt ChainWservSwitch() |
|
36 { |
|
37 _LIT(KWservSwitchNga,"z:\\sys\\bin\\wserv_nga.exe"); |
|
38 _LIT(KWservSwitchNonNga,"z:\\sys\\bin\\wserv_nonnga.exe"); |
|
39 // need to forward the command parameters to the chained version of Wserv |
|
40 TInt argLen = User::CommandLineLength(); |
|
41 HBufC* arg = HBufC::New(argLen); |
|
42 if (arg == NULL) |
|
43 { |
|
44 return KErrNoMemory; |
|
45 } |
|
46 TPtr argPtr = arg->Des(); |
|
47 User::CommandLine(argPtr); |
|
48 |
|
49 // NGA or Non-NGA WServ version? |
|
50 TBool nga = EFalse; |
|
51 UserSvr::HalFunction(EHalGroupEmulator, EEmulatorHalBoolProperty, (TAny*)"symbian_graphics_use_gce", &nga); |
|
52 |
|
53 // try to launch it |
|
54 const TPtrC exeName = nga ? KWservSwitchNga() : KWservSwitchNonNga(); |
|
55 RDebug::Print(_L("%S: Starting \"%S\" \"%S\""), &KProcessName, &exeName, &argPtr); |
|
56 RProcess server; |
|
57 TInt err = server.Create(exeName, argPtr, EOwnerThread); |
|
58 delete arg; |
|
59 arg = NULL; |
|
60 if (err) |
|
61 { |
|
62 return err; |
|
63 } |
|
64 |
|
65 // wait for server to start |
|
66 RDebug::Print(_L("%S: waiting on process ..."), &KProcessName); |
|
67 TRequestStatus stat; |
|
68 server.Rendezvous(stat); |
|
69 |
|
70 if (stat!=KRequestPending) |
|
71 { // abort startup |
|
72 server.Kill(0); |
|
73 } |
|
74 else |
|
75 { // logon OK - start the server |
|
76 server.Resume(); |
|
77 } |
|
78 |
|
79 User::WaitForRequest(stat); |
|
80 return (server.ExitType() == EExitPanic) ? KErrGeneral : stat.Int(); |
|
81 } |
|
82 |
|
83 |
|
84 TInt E32Main() |
|
85 { |
|
86 TInt error = ChainWservSwitch(); |
|
87 // propagate error to SysStart |
|
88 if (error) |
|
89 { |
|
90 RDebug::Print(_L("%S: Failed with error %i"), &KProcessName, error); |
|
91 } |
|
92 RProcess::Rendezvous(error); |
|
93 return error; |
|
94 } |
|
95 |