equal
deleted
inserted
replaced
|
1 /* |
|
2 * Copyright (c) 2005-2009 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <stdio.h> |
|
19 #include <string.h> |
|
20 #include <stdlib.h> |
|
21 #include <e32base.h> |
|
22 |
|
23 int main(int argc, char *argv[], char **/*envp*/) |
|
24 { |
|
25 |
|
26 TInt64 handleNumber; |
|
27 TInt err = KErrNone; |
|
28 |
|
29 if(argc!=2) |
|
30 { |
|
31 printf("Usage:\n"); |
|
32 printf("test_kill [pid]\n"); |
|
33 exit(KErrNone); |
|
34 } |
|
35 |
|
36 TBuf8<10> desc; |
|
37 TInt size = strlen(argv[1]); |
|
38 desc.Copy((TUint8 *)argv[1],size); |
|
39 |
|
40 TLex8 conv(desc); |
|
41 |
|
42 err = conv.Val(handleNumber); |
|
43 |
|
44 if(err==KErrNone) |
|
45 { |
|
46 RProcess newProcess; |
|
47 err = newProcess.Open(TProcessId(handleNumber)); |
|
48 if(err==KErrNone) |
|
49 { |
|
50 newProcess.Kill(1); |
|
51 } |
|
52 newProcess.Close(); |
|
53 } |
|
54 |
|
55 printf("Return Code: %d\n",err); |
|
56 |
|
57 return err; |
|
58 } |
|
59 |