Пример #1
0
/**
Delivers the request to the end of plugin thread's queue. 
In certain circumstances, where the request requires priority handling
it adds it to the front of the queue.

@param	aRequest: The request to be delivered
@return KErrNone
*/
EXPORT_C TInt CFsPlugin::Deliver(TFsPluginRequest& aRequest)
	{
	__ASSERT_ALWAYS(iThreadP != NULL, User::Panic(_L("CFsPlugin::Dispatch"),999));

	TInt function = aRequest.Function();

	if(function == EFsPluginOpen)
		{
		// Don't dispatch open requests to the plugin thread
		return KPluginMessageForward;
		}

	if(function == EFsPluginDoRequest ||
	   function == EFsPluginDoControl ||
	   function == EFsPluginDoCancel)
		{
		iThreadP->DeliverFront(aRequest.Request());
		}
	else
		{
		iThreadP->DeliverBack(aRequest.Request());
		}

	return KErrNone;
	}
/**
Handle requests to Dismount the plugin only.
This plugin is designed such that its removal is not allowed.
@internalComponent
*/
TInt CUnremovablePlugin::DoRequestL(TFsPluginRequest& aRequest)
	{
	TInt err = KErrNone;

	TInt function = aRequest.Function();

	if (aRequest.IsPostOperation())
		{
		_LOG2(_L("CUnremovablePlugin post intercept for function %d"), function);
		//We should never get here
		//Is it even correct to post-intercept a EFsDismountPlugin ??
		User::Invariant();
		}
	else
		{
		_LOG2(_L("CUnremovablePlugin pre intercept for function %d"), function);

		//If a user is trying to dismount this plugin and this plugin doesn't want
		//to be dismounted then we should eb able to intecept this and return KErrAccessDenied or some
		//appropriate error code.

		if(iRemovable)
			{
			return KErrNone;
			}
		else
			{
			return KErrPermissionDenied;	
			}
		
		}

	return err;
	}
Пример #3
0
/**
@internalComponent
*/
TInt CTestHexHook::DoRequestL(TFsPluginRequest& aRequest)
	{
	TInt err = KErrNotSupported;

	TInt function = aRequest.Function();
	
	iDrvNumber = aRequest.DriveNumber();

	switch(function)
		{
		case EFsFileOpen:
			err = HexFileOpen(aRequest);
			break;

		case EFsFileRead:
			// Post intercept does nothing except prove that it is possible and that no deadlock occurs.
			// plugin always calls FileRead() when receiving a EFsFileRead, and so the mesage gets completed
			// by the plugin and has to be post intercepted by the plugin (if registered to post-intercept the request) 
			// and any plugins above it.

			if (!(aRequest.IsPostOperation()))
				err = HexFileRead(aRequest);
			break;

		default:
			break;
		}

	return err;
	}
Пример #4
0
/**
@internalTechnology
@prototype
@deprecated

Pushes a msgop, dispatches it and waits for it to complete
*/
TInt CFsPlugin::DispatchOperation(TFsPluginRequest& aRequest, TDes8& aDes, TInt64 aPos, TInt aFunction)
	{
	if (aRequest.Function() != EFsFileRead && aRequest.Function() != EFsFileWrite)
		return KErrNotSupported;
	if (aFunction != EFsFileRead && aFunction != EFsFileWrite)
		return KErrNotSupported;

	CFsMessageRequest& msgRequest = * (CFsMessageRequest*) aRequest.Request();


	TInt len = aDes.Length();
	if (len <= 0)
		return CFsRequest::EReqActionComplete;

	TUint8* ptr = (TUint8*) aDes.Ptr();

	TInt r = msgRequest.PushOperation(
		aPos, len, ptr,
		0,			// aOffset
		Complete,	// callback
		0,			// next state
		aFunction);
	if (r != KErrNone)
		return r;


	CFsPlugin* plugin = this;
	FsPluginManager::ReadLockChain();
	FsPluginManager::NextPlugin(plugin, &msgRequest);
	msgRequest.iCurrentPlugin = plugin;
	msgRequest.Dispatch();
	FsPluginManager::UnlockChain();
	iThreadP->OperationLockWait();

	aDes.SetLength(len);
	
	return msgRequest.LastError();	// KErrNone;
	}
Пример #5
0
/**
Handle requests
@internalComponent
*/
TInt CTemplatePlugin::DoRequestL(TFsPluginRequest& aRequest)
	{
	TInt err = KErrNone;

	TInt function = aRequest.Function();

	if (aRequest.IsPostOperation())
		{
		_LOG2(_L("CTemplatePlugin post intercept for function %d"), function);
		}
	else
		{
		_LOG2(_L("CTemplatePlugin pre intercept for function %d"), function);
		}

	return err;
	}
Пример #6
0
/**
Handle requests
@internalComponent
*/
TInt CExclusiveAccessPlugin::DoRequestL(TFsPluginRequest& aRequest)
	{
	TInt err = KErrNone;

	TInt function = aRequest.Function();

	switch(function)
		{
		case EFsFileRead:
			err = FsFileReadL(aRequest);
			break;
		case EFsFileWrite:
			err = FsFileWriteL(aRequest);
			break;
		default:
			//Only registered for Read/Write
			break;
		}

	return err;
	}
Пример #7
0
/**
Handle requests
@internalComponent
 */
TInt CStacked3Plugin::DoRequestL(TFsPluginRequest& aRequest)
	{

	TInt err = KErrNone;

	TInt function = aRequest.Function();

	switch(function)
		{
		case EFsFileRead:
			break;

		case EFsFileWrite:
			TRAP(err, FsFileWriteL(aRequest));
			break;

		default:
			break;
		}

	return err;
	}
Пример #8
0
/**
@internalComponent
*/
TInt CTestVirusHook::DoRequestL(TFsPluginRequest& aRequest)
	{
	TInt err = KErrNotSupported;

	TInt function = aRequest.Function();
	
	iDrvNumber = aRequest.DriveNumber();

	switch(function)
		{
		case EFsFileOpen:
			err = VsFileOpen(aRequest);
			break;

		case EFsFileSubClose:
			VsFileClose(aRequest);
			break;

		case EFsFileRename:
		case EFsRename:
		case EFsReplace:
			err = VsFileRename(aRequest);
			break;

		case EFsDelete:
			err = VsFileDelete(aRequest);
			break;

		case EFsReadFileSection:
			err = VsReadFileSection(aRequest);
			break;

		default:
			break;
		}

	return err;
	}
/**
Handle requests
@internalComponent
*/
TInt CPreModifierPlugin::DoRequestL(TFsPluginRequest& aRequest)
	{
	TInt err = KErrNone;

	TInt function = aRequest.Function();

	switch(function)
		{
		case EFsFileRead:
			TRAP(err, FsFileReadL(aRequest));
			break;

		case EFsFileWrite:
			TRAP(err, FsFileWriteL(aRequest));
			break;

		case EFsFileRename:
			TRAP(err, FsFileRenameL(aRequest));
			break;

		case EFsFileCreate:
			TRAP(err, FsFileCreateL(aRequest));
			break;

		case EFsFileSize:
			TRAP(err, FsFileSizeL(aRequest));
			break;

		case EFsFileSetSize:
			TRAP(err, FsFileSetSizeL(aRequest));
			break;

		case EFsFileLock:
			TRAP(err, FsFileLockL(aRequest));
			break;

		case EFsFileUnLock:
			TRAP(err, FsFileUnLockL(aRequest));
			break;

		case EFsFileSeek:
			TRAP(err, FsFileSeekL(aRequest));
			break;

		case EFsDirReadOne:
			TRAP(err,FsDirReadOneL(aRequest));
			break;

		case EFsDirReadPacked:
			TRAP(err,FsDirReadPackedL(aRequest));
			break;

		case EFsFileOpen:
			TRAP(err, FsFileOpenL(aRequest));
			break;

		case EFsFileReplace:
			TRAP(err, FsFileReplaceL(aRequest));
			break;

		case EFsReadFileSection:
			TRAP(err, FsReadFileSectionL(aRequest));
			break;

		case EFsFileSubClose:
			TRAP(err, FsFileSubCloseL(aRequest));
			break;

		case EFsDirOpen:
			TRAP(err, FsDirOpenL(aRequest));
			break;

		case EFsFileTemp:
			TRAP(err, FsFileTempL(aRequest));
			break;

		case EFsDelete:
			TRAP(err, FsDeleteL(aRequest));
			break;

		case EFsReplace:
			TRAP(err, FsReplaceL(aRequest));
			break;

		case EFsRename:
			TRAP(err, FsRenameL(aRequest));
			break;

		case EFsEntry:
			TRAP(err, FsEntryL(aRequest));
			break;

		case EFsSetEntry:
			TRAP(err, FsSetEntryL(aRequest));
			break;

		default:
			break;
		}

	return err;
	}