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 "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: //
sl@0:
sl@0: #include "SaCls.h"
sl@0: #include "SaPrivate.h"
sl@0:
sl@0: /**
sl@0: The function starts SysAgt2 server.
sl@0:
sl@0: SysAgt2 server does not offer any functionality other than registering system
sl@0: software P&S properties. This method is redundant and not used by system
sl@0: software, hence it is deprecated and will be removed in a future release. It
sl@0: should also be considered an internal API not for use outside of Symbian even
sl@0: though it is classified as publishedAll. Its interface access scope was
sl@0: incorrectly set when introduced.
sl@0:
sl@0: @return KErrNone The server was started successfully.
sl@0: KErrAlreadyExists An instance of the server already exists.
sl@0: KErrGeneral The server panicked at the startup.
sl@0: Some other system-wide error codes.
sl@0: @publishedAll
sl@0: @deprecated Redundant method no longer used by system software
sl@0: */
sl@0: EXPORT_C TInt StartSysAgt2()
sl@0: {
sl@0: // SysAgt2Svr uid
sl@0: const TUid KSystemAgentExeUid = {0x10204FC5};
sl@0: const TUidType serverUid(KNullUid, KNullUid, KSystemAgentExeUid);
sl@0: RProcess server;
sl@0: TInt err = server.Create(KSystemAgentServerImageName, KNullDesC, serverUid);
sl@0: if(err != KErrNone)
sl@0: {
sl@0: return err;
sl@0: }
sl@0: TRequestStatus stat;
sl@0: server.Rendezvous(stat);
sl@0: if(stat != KRequestPending)
sl@0: {
sl@0: server.Kill(0); // abort startup
sl@0: }
sl@0: else
sl@0: {
sl@0: server.Resume(); // logon OK - start the server
sl@0: }
sl@0: User::WaitForRequest(stat); // wait for start or death
sl@0: // we can't use the 'exit reason' if the server panicked as this
sl@0: // is the panic 'reason' and may be '0' which cannot be distinguished
sl@0: // from KErrNone
sl@0: err = server.ExitType() == EExitPanic ? KErrGeneral : stat.Int();
sl@0: server.Close();
sl@0: return err;
sl@0: }