sl@0: // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // e32test\misc\t_abt.cpp sl@0: // sl@0: // sl@0: sl@0: #include sl@0: sl@0: LOCAL_D RTest test(_L("ABT")); sl@0: LOCAL_D TInt junk=0x11; sl@0: sl@0: class RMySession : public RSessionBase sl@0: { sl@0: public: sl@0: TInt Connect(RServer2 aSrv,TRequestStatus& aStat) sl@0: {return CreateSession(aSrv,TVersion(),1,EIpcSession_Unsharable,0,&aStat);} sl@0: void Test(TDesC8& aDes) sl@0: {Send(0,TIpcArgs(&aDes));} sl@0: }; sl@0: sl@0: void RunTest(RMessage2& aMsg,TPtrC8& aDes) sl@0: { sl@0: RProcess().SetPriority(EPriorityLow); sl@0: TUint8* pD=(TUint8*)User::Alloc(2048); sl@0: TPtr8 d(pD,2048); sl@0: TInt* pJ=&junk; sl@0: *pJ++=0x2233; sl@0: TUint32 data_addr=(TUint32)pJ; sl@0: data_addr=(data_addr+4095)&~4095; sl@0: data_addr-=2044; sl@0: const TUint8* p=(const TUint8*)data_addr; sl@0: aDes.Set(p,2048); sl@0: FOREVER sl@0: { sl@0: TInt r=aMsg.Read(0,d); sl@0: if (r!=KErrBadDescriptor) sl@0: { sl@0: test.Printf(_L("Return code %d\n"),r); sl@0: test(0); sl@0: } sl@0: } sl@0: } sl@0: sl@0: GLDEF_C TInt E32Main() sl@0: { sl@0: test.Title(); sl@0: sl@0: RServer2 srv; sl@0: srv.CreateGlobal(KNullDesC); sl@0: sl@0: RMySession sess; sl@0: TRequestStatus stat; sl@0: sess.Connect(srv,stat); sl@0: sl@0: RMessage2 m; sl@0: srv.Receive(m); sl@0: m.Complete(KErrNone); // connect message sl@0: sl@0: User::WaitForRequest(stat); // connected sl@0: sl@0: TPtrC8 des; sl@0: sess.Test(des); sl@0: sl@0: srv.Receive(m); sl@0: RunTest(m, des); sl@0: sl@0: test.End(); sl@0: return 0; sl@0: } sl@0: