Пример #1
0
void CWindowGroupListBoxData::DoInfoForDialogL(RBuf& aTitle, RBuf& inf, TDes* name)
	{
	SWgInfo& info = *reinterpret_cast<SWgInfo*>(iInfo);
	_LIT(KInfo, "Window group info");
	aTitle.Copy(KInfo);
	CApaWindowGroupName* wg = info.iName;
	*name = wg->WindowGroupName();
	PrettyName(EListWindowGroups, *name);

	inf.Append(*name);
	TThreadId tid;
	TInt res = info.iSession->GetWindowGroupClientThreadId(info.iHandle, tid);
	inf.AppendFormat(_L("\n\nOwner thread: %i"), res == KErrNone ? (TInt)tid : res);
	RThread thread;
	if (res == KErrNone)
		{
		res = thread.Open(tid);
		}
	if (res == KErrNone)
		{
		*name = thread.FullName();
		PrettyName(EListThread, *name);
		inf.AppendFormat(_L(" (%S)"), name);
		}
	inf.AppendFormat(_L("\nBusy=%i System=%i Hidden=%i"), wg->IsBusy(), wg->IsSystem(), wg->Hidden());
	}
Пример #2
0
void CCmdSetpriority::NewThread(TInt aHandle)
	{
	if (aHandle == KErrNotSupported)
		{
		PrintError(KErrNotSupported, _L("Kernel was not compiled with __DEBUGGER_SUPPORT__, can't get thread creation notifications."));
		Complete(aHandle);
		}
	else if (aHandle < 0)
		{
		PrintError(aHandle, _L("Failed to get new thread notification, or couldn't open handle to thread."));
		Complete(aHandle);
		}
	else
		{
		RThread thread;
		thread.SetHandle(aHandle);
		TFullName name(thread.FullName());
		TInt priority = 0;
		TPckg<TThreadKernelInfo> pkg(iThreadInfo);
		TInt err = iMemAccess.GetObjectInfoByHandle(EThread, RThread().Id(), aHandle, pkg);
		if (!err)
			{
			priority = iThreadInfo.iThreadPriority;
			}

		TUint tid = thread.Id();
		Printf(_L("New thread id %u name %S priority adjusted to %d\r\n"), tid, &name, priority);
		thread.Close();
		}
	}
Пример #3
0
GLDEF_C TInt E32Main()
{
    test.Title();
    test.Start(_L("Waiting..."));

    RUndertaker u;
    TInt r=u.Create();
    test(r==KErrNone);
    //to avoid RVCT4 warning of unreachable statement.
    volatile TInt forever = 0;
    while(forever)
    {
        TInt h;
        TRequestStatus s;
        r=u.Logon(s,h);
        test(r==KErrNone);
        User::WaitForRequest(s);
        RThread t;
        t.SetHandle(h);
        TBuf8<128> b;
        t.Context(b);
        TInt *pR=(TInt*)b.Ptr();
        TFullName tFullName = t.FullName();
        TExitCategoryName tExitCategory = t.ExitCategory();
        test.Printf(_L("Thread %S Exit %d %S %d\n"),&tFullName,t.ExitType(),&tExitCategory,t.ExitReason());
        test.Printf(_L("r0 =%08x r1 =%08x r2 =%08x r3 =%08x\n"),pR[0],pR[1],pR[2],pR[3]);
        test.Printf(_L("r4 =%08x r5 =%08x r6 =%08x r7 =%08x\n"),pR[4],pR[5],pR[6],pR[7]);
        test.Printf(_L("r8 =%08x r9 =%08x r10=%08x r11=%08x\n"),pR[8],pR[9],pR[10],pR[11]);
        test.Printf(_L("r12=%08x r13=%08x r14=%08x r15=%08x\n"),pR[12],pR[13],pR[14],pR[15]);
        test.Printf(_L("cps=%08x dac=%08x\n"),pR[16],pR[17]);
        t.Close();
    }
    return 0;
}
Пример #4
0
void CWsTop::NewSession(const CWsClient *aClient)
	{	
	if (iShellClient==NULL && iShell)
		{
#if defined(__WINS__)
		RThread proc;
		proc=aClient->Client();
#else
		RProcess proc;
		aClient->Client().Process(proc);
#endif
		TFullName procName = proc.FullName();
		// Before comparing the proc name with iShell name , truncate the proc name up to the actual name
		// referring to the process, by removing the part which starts with ':', if exists.
		TInt colonLocation = procName.Locate(':');
		if( KErrNotFound != colonLocation)
			{
			procName = procName.Left(colonLocation);
			}
		if (procName ==iShell->FullName())
			{
			iShellClient=aClient;
			if (!iPreviousShellClient)
				{
				iPreviousShellClient=ETrue;
				aClient->Screen()->RootWindow()->SetColorIfClear();
				}
			}
#if !defined(__WINS__)
		proc.Close();
#endif
		}	
	}
// RunL() completes a previously issued Observe call 
void CTargetObserver::RunL()
	{
    LOG_MSG2("->CTargetObserver::RunL(status:%d)", iStatus.Int());
	User::LeaveIfError(iStatus.Int()); //something bad happened

    iCrashEventInfo.iEventTime.UniversalTime(); //not 100% exact time of the crash, but as soon as we are notified about it

    Observe(); 

    RThread thread;
    LOG_MSG2("CTargetObserver::RunL() - opening handle to crashed thread:%Lu\n", iCrashEventInfo.iThreadId);
    TInt err = thread.Open(iCrashEventInfo.iThreadId);
    if(err != KErrNone)
        {
        LOG_MSG2("CTargetObserver::RunL - unable to open thread handle! err:%d\n", err); 
        User::Leave(err);
        }
    CleanupClosePushL(thread); 
    
    if( (iThreadList.Count() == 0) || (HasThread(thread.FullName())) )
        {
        //crash event of the whole process or thread that we observe
        LOG_MSG("CTargetObserver::RunL() -> HandleCrashEventL()");
        iHandler.HandleCrashEventL(iCrashEventInfo);
        }
    else //crash event of thread that we don't care about
        {
        LOG_MSG("CTargetObserver::RunL() - resuming crashed thread");
        iSecSess.ResumeThread(iCrashEventInfo.iThreadId);
        }
    CleanupStack::PopAndDestroy(); //thread

	}
Пример #6
0
void CSystemTestBase::HandleThreadExitL(RThread& aThread)
	{
	TExitType exitType=aThread.ExitType();
	if (exitType==EExitPanic)
		{
		CActiveScheduler::Stop();
		iExitReason = aThread.ExitReason();
		iExitCategory = aThread.ExitCategory();
		TBuf<100> iName(aThread.FullName());
		iLogger.WriteFormat(KPanicText, &iName, iExitReason, &iExitCategory);
		User::Panic(iExitCategory,iExitReason);
		}
	}
Пример #7
0
void CCmdKill::DoKillThreadL(TUint aId)
	{
#ifdef FSHELL_MEMORY_ACCESS_SUPPORT
	LoadMemoryAccessL();

	RThread thread;
	LeaveIfErr(iMemAccess.RThreadForceOpen(thread, aId), _L("Unable to open thread"));
	TName name(thread.FullName());
	if (thread.ExitType() != EExitPending)
		{
		Printf(_L("%S (id=%u) has already exited"), &name, aId);
		thread.Close();
		return;
		}

	CleanupClosePushL(thread);
	TExitType type = EExitKill;
	if (iTerminate)
		{
		type = EExitTerminate;
		}
	else if (iPanicCategory)
		{
		type = EExitPanic;
		}
	TInt err = iMemAccess.ObjectDie(EThread, aId, NULL, type, iReason, iPanicCategory ? *iPanicCategory : KNullDesC());
	LeaveIfErr(err, _L("Couldn't kill thread id %u"), aId);

	if (iTerminate)
		{
		Printf(_L("Terminated %S (id=%u) with %d\r\n"), &name, aId, iReason);
		}
	else if (iPanicCategory)
		{
		Printf(_L("Panicked %S (id=%u) with %S %d\r\n"), &name, aId, iPanicCategory, iReason);
		}
	else
		{
		Printf(_L("Killed %S (id=%u) with %d\r\n"), &name, aId, iReason);
		}
	CleanupStack::PopAndDestroy(&thread);

#else
	DoKillByHandleL<RThread>(aId);
#endif
	}
void CSenUnderTakerWaiter::RunL()
    {
    if(iStatus == KErrDied)
        {
        RThread th;
        th.SetHandle(iDyingThreadNumber);
        TFullName name = th.FullName();
        TExitType type = th.ExitType();

        
        if(iDispatcherThreadID == th.Id())
            {
            //Notifies client that thread is died. Client has to restart the 
            //connection here.In this case client has to create new SC object.
            if(type == EExitKill)
                {
                if(iSenServiceConnectionImpl)
                    {
                    iSenServiceConnectionImpl->iErrorNumber = EExitKill;
                    iSenServiceConnectionImpl->iTxnId = -1;    
                    iSenServiceConnectionImpl->HandleMessageFromChildAOL(iStatus.Int());
                    }
                }
            else    // panic
                {
                TExitCategoryName categ = th.ExitCategory();
                if(iSenServiceConnectionImpl)
                    {
                    iSenServiceConnectionImpl->iErrorNumber = EExitPanic;
                    iSenServiceConnectionImpl->iTxnId = -1;
                    iSenServiceConnectionImpl->HandleMessageFromChildAOL(iStatus.Int());
                    }
                }
            }
        th.Close();
        StartWaiter();
        }           
    }
Пример #9
0
void CCmdUndertaker::ProcessHandle(TInt aDeadThreadHandle)
	{
	RThread deadThread;
	deadThread.SetHandle(aDeadThreadHandle);
	TFullName name(deadThread.FullName());
	TExitType type = deadThread.ExitType();
	if (type != EExitKill || deadThread.ExitReason() != 0 || iAll)
		{
		Write(_L("Thread "));
		Write(name);
		Printf(_L(" (tid=%d) "), (TUint)deadThread.Id());
		}

	if (type == EExitPanic)
		{
		TExitCategoryName cat = deadThread.ExitCategory();
		Printf(_L("panicked with %S %d\r\n"), &cat, deadThread.ExitReason());
		}
	else if (type == EExitTerminate)
		{
		Printf(_L("terminated with reason %d\r\n"), deadThread.ExitReason());
		}
	else if (deadThread.ExitReason() != 0)
		{
		// We'll consider a kill with non-zero exit code as counting as abnormal
		Printf(_L("killed with reason %d\r\n"), deadThread.ExitReason());
		}
	else if (iAll)
		{
		Printf(_L("exited cleanly\r\n"));
		}
		
	if (!iLeakThreads)
		{
		deadThread.Close();
		}
	}
Пример #10
0
// ---------------------------------------------------------------------------
// CFotaSrvSession::ServiceL
// Handle client request
// ---------------------------------------------------------------------------
//
void CFotaSrvSession::ServiceL(const RMessage2& aMessage)
    {
    TInt err(KErrNone);
    TInt pkgid = 0;
    TPackageState state;
    RThread clt;
    aMessage.ClientL(clt);
    TFullName cltnm = clt.FullName();
    FLOG(_L( "CFotaSrvSession::ServiceL      %d   serving for %S?" ),
            aMessage.Function(), &cltnm);

    TFotaClient client = CheckClientSecureIdL(aMessage);

    if (client == EUnknown)
        {
        FLOG(_L("Permission denied to use fota services!"));
        User::Leave(KErrPermissionDenied);
        }

    TInt cmd = aMessage.Function();
    if ((cmd != EGetState) && (cmd != EGetResult) && (cmd != EGetCurrFwDetails) && (cmd != EGetUpdateTimestamp))
        {
    
        TInt fotaValue(1);
        CRepository* centrep(NULL);
        TUid uidValue =
            {
            0x101F9A08
            }; // KCRFotaAdapterEnabled

        centrep = CRepository::NewL(uidValue);
        if (centrep)
            {
            FLOG(_L("centralrepository found "));
            centrep->Get(1, fotaValue); // KCRFotaAdapterEnabled     
            delete centrep;
            }

        if (!fotaValue)
            {
            FLOG(_L("Fota is disabled or not supported!"));
            User::Leave(KErrNotSupported);
            }
            
        }

    switch (aMessage.Function())
        {

        case EFotaDownload:
            {
            FLOG(_L( "CFotaSrvSession::ServiceL DOWNLOAD"));
            TDownloadIPCParams ipc;
            TPckg<TDownloadIPCParams> pkg(ipc);
            aMessage.Read(0, pkg);
            TInt deslen = aMessage.GetDesLengthL(1);
            HBufC8* urlbuf = HBufC8::NewLC(deslen);
            TPtr8 urlptr = urlbuf->Des();
            aMessage.Read(1, urlptr);
            TInt silent = aMessage.Int2();
            FotaServer()->DownloadL(ipc, urlptr, client, silent, EFalse);
            CleanupStack::PopAndDestroy(urlbuf); // urlbuf
            aMessage.Complete(KErrNone);

            break;
            }
        case EFotaUpdate:
            {
            FLOG(_L( "CFotaSrvSession::ServiceL UPDATE" ));
            TDownloadIPCParams ipc;
            TPckg<TDownloadIPCParams> pkg(ipc);
            aMessage.Read(0, pkg);

            // If update started from omadmappui, no alert should be sent if 
            // update is cancelled
            if (client == EOMADMAppUi)
                {
                ipc.iSendAlert = EFalse;
                }
            FotaServer()->TryUpdateL(client);
            aMessage.Complete(KErrNone);
            break;
            }
        case EFotaDownloadAndUpdate:
            {
            FLOG(_L( "CFotaSrvSession::ServiceL DOWNLOADANDUPDATE" ));
            TDownloadIPCParams ipc;
            TPckg<TDownloadIPCParams> pkg(ipc);
            aMessage.Read(0, pkg);
            TInt deslen = aMessage.GetDesLengthL(1);
            HBufC8* urlbuf = HBufC8::NewLC(deslen);
            TPtr8 urlptr = urlbuf->Des();
            aMessage.Read(1, urlptr);
            TFotaClient requester = CheckClientSecureIdL(aMessage);

            TInt silent = aMessage.Int2();
            FotaServer()->DownloadL(ipc, urlptr, requester, silent, ETrue);
            CleanupStack::PopAndDestroy(urlbuf);
            aMessage.Complete(KErrNone);
            }
            break;

        case EFotaTryResumeDownload:
            {
            FLOG(_L( "CFotaSrvSession::ServiceL TRYRESUMEDOWNLOAD" ));
            if (client == EOMADMAppUi || client == EFMSServer || client
                    == EFotaTestApp)
                {
                TInt silent = aMessage.Int0();
                
                FotaServer()->TryResumeDownloadL(client, silent); // silent
                aMessage.Complete(KErrNone);
                }
            else
                {
                aMessage.Complete(KErrAccessDenied);
                }

            }
            break;

        case EDeletePackage:
            {
            FLOG(_L( "CFotaSrvSession::ServiceL DELETEPACKAGE"));
            pkgid = aMessage.Int0();
            FotaServer()->DeletePackageL(pkgid);
            aMessage.Complete(KErrNone);
            }
            break;
        case EGetState:
            {
            FLOG(_L( "CFotaSrvSession::ServiceL GETSTATE" ));
            pkgid = aMessage.Int0();

            state = FotaServer()->GetStateL(pkgid);

            FLOG(_L( "CFotaSrvSession::ServiceL GETSTATE << %d" ),  state.iState);
            TPckg<RFotaEngineSession::TState> pkg2(state.iState);
            aMessage.Write(1, pkg2);
            aMessage.Complete(KErrNone);
            }
            break;
        case EGetResult:
            {
            FLOG(_L( "CFotaSrvSession::ServiceL GETRESULT >>" ));
            pkgid = aMessage.Int0();
            state = FotaServer()->GetStateL(pkgid);
            TPckg<TInt> pkg2(state.iResult);
            FLOG(_L( "CFotaSrvSession::ServiceL GETRESULT << %d" ),
                    state.iResult);
            aMessage.Write(1, pkg2);
            aMessage.Complete(err);
            break;
            }
        case EGetUpdatePackageIds:
            {
            FLOG(_L( "CFotaSrvSession::ServiceL EGETUPDATEPACKAGEIDS" ));
            TPkgIdList pkgids;
            FotaServer()->GetUpdatePackageIdsL(pkgids);
            TPckg<TPkgIdList> pkgids_pkg(pkgids);
            aMessage.Write(0, pkgids_pkg);
            aMessage.Complete(KErrNone);
            }
            break;

        case EGetUpdateTimestamp:
            {
            FLOG(_L( "CFotaSrvSession::ServiceL EGETUPDATETIMESTAMP" ));
            TBuf16<15> timestamp;
            FotaServer()->GetUpdateTimeStampL(timestamp);
            aMessage.Write(0, timestamp);
            aMessage.Complete(KErrNone);
            }
            break;

        case EGenericAlertSentForPackage:
            {
            FLOG(_L( "CFotaSrvSession::ServiceL EGENERICALERTSENT FOR PKGID" ));
            TInt pkgid = aMessage.Int0();
            FotaServer()->ResetFotaStateL(pkgid);
            aMessage.Complete(err);
            }
            break;

        case EScheduledUpdate:
            {
            FLOG(_L( "CFotaSrvSession::ServiceL ESCHEDULEDUPDATE" ));
            TFotaScheduledUpdate sched(-1, -1);
            TPckg<TFotaScheduledUpdate> p(sched);
            aMessage.Read(0, p);

            FLOG(_L(" pkgid: %d   scheduleid:%d"), sched.iPkgId,
                    sched.iScheduleId);
            FotaServer()->ScheduledUpdateL(sched, client);
            aMessage.Complete(KErrNone);
            
            }
            break;

        case EPauseDownload:
            {
            FLOG(_L( "CFotaSrvSession::ServiceL EPAUSEDOWNLOAD" ));
            FotaServer()->PauseDownloadL();
            aMessage.Complete(KErrNone);
            }
            break;
        case EGetCurrFwDetails:
            {
            FLOG(_L( "CFotaSrvSession::ServiceL EGETCURRFWDETAILS" ));

            TBuf8<KFotaMaxPkgNameLength> name;
            TBuf8<KFotaMaxPkgVersionLength> version;
            TInt size(0);

            FotaServer()->GetCurrentFwDetailsL(name, version, size);

            /*
            aMessage.Write(1, name);
            aMessage.Write(2, version);
            TPckg<TInt> psize(size);
            aMessage.Write(3, psize);

            aMessage.Complete(KErrNone);*/
            
            aMessage.Write(0, name);
            aMessage.Write(1, version);
            TPckg<TInt> psize(size);
            aMessage.Write(2, psize);

            aMessage.Complete(KErrNone);


            }
            break;
        default:
            {
            FLOG(_L( "CFotaSrvSession::ServiceL In default case" ));
            }
            break;
        }
    }
static TInt CatalogsUndertaker()
    {
    DLTRACEIN((""));

    TFullName catalogsThreadName;
    TInt err = User::GetDesParameter( 15, catalogsThreadName );
    
    if( err != KErrNone )
        {
        DLERROR(( "Failed to read parameter slot 15, error %d", err ));
        catalogsThreadName = KNullDesC();
        }
    else
        {
        DLINFO(( _L("Read catalogs thread name: %S"), &catalogsThreadName ));
        }

    RUndertaker undertaker;
    TRequestStatus status;
    TInt deadThreadHandleNumber;

    undertaker.Create();

    for( ;; )
        {
        undertaker.Logon( status, deadThreadHandleNumber );
        User::WaitForRequest( status );

        RThread deadThread;
        deadThread.SetHandle( deadThreadHandleNumber );

        const TDesC* type;

        switch( deadThread.ExitType() )
            {
            case EExitKill:
                type = &KExitTypeKill;
                break;

            case EExitTerminate:
                type = &KExitTypeTerminate;
                break;

            case EExitPanic:
                type = &KExitTypePanic;
                break;

            default:
                type = &KExitTypeUnknown;
                DLERROR(( "Exit type: %d", (TInt)deadThread.ExitType() ));
                break;
            }


        DLWARNING(( _L("THREAD %S DEATH observed! %S %S %d"), 
            &deadThread.FullName(),
            type,
            &deadThread.ExitCategory(),
            deadThread.ExitReason() ));
        
        type = type; // to suppress compiler warning

        if( catalogsThreadName == deadThread.FullName() )
            {
            DLERROR(( "Catalogs server thread killed, undertaker exits" ));
            deadThread.Close();
            break;
            }

        deadThread.Close();

        }

    undertaker.Close();
    DLTRACEOUT(("KErrNone"));

    return KErrNone;
    }
Пример #12
0
TVerdict CUpsClientStep::doTestStepPreambleL()
/**
 * @return - TVerdict code
 * Override of base class virtual
 */
	{
	
 	__UHEAP_MARK;
 	
	// Read values to config servers from INI file. (ARRAY of values)
 	
    // Read how many times the test step needs to be repeated.
    TName fStepRepeat(_L("StepRepeat"));
    TInt  repeats;
    
    if(GetIntFromConfig(ConfigSection(),fStepRepeat,repeats))
	    {
	   	iStepRepeat=repeats;
	    }
	else
		{
		iStepRepeat=1;		
		}
    
    // Read values for test sequence from INI file. (ARRAY of values)
	TInt index=0;
	TName fUseServiceUID;
	fUseServiceUID.Format(_L("UseServiceUID_%d"),index);
	TName fUseServerName;
	fUseServerName.Format(_L("UseServerName_%d"),index);
	TName fDestination;
	fDestination.Format(_L("Destination_%d"),index);
	TName fExpectedError;
	fExpectedError.Format(_L("ExpectedError_%d"),index);
	TName fUseOpaqueData;
	fUseOpaqueData.Format(_L("UseOpaqueData_%d"),index);
	TName fSelectDialogOption;
	fSelectDialogOption.Format(_L("SelectDialogOption_%d"),index); 
	TName fButtonsDisplayed;
	fButtonsDisplayed.Format(_L("ButtonsDisplayed_%d"),index);
	TName fDialogCreatorInvoked;
	fDialogCreatorInvoked.Format(_L("DialogCreatorInvoked_%d"),index);
	TName fPolicyEvaluatorInvoked;
	fPolicyEvaluatorInvoked.Format(_L("PolicyEvaluatorInvoked_%d"),index);
	TName fAccessGranted;
	fAccessGranted.Format(_L("AccessGranted_%d"), index);
	TName fCloseSession;
	fCloseSession.Format(_L("CloseSession_%d"), index);
	TName fHoldEvaluatorOpen;
	fHoldEvaluatorOpen.Format(_L("HoldEvaluatorOpen_%d"), index);
	TName fHoldPrepareDialogOpen;
	fHoldPrepareDialogOpen.Format(_L("HoldPrepareDialogOpen_%d"), index);
	TName fHoldDisplayDialogOpen;
	fHoldDisplayDialogOpen.Format(_L("HoldDisplayDialogOpen_%d"), index);
	TName fRequestDurationThreshold;
	fRequestDurationThreshold.Format(_L("RequestDurationThreshold_%d"), index);
	TName fLeaveDialog;
	fLeaveDialog.Format(_L("LeaveDialog_%d"), index);
	TName fLeaveEvaluator;
	fLeaveEvaluator.Format(_L("LeaveEvaluator_%d"), index);
	TName fCancelUpsRequest;
	fCancelUpsRequest.Format(_L("CancelUpsRequest_%d"), index);
	TName fPlatSecPass;
	fPlatSecPass.Format(_L("PlatSecPass_%d"), index);
	TName fForcePrompt;
	fForcePrompt.Format(_L("ForcePrompt_%d"), index);
	TName fExpectedEvaInfo;
	fExpectedEvaInfo.Format(_L("ExpectedEvaluatorInfo_%d"), index);
	TName fSelectFingerprint;
	fSelectFingerprint.Format(_L("SelectFingerprint_%d"), index);
	TName fWaitUntilFileAppears;
	fWaitUntilFileAppears.Format(_L("WaitUntilFileAppears_%d"), index);
	
	TInt	useServiceUID;
	TPtrC   useServerName;
	TPtrC   destination;
	TInt	expectedError;
	TPtrC   useOpaqueData;
    TPtrC	selectDialogOption;
	TInt	buttonsDisplayed;
	TInt    dialogCreatorInvoked;
	TInt	policyEvaluatorInvoked;
	TPtrC	accessGranted;
	TBool	closeSession;
	TBool   holdEvaluatorOpen;
	TBool   holdPrepareDialogOpen;
	TBool   holdDisplayDialogOpen;
	TInt 	requestDurationThreshold;
	TBool   leaveDialog;
	TBool   leaveEvaluator;
	TBool   cancelUpsRequest;
	TBool   platSecPass;
	TBool   forcePrompt;
	TInt    expectedEvaInfo;
	TInt	selectFingerprint;
	TPtrC   waitUntilFileAppears;	
	
	while (GetHexFromConfig(ConfigSection(), fUseServiceUID,useServiceUID)
		&& GetStringFromConfig(ConfigSection(),fUseServerName,useServerName)
		&& GetStringFromConfig(ConfigSection(),fDestination,destination)
	  	&& GetStringFromConfig(ConfigSection(),fAccessGranted,accessGranted))
		{
	    TServiceRequestParameters newSerReq;
	    newSerReq.iServiceUID = useServiceUID; 
	    newSerReq.iServerName = useServerName;
	    newSerReq.iDestination = destination;
	    newSerReq.iAccessGranted = accessGranted;
	    
        // Close session is optional.
        if(GetBoolFromConfig(ConfigSection(),fCloseSession,closeSession))
	    	{
	    	newSerReq.iCloseSession = closeSession;
	    	}
	    
	    // use of dialog creator is optional.
	    if(GetStringFromConfig(ConfigSection(),fSelectDialogOption,selectDialogOption)
		&& GetIntFromConfig(ConfigSection(),fButtonsDisplayed,buttonsDisplayed)
		&& GetIntFromConfig(ConfigSection(),fDialogCreatorInvoked,dialogCreatorInvoked))
	    	{
		    newSerReq.iSelectDialogOption = selectDialogOption;
		    newSerReq.iButtonsDisplayed	= buttonsDisplayed;
		    newSerReq.iDialogCreatorInvoked	= dialogCreatorInvoked;
	    	} 
	    
	    // use of policy evaluator is optional.
	    if(GetIntFromConfig(ConfigSection(),fPolicyEvaluatorInvoked,policyEvaluatorInvoked))
	    	{
	       	newSerReq.iPolicyEvaluatorInvoked = policyEvaluatorInvoked;
	    	}
	    	    
	    // Opaque data is optional
	    if(GetStringFromConfig(ConfigSection(),fUseOpaqueData,useOpaqueData))
	    	{
	       	HBufC8* converter = HBufC8::NewLC(useOpaqueData.Length());
			converter->Des().Copy(useOpaqueData);	
             
	       	newSerReq.iOpaqueData = converter->Ptr() ;	
	       	CleanupStack::PopAndDestroy(); //converter 
	    	}
	    
	    // Expected error is optional.
	    if(GetIntFromConfig(ConfigSection(),fExpectedError,expectedError))
	    	{
			newSerReq.iExpectedError = expectedError;
	    	}
	    	
	    // hold policy evaluator open is optional.
	    if(GetBoolFromConfig(ConfigSection(),fHoldEvaluatorOpen, holdEvaluatorOpen))
	    	{
			newSerReq.iHoldEvaluatorOpen =	holdEvaluatorOpen;
	    	}
	    
	    // hold prepare dialog open is optional.
	    if(GetBoolFromConfig(ConfigSection(),fHoldPrepareDialogOpen, holdPrepareDialogOpen))
	    	{
			newSerReq.iHoldPrepareDialogOpen =	holdPrepareDialogOpen;
	    	}
	    	
	    // hold display dialog open is optional.
	    if(GetBoolFromConfig(ConfigSection(),fHoldDisplayDialogOpen, holdDisplayDialogOpen))
	    	{
			newSerReq.iHoldDisplayDialogOpen =	holdDisplayDialogOpen;
	    	}
	    
	    // request duration threshold - if a request takes 
	    // longer than this threshold it will fail the test
	    if(GetIntFromConfig(ConfigSection(),fRequestDurationThreshold, requestDurationThreshold))
	    	{
	       	newSerReq.iRequestDurationThreshold = requestDurationThreshold;
	    	}

	    // leave dialog is optional.
	    if(GetBoolFromConfig(ConfigSection(),fLeaveDialog,leaveDialog))
	    	{
	    	newSerReq.iLeaveDialog = leaveDialog;
	   		}
	    
	    // leave Evaluator is optional.
	    if(GetBoolFromConfig(ConfigSection(),fLeaveEvaluator,leaveEvaluator))
	    	{
			newSerReq.iLeaveEvaluator = leaveEvaluator;	
	    	}
		       
	    // Cancel ups request is optional.
	    if(GetBoolFromConfig(ConfigSection(),fCancelUpsRequest,cancelUpsRequest))
	    	{
	  		newSerReq.iCancelUpsRequest = cancelUpsRequest;		
	    	}
    
	    // plat sec pass is optional.
	    if(GetBoolFromConfig(ConfigSection(),fPlatSecPass,platSecPass))
	    	{
			newSerReq.iPlatSecPass = platSecPass;
	    	}
	    
	    // Force prompt is optional.
	    if(GetBoolFromConfig(ConfigSection(),fForcePrompt,forcePrompt))
	    	{
			newSerReq.iForcePrompt = forcePrompt;
	    	}
	    
	    // use of policy evaluator is optional.
	    if(GetIntFromConfig(ConfigSection(),fExpectedEvaInfo,expectedEvaInfo))
	    	{
	       	newSerReq.iExpectedEvaluatorInfo = expectedEvaInfo;
	    	}
	    
	    // Fingerprint selection is optional.
	    if(GetIntFromConfig(ConfigSection(),fSelectFingerprint,selectFingerprint))
	    	{
	       	newSerReq.iSelectFingerprint = selectFingerprint;
	    	}
	    
	    // iRepeatUntilFileAppears is optional.
	    if(GetStringFromConfig(ConfigSection(),fWaitUntilFileAppears,waitUntilFileAppears))
	    	{
	    	newSerReq.iWaitUntilFileAppears = waitUntilFileAppears;
	    	}
	    
	    // Add the new service to be requested to array.
	    iArraySersToRequest.Append(newSerReq);
	       
	    index++;
	    fUseServiceUID.Format(_L("UseServiceUID_%d"),index);
	    fUseServerName.Format(_L("UseServerName_%d"),index);
	    fDestination.Format(_L("Destination_%d"),index);
	    fExpectedError.Format(_L("ExpectedError_%d"),index);
	    fUseOpaqueData.Format(_L("UseOpaqueData_%d"),index);
	    fSelectDialogOption.Format(_L("SelectDialogOption_%d"),index);
	    fButtonsDisplayed.Format(_L("ButtonsDisplayed_%d"),index);
	    fDialogCreatorInvoked.Format(_L("DialogCreatorInvoked_%d"),index); 
	    fPolicyEvaluatorInvoked.Format(_L("PolicyEvaluatorInvoked_%d"),index);
	    fAccessGranted.Format(_L("AccessGranted_%d"), index);  
	    fCloseSession.Format(_L("CloseSession_%d"), index);
	    fHoldEvaluatorOpen.Format(_L("HoldEvaluatorOpen_%d"), index);
	    fHoldPrepareDialogOpen.Format(_L("HoldPrepareDialogOpen_%d"), index);
	    fHoldDisplayDialogOpen.Format(_L("HoldDisplayDialogOpen_%d"), index);
		fRequestDurationThreshold.Format(_L("RequestDurationThreshold_%d"), index);
	    fLeaveDialog.Format(_L("LeaveDialog_%d"), index);
	    fLeaveEvaluator.Format(_L("LeaveEvaluator_%d"), index);
	    fCancelUpsRequest.Format(_L("CancelUpsRequest_%d"), index);
	    fPlatSecPass.Format(_L("PlatSecPass_%d"), index);
	    fForcePrompt.Format(_L("ForcePrompt_%d"), index);
	   	fExpectedEvaInfo.Format(_L("ExpectedEvaluatorInfo_%d"), index);
	   	fSelectFingerprint.Format(_L("SelectFingerprint_%d"), index);
	   	fWaitUntilFileAppears.Format(_L("WaitUntilFileAppears_%d"), index);
	   	}	

	// now try for some clientStep specific stuff
	// this ini file entry specifies the property key value for the hold flag
	// If the hold flag property is true then monitor it until it becomes false
	// then continue
	TInt holdKey;
    if(GetIntFromConfig(ConfigSection(),_L("HoldClientStepKey"), holdKey))
	    {
		iHoldClientStepKey = holdKey;

		// as this property is present then set it to true using a direct call to p&s api because
		// the ups p&s api only handles policy evaluators and dialog creators and not test steps
		User::LeaveIfError(RProperty::Set(KPropertyCreatorUid, iHoldClientStepKey, 2));
	    }

	// Instantiates property reader and seter
	iPropertyReader= CUpsProperty::NewL(KPropertyCreatorUid); 

	// reads client name and SID
	TParse clientFullName;
	RThread client;
	clientFullName.Set(client.FullName(),NULL, NULL);
	iTEFServerName=clientFullName.Name();
	iExpectedClientSid = client.SecureId() ;
	client.Close();
			
	SetTestStepResult(EPass);
	return TestStepResult();
	}
TVerdict CUPSDbManagementStep::doTestStepPreambleL()
/**
 * @return - TVerdict code
 * Override of base class virtual
 */
	{
 	__UHEAP_MARK;
 	
 	INFO_PRINTF2(_L("START CELLS: %d"), User::CountAllocCells());
 	
 	// reads client name and SID
	TParse clientFullName;
	RThread client;
	clientFullName.Set(client.FullName(),NULL, NULL);
	iTEFServerName=clientFullName.Name();
	iExpectedClientSid = client.SecureId() ;
	client.Close();
 	
    // Read how many times the test step needs to be repeated.
    TName fStepRepeat(_L("StepRepeat"));
    TInt  repeats;
    
    if(GetIntFromConfig(ConfigSection(),fStepRepeat,repeats))
    	{
    	iStepRepeat=repeats;
    	}
	else
		{	
		iStepRepeat=1;		
		}
    
    // Read values for test sequence from INI file. (ARRAY of values)
	TInt index=0;
	TName fOperation;
	fOperation.Format(_L("Operation_%d"), index);
	TName fClientSid;
	fClientSid.Format(_L("ClientSid_%d"),index);
	TName fEvaluatorId;
	fEvaluatorId.Format(_L("EvaluatorId_%d"),index);
	TName fServiceId;
	fServiceId.Format(_L("ServiceId_%d"),index);
	TName fServerSid;
	fServerSid.Format(_L("ServerSid_%d"),index);
	TName fFingerprint;
	fFingerprint.Format(_L("Fingerprint_%d"),index);
	TName fClientEntity;
	fClientEntity.Format(_L("ClientEntity_%d"),index);
	TName fDescription;
	fDescription.Format(_L("Description_%d"),index);
	TName fDecisionResult;
	fDecisionResult.Format(_L("DecisionResult_%d"),index);
	TName fMajorPolicyVersion;
	fMajorPolicyVersion.Format(_L("MajorPolicyVersion_%d"),index);
	TName fRecordId;
	fRecordId.Format(_L("RecordId_%d"),index);
	TName fEvaluatorInfo;
	fEvaluatorInfo.Format(_L("EvaluatorInfo_%d"),index);
	TName fExpectedDecisionCount;
	fExpectedDecisionCount.Format(_L("ExpectedDecisionCount_%d"),index);
	
	TPtrC 	operation;
	TInt	clientSid;
	TInt	evaluatorId;
	TInt	serviceId;
	TInt	serverSid;
	TPtrC	fingerprint;
	TPtrC	clientEntity;
	TPtrC	description;
	TPtrC	decisionResult;
	TInt	majorPolicyVersion;
	TInt 	recordId;
	TInt	evaluatorInfo;
	TInt 	expectedDecisionCount;
	
	while (GetStringFromConfig(ConfigSection(),fOperation,operation))
		{
		
		// Create an instance of a new request
		CUpsDbRequest* newRequest = CUpsDbRequest::NewL();
		CleanupStack::PushL(newRequest);
		
		// Set the operation to be performed
	    newRequest->iOperation = operation;
	    
	    if(GetHexFromConfig(ConfigSection(),fClientSid,clientSid))
		    {
		    newRequest->iClientSid = clientSid;
		  	newRequest->iDecisionFilter->SetClientSid(TSecureId(clientSid),EEqual);
		    }
	    
		if(GetHexFromConfig(ConfigSection(),fEvaluatorId,evaluatorId))
			{
			newRequest->iEvaluatorId = evaluatorId;	
			newRequest->iDecisionFilter->SetEvaluatorId(TUid::Uid(evaluatorId),EEqual);
			}
		
		if(GetHexFromConfig(ConfigSection(),fServiceId,serviceId))
			{
			newRequest->iServiceId = serviceId;	
			newRequest->iDecisionFilter->SetServiceId(TUid::Uid(serviceId),EEqual);
			}
	
		if(GetHexFromConfig(ConfigSection(),fServerSid,serverSid))
			{
			newRequest->iServerSid = serverSid;	
			newRequest->iDecisionFilter->SetServerSid(TSecureId(serverSid),EEqual);
			}
			
		if(GetStringFromConfig(ConfigSection(),fFingerprint,fingerprint))
			{
			HBufC8* fingerprintConverter = HBufC8::NewLC(fingerprint.Length());
			TPtr8 fingerprintPtr = fingerprintConverter->Des();
			fingerprintPtr.Copy(fingerprint); 	
             
	       	newRequest->iFingerprint = fingerprintPtr;
	       	
	       	HBufC8* binaryFingerprint = StringToBinaryLC(fingerprintPtr);
	       	
	      	newRequest->iDecisionFilter->SetFingerprintL(*binaryFingerprint,EEqual);	
	       	CleanupStack::PopAndDestroy(binaryFingerprint);
	       	CleanupStack::PopAndDestroy(fingerprintConverter); 
			}

		if(GetStringFromConfig(ConfigSection(),fClientEntity,clientEntity))
			{
			HBufC8* clientEntityConverter = HBufC8::NewLC(clientEntity.Length());
			TPtr8 clientEntityPtr = clientEntityConverter->Des();
			clientEntityPtr.Copy(clientEntity); 	
             
	       	newRequest->iClientEntity = clientEntityPtr;
	       	newRequest->iDecisionFilter->SetClientEntityL(clientEntityPtr,EEqual);		
	       	CleanupStack::PopAndDestroy(clientEntityConverter); 
			}
			
		if(GetStringFromConfig(ConfigSection(),fDescription,description))
			{
		    newRequest->iDescription = description;
			}
			
		if(GetStringFromConfig(ConfigSection(),fDecisionResult,decisionResult))
			{
			if(decisionResult.CompareF(_L("Yes"))==0 || decisionResult.CompareF(_L("No"))==0 || decisionResult.CompareF(_L(""))==0 )
				{
				newRequest->iDecisionResult = decisionResult;	
				}
			else 
				{
				ERR_PRINTF3(_L("%S: Unexpected Decision Result - %S"),&iTEFServerName, &decisionResult);
				}
			}

		if(GetIntFromConfig(ConfigSection(),fMajorPolicyVersion,majorPolicyVersion)) 
			{
			newRequest->iMajorPolicyVersion = majorPolicyVersion;
			newRequest->iDecisionFilter->SetMajorPolicyVersion(majorPolicyVersion,EEqual);		
			}
		
		if(GetIntFromConfig(ConfigSection(),fRecordId,recordId))
			{
			newRequest->iRecordId = recordId;
			newRequest->iDecisionFilter->SetRecordId(recordId,EEqual);		
			}
			
		if(GetIntFromConfig(ConfigSection(),fEvaluatorInfo,evaluatorInfo))
			{
			newRequest->iEvaluatorInfo = evaluatorInfo;		
			}
			
		if(GetIntFromConfig(ConfigSection(),fExpectedDecisionCount,expectedDecisionCount))
			{
			newRequest->iExpectedDecisionCount = expectedDecisionCount;		
			}
	    
	    // Add the new service to be requested to array.
	    iArraySersToRequest.AppendL(newRequest);
	    
	    CleanupStack::Pop(newRequest);
	       
	    index++;
	    fOperation.Format(_L("Operation_%d"), index);
	    fClientSid.Format(_L("ClientSid_%d"),index);
		fEvaluatorId.Format(_L("EvaluatorId_%d"),index);
		fServiceId.Format(_L("ServiceId_%d"),index);
		fServerSid.Format(_L("ServerSid_%d"),index);
		fFingerprint.Format(_L("Fingerprint_%d"),index);
		fClientEntity.Format(_L("ClientEntity_%d"),index);
		fDescription.Format(_L("Description_%d"),index);
		fDecisionResult.Format(_L("DecisionResult_%d"),index);
		fMajorPolicyVersion.Format(_L("MajorPolicyVersion_%d"),index);
		fRecordId.Format(_L("RecordId_%d"),index);
		fEvaluatorInfo.Format(_L("EvaluatorInfo_%d"),index);
		fExpectedDecisionCount.Format(_L("ExpectedDecisionCount_%d"),index);
		}
	
	SetTestStepResult(EPass);
	return TestStepResult();
	}