00001
00011 #include "recsidfile.h"
00012 #include <e32svr.h>
00013 #include <s32file.h>
00014 #include <f32file.h>
00015 #include <apaid.h>
00016 #include <apacmdln.h>
00017 #include <apgcli.h>
00018
00019
00025 #ifdef _UNICODE
00026 const TUid KUidSidPlayer = {0x10009a97};
00027 #else
00028 const TUid KUidSidPlayer = {0x10009a96};
00029 #endif
00030
00031 _LIT8(KRecSidSignature, "PSID");
00032
00033
00034 CApaFileRecognizerType::TRecognizedType CRecSidFile::DoRecognizeFileL(RFs& aFs, TUidType )
00038 {
00039 iRecognizedType = ENotRecognized;
00040
00041
00042 RFile file;
00043 if(file.Open(aFs, *iFullFileName, EFileShareReadersOnly) != KErrNone)
00044 return iRecognizedType;
00045 TBuf8<1024> buf;
00046 TInt err = file.Read(buf);
00047 file.Close();
00048 if (err!=KErrNone)
00049 return iRecognizedType;
00050 if (buf.FindF(KRecSidSignature) != KErrNotFound)
00051 {
00052 iRecognizedType = EDoc;
00053 iAppUid = KUidSidPlayer;
00054 return iRecognizedType;
00055 }
00056 return iRecognizedType;
00057 }
00058
00059
00060 TThreadId CRecSidFile::RunL(TApaCommand aCommand, const TDesC* aDocFileName, const TDesC8* aTailEnd) const
00061 {
00062 CApaCommandLine* commandLine = CApaCommandLine::NewLC();
00063 commandLine->SetCommandL(aCommand);
00064 if(iRecognizedType == EDoc)
00065 {
00066
00067 TApaAppEntry appEntry;
00068 User::LeaveIfError(iFileRecognizer->AppLocator()->GetAppEntryByUid(appEntry,iAppUid));
00069 commandLine->SetLibraryNameL(appEntry.iFullName);
00070 if(aDocFileName)
00071 commandLine->SetDocumentNameL(*iFullFileName);
00072 }
00073 else
00074 User::Leave(KErrNotSupported);
00075
00076
00077
00078 TThreadId id = AppRunL(*commandLine);
00079 CleanupStack::PopAndDestroy();
00080 return id;
00081 }
00082
00083
00084 EXPORT_C CApaFileRecognizerType* CreateRecognizer()
00092 {
00093 return new CRecSidFile();
00094 }
00095
00096
00097 GLDEF_C TInt E32Dll(TDllReason )
00101 {
00102 return KErrNone;
00103 }
00104
00105
00106