sl@0
|
1 |
// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// e32test\misc\t_abt.cpp
|
sl@0
|
15 |
//
|
sl@0
|
16 |
//
|
sl@0
|
17 |
|
sl@0
|
18 |
#include <e32test.h>
|
sl@0
|
19 |
|
sl@0
|
20 |
LOCAL_D RTest test(_L("ABT"));
|
sl@0
|
21 |
LOCAL_D TInt junk=0x11;
|
sl@0
|
22 |
|
sl@0
|
23 |
class RMySession : public RSessionBase
|
sl@0
|
24 |
{
|
sl@0
|
25 |
public:
|
sl@0
|
26 |
TInt Connect(RServer2 aSrv,TRequestStatus& aStat)
|
sl@0
|
27 |
{return CreateSession(aSrv,TVersion(),1,EIpcSession_Unsharable,0,&aStat);}
|
sl@0
|
28 |
void Test(TDesC8& aDes)
|
sl@0
|
29 |
{Send(0,TIpcArgs(&aDes));}
|
sl@0
|
30 |
};
|
sl@0
|
31 |
|
sl@0
|
32 |
void RunTest(RMessage2& aMsg,TPtrC8& aDes)
|
sl@0
|
33 |
{
|
sl@0
|
34 |
RProcess().SetPriority(EPriorityLow);
|
sl@0
|
35 |
TUint8* pD=(TUint8*)User::Alloc(2048);
|
sl@0
|
36 |
TPtr8 d(pD,2048);
|
sl@0
|
37 |
TInt* pJ=&junk;
|
sl@0
|
38 |
*pJ++=0x2233;
|
sl@0
|
39 |
TUint32 data_addr=(TUint32)pJ;
|
sl@0
|
40 |
data_addr=(data_addr+4095)&~4095;
|
sl@0
|
41 |
data_addr-=2044;
|
sl@0
|
42 |
const TUint8* p=(const TUint8*)data_addr;
|
sl@0
|
43 |
aDes.Set(p,2048);
|
sl@0
|
44 |
FOREVER
|
sl@0
|
45 |
{
|
sl@0
|
46 |
TInt r=aMsg.Read(0,d);
|
sl@0
|
47 |
if (r!=KErrBadDescriptor)
|
sl@0
|
48 |
{
|
sl@0
|
49 |
test.Printf(_L("Return code %d\n"),r);
|
sl@0
|
50 |
test(0);
|
sl@0
|
51 |
}
|
sl@0
|
52 |
}
|
sl@0
|
53 |
}
|
sl@0
|
54 |
|
sl@0
|
55 |
GLDEF_C TInt E32Main()
|
sl@0
|
56 |
{
|
sl@0
|
57 |
test.Title();
|
sl@0
|
58 |
|
sl@0
|
59 |
RServer2 srv;
|
sl@0
|
60 |
srv.CreateGlobal(KNullDesC);
|
sl@0
|
61 |
|
sl@0
|
62 |
RMySession sess;
|
sl@0
|
63 |
TRequestStatus stat;
|
sl@0
|
64 |
sess.Connect(srv,stat);
|
sl@0
|
65 |
|
sl@0
|
66 |
RMessage2 m;
|
sl@0
|
67 |
srv.Receive(m);
|
sl@0
|
68 |
m.Complete(KErrNone); // connect message
|
sl@0
|
69 |
|
sl@0
|
70 |
User::WaitForRequest(stat); // connected
|
sl@0
|
71 |
|
sl@0
|
72 |
TPtrC8 des;
|
sl@0
|
73 |
sess.Test(des);
|
sl@0
|
74 |
|
sl@0
|
75 |
srv.Receive(m);
|
sl@0
|
76 |
RunTest(m, des);
|
sl@0
|
77 |
|
sl@0
|
78 |
test.End();
|
sl@0
|
79 |
return 0;
|
sl@0
|
80 |
}
|
sl@0
|
81 |
|