本文整理汇总了C++中TFsPluginRequest::Message方法的典型用法代码示例。如果您正苦于以下问题:C++ TFsPluginRequest::Message方法的具体用法?C++ TFsPluginRequest::Message怎么用?C++ TFsPluginRequest::Message使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TFsPluginRequest
的用法示例。
在下文中一共展示了TFsPluginRequest::Message方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FsFileReplaceL
void CPreModifierPlugin::FsFileReplaceL(TFsPluginRequest& aRequest)
{
TFileName filename;
TParse parse;
filename = aRequest.Src().FullName();
TUint mode;
TInt err = aRequest.Read(TFsPluginRequest::EMode, mode);
iLastError = err;
iLineNumber = __LINE__;
if(err!=KErrNone)
User::Leave(err); //trapped in DoRequestL
parse.Set(filename, NULL, NULL);
TPtrC extension(parse.Ext());
_LOG2(_L("CPreModifierPlugin::FsFileReplaceL, file: %S"), &filename);
if (aRequest.IsPostOperation())
{
_LOG(_L("CPreModifierPlugin::FsFileReplaceL, post intercept"));
if ((extension.CompareF(_L(".tst")) == 0) && (aRequest.Message().Int1() != 0))
{
//write to the newly replaced file
TBuf8<64> wbuffer;
wbuffer.Copy(_L8("TestTestTest"));
RFilePlugin fileplugin(aRequest);
TInt err = fileplugin.AdoptFromClient();
iLastError = err;
iLineNumber = __LINE__;
if(err!=KErrNone)
User::Leave(err); //trapped in DoRequestL
err = fileplugin.Write(0, wbuffer);
_LOG2(_L("CPreModifierPlugin::FsFileReplaceL, RFilePlugin::Write to the newly created file returned %d"), err);
iLastError = err;
iLineNumber = __LINE__;
if(err!=KErrNone)
User::Leave(err); //trapped in DoRequestL
TInt length = wbuffer.Length();
HBufC8* tempBuf = HBufC8::NewMaxLC(length);
TPtr8 tempBufPtr((TUint8 *)tempBuf->Des().Ptr(), length, length);
err = fileplugin.Read(0, tempBufPtr);
_LOG2(_L("CPreModifierPlugin::FsFileReplaceL, RFilePlugin::Read returned %d"), err);
iLastError = err;
iLineNumber = __LINE__;
if(err!=KErrNone)
User::Leave(err); //trapped in DoRe
//testing the correct thing has been written to the drive
err = wbuffer.Compare(tempBufPtr);
iLastError = err;
iLineNumber = __LINE__;
if(err!=KErrNone)
User::Leave(err); //trapped in DoRequestL
fileplugin.Close();
CleanupStack::PopAndDestroy();
}
}
else
{
User::Invariant();
}
}