|
1 /* |
|
2 * Copyright (c) 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: XIMP Framework Test Code prfwtestprocessmaster.cpp |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <E32Base.h> |
|
19 #include "prfwtestprocessmaster.h" |
|
20 |
|
21 |
|
22 // ============================================================== |
|
23 // ============ DoKillProcessL() ============= |
|
24 // ============================================================== |
|
25 void DoKillProcessL( const TDesC& aProcessName ) |
|
26 { |
|
27 TFullName psName; |
|
28 psName.Append( _L("*") ); |
|
29 psName.Append( aProcessName ); |
|
30 psName.Append( _L("*") ); |
|
31 |
|
32 TFindProcess psFinder; |
|
33 psFinder.Find( psName ); |
|
34 |
|
35 TInt killCount( 0 ); |
|
36 while( psFinder.Next( psName ) != KErrNotFound ) |
|
37 { |
|
38 RProcess ps; |
|
39 User::LeaveIfError( ps.Open( psFinder ) ); |
|
40 ps.Kill( -666 ); |
|
41 ps.Close(); |
|
42 killCount++; |
|
43 } |
|
44 |
|
45 User::Leave( killCount ); |
|
46 } |
|
47 |
|
48 |
|
49 // ============================================================== |
|
50 // ============ E32MainL() ============= |
|
51 // ============================================================== |
|
52 void E32MainL() |
|
53 { |
|
54 TInt theCommand; |
|
55 User::LeaveIfError( User::GetTIntParameter( PrfwTestProcessMaster::EMsgSlot_Command, theCommand ) ); |
|
56 |
|
57 TBuf< PrfwTestProcessMaster::EMaxMsgDataLength > theDesC16; |
|
58 User::LeaveIfError( User::GetDesParameter( PrfwTestProcessMaster::EMsgSlot_Desc16Data, theDesC16 ) ); |
|
59 |
|
60 switch( theCommand ) |
|
61 { |
|
62 case PrfwTestProcessMaster::EKillProcess: |
|
63 { |
|
64 DoKillProcessL( theDesC16 ); |
|
65 break; |
|
66 } |
|
67 |
|
68 default: |
|
69 { |
|
70 User::Leave( KErrNotSupported ); |
|
71 break; |
|
72 } |
|
73 } |
|
74 } |
|
75 |
|
76 |
|
77 // ============================================================== |
|
78 // ============ E32Main() ============= |
|
79 // ============================================================== |
|
80 GLDEF_C TInt E32Main() |
|
81 { |
|
82 CTrapCleanup* tc = CTrapCleanup::New(); |
|
83 if( !tc ) |
|
84 { |
|
85 return KErrNoMemory; |
|
86 } |
|
87 |
|
88 __UHEAP_MARK; |
|
89 TRAPD( err, E32MainL() ); |
|
90 __UHEAP_MARKEND; |
|
91 |
|
92 delete tc; |
|
93 |
|
94 RProcess::Rendezvous( err ); |
|
95 return err; |
|
96 } |
|
97 |
|
98 |
|
99 //End of file |