0
|
1 |
// Copyright (c) 1999-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 the License "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 |
// f32test\loader\exetifc.cpp
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
#define __INCLUDE_DEPENDENCY_GRAPH
|
|
19 |
|
|
20 |
#include "dlltree.h"
|
|
21 |
#include "exetifc.h"
|
|
22 |
#include "t_ldrtst.h"
|
|
23 |
|
|
24 |
#ifdef __EPOC32__
|
|
25 |
_LIT(KSysBin,"\\Sys\\Bin\\");
|
|
26 |
#endif
|
|
27 |
|
|
28 |
GLDEF_C TInt LoadExe(TInt aModuleNum, TInt aSuffix, RProcess& aProcess, TUint32& aTimeTaken)
|
|
29 |
{
|
|
30 |
TFileName fn;
|
|
31 |
const TPtrC basicFn = MODULE_FILENAME(aModuleNum);
|
|
32 |
if (basicFn[1] == ':')
|
|
33 |
GetNonZFileName(basicFn, fn);
|
|
34 |
else
|
|
35 |
{
|
|
36 |
#ifdef __EPOC32__
|
|
37 |
fn=KSysBin();
|
|
38 |
#endif
|
|
39 |
fn+=MODULE_FILENAME(aModuleNum);
|
|
40 |
}
|
|
41 |
|
|
42 |
TBuf<16> cmd;
|
|
43 |
if (aSuffix>0)
|
|
44 |
cmd.AppendNum(aSuffix);
|
|
45 |
aTimeTaken = 0;
|
|
46 |
TUint32 initial = User::NTickCount();
|
|
47 |
TInt r=aProcess.Create(fn, cmd);
|
|
48 |
TUint32 final = User::NTickCount();
|
|
49 |
if (r==KErrNone)
|
|
50 |
{
|
|
51 |
aTimeTaken = final - initial;
|
|
52 |
aProcess.Resume();
|
|
53 |
}
|
|
54 |
return r;
|
|
55 |
}
|
|
56 |
|
|
57 |
TInt RLoaderTest::Connect(TInt aExeNum)
|
|
58 |
{
|
|
59 |
TInt retry = 10;
|
|
60 |
while (retry)
|
|
61 |
{
|
|
62 |
TInt r = CreateSession(MODULE_NAME(aExeNum), TVersion(1,0,0));
|
|
63 |
if (r != KErrNotFound)
|
|
64 |
return r;
|
|
65 |
--retry;
|
|
66 |
User::After(100000);
|
|
67 |
}
|
|
68 |
return KErrNotFound;
|
|
69 |
}
|
|
70 |
|
|
71 |
TInt RLoaderTest::Connect(TInt aExeNum, TInt aSuffix)
|
|
72 |
{
|
|
73 |
TName n=MODULE_NAME(aExeNum);
|
|
74 |
if (aSuffix>0)
|
|
75 |
{
|
|
76 |
n.Append('.');
|
|
77 |
n.AppendNum(aSuffix);
|
|
78 |
}
|
|
79 |
TInt retry = 10;
|
|
80 |
while (retry)
|
|
81 |
{
|
|
82 |
TInt r = CreateSession(n, TVersion(1,0,0));
|
|
83 |
if (r != KErrNotFound)
|
|
84 |
return r;
|
|
85 |
--retry;
|
|
86 |
User::After(100000);
|
|
87 |
}
|
|
88 |
return KErrNotFound;
|
|
89 |
}
|
|
90 |
|
|
91 |
TInt RLoaderTest::GetExeDepList(SDllInfo* aInfo)
|
|
92 |
{
|
|
93 |
TPtr8 infoptr((TUint8*)aInfo, 0, KNumModules*sizeof(SDllInfo));
|
|
94 |
return SendReceive(EMsgGetExeDepList, TIpcArgs(&infoptr));
|
|
95 |
}
|
|
96 |
|
|
97 |
TInt RLoaderTest::GetCDList(SDllInfo* aInfo)
|
|
98 |
{
|
|
99 |
TPtr8 infoptr((TUint8*)aInfo, 0, KNumModules*sizeof(SDllInfo));
|
|
100 |
return SendReceive(EMsgGetCDList, TIpcArgs(&infoptr));
|
|
101 |
}
|
|
102 |
|
|
103 |
TInt RLoaderTest::LoadDll(TInt aDllNum, SDllInfo* aInfo)
|
|
104 |
{
|
|
105 |
TPtr8 infoptr((TUint8*)aInfo, 0, KNumModules*sizeof(SDllInfo));
|
|
106 |
return SendReceive(EMsgLoadDll, TIpcArgs(aDllNum, &infoptr));
|
|
107 |
}
|
|
108 |
|
|
109 |
TInt RLoaderTest::CloseDll(TInt aHandle)
|
|
110 |
{
|
|
111 |
return SendReceive(EMsgCloseDll, TIpcArgs(aHandle));
|
|
112 |
}
|
|
113 |
|
|
114 |
TInt RLoaderTest::CallBlkI(TInt aHandle, TInt aIn)
|
|
115 |
{
|
|
116 |
return SendReceive(EMsgCallBlkI, TIpcArgs(aHandle, aIn));
|
|
117 |
}
|
|
118 |
|
|
119 |
TInt RLoaderTest::CallRBlkI(TInt aHandle, TInt aIn)
|
|
120 |
{
|
|
121 |
return SendReceive(EMsgCallRBlkI, TIpcArgs(aHandle, aIn));
|
|
122 |
}
|
|
123 |
|
|
124 |
TInt RLoaderTest::CheckReadable(TLinAddr aAddr)
|
|
125 |
{
|
|
126 |
return SendReceive(EMsgCheckReadable, TIpcArgs(aAddr));
|
|
127 |
}
|
|
128 |
|
|
129 |
TInt RLoaderTest::Exit()
|
|
130 |
{
|
|
131 |
return SendReceive(EMsgExit, TIpcArgs(NULL));
|
|
132 |
}
|
|
133 |
|