void CSecMgrStore::RegisterScriptL(TExecutableID aExecID, const CScript& aScript) { HBufC *scriptFile = HBufC::NewLC(KMaxName); TPtr ptr(scriptFile->Des()); User::LeaveIfError(GetScriptFile(ptr,aExecID)); CFileStore* store = CPermanentFileStore::ReplaceLC (iFsSession, ptr, EFileWrite); // Must say what kind of file store. store->SetTypeL (KPermanentFileStoreLayoutUid); // Construct the output stream. RStoreWriteStream outstream; TStreamId id = outstream.CreateLC (*store); aScript.ExternalizeL (outstream); // Commit changes to the stream outstream.CommitL (); // Cleanup the stream object CleanupStack::PopAndDestroy (&outstream); // Set this stream id as the root store->SetRootL (id); // Commit changes to the store store->CommitL (); CleanupStack::PopAndDestroy (store); CleanupStack::PopAndDestroy (scriptFile); }