TBool CFileExecuter::GetAssociatedApp( TFileName aFileExtension, TFileName& aAppPath )
{
	TBool aFoundType;

	CCoCoAppUi* nAppUi = (CCoCoAppUi*)(CEikonEnv::Static()->AppUi());
	CDictionaryStore* nlinkStore = nAppUi->Application()->OpenIniFileLC( CEikonEnv::Static()->FsSession() );

	aFileExtension.LowerCase();
	const TUint16* aFileExtensionPtr = aFileExtension.Ptr();

	TUint nDefaultUid = 0;
	TUint nMemberValue;
	for ( TInt i = 0; i < aFileExtension.Length(); i ++ )
	{
		nMemberValue = aFileExtensionPtr[i];
		if ( nMemberValue >= 97 && nMemberValue <= 122 )
		{
			nMemberValue -= 97;
		}
		else if ( nMemberValue >= 48 && nMemberValue <= 57 )
		{
			nMemberValue -= 48;
		}

		nDefaultUid = nDefaultUid* 10 + nMemberValue;
	}


	if ( nlinkStore->IsPresentL( TUid::Uid(nDefaultUid) ) ) 
	{
		RDictionaryReadStream inLinkStoreStream;
		inLinkStoreStream.OpenLC( *nlinkStore, TUid::Uid(nDefaultUid) );
		inLinkStoreStream >> aAppPath;
		CleanupStack::PopAndDestroy();

		aFoundType = true;
	}
// ----------------------------------------------------------------------------------------
// CTerminalControlServer::StopProcessByFullNameL
// ----------------------------------------------------------------------------------------
void CTerminalControlServer::StopProcessByFullNameL(const TDesC8& aName) {
    RDEBUG("[CTerminalControlServer]-> StopProcessByFullNameL() >>>");


    TInt rounds = 5;
    TFileName lMatchStr;
    lMatchStr.Copy(aName);
    lMatchStr.LowerCase();

    TBool lIsAbsolute = EFalse;
    if(lMatchStr.LocateReverse(TChar('\\')) != KErrNotFound) {
        lIsAbsolute = ETrue;
    }
    while(rounds--) {
        TInt ret = KErrNone;
        TFullName processName;
        TFindProcess findProcess;

        while(KErrNone == (ret = findProcess.Next(processName))) {
            RProcess process;

            if(KErrNone == (ret = process.Open(findProcess))) {
                RDEBUG("[CTerminalControlServer]-> Process.Open() returned");

                TFileName lStrSource(process.FileName());
                lStrSource.LowerCase();
                if(lIsAbsolute) {
                    RDEBUG("[CTerminalControlServer]-> INFO: The input was specified as an absolute path...");
                    if(lStrSource.Compare(lMatchStr) == 0) {
                        RDEBUG("[CTerminalControlServer]-> Process with correct Filename found => Kill(0) ");
                        process.Kill(0);
                    }
                }
                else {
                    RDEBUG("[CTerminalControlServer]-> INFO: The input was specified as an application name...");
                    TInt lLastDirSepIndex = lStrSource.LocateReverse('\\');
                    TInt lExeIndex = lStrSource.Find(_L(".exe"));
                    if(lLastDirSepIndex < lExeIndex) {
                        TInt lAppNameIndex = lStrSource.Find(lMatchStr);

                        /*
                         * The logic works like this, if the value of lStrSource was 'z:\sys\bin\calendar.exe', lMatchStr would contain calendar
                         * the values of the variables will be as follows
                         * lLastDirSepIndex = 10
                         * lAppNameIndex = 11
                         * lExeIndex = 19
                         *
                         * The below logic would make sure that the right process is killed
                         */
                        if((lAppNameIndex == (lLastDirSepIndex + 1)) && ((lAppNameIndex + lMatchStr.Length()) == lExeIndex)) {
                            RDEBUG("[CTerminalControlServer]-> Process with correct Filename found => Kill(0)");
                            process.Kill(0);
                        }
                    }
                }
            }
            else {
                RDEBUG_2("[CTerminalControlServer]-> Process.Open() returned %d", ret);
            }
        }
        if(KErrNone != ret) {
            RDEBUG_2("[CTerminalControlServer]-> findProcess.Next() returned %d", ret);
        }
    }
    RDEBUG("[CTerminalControlServer]-> StopProcessByFullNameL() <<<");
}